diff options
author | Tor Andersson <tor@ccxvii.net> | 2024-04-20 13:28:58 +0200 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2024-04-20 13:28:58 +0200 |
commit | 4890db92b6264ad4790a58b6e520e0e3ed97f7a3 (patch) | |
tree | fcd014d4f46995c6b9c3d98044a51ca2d9f13e21 | |
parent | b2d23fdcbf7b8bc84ebe8cbe096b3acf168facdf (diff) | |
download | plantagenet-4890db92b6264ad4790a58b6e520e0e3ed97f7a3.tar.gz |
Scenario victory thresholds.
-rw-r--r-- | play.js | 9 | ||||
-rw-r--r-- | rules.ts | 40 |
2 files changed, 33 insertions, 16 deletions
@@ -1552,8 +1552,13 @@ function on_update() { ui.held_york.textContent = `${view.held_y} Held` ui.held_lancaster.textContent = `${view.held_l} Held` - ui.victory_check.style.top = (track_xy[view.victory_check][1]) + "px" - ui.victory_check.style.left = (track_xy[view.victory_check][0]) + "px" + if (view.victory_check <= 45) { + ui.victory_check.style.display = "block" + ui.victory_check.style.top = (track_xy[view.victory_check][1]) + "px" + ui.victory_check.style.left = (track_xy[view.victory_check][0]) + "px" + } else { + ui.victory_check.style.display = "none" + } let town = count_favour(TOWN) ui.town.style.top = (track_xy[Math.abs(town)][1]) + "px" @@ -1,18 +1,13 @@ "use strict" -// TODO: "approach" pause when about to move into intercept range? // TODO: log end victory conditions at scenario start // TODO: check all who = NOBODY etc resets // TODO - show held events when played for effect /* - TODO - EVENTS and CAPABILITIES trigger - Pass instead of Done - handle both lords at same sea... - NAVAL BLOCKADE - for Tax and Tax Collectors REGROUP - other timing windows @@ -8439,7 +8434,7 @@ function check_disband_victory() { function check_threshold_victory() { // This needs to change to account for graduated victory thresholds in some scenarios. - if (Math.abs(game.influence) > scenario_victory_check[game.scenario]) { + if (Math.abs(game.influence) >= scenario_victory_threshold(game.scenario)) { if (game.influence > 0) goto_game_over(LANCASTER, `${LANCASTER} won with ${game.influence} Influence.`) else @@ -8502,13 +8497,30 @@ const scenario_last_turn = [ 15, ] -const scenario_victory_check = [ - 40, - 45, - 40, - 40, - 40, -] +function scenario_victory_threshold() { + let turn = current_turn() + switch (game.scenario) { + case SCENARIO_IA: + if (turn <= 5) + return 40 + if (turn <= 10) + return 35 + return 30 + case SCENARIO_IB: + return 100 // no threshold + case SCENARIO_IC + return 25 + case SCENARIO_II: + if (turn <= 5) + return 40 + if (turn <= 10) + return 35 + return 30 + case SCENARIO_III: + return 45 + } + return 45 +} function is_card_in_scenario(c: Card): boolean { let roses = data.cards[c].roses @@ -11697,7 +11709,7 @@ exports.view = function (state, current) { end: scenario_last_turn[game.scenario], turn: game.turn, - victory_check: scenario_victory_check[game.scenario], + victory_check: scenario_victory_threshold(game.scenario), influence: game.influence, events: game.events, |