From 4913146fdf49ff941e582970c6056d21444e6efa Mon Sep 17 00:00:00 2001
From: iainp5 <iain.pearce.ip@gmail.com>
Date: Sun, 10 Nov 2024 10:42:28 +0000
Subject: Update implementation of Tyrant

---
 rules.js | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)

(limited to 'rules.js')

diff --git a/rules.js b/rules.js
index ed79e5e..e61586c 100644
--- a/rules.js
+++ b/rules.js
@@ -2972,7 +2972,7 @@ function select_card(card){
 }
 
 function is_auto_resolve(card) {
-	let ceausecu_events = [10, 41, 101, 107]
+	let ceausecu_events = [10, 41, 69, 101, 107]
 	if (auto_resolve_events.includes(card)) {
 		return true
 	}  
@@ -3729,14 +3729,13 @@ function reset_power() {
 }
 
 function check_tyrant() {
-	if (game.the_tyrant_is_gone > 0 && game.the_tyrant_is_gone !== 111 && check_dem_control(game.the_tyrant_is_gone)) {
+	if (game.the_tyrant_is_gone > 0 && check_dem_control(game.the_tyrant_is_gone)) {
 		log('+2 VP from C97')
 		game.vp += 2
 		if (check_vp()) {
 			return
 		}
-		game.persistent_events = game.persistent_events.filter(n => n !== C_THE_TYRANT_IS_GONE)
-		game.the_tyrant_is_gone = 111
+		delete game.the_tyrant_is_gone
 	}
 }
 
@@ -7986,7 +7985,7 @@ CODE[9] = [ // The Wall*
 
 CODE[10] = [ // Cult of Personality
 	[ vm_permanently_remove ],
-	[ vm_if, ()=>!game.the_tyrant_is_gone ],
+	[ vm_if, ()=>!game.persistent_events.includes(C_THE_TYRANT_IS_GONE) ],
 	[ vm_valid_spaces_country_socio_2, 'Romania', 3, 4 ],
 	[ vm_prompt, 'Worker or Farmer spaces in Romania, no more than 2 per space' ],
 	[ vm_add_limited_infl, 4, 2 ],
@@ -8220,7 +8219,7 @@ CODE[40] = [ // Hungarian Democratic Forum
 
 CODE[41] = [ // Ceausescu*
 	[ vm_permanently_remove ],
-	[ vm_if, ()=>game.the_tyrant_is_gone ],
+	[ vm_if, ()=>!game.persistent_events.includes(C_THE_TYRANT_IS_GONE) ],
 	[ vm_tyrant_block ],
 	[ vm_else ],
 	[ vm_if, ()=>!is_auto_resolve(C_CEAUSESCU) ],
@@ -8431,8 +8430,12 @@ CODE[68] = [ // Klaus and Komarek*
 ]
 
 CODE[69] = [ // Systematization*
+	[ vm_if, ()=>!game.persistent_events.includes(C_THE_TYRANT_IS_GONE) ],
 	[ vm_valid_spaces_country, 'Romania' ],
 	[ vm_systematization ],
+	[ vm_else ],
+	[ vm_tyrant_block ],
+	[ vm_endif ],
 	[ vm_return ],
 ]
 
@@ -8669,7 +8672,7 @@ CODE[96] = [ // The Chinese Solution*
 ]
 
 CODE[97] = [ // The Tyrant is Gone*
-	[ vm_if, ()=>game.persistent_events.includes(THE_CROWD_TURNS_AGAINST_CEAUSESCU_OCCURRED) ],
+	[ vm_if, ()=>game.persistent_events.includes(54) ],
 	[ vm_valid_spaces, 'Cluj-Napoca' ],
 	[ vm_prompt, 'the Romanian Elite Space' ],
 	[ vm_remove_x_opp_infl, 4 ],
@@ -8703,7 +8706,7 @@ CODE[100] = [ // Stand Fast*
 ]
 
 CODE[101] = [ // Elena*
-	[ vm_if, ()=>!game.the_tyrant_is_gone ],
+	[ vm_if, ()=>!game.persistent_events.includes(C_THE_TYRANT_IS_GONE) ],
 	[ vm_valid_spaces, 'Cluj-Napoca' ],
 	[ vm_prompt, 'the Romania Elite Space' ],
 	[ vm_add_x_infl, 2 ],
@@ -8762,7 +8765,7 @@ CODE[106] = [ // Social Democratic Platform Adopted*
 
 CODE[107] = [ // Massacre in Timisoara*
 	[ vm_permanently_remove ],
-	[ vm_if, ()=>!game.the_tyrant_is_gone ],
+	[ vm_if, ()=>!game.persistent_events.includes(C_THE_TYRANT_IS_GONE) ],
 	[ vm_massacre_in_timisoara ],
 	[ vm_valid_spaces_country_sc, 'Romania' ],
 	[ vm_prompt, 'Make Support Checks in Romania' ],
-- 
cgit v1.2.3