diff options
author | Tor Andersson <tor@ccxvii.net> | 2024-05-06 15:23:14 +0200 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2024-05-06 15:28:03 +0200 |
commit | afa7dba661d39abdaa2f5712b8ee42ce972e276f (patch) | |
tree | 6c6b8fd12ad9d7587cdb896e218be549a0e849ca | |
parent | 4d2ba72129012dba2493011c091e76057386fb12 (diff) | |
download | plantagenet-afa7dba661d39abdaa2f5712b8ee42ce972e276f.tar.gz |
common favour change logging for events
-rw-r--r-- | rules.js | 25 | ||||
-rw-r--r-- | rules.ts | 26 |
2 files changed, 31 insertions, 20 deletions
@@ -1476,6 +1476,14 @@ function is_lancaster_dominating_wales() { return n >= all_wales_locales.length; } // === 1.4 INFLUENCE === +function log_favour(loc) { + if (has_york_favour(loc)) + log(`S${loc} to Yorkist.`); + else if (has_lancaster_favour(loc)) + log(`S${loc} to Lancastrian.`); + else + log(`S${loc} to Neutral.`); +} function log_ip(n) { if (n < 0) log(".ip " + n); @@ -2764,8 +2772,8 @@ states.levy_lord_at_seat = { muster_lord(game.who, loc); levy_burgundians(game.who); if (game.active === YORK) { - add_york_favour(loc); remove_lancaster_favour(loc); + add_york_favour(loc); } else { if (loc === LOC_LONDON && has_york_favour(LONDON_FOR_YORK)) { @@ -9945,7 +9953,7 @@ states.warwicks_propaganda_yorkist_choice = { remove() { remove_york_favour(game.where); remove_propaganda_target(game.where); - logi(`Removed York Favour at S${game.where}.`); + log_favour(game.where); game.where = NOWHERE; }, pay() { @@ -10085,7 +10093,7 @@ states.welsh_rebellion_remove_favour = { locale(loc) { push_undo(); remove_york_favour(loc); - log(`Removed York Favour at S${loc}.`); + log_favour(loc); game.count++; }, done() { @@ -10226,8 +10234,8 @@ states.wilful_disobedience = { locale(loc) { push_undo(); remove_york_favour(loc); + log_favour(loc); game.count++; - logi(`Yorkist Favour removed at S${loc}`); }, done() { end_immediate_event(); @@ -10306,7 +10314,7 @@ states.robins_rebellion = { locale(loc) { push_undo(); shift_favour_toward(loc); - log(`Placed/Removed Favour at S${loc}.`); + log_favour(loc); game.count++; }, done() { @@ -10351,7 +10359,7 @@ states.tudor_banners = { locale(loc) { remove_york_favour(loc); add_lancaster_favour(loc); - log(`Placed Lancastrian Favour at S${loc}`); + log_favour(loc); }, done() { game.who = NOBODY; @@ -10544,10 +10552,7 @@ states.richard_leigh = { }, locale(loc) { shift_favour_toward(loc); - if (has_york_favour(loc)) - log(`L${loc} to Yorkist Favour.`); - else - log(`L${loc} to neutral.`); + log_favour(loc); end_immediate_event(); } }; @@ -1949,6 +1949,15 @@ function is_lancaster_dominating_wales() { // === 1.4 INFLUENCE === +function log_favour(loc) { + if (has_york_favour(loc)) + log(`S${loc} to Yorkist.`) + else if (has_lancaster_favour(loc)) + log(`S${loc} to Lancastrian.`) + else + log(`S${loc} to Neutral.`) +} + function log_ip(n) { if (n < 0) log(".ip " + n) @@ -3401,8 +3410,8 @@ states.levy_lord_at_seat = { levy_burgundians(game.who) if (game.active === YORK) { - add_york_favour(loc) remove_lancaster_favour(loc) + add_york_favour(loc) } else { if (loc === LOC_LONDON && has_york_favour(LONDON_FOR_YORK)) { logevent(EVENT_YORK_LONDON_FOR_YORK) @@ -11501,7 +11510,7 @@ states.warwicks_propaganda_yorkist_choice = { remove() { remove_york_favour(game.where) remove_propaganda_target(game.where) - logi(`Removed York Favour at S${game.where}.`) + log_favour(game.where) game.where = NOWHERE }, pay() { @@ -11650,7 +11659,7 @@ states.welsh_rebellion_remove_favour = { locale(loc) { push_undo() remove_york_favour(loc) - log(`Removed York Favour at S${loc}.`) + log_favour(loc) game.count++ }, done() { @@ -11803,8 +11812,8 @@ states.wilful_disobedience = { locale(loc) { push_undo() remove_york_favour(loc) + log_favour(loc) game.count++ - logi(`Yorkist Favour removed at S${loc}`) }, done() { end_immediate_event() @@ -11888,7 +11897,7 @@ states.robins_rebellion = { locale(loc) { push_undo() shift_favour_toward(loc) - log(`Placed/Removed Favour at S${loc}.`) + log_favour(loc) game.count++ }, done() { @@ -11936,7 +11945,7 @@ states.tudor_banners = { locale(loc) { remove_york_favour(loc) add_lancaster_favour(loc) - log(`Placed Lancastrian Favour at S${loc}`) + log_favour(loc) }, done() { game.who = NOBODY @@ -12142,10 +12151,7 @@ states.richard_leigh = { }, locale(loc) { shift_favour_toward(loc) - if (has_york_favour(loc)) - log(`L${loc} to Yorkist Favour.`) - else - log(`L${loc} to neutral.`) + log_favour(loc) end_immediate_event() } } |