diff options
-rw-r--r-- | play.html | 2 | ||||
-rw-r--r-- | play.js | 16 | ||||
-rw-r--r-- | rules.js | 52 | ||||
-rw-r--r-- | tools/gendata.js | 16 |
4 files changed, 46 insertions, 40 deletions
@@ -251,7 +251,7 @@ main { } -.action_type.fizzle { +.action_type.action.null { border-color: black; box-shadow: 0 0 0 2px black; } @@ -76,10 +76,10 @@ function animate_position(e) { let action_registry = [] -function register_action(e, action, id, fizzle=null) { +function register_action(e, action, id, null_action=null) { e.my_id = id e.my_action = action - e.my_fizzle = fizzle + e.my_null_action = null_action e.onclick = on_click_action action_registry.push(e) return e @@ -89,8 +89,8 @@ function on_click_action(evt) { if (evt.button === 0) { if (send_action(evt.target.my_action, evt.target.my_id)) evt.stopPropagation() - if (evt.target.my_fizzle) - if (send_action(evt.target.my_fizzle, evt.target.my_id)) + if (evt.target.my_null_action) + if (send_action(evt.target.my_null_action, evt.target.my_id)) evt.stopPropagation() } } @@ -190,7 +190,7 @@ function create_formation_card(id) { et = append_div(ee, "action_type reaction", a.type) else et = append_div(ee, "action_type", a.type) - register_action(et, "a" + ix, id, "f" + ix) + register_action(et, "a" + ix, id, "n" + ix) append_div(ee, "action_requirement", a.requirement) if (Array.isArray(a.target)) append_div(ee, "action_target", a.target.map(t=>data.cards[t].name).join(", ")) @@ -362,9 +362,9 @@ function on_update() { } for (let e of action_registry) { - if (e.my_fizzle) { - e.classList.toggle("action", is_action(e.my_action, e.my_id) || is_action(e.my_fizzle, e.my_id)) - e.classList.toggle("fizzle", is_action(e.my_fizzle, e.my_id)) + if (e.my_null_action) { + e.classList.toggle("action", is_action(e.my_action, e.my_id) || is_action(e.my_null_action, e.my_id)) + e.classList.toggle("null", is_action(e.my_null_action, e.my_id)) } else { e.classList.toggle("action", is_action(e.my_action, e.my_id)) } @@ -27,7 +27,7 @@ Special card rules implemented: */ // TODO: morale cube limit (cannot place on special if maxed) -// TODO: fizzle when action says to take cards from other dice? +// TODO: null action when action says to take cards from other dice? const data = require("./data.js") @@ -522,13 +522,13 @@ function pursue_card(c) { eliminate_card(c) } -function remove_card(c) { - log(c + " removed.") +function retire_card(c) { + log(c + " retired.") eliminate_card(c) } -function retire_card(c) { - log(c + " retired.") +function remove_card(c) { + log(c + " removed.") eliminate_card(c) } @@ -596,7 +596,7 @@ function is_card_in_play_or_reserve(c) { ) } -function is_routed(c) { +function is_removed_from_play(c) { return !is_card_in_play_or_reserve(c) } @@ -927,9 +927,9 @@ function can_place_dice(c) { if (game.scenario === S8_BROOKLYN_HEIGHTS) { if (c === S8_CLINTON) { - if (is_routed(S8_GRANT)) + if (is_removed_from_play(S8_GRANT)) return false - if (is_routed(S8_HESSIANS)) + if (is_removed_from_play(S8_HESSIANS)) return false } } @@ -1688,7 +1688,7 @@ states.action = { if (can_take_action(c, data.cards[c].actions[0], 0)) gen_action_action1(c) else if (has_dice) - gen_action_fizzle1(c) + gen_action_null1(c) } } if (data.cards[c].actions.length >= 2) { @@ -1696,7 +1696,7 @@ states.action = { if (can_take_action(c, data.cards[c].actions[1], 1)) gen_action_action2(c) else if (has_dice) - gen_action_fizzle2(c) + gen_action_null2(c) } } if (data.cards[c].retire) @@ -1717,13 +1717,13 @@ states.action = { push_undo() goto_take_action(c, 1) }, - f1(c) { + n1(c) { push_undo() - goto_fizzle(c) + goto_null(c) }, - f2(c) { + n2(c) { push_undo() - goto_fizzle(c) + goto_null(c) }, roll() { clear_undo() @@ -1732,7 +1732,7 @@ states.action = { }, } -function goto_fizzle(c) { +function goto_null(c) { log("Fizzled " + card_number(c)) pay_for_action(c) end_action_phase() @@ -2175,7 +2175,7 @@ function can_take_reaction(c, a, wild) { if (game.scenario === S15_TEWKESBURY) { if (c === S15_WENLOCK) { - if (is_routed(S15_SOMERSET)) + if (is_removed_from_play(S15_SOMERSET)) return false } } @@ -2183,7 +2183,7 @@ function can_take_reaction(c, a, wild) { if (game.scenario === S31_NEWBURY_1ST) { if (c === S31_GERARD) { // TODO: or is it while London New Bands is in play? - if (is_routed(S31_SKIPPON)) + if (is_removed_from_play(S31_SKIPPON)) return false } } @@ -2545,7 +2545,7 @@ function should_rout_card(c) { let rout_with = card_has_rule(c, "rout_with") if (rout_with) { for (let other of rout_with) - if (!is_routed(other)) + if (!is_removed_from_play(other)) return false return true } @@ -2564,7 +2564,7 @@ function should_remove_card(c) { let remove_with = card_has_rule(c, "remove_with") if (remove_with) { for (let other of remove_with) - if (!is_routed(other)) + if (!is_removed_from_play(other)) return false return true } @@ -2575,7 +2575,7 @@ function should_retire_card(c) { let retire_with = card_has_rule(c, "retire_with") if (retire_with) { for (let other of retire_with) - if (!is_routed(other)) + if (!is_removed_from_play(other)) return false return true } @@ -2722,14 +2722,14 @@ function should_enter_reserve(c) { if (Array.isArray(reserve)) { for (let t of reserve) { - if (is_routed(t)) + if (is_removed_from_play(t)) return true } } if (game.scenario === S30_EDGEHILL) { if (c === S30_BALFOUR || c === S30_STAPLETON) { - return is_routed(S30_RUPERT) && is_routed(S30_WILMOT) + return is_removed_from_play(S30_RUPERT) && is_removed_from_play(S30_WILMOT) } } @@ -2804,12 +2804,12 @@ function gen_action_action2(c) { gen_action("a2", c) } -function gen_action_fizzle1(c) { - gen_action("f1", c) +function gen_action_null1(c) { + gen_action("n1", c) } -function gen_action_fizzle2(c) { - gen_action("f2", c) +function gen_action_null2(c) { + gen_action("n2", c) } function gen_action_retire(c) { diff --git a/tools/gendata.js b/tools/gendata.js index 283449d..d96d46e 100644 --- a/tools/gendata.js +++ b/tools/gendata.js @@ -132,7 +132,10 @@ for (let c of card_records) { if (c.action1_type) { card.actions.push(make_action(c.action1_type, c.action1_req, c.action1_target, c.action1_effect)) result.push(`<div class="action_row">`) - result.push(`<div class="action_type">${c.action1_type}</div>`) + if (/Screen|Absorb|Counterattack/.test(c.action1_type)) + result.push(`<div class="action_type reaction">${c.action1_type}</div>`) + else + result.push(`<div class="action_type">${c.action1_type}</div>`) result.push(`<div class="action_requirement">${c.action1_req}</div>`) result.push(`<div class="action_target">${c.action1_target}</div>`) if (c.action1_effect) @@ -143,7 +146,10 @@ for (let c of card_records) { if (c.action2_type || c.action2_effect) { card.actions.push(make_action(c.action2_type, c.action2_req, c.action2_target, c.action2_effect)) result.push(`<div class="action_row">`) - result.push(`<div class="action_type reaction">${c.action2_type}</div>`) + if (/Screen|Absorb|Counterattack/.test(c.action2_type)) + result.push(`<div class="action_type reaction">${c.action2_type}</div>`) + else + result.push(`<div class="action_type">${c.action2_type}</div>`) result.push(`<div class="action_requirement">${c.action2_req}</div>`) result.push(`<div class="action_target">${c.action2_target}</div>`) if (c.action2_effect) @@ -278,11 +284,11 @@ function process_card(c, ix) { else if (tname === "Any friendly but Little Round Top") a.target_list = find_friendly_cards(c.scenario, c.wing).filter(x => x !== find_card(c.scenario, "Little Round Top")) else if (tname === 'Activate "Retreat to Nivelles"') - a.target_list = [ "Retreat to Nivelles" ] + a.target_list = null else if (tname === "The Fog Lifts...") - a.target_list = [ "The Fog" ] + a.target_list = null else if (tname === "See Below") - a.target_list = [ ] + a.target_list = null else a.target_list = tname.split(/, | OR | or | and /).map(name => find_card(c.scenario, name)) } |