Created
April 15, 2019 23:16
-
-
Save NimaBoscarino/0331471b64a51bc576e4ab732c96ac4b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
puts 'Welcome to Nima\'s Arena' | |
# - Pokemon | |
# - attacks | |
# - health | |
# - type | |
# - weakness | |
# - name (pokemon name) | |
# - nick name | |
class Pokemon | |
attr_accessor :name, :trainer, :health | |
attr_reader :breed | |
def initialize breed, name | |
@breed = breed | |
@name = name # kind of like this.name | |
@health = 100 | |
end | |
def attack pokemon | |
puts @name + ' attacked ' + pokemon.name | |
pokemon.health = pokemon.health - 10 | |
end | |
end | |
class Blastoise < Pokemon | |
def initialize name | |
# (CALL POKEMON.INITIALIZE, or whatever method you're in) | |
super 'Blastoise', name | |
end | |
def roar | |
'I AM BLASTOISE' | |
end | |
end | |
# - Trainer | |
# - one or many pokemon | |
# - badges | |
class Trainer | |
attr_reader :name | |
def initialize name | |
@name = name | |
end | |
# def addPokemon pokemon | |
# end | |
end | |
madonna = Pokemon.new 'Jynx', 'Madonna' | |
fkatwigs = Pokemon.new 'Sudowoodo', 'FKA Twigs' | |
yeezy = Trainer.new 'Kanye West' | |
nima = Blastoise.new 'Nima' | |
nima.trainer = yeezy | |
puts nima | |
puts madonna | |
puts fkatwigs | |
puts nima.name # call the name method in yeezy (pokemon) | |
puts nima.breed | |
puts fkatwigs.breed | |
nima.name = 'Drake' | |
# yeezy.setName 'Drake' | |
puts yeezy.name | |
puts nima.health | |
madonna.attack(nima) | |
madonna.attack(nima) | |
madonna.attack(nima) | |
madonna.attack(nima) | |
madonna.attack(nima) | |
madonna.attack(nima) | |
puts nima.health | |
puts madonna.health | |
puts nima.roar | |
# puts madonna.roar |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment