summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--events.txt27
-rw-r--r--rules.js96
2 files changed, 91 insertions, 32 deletions
diff --git a/events.txt b/events.txt
index 02033e7..2dd1172 100644
--- a/events.txt
+++ b/events.txt
@@ -122,7 +122,7 @@ EVENT 6
SHADED 6
current DS
- prompt "Campaign: Select four contiguous spaces, finishing adjacent to Warangal"
+ prompt "Select four contiguous spaces, finishing adjacent to Warangal"
shaded_6
shaded_6_2
@@ -613,10 +613,31 @@ SHADED 30
log "NOT IMPLEMENTED"
EVENT 31
- log "NOT IMPLEMENTED"
+ current REBEL_FACTIONS
+ prompt "Free Migrate in a Province adjacent to Vijayanagara"
+ space 1 (is_adjacent_to_city(C_VIJAYANAGARA, s))
+ mark_space
+ free_migrate
+ clean_p
+ prompt "Remove an opposing Unit from the selected Province."
+ piece 1 (is_piece_in_event_space(p) && is_enemy_unit(p))
+ remove
+ endpiece
+ free_attack
+ endspace
SHADED 31
- log "NOT IMPLEMENTED"
+ current DS
+ prompt "Remove a Fort adjacent to Vijayanagara"
+ piece 1 (is_fort(p) && is_adjacent_to_city(C_VIJAYANAGARA, piece_space(p)))
+ remove
+ endpiece
+ prompt "Remove a Temple adjacent to Vijayanagara"
+ piece 1 (is_temple(p) && is_adjacent_to_city(C_VIJAYANAGARA, piece_space(p)))
+ remove
+ endpiece
+ remove_influence BK
+ remove_influence VE
EVENT 32
current REBEL_FACTIONS
diff --git a/rules.js b/rules.js
index 8b7d30f..81dfc2a 100644
--- a/rules.js
+++ b/rules.js
@@ -1621,6 +1621,9 @@ states.migrate_space = {
if (game.cmd.count > 0)
view.actions.next = 1
+ if (game.vm && game.vm.fp === 62 && game.cmd.count === 0)
+ view.actions.skip = 1
+
},
piece(p) {
log_summary_move_from(p)
@@ -1647,6 +1650,9 @@ states.migrate_space = {
} else {
game.state = "migrate"
}
+ },
+ skip() {
+ vm_next()
}
}
@@ -2840,7 +2846,7 @@ function is_enemy_piece(p) {
}
function is_enemy_unit(p) {
- return is_enemy_piece(p) && piece_type(p) !== DISC
+ return is_enemy_piece(p) && (piece_type(p) !== DISC)
}
function is_piece(p, faction, type) {
@@ -2998,21 +3004,20 @@ function add_influence(faction) {
function remove_influence(faction) {
if (game.inf[faction] === 0) {
end_influence()
- return
+ } else {
+ game.inf[faction]--
+ log(faction_name[faction] + " loses influence.")
+ update_vp()
+
+ if (faction === BK && game.inf[faction] === 3)
+ troops_to_inf_track(BK, S_BK_INF_4)
+ else if (faction === BK && game.inf[faction] === 1)
+ troops_to_inf_track(BK, S_BK_INF_2)
+ else if (faction === VE)
+ troops_to_inf_track(VE, S_VE_INF_1 + game.inf[faction])
+ else
+ end_influence()
}
-
- game.inf[faction]--
- log(faction_name[faction] + " loses influence.")
- update_vp()
-
- if (faction === BK && game.inf[faction] === 3)
- troops_to_inf_track(BK, S_BK_INF_4)
- else if (faction === BK && game.inf[faction] === 1)
- troops_to_inf_track(BK, S_BK_INF_2)
- else if (faction === VE)
- troops_to_inf_track(VE, S_VE_INF_1 + game.inf[faction])
- else
- end_influence()
}
function end_influence() {
@@ -4437,16 +4442,20 @@ function vm_remove_tributary() {
// VM: ATTACK
function vm_free_attack() {
- init_free_command("Attack", game.vm.s)
- game.cmd.attacker = game.current
- game.cmd.support_space = null
-
- if (typeof vm_inst(1) !== "undefined") {
- game.cmd.selected = []
- game.cmd.target = vm_inst(1)
- goto_attack_space()
- } else {
- goto_attack_select()
+ if (!can_attack_in_space(game.vm.s))
+ vm_next()
+ else {
+ init_free_command("Attack", game.vm.s)
+ game.cmd.attacker = game.current
+ game.cmd.support_space = null
+
+ if (typeof vm_inst(1) !== "undefined") {
+ game.cmd.selected = []
+ game.cmd.target = vm_inst(1)
+ goto_attack_space()
+ } else {
+ goto_attack_select()
+ }
}
}
@@ -4503,7 +4512,15 @@ function vm_free_march() {
function vm_free_migrate() {
let shift = (game.cmd && game.cmd.shift) ? true : false
- init_free_command("Migrate", game.vm.s)
+ game.cmd = {
+ type: "Migrate",
+ limited: 1,
+ free: 1,
+ spaces: [],
+ selected: [],
+ pieces: [],
+ where: game.vm.s,
+ }
game.cmd.pieces = game.vm.pp
game.cmd.shift = shift
goto_migrate_space()
@@ -4821,7 +4838,7 @@ CODE[6 * 2 + 0] = [
// SHADED 6
CODE[6 * 2 + 1] = [
[ vm_current, DS ],
- [ vm_prompt, "Campaign: Select four contiguous spaces, finishing adjacent to Warangal" ],
+ [ vm_prompt, "Select four contiguous spaces, finishing adjacent to Warangal" ],
[ vm_shaded_6 ],
[ vm_shaded_6_2 ],
[ vm_return ],
@@ -5455,13 +5472,34 @@ CODE[30 * 2 + 1] = [
// EVENT 31
CODE[31 * 2 + 0] = [
- [ vm_log, "NOT IMPLEMENTED" ],
+ [ vm_current, REBEL_FACTIONS ],
+ [ vm_prompt, "Free Migrate in a Province adjacent to Vijayanagara" ],
+ [ vm_space, true, 1, 1, (s)=>(is_adjacent_to_city(C_VIJAYANAGARA, s)) ],
+ [ vm_mark_space ],
+ [ vm_free_migrate ],
+ [ vm_clean_p ],
+ [ vm_prompt, "Remove an opposing Unit from the selected Province." ],
+ [ vm_piece, false, 1, 1, (p,s)=>(is_piece_in_event_space(p) && is_enemy_unit(p)) ],
+ [ vm_remove ],
+ [ vm_endpiece ],
+ [ vm_free_attack ],
+ [ vm_endspace ],
[ vm_return ],
]
// SHADED 31
CODE[31 * 2 + 1] = [
- [ vm_log, "NOT IMPLEMENTED" ],
+ [ vm_current, DS ],
+ [ vm_prompt, "Remove a Fort adjacent to Vijayanagara" ],
+ [ vm_piece, false, 1, 1, (p,s)=>(is_fort(p) && is_adjacent_to_city(C_VIJAYANAGARA, piece_space(p))) ],
+ [ vm_remove ],
+ [ vm_endpiece ],
+ [ vm_prompt, "Remove a Temple adjacent to Vijayanagara" ],
+ [ vm_piece, false, 1, 1, (p,s)=>(is_temple(p) && is_adjacent_to_city(C_VIJAYANAGARA, piece_space(p))) ],
+ [ vm_remove ],
+ [ vm_endpiece ],
+ [ vm_remove_influence, BK ],
+ [ vm_remove_influence, VE ],
[ vm_return ],
]