summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--events.txt15
-rw-r--r--rules.js71
2 files changed, 80 insertions, 6 deletions
diff --git a/events.txt b/events.txt
index be2a7e2..1d9eb79 100644
--- a/events.txt
+++ b/events.txt
@@ -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
diff --git a/rules.js b/rules.js
index 135b2df..aa85963 100644
--- a/rules.js
+++ b/rules.js
@@ -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 ],
]