Skip to content

Instantly share code, notes, and snippets.

@aguayma
Created February 28, 2017 15:14
Show Gist options
  • Save aguayma/ce53149a3c85c056d3cafa48b923007c to your computer and use it in GitHub Desktop.
Save aguayma/ce53149a3c85c056d3cafa48b923007c to your computer and use it in GitHub Desktop.
def game_intro
puts "The Dark Knight Returns"
end
def bats
puts " ๐Ÿฆ‡ " * 20
end
def new_line
puts ""
end
def choose_sidekick
puts "Who will be your sidekick?"
new_line
puts "Options: Batgirl or Robin"
ally = gets.chomp.downcase
new_line
return ally
end
def say(name, statement)
if name.nil?
puts statement
else
puts "#{name.capitalize}: #{statement}"
end
end
def ally_catch_phrase(ally)
if ally == "batgirl"
say("batgirl", "I''ll follow your lead!")
elsif ally == "robin"
say("robin", "Gotham needs us!")
else
say(nil, "Since you can't decide will give you Robin!")
ally = "robin"
end
end
def weapon_select
puts "Choose a weapon for your sidekick!"
new_line
puts "Options: mine detonator, smoke pellets, disruptor"
weapon = gets.chomp.downcase
# choose weapon
valid_weapons = ["mine detonator", "smoke pellets", "disruptor"]
until valid_weapons.include?(weapon)
puts "Options: mine detonator, smoke pellets, disruptor"
weapon = gets.chomp.downcase
end
return weapon
end
def weapon_statement(ally, weapon)
case weapon
when "mine detonator"
say "#{ally}: These will come in handy!", "๐Ÿ’ฃ ๐Ÿ’ฃ ๐Ÿ’ฃ"
when "smoke pellets"
say "#{ally}: They can't beat us if they can't see us!", "๐Ÿ‘ฅ ๐Ÿ‘€"
when "disruptor"
say "#{ally}: Perfect! We can lock up their firearms!", "๐Ÿ”’ ๐Ÿ”’ ๐Ÿ”’"
end
end
def enemy_select
puts "Who should we fight first?"
new_line
puts "Options: Two Face, Poison Ivy, or Harley Quinn"
enemy = gets.chomp.downcase
new_line
return enemy
end
def shout(name, catchphrase)
if name.nil?
puts catchphrase
else
puts "#{name.capitalize}: #{catchphrase}"
end
end
def enemy_quote(enemy)
if enemy == "two face"
shout("two face", "Right on time for your own funeral โšฐ๏ธ")
elsif enemy == "poison ivy"
shout("poison ivy", "Let me warm you up with a kiss ๐Ÿ’‹")
elsif enemy == "harley quinn"
shout("harley quinn", "You think I'm just a doll, but you're very wrongโ•๐Ÿƒโ—๏ธ")
else
say(nil, "Since you can't decide will give you Harley Quinn!")
enemy = "harley quinn"
shout("harley quinn", "Can we put this on camera for Mr. Jโ‰๏ธ ๐Ÿ“น")
end
end
def end_game
puts " ๐Ÿ›‘ ๐ŸŽฎ Stop playing for now and go read a book! โžก๏ธ ๐Ÿ“š"
end
game_intro
new_line
bats
new_line
ally = choose_sidekick
ally_catch_phrase(ally)
new_line
bats
weapon = weapon_select
weapon_statement(ally, weapon)
new_line
bats
new_line
enemy = enemy_select
enemy_quote(enemy)
bats
new_line
end_game
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment