summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2024-04-19 21:34:58 +0200
committerTor Andersson <tor@ccxvii.net>2024-04-19 21:38:16 +0200
commit8e2995978aa4dcf17f6d5d674b95b355c851aae7 (patch)
treefa395f976ca2d1319a49faccbac0c156e5c0468b
parentb221ffc612610452e7949b9dd72ac25411766109 (diff)
downloadplantagenet-8e2995978aa4dcf17f6d5d674b95b355c851aae7.tar.gz
Cap influence to 45.
-rw-r--r--play.js4
-rw-r--r--rules.ts17
2 files changed, 9 insertions, 12 deletions
diff --git a/play.js b/play.js
index 5bb3e36..1edad3f 100644
--- a/play.js
+++ b/play.js
@@ -1588,8 +1588,8 @@ function on_update() {
ui.fortress.classList.toggle("york", fortress < 0)
ui.fortress.classList.toggle("lancaster", fortress >= 0)
- ui.influence.style.top = (track_xy[Math.abs(view.influence)][1]) + "px"
- ui.influence.style.left = (track_xy[Math.abs(view.influence)][0]) + "px"
+ ui.influence.style.top = (track_xy[Math.min(45,Math.abs(view.influence))][1]) + "px"
+ ui.influence.style.left = (track_xy[Math.min(45,Math.abs(view.influence))][0]) + "px"
ui.influence.classList.toggle("york", view.influence < 0)
ui.influence.classList.toggle("lancaster", view.influence >= 0)
diff --git a/rules.ts b/rules.ts
index f957f0a..ea7056c 100644
--- a/rules.ts
+++ b/rules.ts
@@ -1812,19 +1812,19 @@ function reduce_influence(amt: number) {
}
function reduce_york_influence(amt: number) {
- game.influence += amt
+ game.influence = Math.max(-45, Math.min(45, game.influence + amt))
}
function increase_york_influence(amt: number) {
- game.influence -= amt
+ game.influence = Math.max(-45, Math.min(45, game.influence - amt))
}
function reduce_lancaster_influence(amt: number) {
- game.influence -= amt
+ game.influence = Math.max(-45, Math.min(45, game.influence - amt))
}
function increase_lancaster_influence(amt: number) {
- game.influence += amt
+ game.influence = Math.max(-45, Math.min(45, game.influence + amt))
}
function is_automatic_levy_vassal_success(lord: Lord) {
@@ -8009,8 +8009,8 @@ function tides_calc() {
log(`Total ` + domy + ` Influence for York`)
log(`Total ` + doml + ` Influence for Lancaster`)
- game.influence += doml
- game.influence -= domy
+ increase_lancaster_influence(doml)
+ increase_york_influence(domy)
}
function goto_tides_of_war() {
@@ -8142,10 +8142,7 @@ function disband_influence_penalty(lord: Lord) {
}
}
- if (game.active === LANCASTER)
- game.influence -= influence
- else
- game.influence += influence
+ reduce_influence(influence)
}
function goto_advance_campaign() {