diff options
author | iainp5 <iain.pearce.ip@gmail.com> | 2024-11-21 07:24:54 +0000 |
---|---|---|
committer | iainp5 <iain.pearce.ip@gmail.com> | 2024-11-21 07:24:54 +0000 |
commit | a6f72eae1a1a33937f2daf2695f995cf10490612 (patch) | |
tree | 69a392acd9e2d571ffbc2a01b10536b542f5b7d7 | |
parent | d4718cfbd613e6b906653270b1ac0e14e82b87d7 (diff) | |
download | 1989-dawn-of-freedom-a6f72eae1a1a33937f2daf2695f995cf10490612.tar.gz |
Tidy up Tyrant code
-rw-r--r-- | rules.js | 40 |
1 files changed, 16 insertions, 24 deletions
@@ -1496,19 +1496,7 @@ states.vp_roll = { push_undo() log_h2('Scoring') score_country(game.pwr_struggle_in) - - //Check if The Tyrant is Gone occurs - if (game.persistent_events.includes(C_THE_TYRANT_IS_GONE) && game.pwr_struggle_in === 'Romania' && game.persistent_events.includes(THE_CROWD_TURNS_AGAINST_CEAUSESCU_OCCURRED)) { - game.persistent_events = game.persistent_events.filter (c => c !== C_THE_CROWD_TURNS_AGAINST_CEAUSESCU) - game.persistent_events = game.persistent_events.filter (c => c !== THE_CROWD_TURNS_AGAINST_CEAUSESCU_OCCURRED) - game.return_state = 'finish_scoring' - if (game.active !== DEM) { - next_player() - } - game.state = 'the_tyrant_is_gone' - } else { - game.state = 'finish_scoring' - } + resolve_tyrant() }, } @@ -1538,17 +1526,7 @@ states.choose_power = { scoring () { push_undo() score_country(game.pwr_struggle_in) - - //Check if The Tyrant is Gone occurs - if (game.persistent_events.includes(C_THE_TYRANT_IS_GONE) && game.pwr_struggle_in === 'Romania' && game.persistent_events.includes(THE_CROWD_TURNS_AGAINST_CEAUSESCU_OCCURRED)) { - game.return_state = 'finish_scoring' - if (game.active !== DEM) { - next_player() - } - game.state = 'the_tyrant_is_gone' - } else { - game.state = 'finish_scoring' - } + resolve_tyrant() } } @@ -1569,6 +1547,7 @@ states.the_tyrant_is_gone ={ } log_h3(`C${C_THE_TYRANT_IS_GONE}`) game.vm_event = C_THE_TYRANT_IS_GONE + console.log('ceausescu occurred', game.persistent_events.includes(THE_CROWD_TURNS_AGAINST_CEAUSESCU_OCCURRED)) goto_vm(game.vm_event) } } @@ -3775,6 +3754,18 @@ function check_tyrant() { } } +function resolve_tyrant() { + if (game.persistent_events.includes(C_THE_TYRANT_IS_GONE) && game.pwr_struggle_in === 'Romania' && game.persistent_events.includes(THE_CROWD_TURNS_AGAINST_CEAUSESCU_OCCURRED)) { + game.return_state = 'finish_scoring' + if (game.active !== DEM) { + next_player() + } + game.state = 'the_tyrant_is_gone' + } else { + game.state = 'finish_scoring' + } +} + function check_systematization() { /* Check for Systematization - may not use this space */ if (game.systematization > 0) { game.valid_spaces = game.valid_spaces.filter(n => n !== game.systematization) @@ -5337,6 +5328,7 @@ function vm_the_third_way() { } function vm_the_tyrant_is_gone() { + permanently_remove(C_THE_CROWD_TURNS_AGAINST_CEAUSESCU) game.persistent_events.push(THE_TYRANT_IS_GONE_OCCURRED) game.valid_spaces = [] for (let i = 0; i < spaces.length; i++) { |