class Goby::BattleCommand
Commands that are used in the battle system. At each turn, an Entity
specifies which BattleCommand
to use.
Constants
- NO_ACTION
Text for when the battle command does nothing.
Attributes
Public Class Methods
@param [String] name the name.
# File lib/goby/battle/battle_command.rb, line 11 def initialize(name: "BattleCommand") @name = name end
Public Instance Methods
@param [BattleCommand] rhs the command on the right. @return [Boolean] true iff the commands are considered equal.
# File lib/goby/battle/battle_command.rb, line 40 def ==(rhs) @name.casecmp(rhs.name).zero? end
This method can prevent the user from using this command based on a defined condition. Override for subclasses.
@param [Entity] user the one who is using the command. @return [Boolean] true iff the command cannot be used.
# File lib/goby/battle/battle_command.rb, line 20 def fails?(user) false end
The process that runs when this command is used in battle. Override this function for subclasses.
@param [Entity] user the one who is using the command. @param [Entity] entity the one on whom the command is used.
# File lib/goby/battle/battle_command.rb, line 29 def run(user, entity) print NO_ACTION end
@return [String] the name of the BattleCommand
.
# File lib/goby/battle/battle_command.rb, line 34 def to_s @name end