summaryrefslogtreecommitdiff
path: root/rules.js
diff options
context:
space:
mode:
Diffstat (limited to 'rules.js')
-rw-r--r--rules.js12
1 files changed, 11 insertions, 1 deletions
diff --git a/rules.js b/rules.js
index 16b6078..9e3cc1c 100644
--- a/rules.js
+++ b/rules.js
@@ -229,6 +229,16 @@ function select_random_block(where) {
return list[Math.floor(Math.random() * list.length)];
}
+function select_random_enemy_block(where) {
+ let list = [];
+ for (let b in BLOCKS)
+ if (game.location[b] === where && block_owner(b) === enemy(game.active))
+ list.push(b);
+ if (list.length === 0)
+ return null;
+ return list[Math.floor(Math.random() * list.length)];
+}
+
function block_plural(who) {
return BLOCKS[who].plural;
}
@@ -1323,7 +1333,7 @@ states.assassins = {
},
block: function (who) {
game.where = game.location[who];
- game.who = select_random_block(game.where);
+ game.who = select_random_enemy_block(game.where);
game.location[ASSASSINS] = game.where;
game.state = 'assassins_show_1';
},