diff options
author | Tor Andersson <tor@ccxvii.net> | 2021-06-20 12:37:26 +0200 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2022-11-16 19:19:38 +0100 |
commit | 9ecbee1517966c892c60ddc2310e03d57b0de413 (patch) | |
tree | ed5f1ff4c1ae68113291936b201c336c7a50441d /rules.js | |
parent | 64186a7f490167a04e5dde149079091d9b2d9928 (diff) | |
download | crusader-rex-9ecbee1517966c892c60ddc2310e03d57b0de413.tar.gz |
crusader: Simplify block layout by sending all info to client.
Trust the user not to cheat...
Diffstat (limited to 'rules.js')
-rw-r--r-- | rules.js | 38 |
1 files changed, 4 insertions, 34 deletions
@@ -1719,9 +1719,10 @@ exports.view = function(state, current) { s_card: (game.show_cards || current == SARACEN) ? game.s_card : 0, hand: (current == FRANK) ? game.f_hand : (current == SARACEN) ? game.s_hand : [], who: (game.active == current) ? game.who : null, - where: game.where, - known: {}, - secret: { Frank: {}, Saracen: {}, Assassins: {} }, + location: game.location, + steps: game.steps, + reserves: game.reserves1.concat(game.reserves2), + moved: game.moved, battle: null, prompt: null, actions: null, @@ -1732,36 +1733,5 @@ exports.view = function(state, current) { if (states[game.state].show_battle) view.battle = make_battle_view(); - for (let b in BLOCKS) { - let a = game.location[b]; - if (!a) - continue; - if (a == DEAD) - continue; - if (a == F_POOL) // && current != FRANK) - continue; - if (a == S_POOL) // && current != SARACEN) - continue; - if (a == F_POOL || a == S_POOL) - a = "Pool"; - - let is_known = false; - if (current == block_owner(b)) - is_known = true; - if (b == ASSASSINS) - is_known = true; - - if (is_known) { - view.known[b] = [a, game.steps[b], game.moved[b] ? 1 : 0]; - } else { - let list = view.secret[BLOCKS[b].owner]; - if (!(a in list)) - list[a] = [0, 0]; - list[a][0]++; - if (game.moved[b]) - list[a][1]++; - } - } - return view; } |