summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--rules.js25
-rw-r--r--ui.js1
2 files changed, 17 insertions, 9 deletions
diff --git a/rules.js b/rules.js
index 3f6dd9d..7ae65d1 100644
--- a/rules.js
+++ b/rules.js
@@ -354,11 +354,11 @@ function is_london_friendly_to(owner) {
return is_area_friendly_to("Middlesex", owner);
}
-function count_lancaster_nobles() {
+function count_lancaster_nobles_and_heirs() {
let count = 0;
for (let b in BLOCKS)
if (block_owner(b) == LANCASTER &&
- (block_type(b) == 'nobles' || block_type(b) == 'church'))
+ (block_type(b) == 'nobles' || block_type(b) == 'church' || block_type(b) == 'heir'))
if (is_on_map_not_in_exile_or_man(b))
++count;
if (is_london_friendly_to(LANCASTER))
@@ -366,11 +366,11 @@ function count_lancaster_nobles() {
return count;
}
-function count_york_nobles() {
+function count_york_nobles_and_heirs() {
let count = 0;
for (let b in BLOCKS)
if (block_owner(b) == YORK &&
- (block_type(b) == 'nobles' || block_type(b) == 'church'))
+ (block_type(b) == 'nobles' || block_type(b) == 'church' || block_type(b) == 'heir'))
if (is_on_map_not_in_exile_or_man(b))
++count;
if (is_london_friendly_to(YORK))
@@ -391,14 +391,21 @@ function block_home(who) {
}
function block_owner(who) {
- if (who == REBEL)
- return block_owner(game.pretender);
+ if (who == REBEL) {
+ let pretender = game.pretender;
+ if (game.pretender)
+ return block_owner(game.pretender);
+ else if (game.king)
+ return ENEMY[block_owner(game.king)];
+ else
+ return YORK; // whatever... they're both dead
+ }
return BLOCKS[who].owner;
}
function block_initiative(who) {
if (block_type(who) == 'bombard')
- return game.battle_round == 1 ? 'A' : 'D';
+ return game.battle_round <= 1 ? 'A' : 'D';
return BLOCKS[who].combat[0];
}
@@ -2972,8 +2979,8 @@ function goto_political_turn() {
print_turn_log("Levies disband:");
// Usurpation
- let l_count = count_lancaster_nobles();
- let y_count = count_york_nobles();
+ let l_count = count_lancaster_nobles_and_heirs();
+ let y_count = count_york_nobles_and_heirs();
log("");
log("Lancaster controls " + l_count + " nobles.");
log("York controls " + y_count + " nobles.");
diff --git a/ui.js b/ui.js
index 1433f0f..ef73ff6 100644
--- a/ui.js
+++ b/ui.js
@@ -89,6 +89,7 @@ const STEP_TEXT = [ 0, "I", "II", "III", "IIII" ];
const HEIR_TEXT = [ 0, '\u00b9', '\u00b2', '\u00b3', '\u2074', '\u2075' ];
function block_name(who) {
+ if (!who) return "Nobody";
let name = BLOCKS[who].name;
let long_name = LONG_NAME[name];
return long_name ? long_name : name;