summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2024-05-31 18:42:23 +0200
committerTor Andersson <tor@ccxvii.net>2024-05-31 18:45:11 +0200
commit2dbf41126f4ddc8fa69811b84c4a06a0abc25c60 (patch)
tree046550d03bcb26a4edff9b2bf62d6a033d4361c3
parentcbfcfe09f1d6634798c6de487e51da8c58a0d113 (diff)
downloadplantagenet-2dbf41126f4ddc8fa69811b84c4a06a0abc25c60.tar.gz
show automatic success event/capability effects:
- earl of richmond - two roses - dorset
-rw-r--r--rules.js17
-rw-r--r--rules.ts17
2 files changed, 24 insertions, 10 deletions
diff --git a/rules.js b/rules.js
index c05acd2..704c9a0 100644
--- a/rules.js
+++ b/rules.js
@@ -1584,21 +1584,25 @@ function parley_ic_cost(lord, spend) {
}
return cost;
}
-function common_ic_success(_lord) {
+function common_ic_success(_lord, _report) {
return false;
}
-function vassal_ic_success(lord) {
+function vassal_ic_success(lord, report) {
if (game.active === LANCASTER) {
if (is_event_in_play(EVENT_LANCASTER_THE_EARL_OF_RICHMOND)) {
+ if (report)
+ logevent(EVENT_LANCASTER_THE_EARL_OF_RICHMOND);
return true;
}
if (lord_has_capability(lord, AOW_LANCASTER_TWO_ROSES)) {
+ if (report)
+ logcap(AOW_LANCASTER_TWO_ROSES);
return true;
}
}
return false;
}
-function parley_ic_success(lord) {
+function parley_ic_success(lord, report) {
if (is_levy_phase()) {
if (game.levy_flags.jack_cade > 0) {
return true;
@@ -1614,6 +1618,8 @@ function parley_ic_success(lord) {
}
else {
if (lord === LORD_DEVON && get_lord_locale(lord) === LOC_EXETER && is_event_in_play(EVENT_YORK_DORSET)) {
+ if (report)
+ logevent(EVENT_YORK_DORSET);
return true;
}
}
@@ -1701,7 +1707,7 @@ function parley_ic_rating(lord, spend, report) {
}
function prompt_influence_check(lord, calc = common_ic) {
let cost = calc.cost(lord, 0);
- if (calc.success(lord)) {
+ if (calc.success(lord, false)) {
view.prompt += ` Influence success for ${cost} IP.`;
view.actions.check = [0];
}
@@ -1720,8 +1726,9 @@ function prompt_influence_check(lord, calc = common_ic) {
function roll_influence_check(what, lord, spend, calc = common_ic) {
let cost = calc.cost(lord, spend);
reduce_influence(cost);
- if (calc.success(lord)) {
+ if (calc.success(lord, false)) {
log(`${what}.`);
+ calc.success(lord, true);
return true;
}
else {
diff --git a/rules.ts b/rules.ts
index 2b9ac10..e071a09 100644
--- a/rules.ts
+++ b/rules.ts
@@ -2071,23 +2071,27 @@ function parley_ic_cost(lord: Lord, spend: number) {
return cost
}
-function common_ic_success(_lord: Lord) {
+function common_ic_success(_lord: Lord, _report: boolean) {
return false
}
-function vassal_ic_success(lord: Lord) {
+function vassal_ic_success(lord: Lord, report: boolean) {
if (game.active === LANCASTER) {
if (is_event_in_play(EVENT_LANCASTER_THE_EARL_OF_RICHMOND)) {
+ if (report)
+ logevent(EVENT_LANCASTER_THE_EARL_OF_RICHMOND)
return true
}
if (lord_has_capability(lord, AOW_LANCASTER_TWO_ROSES)) {
+ if (report)
+ logcap(AOW_LANCASTER_TWO_ROSES)
return true
}
}
return false
}
-function parley_ic_success(lord: Lord) {
+function parley_ic_success(lord: Lord, report: boolean) {
if (is_levy_phase()) {
if (game.levy_flags.jack_cade > 0) {
return true
@@ -2101,6 +2105,8 @@ function parley_ic_success(lord: Lord) {
}
} else {
if (lord === LORD_DEVON && get_lord_locale(lord) === LOC_EXETER && is_event_in_play(EVENT_YORK_DORSET)) {
+ if (report)
+ logevent(EVENT_YORK_DORSET)
return true
}
}
@@ -2194,7 +2200,7 @@ function parley_ic_rating(lord: Lord, spend: number, report: boolean) {
function prompt_influence_check(lord: Lord, calc=common_ic) {
let cost = calc.cost(lord, 0)
- if (calc.success(lord)) {
+ if (calc.success(lord, false)) {
view.prompt += ` Influence success for ${cost} IP.`
view.actions.check = [ 0 ]
} else {
@@ -2217,8 +2223,9 @@ function roll_influence_check(what: string, lord: Lord, spend: number, calc=comm
reduce_influence(cost)
- if (calc.success(lord)) {
+ if (calc.success(lord, false)) {
log(`${what}.`)
+ calc.success(lord, true)
return true
} else {
let rating = Math.max(1, Math.min(5, calc.rating(lord, spend, false)))