From 163e2eaa1803c26231bc24bb0b6fe33239296f3c Mon Sep 17 00:00:00 2001
From: Tor Andersson <tor@ccxvii.net>
Date: Thu, 15 Jul 2021 13:06:44 +0200
Subject: crusader: Improve UI for sending Asasssins event.

---
 play.html |  1 +
 rules.js  | 33 +++++++++++++++++++++++----------
 ui.js     |  2 --
 3 files changed, 24 insertions(+), 12 deletions(-)

diff --git a/play.html b/play.html
index ade2eec..255784b 100644
--- a/play.html
+++ b/play.html
@@ -158,6 +158,7 @@ body.shift .block.known:hover {
 
 .block.Franks.highlight { border-color: white; }
 .block.Saracens.highlight { border-color: white; }
+.block.Assassins.highlight { border-color: white; }
 
 .block.Franks.selected { border-color: crimson; }
 .block.Saracens.selected { border-color: yellow; }
diff --git a/rules.js b/rules.js
index 9e3cc1c..1feae19 100644
--- a/rules.js
+++ b/rules.js
@@ -1342,31 +1342,44 @@ states.assassins = {
 states.assassins_show_1 = {
 	prompt: function (view, current) {
 		view.assassinate = game.who;
+		view.who = ASSASSINS;
 		if (is_inactive_player(current))
 			return view.prompt = "Assassins: Waiting for " + game.active + ".";
 		view.prompt = "Assassins: The assassins target " + block_name(game.who) + " in " + game.where + ".";
 		gen_action(view, 'next');
+		gen_action(view, 'block', game.who);
+		gen_action(view, 'block', ASSASSINS);
 	},
-	next: function () {
-		assassinate(game.who, game.where);
-		game.state = 'assassins_show_2';
-	},
+	next: assassins_next_1,
+	block: assassins_next_1,
+}
+
+function assassins_next_1() {
+	assassinate(game.who, game.where);
+	game.state = 'assassins_show_2';
 }
 
 states.assassins_show_2 = {
 	prompt: function (view, current) {
 		view.assassinate = game.who;
+		view.who = ASSASSINS;
 		if (is_inactive_player(current))
 			return view.prompt = "Assassins: Waiting for " + game.active + ".";
 		view.prompt = "Assassins: The assassins hit " + block_name(game.who) + " in " + game.where + ".";
 		gen_action(view, 'next');
+		gen_action(view, 'block', ASSASSINS);
+		gen_action(view, 'town', MASYAF);
 	},
-	next: function () {
-		game.location[ASSASSINS] = MASYAF;
-		game.who = null;
-		game.where = null;
-		end_player_turn();
-	},
+	next: assassins_next_2,
+	block: assassins_next_2,
+	town: assassins_next_2,
+}
+
+function assassins_next_2() {
+	game.location[ASSASSINS] = MASYAF;
+	game.who = null;
+	game.where = null;
+	end_player_turn();
 }
 
 function assassinate(who, where) {
diff --git a/ui.js b/ui.js
index ea2097c..6727d45 100644
--- a/ui.js
+++ b/ui.js
@@ -566,8 +566,6 @@ function update_map() {
 	}
 	if (game.who && !game.battle)
 		ui.blocks[game.who].classList.add('selected');
-	if (game.assassinate)
-		ui.blocks[game.assassinate].classList.add('selected');
 	for (let b of game.castle)
 		ui.blocks[b].classList.add('castle');
 }
-- 
cgit v1.2.3