summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoël Simoneau <simoneaujoel@gmail.com>2025-03-21 08:56:07 -0400
committerJoël Simoneau <simoneaujoel@gmail.com>2025-03-21 08:56:07 -0400
commitd4a7cc78037cb0f94b8803a7d962be93c37ed6d4 (patch)
tree3e533ee5633d36b5fa9020b3872caa5c25464507
parentbb3fabbf95dd5b6c39672e9f643df32f1f6e923f (diff)
downloadvijayanagara-d4a7cc78037cb0f94b8803a7d962be93c37ed6d4.tar.gz
Fix free attack
-rw-r--r--events.txt3
-rw-r--r--rules.js7
2 files changed, 5 insertions, 5 deletions
diff --git a/events.txt b/events.txt
index ef381d3..96b3f44 100644
--- a/events.txt
+++ b/events.txt
@@ -500,10 +500,11 @@ SHADED 22
EVENT 23
current VE
- prompt "Build and then replace a Unit with a Raja in each Province with a Temple."
add_influence VE
+ prompt "Build and then replace a Unit with a Raja in each Province with a Temple."
space_opt 1 can_build_in_space(s)
free_build
+ log_br
endspace
prompt "In each Province with a Temple, replace a Unit with a Raja."
space_opt all has_temple(s) && has_units_enemy_faction(s)
diff --git a/rules.js b/rules.js
index ea87962..a2102ab 100644
--- a/rules.js
+++ b/rules.js
@@ -2900,10 +2900,8 @@ function has_unmoved_piece(space, faction) {
function has_valid_attackers(s, faction) {
let valid_attacker = false
- console.log(game.decree)
- console.log(game.cmd)
for_each_movable(faction, p => {
- if (piece_space(p) === s && !set_has(game.cmd.pieces, p))
+ if (piece_space(p) === s && (!game.cmd || !set_has(game.cmd.pieces, p)))
valid_attacker = true
if (piece_space(p) === s || (has_piece(piece_space(p), faction, DISC) && SPACES[s].adjacent.includes(piece_space(p))))
if (!game.cmd.pieces || game.cmd.pieces.length === 0)
@@ -6303,10 +6301,11 @@ CODE[22 * 2 + 1] = [
// EVENT 23
CODE[23 * 2 + 0] = [
[ vm_current, VE ],
- [ vm_prompt, "Build and then replace a Unit with a Raja in each Province with a Temple." ],
[ vm_add_influence, VE ],
+ [ vm_prompt, "Build and then replace a Unit with a Raja in each Province with a Temple." ],
[ vm_space, true, 0, 1, (s)=>can_build_in_space(s) ],
[ vm_free_build ],
+ [ vm_log_br ],
[ vm_endspace ],
[ vm_prompt, "In each Province with a Temple, replace a Unit with a Raja." ],
[ vm_space, true, 0, 999, (s)=>has_temple(s) && has_units_enemy_faction(s) ],