jj1bdx / erltrek

An Erlang Star Trek game
http://jj1bdx.github.io/erltrek
Other
16 stars 2 forks source link

Do not fire phaser when no Klingon in quadrant #21

Closed jj1bdx closed 10 years ago

jj1bdx commented 10 years ago

See https://github.com/jj1bdx/erltrek/commit/8282b539ddc7f7bcfc6b6946f84629ac066dec5e and see https://github.com/jj1bdx/erltrek/commit/8282b539ddc7f7bcfc6b6946f84629ac066dec5e#commitcomment-5756681 for the details. Revised for the latest commit.

jj1bdx commented 10 years ago

@kaos Please review. I won't merge this without your approval.

kaos commented 10 years ago

Executive summary: :+1: good to go (possibly with some tweaks if you feel like it, see below ;)

Long version:

Ok, I don't really mind such fool-proof checks.. and that code looks good.

Only thing I was thinking of was perhaps check the ships energy first, and then if there are any klingons (as it won't matter if there are any klingons or not if you attempt to fire with more power than you got). But then again, if there are no klingons, it won't matter either.. so I guess it can be either way. Never mind :p

Oh, for the message on no_klingons_in_quadrant, maybe leave it at that first part, and skip saying "phaser not fired". Say there will be other commands, operating on enemy klingons.. they'd also like to return no_klingons_in_quadrant... and you ought to know what you just attempted to do any way (a little like how the not_enough_energy doesn't say what action failed, just why). Just a thought any way.

jj1bdx commented 10 years ago

Changed message as in https://github.com/jj1bdx/erltrek/commit/3c0e3cdc294a5ffdfd5adee99746f534398d0674. Thx for suggestion.