diff options
-rw-r--r-- | play.js | 8 | ||||
-rw-r--r-- | rules.js | 48 |
2 files changed, 35 insertions, 21 deletions
@@ -685,7 +685,7 @@ function build_map() { // Locale Markers e = ui.locale_markers[ix] = document.createElement("div") - e.className = "locale marker rose york favour " + locale.name // York to be removed - York/Lancaster + e.className = "locale marker rose favour " + locale.name // York to be removed - York/Lancaster e.style.top = y+h-small + "px" e.style.left = x+ (w-small)/2 + "px" e.style.width = small + "px" @@ -698,7 +698,7 @@ function build_map() { // Depleted markers e = ui.locale_markers[ix] = document.createElement("div") - e.className = "locale marker exhausted " + locale.name // Depleted to be removed - depleted/exhausted to add markers + e.className = "locale marker " + locale.name // Depleted to be removed - depleted/exhausted to add markers e.style.top = y+h-small-offsetdeplete + "px" e.style.left = offsetdeplete+x+ (w-small)/2 + "px" e.style.width = small + "px" @@ -1120,14 +1120,14 @@ function update_locale(loc) { else ui.locale_markers[loc].appendChild(get_cached_element("marker circle battle")) - if (set_has(view.pieces.exhausted, loc)) { + /*if (set_has(view.pieces.exhausted, loc)) { let cn if (is_york_locale(loc)) cn = "marker small exhausted lancaster" else cn = "marker small exhausted york" ui.locale_markers[loc].appendChild(get_cached_element(cn)) - } + }*/ } function update_plan() { @@ -1110,7 +1110,7 @@ function remove_favoury_marker(loc) { set_delete(game.pieces.favoury, loc) } -function has_ravaged_marker(loc) { +function has_exhausted_marker(loc) { return set_has(game.pieces.exhausted, loc) } @@ -1118,8 +1118,29 @@ function add_exhausted_marker(loc) { set_add(game.pieces.exhausted, loc) } +function has_depleted_marker(loc) { + return set_has(game.pieces.depleted, loc) +} + +function add_depleted_marker(loc) { + set_add(game.pieces.depleted, loc) +} + +function remove_depleted_marker(loc) { + set_delete(game.pieces.depleted, loc) +} + function remove_exhausted_marker(loc) { - set_delete(game.pieces.ravaged, loc) + set_delete(game.pieces.exhausted, loc) +} +function deplete_locale(loc) { + if (has_depleted_marker(loc)) { + remove_depleted_marker(loc), + add_exhausted_marker(loc) + } + else { + add_depleted_marker(loc) + } } function is_friendly_locale(loc) { @@ -1339,6 +1360,7 @@ exports.setup = function (seed, scenario, options) { capabilities: Array(lord_count << 1).fill(NOTHING), moved: 0, vassals: Array(vassal_count).fill(VASSAL_UNAVAILABLE), + depleted: [], exhausted: [], favourl:[], favoury:[], @@ -3502,18 +3524,10 @@ states.supply_path_way = { function can_action_forage() { if (game.actions < 1) return false - - /* if - return false */ - let here = get_lord_locale(game.command) - if (has_ravaged_marker(here)) + if (has_exhausted_marker(here)) return false - if (is_summer()) - return true -// if (is_friendly_stronghold_locale(here)) // FIXME: simpler check? -// return true - return false + return true } function goto_forage() { @@ -3521,6 +3535,7 @@ function goto_forage() { let here = get_lord_locale(game.command) log(`Foraged at %${here}`) add_lord_assets(game.command, PROV, 1) + deplete_locale(here) spend_action(1) resume_command() } @@ -3531,30 +3546,29 @@ function goto_forage() { function can_action_tax() { if (game.actions < 1) return false - - // Must have space left to hold Coin if (get_lord_assets(game.command, COIN) >= 8) return false - // Must be at own seat TO BE REMOVED return is_lord_at_seat(game.command) - // TODO : Add deplete/exhaust } function goto_tax() { push_undo() let here = get_lord_locale(game.command) + log(`Taxed %${here}.`) + + if (is_town(here) || is_fortress(here) || is_harlech(here)) add_lord_assets(game.command, COIN, 1) else if (is_city(here)) add_lord_assets(game.command, COIN, 2) else add_lord_assets(game.command, COIN, 3) -// TODO : Add deplete/exhaust + spend_action(1) resume_command() |