summaryrefslogtreecommitdiff
path: root/rules.ts
diff options
context:
space:
mode:
Diffstat (limited to 'rules.ts')
-rw-r--r--rules.ts52
1 files changed, 42 insertions, 10 deletions
diff --git a/rules.ts b/rules.ts
index dfa17f3..a706f34 100644
--- a/rules.ts
+++ b/rules.ts
@@ -1164,17 +1164,19 @@ function resolve_player_with_most_hero_points(faction: FactionId) {
if (value < 0) {
lose_hero_point(faction, value);
} else {
- gain_hero_points(faction, value)
+ gain_hero_points(faction, value);
}
resolve_active_and_proceed();
}
-
states.select_player_with_most_hero_points = {
inactive: 'choose a Player',
prompt() {
const { v } = get_active_node_args();
- view.prompt = v < 0 ? 'Choose player to lose Hero Points' : 'Choose player to gain Hero Points';
+ view.prompt =
+ v < 0
+ ? 'Choose player to lose Hero Points'
+ : 'Choose player to gain Hero Points';
const factions = get_factions_with_most_hero_poins();
for (let faction_id of factions) {
@@ -1506,12 +1508,37 @@ states.swap_card_tableau_hand = {
// card(c: CardId) {},
};
-// TODO: implement, card 12 + card 32 + card 44
-// Value should come from args
+function resolve_take_hero_points(faction: FactionId) {
+ const { v } = get_active_node_args();
+ const amount = Math.min(v, game.hero_points[faction]);
+ lose_hero_point(faction, amount);
+ gain_hero_points(get_active_faction(), amount);
+ resolve_active_and_proceed();
+}
+
states.take_hero_points = {
inactive: 'take Hero Points',
prompt() {
- view.prompt = 'Choose a player to take Hero Points from';
+ const { v } = get_active_node_args();
+ view.prompt =
+ v === 1
+ ? 'Choose a player to take a Hero Point from'
+ : `Choose a player to take ${v} Hero Points from`;
+ const active_faction = get_active_faction();
+ for (const faction of role_ids) {
+ if (faction !== active_faction) {
+ gen_action(faction_player_map[faction]);
+ }
+ }
+ },
+ Anarchist() {
+ resolve_take_hero_points(ANARCHISTS_ID);
+ },
+ Communist() {
+ resolve_take_hero_points(COMMUNISTS_ID);
+ },
+ Moderate() {
+ resolve_take_hero_points(MODERATES_ID);
},
};
@@ -1853,15 +1880,20 @@ function gain_hero_points_in_player_order(factions: FactionId[], value) {
}
}
-function gain_hero_points(faction_id: FactionId, value: number) {
+function gain_hero_points(
+ faction_id: FactionId,
+ value: number,
+ skip_abilities = false // Used to prevent gaining of extra hero points when taking them from another player
+) {
if (game.hero_points.pool === 0) {
return;
}
if (
- (faction_id === ANARCHISTS_ID &&
+ !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 === COMMUNISTS_ID &&
+ (game.active_abilities || []).includes(COMMUNIST_EXTRA_HERO_POINT)))
) {
value++;
}