Class: Mgmg::Reinforcement
- Inherits:
-
Object
- Object
- Mgmg::Reinforcement
- Defined in:
- lib/mgmg/reinforce.rb
Constant Summary collapse
- Skill =
スキル名 攻 物 防 HP MP 腕 器 速 魔
{ '物防御UP' => Reinforcement.new( Vec[ 0, 10, 0, 0, 0, 0, 0, 0, 0] ), '魔防御UP' => Reinforcement.new( Vec[ 0, 0, 10, 0, 0, 0, 0, 0, 0] ), '腕力UP' => Reinforcement.new( Vec[ 0, 0, 0, 0, 0, 10, 0, 0, 0] ), 'メンテナンス' => Reinforcement.new( Vec[ 50, 0, 0, 0, 0, 0, 0, 0, 0] ), 'ガードアップ' => Reinforcement.new( Vec[ 0, 50, 0, 0, 0, 0, 0, 0, 0] ), 'パワーアップ' => Reinforcement.new( Vec[ 0, 0, 0, 0, 0, 50, 0, 0, 0] ), 'デックスアップ' => Reinforcement.new( Vec[ 0, 0, 0, 0, 0, 0, 50, 0, 0] ), 'スピードアップ' => Reinforcement.new( Vec[ 0, 0, 0, 0, 0, 0, 0, 50, 0] ), 'マジックアップ' => Reinforcement.new( Vec[ 0, 0, 0, 0, 0, 0, 0, 0, 50] ), 'オールアップ' => Reinforcement.new( Vec[ 0, 50, 0, 0, 0, 50, 50, 50, 50] ), }
Instance Attribute Summary collapse
-
#vec ⇒ Object
Returns the value of attribute vec.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(vec) ⇒ Reinforcement
constructor
A new instance of Reinforcement.
- #initialize_copy(other) ⇒ Object
- #to_s ⇒ Object (also: #inspect)
Constructor Details
#initialize(vec) ⇒ Reinforcement
Returns a new instance of Reinforcement.
3 4 5 |
# File 'lib/mgmg/reinforce.rb', line 3 def initialize(vec) @vec = vec end |
Instance Attribute Details
#vec ⇒ Object
Returns the value of attribute vec.
6 7 8 |
# File 'lib/mgmg/reinforce.rb', line 6 def vec @vec end |
Class Method Details
.compile(arg) ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/mgmg/reinforce.rb', line 34 def compile(arg) case arg when Reinforcement arg when Cuisine cuisine(arg) when String if Skill.has_key?(arg) Skill[arg] elsif SystemCuisine.has_key?(arg) cuisine(SystemCuisine[arg]) else raise InvalidReinforcementNameError, arg end else raise ArgumentError, "The argument should be Mgmg::Cuisine or skill name String. (`#{arg}' is given)" end end |
.cuisine(c) ⇒ Object
31 32 33 |
# File 'lib/mgmg/reinforce.rb', line 31 def cuisine(c) Reinforcement.new( Vec[*(c.vec), *Array.new(6, 0)] ) end |
Instance Method Details
#initialize_copy(other) ⇒ Object
7 8 9 |
# File 'lib/mgmg/reinforce.rb', line 7 def initialize_copy(other) @vec = other.vec.dup end |