summaryrefslogtreecommitdiff
path: root/rules.js
diff options
context:
space:
mode:
Diffstat (limited to 'rules.js')
-rw-r--r--rules.js62
1 files changed, 58 insertions, 4 deletions
diff --git a/rules.js b/rules.js
index 42b97a6..d0bf23a 100644
--- a/rules.js
+++ b/rules.js
@@ -229,6 +229,7 @@ exports.setup = function (seed, scenario, _options) {
pieces: Array(104).fill(AVAILABLE), // piece locations
cavalry: Array(10).fill(AVAILABLE),
deck: [],
+ of_gods_and_kings: [null, null, 0],
order: [],
cmd: {
type: null,
@@ -288,7 +289,9 @@ function setup_deck() {
if (p<3)
deck = deck.concat([45+p])
}
+ game.of_gods_and_kings[0] = cards[cards.length-1]
game.deck = deck
+ game.deck = [1, 26, 23, 22]
}
function setup_standard() {
@@ -700,6 +703,8 @@ states.main_phase = {
event() { goto_event(0) },
unshaded() { goto_event(0) },
shaded() { goto_event(1) },
+ gk_unshaded() { goto_gk_event(0) },
+ gk_shaded() { goto_gk_event(1) },
end_of_turn: resume_event_card,
}
@@ -3873,12 +3878,42 @@ function gen_any_event() {
view.actions.unshaded = 1
view.actions.shaded = 1
}
+
+ if (game.of_gods_and_kings[1] === game.current) {
+ view.actions.gk_shaded = 1
+ view.actions.gk_unshaded = 1
+ }
+}
+
+function goto_gk_event(shaded) {
+ push_undo()
+ let c = game.of_gods_and_kings[0]
+ game.of_gods_and_kings[2] = 1
+ game.cmd = 0
+
+ if (shaded) {
+ log_h2(faction_name[game.current] + " - Shaded Event")
+ log(faction_acronyms[game.current] + " is using the set-aside Event Card.")
+ log_br()
+ log("C" + c)
+ log(".i " + data.card_flavor_shaded[c] + ".")
+ log_br()
+ goto_vm(c * 2 + 1)
+ } else {
+ log_h2(faction_name[game.current] + " - Event")
+ log(faction_acronyms[game.current] + " is using the set-aside Event Card.")
+ log_br()
+ log("C" + c)
+ if (data.card_flavor[c])
+ log(".i " + data.card_flavor[c] + ".")
+ log_br()
+ goto_vm(c * 2 + 0)
+ }
}
function goto_event(shaded) {
push_undo()
let c = this_card()
-
game.cmd = 0
if (shaded) {
@@ -3898,6 +3933,8 @@ function goto_event(shaded) {
}
function end_event() {
+ if (game.of_gods_and_kings[2] === 1)
+ clean_gk()
game.vm = null
resume_event_card()
}
@@ -3907,7 +3944,10 @@ function event_prompt(str) {
str = CODE[game.vm.fp][game.vm.prompt][1]
if (typeof str === "function")
str = str()
- view.prompt = data.card_title[this_card()] + ": " + str
+ if (game.of_gods_and_kings[2] === 1)
+ view.prompt = data.card_title[game.of_gods_and_kings[0]] + ": " + str
+ else
+ view.prompt = data.card_title[this_card()] + ": " + str
}
// === VM ===
@@ -4228,7 +4268,7 @@ function vm_set_space() {
}
function vm_stay_eligible() {
- log("Marked " + faction_name[game.current] + " Eligible.")
+ log(faction_acronyms[game.current] + " stays Eligible.")
game.marked |= (16 << game.current)
vm_next()
}
@@ -5032,6 +5072,20 @@ states.event_25 = {
}
}
+// VM: EVENT_26
+
+function vm_event_26() {
+ game.of_gods_and_kings[1] = game.current
+ game.state = "event_26"
+ log(faction_acronyms[game.current] + " draws C" + game.of_gods_and_kings[0])
+ vm_next()
+}
+
+function clean_gk() {
+ game.of_gods_and_kings[1] = null
+ game.of_gods_and_kings[2] = 0
+}
+
// VM: SHADED_29
function vm_shaded_29() {
@@ -5840,7 +5894,7 @@ CODE[25 * 2 + 1] = [
// EVENT 26
CODE[26 * 2 + 0] = [
[ vm_stay_eligible ],
- [ vm_log, "NOT IMPLEMENTED" ],
+ [ vm_event_26 ],
[ vm_return ],
]