Ellen Lee | bbfd78e | 2017-10-27 10:57:24 +0800 | [diff] [blame^] | 1 | require "./monster" |
2 | require "./mage" | ||||
3 | require_relative "holy_knight" | ||||
4 | |||||
5 | |||||
6 | # 建立一個有不同職業 (包括英雄、神聖武士與魔法師)的團隊 | ||||
7 | hero = Hero.new("Robinhood", 100000, 20) | ||||
8 | holy_knight = HolyKnight.new("Howard", 100, 3000) | ||||
9 | mage = Mage.new("Merlin",60, 20, 100) | ||||
10 | |||||
11 | # 列印英雄隊伍 | ||||
12 | team = Hero.all | ||||
13 | |||||
14 | puts "You have #{Hero.count} heroes in your team:" | ||||
15 | |||||
16 | team.each do |hero| | ||||
17 | puts "#{hero.name} - Class:#{hero.class}, HP:#{hero.hp} " | ||||
18 | end |