Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Role
- def initialize(type, job)
- @type = type
- @job = job
- end
- def to_s
- "#{@type}: #{@job}"
- end
- end
- class Fight
- def initialize(warstats, arcstats)
- arcstats[0] = arcstats[0] - (warstats[1] - arcstats[3])
- warstats[0] = warstats[0] - (arcstats[1] - warstats[3])
- return player1
- return player2
- end
- end
- warstats = { 'hp' => 10, 'atk' => 5, 'def' => 6 }
- arcstats = { 'hp' => 9 , 'atk' => 7, 'def' => 4 }
- wizstats = { 'hp' => 4 , 'atk' => 11, 'def' => 3 }
- b1 = Role.new("Rock", "Warrior")
- puts b1
- b2 = Role.new("Scissors", "Archer")
- puts b2
- b3 = Role.new("Paper", "Wizard")
- puts b3
- puts "What are you?"
- chosenclass = gets
- chosenclass.chomp!
- if chosenclass == "Warrior"
- player1=warstats
- player2=arcstats
- round1 = Fight.new(player1, player2)
- puts round1
- puts "You beat Archer, but Wizard beats you!"
- puts "HP: #{warstats['hp']} ATK: #{warstats['atk']} DEF: #{warstats['def']}"
- else
- if chosenclass == "Archer"
- puts "You beat Wizard, but Warrior beats you!"
- puts "HP: #{arcstats['hp']} ATK: #{arcstats['atk']} DEF: #{arcstats['def']}"
- else
- if chosenclass == "Wizard"
- puts "You beat Warrior, but Archer beats you!"
- puts "HP: #{wizstats['hp']} ATK: #{wizstats['atk']} DEF: #{wizstats['def']}"
- else
- puts "That isn't a class!"
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement