summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrans Bongers <fransbongers@franss-mbp.home>2025-01-08 20:53:51 +0100
committerFrans Bongers <fransbongers@franss-mbp.home>2025-01-08 20:53:51 +0100
commitb1a3b055df4472ff191f067f707c7722fb04d946 (patch)
treedda9a7c4d83c47a4dbfeafbf1170e1bf24a25cd4
parent3ed56f482596fd4bf914bea95bd3ce46c0dcad6b (diff)
downloadland-and-freedom-master.tar.gz
bugfixesHEADmaster
-rw-r--r--data.js2
-rw-r--r--data.ts2
-rw-r--r--rules.js26
-rw-r--r--rules.ts35
4 files changed, 49 insertions, 16 deletions
diff --git a/data.js b/data.js
index 7769d5c..4882c14 100644
--- a/data.js
+++ b/data.js
@@ -1574,7 +1574,7 @@ const data = {
id: 100,
effects: [
create_effect('attack', SOUTHERN, -7, INITIATIVE_PLAYER),
- create_effect('attack', CLOSEST_TO_DEFEAT, -2, INITIATIVE_PLAYER),
+ create_effect('attack', CLOSEST_TO_VICTORY, -2, INITIATIVE_PLAYER),
create_effect('track', FOREIGN_AID, -2, INITIATIVE_PLAYER),
create_effect('hero_points', PLAYER_WITH_MOST_HERO_POINTS, -1, INITIATIVE_PLAYER),
],
diff --git a/data.ts b/data.ts
index e73148f..d22a005 100644
--- a/data.ts
+++ b/data.ts
@@ -1626,7 +1626,7 @@ const data: StaticData = {
id: 100,
effects: [
create_effect('attack', SOUTHERN, -7, INITIATIVE_PLAYER),
- create_effect('attack', CLOSEST_TO_DEFEAT, -2, INITIATIVE_PLAYER),
+ create_effect('attack', CLOSEST_TO_VICTORY, -2, INITIATIVE_PLAYER),
create_effect('track', FOREIGN_AID, -2, INITIATIVE_PLAYER),
create_effect(
'hero_points',
diff --git a/rules.js b/rules.js
index 0f53324..4aa2491 100644
--- a/rules.js
+++ b/rules.js
@@ -991,19 +991,26 @@ states.draw_card = {
states.end_of_year_discard = {
inactive: 'discard cards from hand and tableau',
prompt() {
- view.prompt = 'Discard a card';
const faction_id = get_active_faction();
const hand = game.hands[faction_id];
const hand_limit = get_hand_limit(faction_id);
- if (hand.length > hand_limit) {
+ const needs_to_discard_from_hand = hand.length > hand_limit;
+ if (needs_to_discard_from_hand) {
for (let c of hand)
gen_action_card(c);
}
const tableau = game.tableaus[faction_id];
- if (tableau.length > game.year) {
+ const needs_to_discard_from_tableau = tableau.length > game.year;
+ if (needs_to_discard_from_tableau) {
for (let c of tableau)
gen_action_card(c);
}
+ if (needs_to_discard_from_hand && needs_to_discard_from_tableau) {
+ view.prompt = 'Discard a card from your hand or tableau';
+ }
+ else {
+ view.prompt = `Discard a card from your ${needs_to_discard_from_hand ? 'hand' : 'tableau'}`;
+ }
},
card(c) {
const faction_id = get_active_faction();
@@ -1911,11 +1918,16 @@ function gain_hero_points(faction_id, value, skip_abilities = false) {
return;
}
if (!skip_abilities &&
- ((faction_id === data_1.ANARCHISTS_ID &&
- (game.active_abilities || []).includes(data_1.ANARCHIST_EXTRA_HERO_POINT)) ||
- (faction_id === data_1.COMMUNISTS_ID &&
- (game.active_abilities || []).includes(data_1.COMMUNIST_EXTRA_HERO_POINT)))) {
+ faction_id === data_1.ANARCHISTS_ID &&
+ (game.active_abilities || []).includes(data_1.ANARCHIST_EXTRA_HERO_POINT)) {
+ value++;
+ game.active_abilities = (game.active_abilities || []).filter((ability) => ability !== data_1.ANARCHIST_EXTRA_HERO_POINT);
+ }
+ if (!skip_abilities &&
+ faction_id === data_1.COMMUNISTS_ID &&
+ (game.active_abilities || []).includes(data_1.COMMUNIST_EXTRA_HERO_POINT)) {
value++;
+ game.active_abilities = (game.active_abilities || []).filter((ability) => ability !== data_1.COMMUNIST_EXTRA_HERO_POINT);
}
const gain = Math.min(game.hero_points.pool, value);
game.hero_points.pool -= gain;
diff --git a/rules.ts b/rules.ts
index d3c58ab..18bb5d3 100644
--- a/rules.ts
+++ b/rules.ts
@@ -1242,17 +1242,26 @@ states.draw_card = {
states.end_of_year_discard = {
inactive: 'discard cards from hand and tableau',
prompt() {
- view.prompt = 'Discard a card';
const faction_id = get_active_faction();
const hand = game.hands[faction_id];
const hand_limit = get_hand_limit(faction_id);
- if (hand.length > hand_limit) {
+ const needs_to_discard_from_hand = hand.length > hand_limit;
+ if (needs_to_discard_from_hand) {
for (let c of hand) gen_action_card(c);
}
const tableau = game.tableaus[faction_id];
- if (tableau.length > game.year) {
+ const needs_to_discard_from_tableau = tableau.length > game.year;
+ if (needs_to_discard_from_tableau) {
for (let c of tableau) gen_action_card(c);
}
+
+ if (needs_to_discard_from_hand && needs_to_discard_from_tableau) {
+ view.prompt = 'Discard a card from your hand or tableau';
+ } else {
+ view.prompt = `Discard a card from your ${
+ needs_to_discard_from_hand ? 'hand' : 'tableau'
+ }`;
+ }
},
card(c: CardId) {
const faction_id = get_active_faction();
@@ -2363,12 +2372,24 @@ function gain_hero_points(
}
if (
!skip_abilities &&
- ((faction_id === ANARCHISTS_ID &&
- (game.active_abilities || []).includes(ANARCHIST_EXTRA_HERO_POINT)) ||
- (faction_id === COMMUNISTS_ID &&
- (game.active_abilities || []).includes(COMMUNIST_EXTRA_HERO_POINT)))
+ faction_id === ANARCHISTS_ID &&
+ // TODO: remove || [] and replace filter with array_remove
+ (game.active_abilities || []).includes(ANARCHIST_EXTRA_HERO_POINT)
) {
value++;
+ game.active_abilities = (game.active_abilities || []).filter(
+ (ability) => ability !== ANARCHIST_EXTRA_HERO_POINT
+ );
+ }
+ if (
+ !skip_abilities &&
+ faction_id === COMMUNISTS_ID &&
+ (game.active_abilities || []).includes(COMMUNIST_EXTRA_HERO_POINT)
+ ) {
+ value++;
+ game.active_abilities = (game.active_abilities || []).filter(
+ (ability) => ability !== COMMUNIST_EXTRA_HERO_POINT
+ );
}
const gain = Math.min(game.hero_points.pool, value);
game.hero_points.pool -= gain;