diff options
author | Joël Simoneau <simoneaujoel@gmail.com> | 2025-03-08 20:13:27 -0500 |
---|---|---|
committer | Joël Simoneau <simoneaujoel@gmail.com> | 2025-03-08 20:13:27 -0500 |
commit | 838426d230359ab5afcb6da546cf6d1be4808aa6 (patch) | |
tree | 1a9dcc49604b660cdb985a82ebfeb37095f6ebbf | |
parent | 3c6cb57b15420b0d56af26e2e8b52ad70c2b8508 (diff) | |
download | vijayanagara-838426d230359ab5afcb6da546cf6d1be4808aa6.tar.gz |
Event 7.
-rw-r--r-- | events.txt | 15 | ||||
-rw-r--r-- | rules.js | 71 |
2 files changed, 80 insertions, 6 deletions
@@ -127,10 +127,21 @@ SHADED 6 shaded_6_2 EVENT 7 - log "NOT IMPLEMENTED" + current REBEL_FACTIONS + prompt `Place up to 2 ${PIECE_FACTION_TYPE_NAME[game.current][ELITE]}s in Tamilakam.` + space 1 (s === S_TAMILAKAM) + place 2 (game.current) ELITE + endspace + cav_resources 3 SHADED 7 - log "NOT IMPLEMENTED" + current DS + prompt `Place up to 4 Troops and a Governor in Tamilakam.` + space 1 (s === S_TAMILAKAM) + place 4 DS TROOPS + place 1 DS ELITE + endspace + cav_resources 3 EVENT 8 current REBEL_FACTIONS @@ -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 ], ] |