Skip to content

Instantly share code, notes, and snippets.

@capjuancode
Created July 7, 2015 20:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save capjuancode/ace2c4c8d3f12ca7285c to your computer and use it in GitHub Desktop.
Save capjuancode/ace2c4c8d3f12ca7285c to your computer and use it in GitHub Desktop.
REPL Game Captain America
module Actions
def welcome
20.times do
puts
end
puts <<-END
CAPTAIN AMERICA
END
10.times do
puts
end
end
#---------------------------------------------------
def game_over
sleep(3)
20.times do
puts
end
puts <<-END
GAME OVER
END
10.times do
puts
end
end
def space(number)
number.times do
puts
end
end
end
require './game'
include Game
the_start
require './actions'
module Ending
include Actions
# This runs from Riddle
def win_ending
puts "Mr.H: you thinking that i am going to let you go that easy"
puts "Captain America see the opportunity attacks Mrs H and leaves him unconscious. Captain America He destroyed the base\n\n"
sleep (4)
space(20)
puts "YOU HAVE SAVE ONCE AGAIN THE PLANET\n\n"
sleep(4)
space(20)
game_over
end
def final_story_2
puts "you are almost there you see radiation levels are going up you're thinking why?, why things got to go so wrong it's sad very sad"
sleep (2)
puts "you have entered the building you see that every thing is ok you went to the back entrance and finds the gate open you are coming in when you see Mr. HOOoo and....\n\n"
puts "One guard gets you from the back the other shocks you and you are unconscious"
final_story_1
end
def final_story_1
space(20)
puts "..."
puts "You are very injured, you just gain consciousness and you see Mr.Hoo looking down at you as you lie on the floor "
sleep(2)
puts "Mr.H: Why are you trying to stop me"
puts "you're first words are"
puts "...\n\n"
puts "CA:Why you need the uranium\n\n"
puts "Mr.H:Jajaja nuclear man isn't that obvious\n\n"
puts "nuclear"
sleep(3)
puts "look boy you must understand the we are very careless."
puts "the only way is that we lose what we have to make us appreciate more what we had"
puts "you know what I will give you the chance to live \n\n"
sleep (7)
puts "this is a Riddle. You have 6 chances to figure it out. Only key one letter at a time like hangman ok... "
sleep(2)
puts "lets do this!!!\n\n"
puts "what goes round and round and it only thing that stops it is if you brake it"
space(20)
riddle_one
space(20)
end
end
require "./actions"
require "./ending"
require "./riddle"
require "./wrong_spot"
module Game
include Actions
include Riddle
include Ending
include WrongSpot
def the_start
intro
ask_player
end
def intro
welcome
puts "In C-130 over Russian territory a message comes to captain America\n\n"
sleep(2)
puts "Pilot C-130: Its the President\n\n"
sleep(2)
puts "CA:Yes, Mrs President "
sleep(2)
puts "President: We have a mission for you , Mr Whoo is in Russia . We know he is on his way to Chernobyl and his intentions aren’t good."
puts "Can you stop him?\n\n"
sleep(2)
puts "CA: Mr Whoo ….. "
sleep(7)
space(20)
puts "President: Captain America!!\n\n"
end
def ask_player
puts "Do you (A)ccept this mission or (D)ecline?\n\n"
puts "Please choose only one of the options are:\n\n"
puts " A or D"
case gets.chomp.downcase
when "a"
puts "...."
sleep (2)
puts
puts "Pilot C-130: we are on Chernobyl , get you parachute on\n\n"
sleep (3)
puts "Captain America jumps at 20,000ft\n\n"
sleep (2)
puts "15.000 ft CA looks over his shoulder he sees his plane get shot down\n\n"
sleep (2)
puts "10.000 ft he could feel the gun shot passing close to him and he starting to see that search light when he gets a (FlashBack)"
space(10)
puts "..."
sleep (3)
puts "Mr Whoo: boy you know this is dangerous, I don’t want to hurt you"
sleep (2)
puts "CA: I need it if, I do this its because I do it for my country . Just do it"
sleep (2)
puts "2 military officials come in to the lab"
sleep (2)
puts "MP: Mr Whoo you are under arrest. You knew that you can’t do this test"
sleep (2)
puts "Mr Whoo: Please let me help this young boy he is suffering with that injection"
sleep (2)
puts "MP: handcuff this man "
sleep (2)
puts "Mr.Whoo : NOooo…"
puts "..."
sleep (4)
puts "5000ft…\n\n"
sleep(2)
puts "1000ft shoot deploy"
sleep(2)
wrong_spot
when "d"
puts "Your Plane was shot down on your way back to the BASE"
game_over
puts "Do you want to try one more time"
puts "your options are (Y)es and (N)o "
case gets.chomp.downcase
when "y"
ask_player
when "n"
"America got destroyed because of your INCOMPETENCE"
end
else
puts "For messing around you have been killed\n\n"
puts "Do you want to try one more time"
puts "your options are (Y)es and (N)o "
case gets.chomp.downcase
when "y"
space(10)
ask_player
when "n"
"America got destroyed because of your INCOMPETENCE"
game_over
end
end
end
end
require './ending.rb'
module Riddle
include Ending
def riddle_one
i=0
stop = false
a = [8,8,8,8]
until stop do
puts "incert letter"
case gets.chomp
when "o"
a.insert(1, "O")
a.delete_at(2)
a.insert(2, "O")
a.delete_at(3)
when "l"
a.insert(0, "L")
a.delete_at(1)
when "p"
a.insert(3, "P")
a.delete_at(4)
else
i == 5
end
i += 1
if i == 6
stop = true
puts "** You have lost **"
game_over
end
if
a == ["L","O","O","P"]
stop = true
puts "** You are a winner **"
win_ending
# final_end
end
puts "-----------------------------------------------------"
print a.join
puts
puts
puts "number of tries"
puts i
puts "-----------------------------------------------------"
end
end
end
require './actions'
module WrongSpot
include Actions
def wrong_spot
space(20)
puts "CA: Oh god I landed in the wrong spot, ok I guess I have to walk LOL"
puts "..."
sleep (3)
puts "Captain America spots three Mr. Whoo..bad guys\n\n"
puts "You have three options: (A)ttack head on (G)o around them (C)all for extraction\n\n"
ask_player2
end
def ask_player2
case gets.chomp.downcase
when "a"
puts "you got one of them down two to go\n\n"
sleep (3)
puts "Ho Nooo...\n\n"
sleep(2)
puts "One guard gets you from the back the other shock you and you are unconscious\n\n"
final_story_1
when "g"
puts "You got away\n\n.\n\n.\n\n."
sleep(2)
puts "Security guards: base this is Guard 1…"
sleep(2)
puts "Base: Whats up?\n\n"
puts "Guard1: We located some foot prints just keep your eyes open\n\n"
sleep (1)
puts "Base: Roger that\n\n"
final_story_2
when "c"
puts "While you wait you are spotted and they are shooting at you"
figth_seen1
else
puts "For messing around you have been killed"
puts "For messing around you have been killed\n\n"
puts "Do you want to try one more time"
puts "your options are (Y)es and (N)o "
case gets.chomp.downcase
when "y"
space(10)
ask_player2
when "n"
"America got destroyed because of your INCOMPETENCE"
game_over
end
end
end
end
include WrongSpot
# fight scene
def figth_seen1
puts "Your options are (R)aise your shield attack head on ore (S)urrender"
case gets.chomp.downcase
when "r"
puts "you got one of the guard down two to go\n\n"
sleep (2)
puts "One guard gets you from the back the other shocks you and you are unconscious"
final_story_1
when "s"
puts "One guard gets you from the back the other shocks you and you are unconscious"
final_story_1
else
puts "For messing around you have been killed"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment