Skip to content

Commit

Permalink
Supernova works on demo
Browse files Browse the repository at this point in the history
Had to rewrite the image to the olf flag unit and have the current mode
always on the state. Created an issue to solve this later:
#36
  • Loading branch information
donbonifacio committed Apr 2, 2016
1 parent 261be4c commit 6eafa97
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
11 changes: 10 additions & 1 deletion src/obb_demo/boardground.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,22 @@
(let [dir (element/element-direction element)]
(first (name dir))))

(defn- process-unit-name
"If the unit name needs transformations, does it to match the resources
on the main site."
[unit-name]
(if (= unit-name "star")
"flag"
unit-name))

(defn- unit-image
"Renders an html element that displays a board element's unit, if present
at the given coordinates"
[game element]
(when element
(let [unit (element/element-unit element)
unit-name (unit/unit-name unit)]
unit-name (-> (unit/unit-name unit)
process-unit-name)]
[:img.unit {:src (str "http://orionsbelt.eu/public/units/" unit-name "_" (direction element) ".png")}])))

(defn- possible-cost?
Expand Down
4 changes: 3 additions & 1 deletion src/obb_demo/processor.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@
#_(println "game" (simplifier/clean-result {:board game}))
(println "--" player actions)
(if (= :final (game/state game))
{:game (deployed-game {:mode (get game-data :mode :annihilation)})}
(let [mode (get game-data :mode :annihilation)]
{:game (deployed-game {:mode mode})
:mode mode})
(-> (assoc game-data :actions actions)
(assoc :original-actions actions)
(assoc :history (conj (vec (get game-data :history (:history game)))
Expand Down
2 changes: 1 addition & 1 deletion src/obb_demo/views/play.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
[:div.col-lg-5
[boardground/render {} game-data]
(game-as-string game-data)]
[:div.col-lg-2
[:div.col-lg-3
[:div.panel.panel-default
[:div.panel-heading
[:h3.panel-title "Options"]]
Expand Down

0 comments on commit 6eafa97

Please sign in to comment.