diff options
Diffstat (limited to 'rules.js')
-rw-r--r-- | rules.js | 21 |
1 files changed, 11 insertions, 10 deletions
@@ -83,13 +83,14 @@ const turn_name = [ "Winter 1744", ] -const DI_TURN = 0 -const DI_A_POWER = 1 -const DI_B_POWER = 2 -const DI_A_PROMISE = 3 -const DI_B_PROMISE = 4 -const DI_A_PHASE = 5 -const DI_B_PHASE = 6 +const DI_A_POWER = 0 +const DI_B_POWER = 1 +const DI_A_TURN = 2 +const DI_B_TURN = 3 +const DI_A_PHASE = 4 +const DI_B_PHASE = 5 +const DI_A_PROMISE = 6 +const DI_B_PROMISE = 7 const F_EMPEROR_FRANCE = 1 const F_EMPEROR_AUSTRIA = 2 @@ -1405,7 +1406,7 @@ function goto_start_turn() { } // remove expired deals - game.deals = game.deals.filter(deal => deal[DI_TURN] >= game.turn) + game.deals = game.deals.filter(deal => deal[DI_A_TURN] >= game.turn || deal[DI_B_TURN] >= game.turn) } function goto_end_turn() { @@ -6617,9 +6618,9 @@ states.pong = { function should_validate_promise(me, you, phase) { for (let deal of game.deals) { - if (deal[DI_A_POWER] === me && deal[DI_B_POWER] === you && (deal[DI_A_PHASE] & phase)) + if (deal[DI_A_POWER] === me && deal[DI_B_POWER] === you && (deal[DI_A_PHASE] & phase) && game.turn <= deal[DI_A_TURN]) return true - if (deal[DI_B_POWER] === me && deal[DI_A_POWER] === you && (deal[DI_B_PHASE] & phase)) + if (deal[DI_B_POWER] === me && deal[DI_A_POWER] === you && (deal[DI_B_PHASE] & phase) && game.turn <= deal[DI_B_TURN]) return true } return false |