diff options
author | Tor Andersson <tor@ccxvii.net> | 2022-12-28 17:36:34 +0100 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2023-02-18 13:02:38 +0100 |
commit | 3c8c0e53100ad8abe575b923e5d0f1f5474e40af (patch) | |
tree | 385d8d87da7bf515fea592ac3e44aecdd38d47ec /play.js | |
parent | 298695de12eac0884e1aa6b416b1300694e0ae70 (diff) | |
download | nevsky-3c8c0e53100ad8abe575b923e5d0f1f5474e40af.tar.gz |
Lift siege after retreat.
Diffstat (limited to 'play.js')
-rw-r--r-- | play.js | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -180,11 +180,24 @@ function pack1_get(word, n) { return (word >>> n) & 1 } +function pack2_get(word, n) { + n = n << 1 + return (word >>> n) & 3 +} + function pack4_get(word, n) { n = n << 2 return (word >>> n) & 15 } +function is_lord_besieged(lord) { + return pack1_get(view.pieces.besieged, lord) +} + +function is_lord_moved(lord) { + return pack2_get(view.pieces.moved, lord) > 0 +} + function is_veche_action() { return !!(view.actions && view.actions.veche === 1) } @@ -1079,6 +1092,8 @@ function update_lord(ix) { ui.lord_cylinder[ix].classList.remove("hide") ui.lord_service[ix].classList.add("hide") } + ui.lord_cylinder[ix].classList.toggle("besieged", is_lord_besieged(ix)) + ui.lord_cylinder[ix].classList.toggle("moved", is_lord_moved(ix)) ui.lord_buttons[ix].classList.toggle("action", is_lord_action(ix)) ui.lord_cylinder[ix].classList.toggle("action", is_lord_action(ix)) ui.lord_service[ix].classList.toggle("action", is_service_action(ix)) @@ -1093,6 +1108,9 @@ function update_lord(ix) { else ui.lord_cylinder[ix].classList.toggle("selected", is_cylinder_selected(ix)) ui.lord_mat[ix].classList.toggle("selected", is_lord_mat_selected(ix)) + + ui.lord_mat[ix].classList.toggle("besieged", is_lord_besieged(ix)) + ui.lord_mat[ix].classList.toggle("moved", is_lord_moved(ix)) } function update_legate() { |