Move AttackRequirement to separate source unit

This commit is contained in:
Gary Tierney
2015-12-24 05:13:14 +00:00
parent 5686a1dcd6
commit 04df65be4c
+9 -1
View File
@@ -24,11 +24,19 @@ class SpecialEnergyRequirement < AttackRequirement
end
def validate!(player)
throw AttackRequirementException.new('Not enough special attack energy.') unless player.special_energy >= @amount
if player.special_energy < @amount
player.using_special = false
update_special_bar(player)
raise AttackRequirementException.new('Not enough special attack energy.')
end
end
def apply(player)
player.special_energy = player.special_energy - @amount
player.using_special = false
update_special_bar player
end
end