diff options
-rw-r--r-- | data.js | 3 | ||||
-rw-r--r-- | data.ts | 1 | ||||
-rw-r--r-- | rules.js | 25 | ||||
-rw-r--r-- | rules.ts | 35 |
4 files changed, 59 insertions, 5 deletions
@@ -1,6 +1,6 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -exports.FRONTS = exports.DEFEAT = exports.VICTORY = exports.TRASH = exports.TOWARDS_CENTER = exports.SELF = exports.PLAYER_WITH_MOST_HERO_POINTS = exports.OTHER_PLAYERS = exports.ON = exports.OFF = exports.TEAMWORK_BONUS = exports.MORALE_BONUS = exports.FOREIGN_AID = exports.SOVIET_SUPPORT = exports.GOVERNMENT = exports.COLLECTIVIZATION = exports.CLOSEST_TO_VICTORY = exports.CLOSEST_TO_DEFEAT = exports.LIBERTY = exports.ANY = exports.MODERATES_ID = exports.COMMUNISTS_ID = exports.ANARCHISTS_ID = exports.MODERATE = exports.COMMUNIST = exports.ANARCHIST = void 0; +exports.FRONTS = exports.DEFEAT = exports.VICTORY = exports.TRASH = exports.TOWARDS_CENTER = exports.AWAY_FROM_CENTER = exports.SELF = exports.PLAYER_WITH_MOST_HERO_POINTS = exports.OTHER_PLAYERS = exports.ON = exports.OFF = exports.TEAMWORK_BONUS = exports.MORALE_BONUS = exports.FOREIGN_AID = exports.SOVIET_SUPPORT = exports.GOVERNMENT = exports.COLLECTIVIZATION = exports.CLOSEST_TO_VICTORY = exports.CLOSEST_TO_DEFEAT = exports.LIBERTY = exports.ANY = exports.MODERATES_ID = exports.COMMUNISTS_ID = exports.ANARCHISTS_ID = exports.MODERATE = exports.COMMUNIST = exports.ANARCHIST = void 0; exports.create_effect = create_effect; const LIBERTY = 0; exports.LIBERTY = LIBERTY; @@ -37,6 +37,7 @@ exports.FRONTS = FRONTS; const TOWARDS_CENTER = 10; exports.TOWARDS_CENTER = TOWARDS_CENTER; const AWAY_FROM_CENTER = 11; +exports.AWAY_FROM_CENTER = AWAY_FROM_CENTER; const ANY = 'any'; exports.ANY = ANY; const SELF = 'self'; @@ -78,6 +78,7 @@ export { OTHER_PLAYERS, PLAYER_WITH_MOST_HERO_POINTS, SELF, + AWAY_FROM_CENTER, TOWARDS_CENTER, TRASH, VICTORY, @@ -654,12 +654,23 @@ states.move_track = { const node = get_active_node(); const track = node.a.t; const value = node.a.v; - view.prompt = `Move ${tracks[track].name} ${value > 0 ? 'up' : 'down'}`; + const name = tracks[track].name; + view.prompt = `Move ${name} ${value > 0 ? 'up' : 'down'}`; + if (track === data_1.GOVERNMENT && value === data_1.TOWARDS_CENTER) { + view.prompt = `Move ${name} towards center`; + } + else if (track === data_1.GOVERNMENT && value === data_1.AWAY_FROM_CENTER) { + view.prompt = `Move ${name} away from center`; + } gen_action_standee(track); }, standee(s) { const node = get_active_node(); - const value = node.a.v; + let value = node.a.v; + if (s === data_1.GOVERNMENT && + (value === data_1.TOWARDS_CENTER || value === data_1.AWAY_FROM_CENTER)) { + value = get_government_track_direction(value); + } move_track(s, value); resolve_active_and_proceed(); }, @@ -933,6 +944,16 @@ function get_min_value_for_track(track_id) { return 0; } } +function get_government_track_direction(direction) { + const value = game.tracks[data_1.GOVERNMENT]; + if ((direction === data_1.TOWARDS_CENTER && value >= 6) || + (direction === data_1.AWAY_FROM_CENTER && value <= 5)) { + return -1; + } + else { + return 1; + } +} function move_track(track_id, change) { const current_value = game.tracks[track_id]; let new_value = current_value + change; @@ -52,6 +52,8 @@ import data, { DEFEAT, FRONTS, create_effect, + AWAY_FROM_CENTER, + TOWARDS_CENTER, // StaticData, // PLAYER_WITH_MOST_HERO_POINTS, } from './data'; @@ -847,13 +849,28 @@ states.move_track = { const node = get_active_node(); const track = node.a.t; const value = node.a.v; - view.prompt = `Move ${tracks[track].name} ${value > 0 ? 'up' : 'down'}`; + const name = tracks[track].name; + + view.prompt = `Move ${name} ${value > 0 ? 'up' : 'down'}`; + if (track === GOVERNMENT && value === TOWARDS_CENTER) { + view.prompt = `Move ${name} towards center`; + } else if (track === GOVERNMENT && value === AWAY_FROM_CENTER) { + view.prompt = `Move ${name} away from center`; + } // return 'Decrease ' + tracks[effect.target].name; gen_action_standee(track); }, standee(s: number) { const node = get_active_node(); - const value = node.a.v; + let value = node.a.v; + + if ( + s === GOVERNMENT && + (value === TOWARDS_CENTER || value === AWAY_FROM_CENTER) + ) { + value = get_government_track_direction(value); + } + move_track(s, value); resolve_active_and_proceed(); }, @@ -1191,6 +1208,20 @@ function get_min_value_for_track(track_id: number) { } } +// TOWARDS_CENTER = 10; +// AWAY_FROM_CENTER = 11; +function get_government_track_direction(direction: 10 | 11): -1 | 1 { + const value = game.tracks[GOVERNMENT]; + if ( + (direction === TOWARDS_CENTER && value >= 6) || + (direction === AWAY_FROM_CENTER && value <= 5) + ) { + return -1; + } else { + return 1; + } +} + function move_track(track_id: number, change: number) { const current_value = game.tracks[track_id]; let new_value = current_value + change; |