summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--rules.js37
1 files changed, 18 insertions, 19 deletions
diff --git a/rules.js b/rules.js
index 0c99a15..ff2f148 100644
--- a/rules.js
+++ b/rules.js
@@ -31,7 +31,6 @@ const MA_LANCASTER = [ "Lancaster" ]
const MA_YORK = [ "York" ]
const PLAYER_ID = { "": 0, Lancaster: 1, York: 2 }
-const ID_PLAYER = [ "", "Lancaster", "York" ]
// areas
const NOWHERE = 0
@@ -784,7 +783,7 @@ function count_pinned(where) {
return count
}
-function is_pinned(who, from) {
+function is_pinned(from) {
if (game.active === game.p2) {
if (count_pinned(from) <= count_pinning(from))
return true
@@ -810,7 +809,7 @@ function can_block_sea_move(who) {
if (can_activate(who)) {
let from = game.location[who]
if (from !== NOWHERE) {
- if (is_pinned(who, from))
+ if (is_pinned(from))
return false
for (let to of AREAS[from].exits)
if (can_block_sea_move_to(who, from, to))
@@ -820,7 +819,7 @@ function can_block_sea_move(who) {
return false
}
-function can_block_use_border(who, from, to) {
+function can_block_use_border(from, to) {
if (game.active === game.surprise) {
switch (border_type(from, to)) {
case 'major': return border_limit(from, to) < 5
@@ -846,12 +845,12 @@ function count_borders_crossed(to) {
return count
}
-function can_block_land_move_to(who, from, to) {
+function can_block_land_move_to(from, to) {
if (is_enemy_exile_area(to))
return false
if (game.active === game.piracy)
return false
- if (can_block_use_border(who, from, to)) {
+ if (can_block_use_border(from, to)) {
// limit number of borders used to attack/reinforce
let contested = is_contested_area(to)
if (contested && !border_was_last_used_by_active(from, to)) {
@@ -880,17 +879,17 @@ function can_block_land_move(who) {
if (can_activate(who)) {
let from = game.location[who]
if (from !== NOWHERE) {
- if (is_pinned(who, from))
+ if (is_pinned(from))
return false
for (let to of AREAS[from].exits)
- if (can_block_land_move_to(who, from, to))
+ if (can_block_land_move_to(from, to))
return true
}
}
return false
}
-function can_block_continue(who, from, to) {
+function can_block_continue(from, to) {
if (is_contested_area(to))
return false
if (border_type(from, to) === 'minor')
@@ -912,7 +911,7 @@ function can_block_retreat_to(who, to) {
return false
if (is_friendly_area(to) || is_vacant_area(to)) {
let from = game.location[who]
- if (can_block_use_border(who, from, to)) {
+ if (can_block_use_border(from, to)) {
if (border_was_last_used_by_enemy(from, to))
return false
return true
@@ -926,7 +925,7 @@ function can_block_regroup_to(who, to) {
return false
if (is_friendly_area(to) || is_vacant_area(to)) {
let from = game.location[who]
- if (can_block_use_border(who, from, to))
+ if (can_block_use_border(from, to))
return true
}
return false
@@ -942,13 +941,13 @@ function can_block_regroup(who) {
return false
}
-function can_block_muster_via(who, from, next, muster) {
- if (can_block_land_move_to(who, from, next) && is_friendly_or_vacant_area(next)) {
+function can_block_muster_via(from, next, muster) {
+ if (can_block_land_move_to(from, next) && is_friendly_or_vacant_area(next)) {
if (next === muster)
return true
if (border_type(from, next) !== 'minor') {
if (set_has(AREAS[next].exits, muster))
- if (can_block_land_move_to(who, next, muster))
+ if (can_block_land_move_to(next, muster))
return true
}
}
@@ -960,10 +959,10 @@ function can_block_muster(who, muster) {
if (from === muster)
return false
if (can_activate(who) && is_block_on_map(who)) {
- if (is_pinned(who, from))
+ if (is_pinned(from))
return false
for (let next of AREAS[from].exits)
- if (can_block_muster_via(who, from, next, muster))
+ if (can_block_muster_via(from, next, muster))
return true
}
return false
@@ -1707,7 +1706,7 @@ states.muster_move_1 = {
gen_action(view, 'block', game.who)
let from = game.location[game.who]
for (let to of AREAS[from].exits) {
- if (can_block_muster_via(game.who, from, to, game.where))
+ if (can_block_muster_via(from, to, game.where))
gen_action(view, 'area', to)
}
},
@@ -1904,7 +1903,7 @@ states.move_to = {
if (game.distance > 0)
gen_action(view, 'area', from)
for (let to of AREAS[from].exits) {
- if (to !== game.last_from && can_block_land_move_to(game.who, from, to))
+ if (to !== game.last_from && can_block_land_move_to(from, to))
gen_action(view, 'area', to)
else if (game.distance === 0 && can_block_sea_move_to(game.who, from, to)) {
let has_destination_port = false
@@ -1948,7 +1947,7 @@ states.move_to = {
} else {
let mark = move_block(game.who, from, to)
log_move_continue(to, mark)
- if (!can_block_continue(game.who, from, to))
+ if (!can_block_continue(from, to))
end_move()
}
},