summaryrefslogtreecommitdiff
path: root/rules.js
diff options
context:
space:
mode:
Diffstat (limited to 'rules.js')
-rw-r--r--rules.js75
1 files changed, 44 insertions, 31 deletions
diff --git a/rules.js b/rules.js
index f79edd0..2102329 100644
--- a/rules.js
+++ b/rules.js
@@ -354,25 +354,25 @@ const CARD_INFO = [
{ name: "M1", type: 0, value: 1, event: "None" },
{ name: "S1", type: 1, value: 1, event: "None" },
{ name: "P1", type: 2, value: 1, event: "None" },
- { name: "M2 - Castra", type: 0, value: 2, event: "Castra" },
- { name: "S2 - Tribute", type: 1, value: 2, event: "Tribute" },
- { name: "P2 - Quaestor", type: 2, value: 2, event: "Quaestor" },
- { name: "M2 - Cavalry", type: 0, value: 2, event: "Cavalry" },
- { name: "S2 - Princeps Senatus", type: 1, value: 2, event: "Princeps Senatus" },
- { name: "P2 - Ambitus", type: 2, value: 2, event: "Ambitus" },
- { name: "M3 - Flanking Maneuver", type: 0, value: 3, event: "Flanking Maneuver" },
- { name: "S3 - Foederati", type: 1, value: 3, event: "Foederati" },
- { name: "P3 - Mob", type: 2, value: 3, event: "Mob" },
- { name: "M3 - Force March", type: 0, value: 3, event: "Force March" },
- { name: "S3 - Frumentarii", type: 1, value: 3, event: "Frumentarii" },
- { name: "P3 - Mobile Vulgus", type: 2, value: 3, event: "Mobile Vulgus" },
- { name: "M4 - Praetorian Guard", type: 0, value: 4, event: "Praetorian Guard" },
- { name: "S4 - Damnatio Memoriae", type: 1, value: 4, event: "Damnatio Memoriae" },
- { name: "S4 - Damnatio Memoriae", type: 1, value: 4, event: "Damnatio Memoriae (exp)" },
- { name: "P4 - Pretender", type: 2, value: 4, event: "Pretender" },
- { name: "M4 - Spiculum", type: 0, value: 4, event: "Spiculum" },
- { name: "S4 - Triumph", type: 1, value: 4, event: "Triumph" },
- { name: "P4 - Demagogue", type: 2, value: 4, event: "Demagogue" },
+ { name: "M2 Castra", type: 0, value: 2, event: "Castra" },
+ { name: "S2 Tribute", type: 1, value: 2, event: "Tribute" },
+ { name: "P2 Quaestor", type: 2, value: 2, event: "Quaestor" },
+ { name: "M2 Cavalry", type: 0, value: 2, event: "Cavalry" },
+ { name: "S2 Princeps Senatus", type: 1, value: 2, event: "Princeps Senatus" },
+ { name: "P2 Ambitus", type: 2, value: 2, event: "Ambitus" },
+ { name: "M3 Flanking Maneuver", type: 0, value: 3, event: "Flanking Maneuver" },
+ { name: "S3 Foederati", type: 1, value: 3, event: "Foederati" },
+ { name: "P3 Mob", type: 2, value: 3, event: "Mob" },
+ { name: "M3 Force March", type: 0, value: 3, event: "Force March" },
+ { name: "S3 Frumentarii", type: 1, value: 3, event: "Frumentarii" },
+ { name: "P3 Mobile Vulgus", type: 2, value: 3, event: "Mobile Vulgus" },
+ { name: "M4 Praetorian Guard", type: 0, value: 4, event: "Praetorian Guard" },
+ { name: "S4 Damnatio Memoriae", type: 1, value: 4, event: "Damnatio Memoriae" },
+ { name: "S4 Damnatio Memoriae", type: 1, value: 4, event: "Damnatio Memoriae (exp)" },
+ { name: "P4 Pretender", type: 2, value: 4, event: "Pretender" },
+ { name: "M4 Spiculum", type: 0, value: 4, event: "Spiculum" },
+ { name: "S4 Triumph", type: 1, value: 4, event: "Triumph" },
+ { name: "P4 Demagogue", type: 2, value: 4, event: "Demagogue" },
]
function card_name(c) {
@@ -1041,6 +1041,7 @@ function eliminate_barbarian(id) {
}
function eliminate_rival_emperor(id) {
+ log(RIVAL_EMPEROR_NAME[id] + " killed!")
if (game.battle)
game.battle.killed |= (1 << id)
set_rival_emperor_location(id, AVAILABLE)
@@ -1432,7 +1433,7 @@ function invade_with_barbarian_counter(id, path, where) {
function goto_crisis_event() {
game.active_event = game.events.pop()
- log("E" + game.active_event)
+ logi("E" + game.active_event)
switch (game.active_event) {
case EVENT_ARDASHIR: return goto_crisis_barbarian_leader(ARDASHIR, SASSANIDS_HOMELAND)
@@ -1920,7 +1921,7 @@ states.take_actions = {
support() {
push_undo()
- improve_support()
+ increase_support_level()
},
place_militia() {
@@ -2057,12 +2058,12 @@ states.build_improvement = {
},
}
-// ACTION: IMPROVE SUPPORT
+// ACTION: INCREASE SUPPORT LEVEL
-function improve_support() {
+function increase_support_level() {
let where = get_governor_location(game.selected_governor)
let support = get_support(where)
- log("Built Support in %" + where + ".")
+ log("Increase Support Level in %" + where + ".")
spend_populace(support + 1)
set_support(where, support + 1)
}
@@ -2780,10 +2781,11 @@ states.foederati_general = {
barbarian(id) {
let tribe = get_barbarian_tribe(id)
let from = get_barbarian_location(id)
- log("Foederati " + BARBARIAN_NAME[tribe] + " from %" + from + ".")
if (count_legions_in_army(game.count) > count_barbarians_in_army(game.count)) {
+ log("Foederati " + BARBARIAN_NAME[tribe] + " from %" + from + " to %" + game.where + ".")
set_barbarian_location(id, ARMY + game.count)
} else {
+ log("Foederati " + BARBARIAN_NAME[tribe] + " in %" + from + ".")
eliminate_barbarian(id)
}
game.state = "take_actions"
@@ -2802,7 +2804,7 @@ states.foederati_militia = {
barbarian(id) {
let tribe = get_barbarian_tribe(id)
let from = get_barbarian_location(id)
- log("Foederati " + BARBARIAN_NAME[tribe] + " from %" + from + ".")
+ log("Foederati " + BARBARIAN_NAME[tribe] + " in %" + from + ".")
eliminate_barbarian(id)
game.state = "take_actions"
},
@@ -3417,6 +3419,14 @@ function award_legacy(p, reason, n) {
game.legacy[p] += n
}
+function award_legacy_summary(p, reason, n) {
+ if (n > 0)
+ logi("+" + n + " for " + reason)
+ if (n < 0)
+ logi(n + " for " + reason)
+ game.legacy[p] += n
+}
+
function goto_combat_no_victory() {
game.battle.killed = 0
end_battle()
@@ -3662,9 +3672,10 @@ states.expand_pretender_empire = {
function goto_gain_legacy() {
log_br()
+ log("Gain Legacy")
if (is_only_pretender_player())
- award_legacy(game.current, "Pretender", count_own_breakaway_provinces())
+ award_legacy_summary(game.current, "Pretender", count_own_breakaway_provinces())
if (is_emperor_player())
goto_legitimize_claim()
@@ -3697,16 +3708,16 @@ states.legitimize_claim = {
function goto_gain_legacy_emperor() {
if (!is_any_rival_emperor_or_pretender()) {
- log(PLAYER_NAMES[game.current] + " +1 Emperor Turn.")
+ logi("+1 Emperor Turn")
game.emperor_turns[game.current] += 1
}
- award_legacy(game.current, "Emperor", Math.max(0, get_support(ITALIA) - count_pretender_provinces()))
+ award_legacy_summary(game.current, "Emperor", Math.max(0, get_support(ITALIA) - count_pretender_provinces()))
goto_gain_legacy_provinces()
}
function goto_gain_legacy_provinces() {
- award_legacy(game.current, "Provinces", count_own_provinces())
- award_legacy(game.current, "Improvements", count_own_improvements())
+ award_legacy_summary(game.current, "Provinces", count_own_provinces())
+ award_legacy_summary(game.current, "Improvements", count_own_improvements())
if (is_emperor_player() && game.legacy[game.current] >= 60) {
log_br()
@@ -4186,6 +4197,8 @@ exports.setup = function (seed, scenario, options) {
update_neutral_italia()
+ log_h1("Time of Crisis")
+
game.first = game.current = random(player_count)
return save_game()