Raceクラス

Race(種族)クラス


Raceクラスの要件


  1. Wizardry::Race::Allで全ての種族が返って来る。
  2. あるキャラクタの種族をHumanに設定する時に、@raceにHumanオブジェクトを代入する。
  3. Human.nameが"Human"を返す。
  4. Human.to_strが"Human"を返す。
  5. Human.abilitiesが[ 8, 8, 5, 8, 8, 9]を返す。
  6. 種族を数値に相互変換可能

 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
ツールボックス

下から選んでください:

新しいページを作成する
ヘルプ / FAQ もご覧ください。