Skip to content

Commit

Permalink
Re-ordering ship hit handling to destroy instead of calling client
Browse files Browse the repository at this point in the history
where needed
  • Loading branch information
bfosberry committed May 11, 2016
1 parent e00c013 commit 28af8c5
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/models/ship.rb
Expand Up @@ -39,11 +39,12 @@ def fire!(other_ship)
def hit!(other_ship)
self.update_attributes(shield: shield - FIRE_DAMAGE)
events.create!(event_name: "hit")
ship_client.hit(other_ship)

if shield <= 0
events.create!(event_name: "destroyed")
swarm_client.destroy_ship(self)
else
ship_client.hit(other_ship)
end
end

Expand Down

0 comments on commit 28af8c5

Please sign in to comment.