Race(種族)クラス
Raceクラスの要件
- Wizardry::Race::Allで全ての種族が返って来る。
- あるキャラクタの種族をHumanに設定する時に、@raceにHumanオブジェクトを代入する。
- Human.nameが"Human"を返す。
- Human.to_strが"Human"を返す。
- Human.abilitiesが[ 8, 8, 5, 8, 8, 9]を返す。
- 種族を数値に相互変換可能
p Wizardry::Race::All# => [Human, Dwarf, Elf, Gnome, Hobbit]
p Wizardry::Races# => [Human, Dwarf, Elf, Gnome, Hobbit]
puts Wizardry::Race::Human# => "Human"
puts Wizardry::Race::Human# => "Human"
puts Wizardry::Race::Human::Abilities# => [ 8, 8, 5, 8, 8, 9]
puts Wizardry::Races[0]# => Human
puts Wizardry::Races[1]# => Dwarf
puts Wizardry::Races[2]# => Elf
puts Wizardry::Races[3]# => Gnome
puts Wizardry::Races[4]# => Hobbit
puts Wizardry::Races.index(Human)# => 0
puts Wizardry::Races.index(Dwarf)# => 1
puts Wizardry::Races.index(Elf)# => 2
puts Wizardry::Races.index(Gnome)# => 3
puts Wizardry::Races.index(Hobbit)# => 4
以上
最終更新:2010年05月12日 22:07