Skip to content

Instantly share code, notes, and snippets.

@NimaBoscarino
Created April 15, 2019 23:16
Show Gist options
  • Save NimaBoscarino/0331471b64a51bc576e4ab732c96ac4b to your computer and use it in GitHub Desktop.
Save NimaBoscarino/0331471b64a51bc576e4ab732c96ac4b to your computer and use it in GitHub Desktop.
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