diff options
Diffstat (limited to 'rules.js')
-rw-r--r-- | rules.js | 71 |
1 files changed, 67 insertions, 4 deletions
@@ -3225,6 +3225,18 @@ function pop_summary() { game.summary = null } +function upop_summary() { + if (game.summary.length > 0) { + for (let [n, msg] of game.summary) { + log(msg.replace("%", String(n))) + } + } else { + log("Nothing") + } + game.summary = null +} + + function placed_summary(type="") { if (game.summary.length > 0) { for (let [n, msg] of game.summary) { @@ -3255,9 +3267,13 @@ function log_summary_remove(p) { function log_summary_cavalry(c) { let from = game.cavalry[c] if (from !== AVAILABLE) - log_summary(faction_acronyms[game.current] + " Cavalry + % from " + faction_acronyms[from] + ".") + log_summary(faction_acronyms[game.current] + " Cavalry +% from " + faction_acronyms[from] + ".") else - log_summary(faction_acronyms[game.current] + " Cavalry + % from supply.") + log_summary(faction_acronyms[game.current] + " Cavalry +% from supply.") +} + +function log_summary_resources(faction) { + log_summary(faction_acronyms[faction] + " Resources +%.") } function logi_resources(faction, n) { @@ -4300,6 +4316,42 @@ states.vm_steal = { } } +// VM : CAVALRY OR RESOURCES + +function vm_cav_resources() { + push_undo() + push_summary() + game.vm.count = vm_inst(1) + game.state = "vm_cav_resources" +} + +states.vm_cav_resources = { + prompt() { + event_prompt(`Gain ${game.vm.count} Resources or Cavalry tokens.`) + gen_action_resources(game.current) + gen_take_cavalry(game.current) + }, + resources(f) { + log_summary_resources(game.current) + add_resources(game.current, 1) + tick_cav_resources() + }, + token(c) { + log_summary_cavalry(c) + set_cavalry_faction(c, game.current) + tick_cav_resources() + } +} + +function tick_cav_resources() { + game.vm.count -= 1 + if (game.vm.count === 0) { + log_br() + upop_summary() + vm_next() + } +} + // VM : REBEL function vm_to_rebel() { @@ -4695,13 +4747,24 @@ CODE[6 * 2 + 1] = [ // EVENT 7 CODE[7 * 2 + 0] = [ - [ vm_log, "NOT IMPLEMENTED" ], + [ vm_current, REBEL_FACTIONS ], + [ vm_prompt, ()=>`Place up to 2 ${PIECE_FACTION_TYPE_NAME[game.current][ELITE]}s in Tamilakam.` ], + [ vm_space, true, 1, 1, (s)=>(s === S_TAMILAKAM) ], + [ vm_place, false, 0, 2, ()=>(game.current), ELITE ], + [ vm_endspace ], + [ vm_cav_resources, 3 ], [ vm_return ], ] // SHADED 7 CODE[7 * 2 + 1] = [ - [ vm_log, "NOT IMPLEMENTED" ], + [ vm_current, DS ], + [ vm_prompt, ()=>`Place up to 4 Troops and a Governor in Tamilakam.` ], + [ vm_space, true, 1, 1, (s)=>(s === S_TAMILAKAM) ], + [ vm_place, false, 0, 4, DS, TROOPS ], + [ vm_place, false, 0, 1, DS, ELITE ], + [ vm_endspace ], + [ vm_cav_resources, 3 ], [ vm_return ], ] |