From 56d629eaa2823d7b2d4d498a5360606223f8b723 Mon Sep 17 00:00:00 2001
From: iainp5 <iain.pearce.ip@gmail.com>
Date: Sun, 3 Nov 2024 12:54:17 +0000
Subject: Fix Kiss of Death with Reformer Rehabilitated

---
 rules.js | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

(limited to 'rules.js')

diff --git a/rules.js b/rules.js
index 23db4f4..a5efc95 100644
--- a/rules.js
+++ b/rules.js
@@ -6069,7 +6069,7 @@ states.vm_dash_for_the_west = {
 
 states.vm_play_event_from_discard = {
 	get inactive() {
-		return `resolve ${clean_name(cards[game.played_card].name)}.`
+		return `resolve ${clean_name(cards[this_card()].name)}.`
 	},
 	prompt() {
 		if (game.valid_cards.length === 0) {
@@ -6085,6 +6085,7 @@ states.vm_play_event_from_discard = {
 	},
 	card(card) {
 		push_undo()
+		log(`C${this_card()}:`)
 		log(`Chose C${card}`)
 		game.vm_event = card
 		game.vm_available_ops = cards[card].ops
@@ -6512,9 +6513,14 @@ states.vm_kiss_of_death = {
 	discard() {
 		clear_undo()
 		game.vm_event = discard_card(game.communist_hand)
-		//Only switch player if a playable non-communist event. Common European Home is not playable here
-		if (cards[game.vm_event].side !== "C" && event_is_playable(game.vm_event) && game.vm_event !== C_COMMON_EUROPEAN_HOME) {
-			next_player()
+		//Change player before checking if event is playable. Common European Home is not playable here
+		change_player()
+		// Special check for the Reformer Rehabilitated
+		if (game.vm_event === C_REFORMER_REHABILITATED && game.dem_tst_position > game.com_tst_position) {
+			log_side()
+			game.state = 'vm_kiss_of_death_finish'
+		} else if (cards[game.vm_event].side !== "C" && event_is_playable(game.vm_event) && game.vm_event !== C_COMMON_EUROPEAN_HOME) {
+			log_side()
 			game.state = 'vm_kiss_of_death_finish'
 		} else {
 			log('Event does not occur')
-- 
cgit v1.2.3