From 763dd8f797f1e9948b420a4453e768b47f21fc95 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Sat, 11 May 2024 00:33:18 +0200 Subject: always log IP relative to commanding lord/active player --- rules.js | 8 ++++++-- rules.ts | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/rules.js b/rules.js index 0ec6077..f90e388 100644 --- a/rules.js +++ b/rules.js @@ -1491,6 +1491,9 @@ function log_favour(loc) { log(`S${loc} to Neutral.`); } function log_ip(n) { + // +ve ip is lancastrian + if ((game.command === NOBODY && game.active === YORK) || is_york_lord(game.command)) + n = -n; if (n < 0) log(".ip " + n); else if (n > 0) @@ -1503,11 +1506,11 @@ function reduce_influence(amt) { reduce_lancaster_influence(amt); } function reduce_york_influence(amt) { - log_ip(-amt); + log_ip(amt); game.influence = Math.max(-45, Math.min(45, game.influence + amt)); } function increase_york_influence(amt) { - log_ip(amt); + log_ip(-amt); game.influence = Math.max(-45, Math.min(45, game.influence - amt)); } function reduce_lancaster_influence(amt) { @@ -7846,6 +7849,7 @@ function goto_tides_of_war() { if (set_has(INFLUENCE_TURNS, current_turn())) york += tow_influence(all_york_lords); log("Total: " + york); + log_br(); game.influence = Math.max(0, Math.min(45, game.influence + lanc - york)); if (eligible_charity()) goto_we_done_deeds_of_charity(); diff --git a/rules.ts b/rules.ts index 8b2397d..ba9bda9 100644 --- a/rules.ts +++ b/rules.ts @@ -1966,6 +1966,9 @@ function log_favour(loc) { } function log_ip(n) { + // +ve ip is lancastrian + if ((game.command === NOBODY && game.active === YORK) || is_york_lord(game.command)) + n = -n if (n < 0) log(".ip " + n) else if (n > 0) @@ -1980,12 +1983,12 @@ function reduce_influence(amt: number) { } function reduce_york_influence(amt: number) { - log_ip(-amt) + log_ip(amt) game.influence = Math.max(-45, Math.min(45, game.influence + amt)) } function increase_york_influence(amt: number) { - log_ip(amt) + log_ip(-amt) game.influence = Math.max(-45, Math.min(45, game.influence - amt)) } @@ -9201,6 +9204,7 @@ function goto_tides_of_war() { york += tow_influence(all_york_lords) log("Total: " + york) + log_br() game.influence = Math.max(0, Math.min(45, game.influence + lanc - york)) -- cgit v1.2.3