diff --git a/desktop/src-common/advent/screens/rooms/inside_cafeteria.clj b/desktop/src-common/advent/screens/rooms/inside_cafeteria.clj index d7eba5fe..bb6a271c 100644 --- a/desktop/src-common/advent/screens/rooms/inside_cafeteria.clj +++ b/desktop/src-common/advent/screens/rooms/inside_cafeteria.clj @@ -15,6 +15,15 @@ :y 0 :baseline 1000)) +(defn play-battle [entities anim] + (actions/transition-music entities :town-1 :fight) + (actions/add-entity entities :fight (get-in @entities [:room :fight])) + (actions/add-entity entities :hands-fight (get-in @entities [:room :hands-fight])) + (actions/play-animation entities :hands-fight anim) + (actions/transition-music entities :fight :town-1) + (actions/remove-entity entities :hands-fight) + (actions/remove-entity entities :fight)) + (defn do-warrior-dialogue [entities] (actions/walk-to entities :ego [150 45] :face :left) (actions/talk entities :ego "Hey guys!") @@ -33,7 +42,8 @@ :warriors "'Thou art my father, and I am thy son. Therefore I will speaketh in this manner.'" :ego "... I think I've got the idea.") :choices actions/previous-choices} - "Can I be a knight like you guys?" + (when (not (actions/has-obtained? entities :medal)) + "Can I be a knight like you guys?") {:run #(actions/respond entities % :warriors "We thinketh not, young esquire." :warriors "You lacketh the strength and vigor required for such a task.") @@ -47,20 +57,14 @@ (if (actions/has-item? @entities :flask-1-strength) (do (actions/do-dialogue entities :ego "One sec.") - (actions/play-animation entities :ego :grow) + (actions/play-animation entities :ego :grow :stop? false) + (play-battle entities :win) (actions/do-dialogue entities :warriors "Congratulations young master. Thou art worthy in might." :warriors "Take my medal of strength.") (actions/give entities :medal)) (do - - (actions/transition-music entities :town-1 :fight) - (actions/add-entity entities :fight (get-in @entities [:room :fight])) - (actions/add-entity entities :hands-fight (get-in @entities [:room :hands-fight])) - (actions/play-animation entities :hands-fight :lose) - (actions/transition-music entities :fight :town-1) - (actions/remove-entity entities :hands-fight) - (actions/remove-entity entities :fight) + (play-battle entities :lose) (actions/do-dialogue entities :warriors "You lost, young master. Go hitherto, unto thy gym."))))} "Something else."