Welcome to Dream.In.Code
Become an Expert!

Join 136,932 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,837 people online right now. Registration is fast and FREE... Join Now!




cool fun rpg in ruby

 
Reply to this topicStart new topic

cool fun rpg in ruby, PLAY

rickyadd
8 Oct, 2007 - 11:47 AM
Post #1

New D.I.C Head
*

Joined: 4 Oct, 2007
Posts: 8


My Contributions
CODE


# The Sickest RPG ever
#
#coded and tested by Ricky Addington, and Tyler Wells
#
#-------------------------------------------------------
health = 10
maxhealth = 10
strength = 1
magic = 1
cheater = "1"

damage = rand(strength) + rand(strength)
magicdamage = rand(magic) + rand(magic)
enemydamage = rand(strength) + 1

print "Choose ye to cheat or not to cheat....\nthat does be the question.\n"
while cheater != "0"

cheater = gets.chomp
if cheater == "Yes"
print "That be the choice to save yer skin.\n"
cheater = "1"
break
else
print "A goodly soul dost nigh ever mean a long life\n"
cheater = "0"
end

end


print"Choose your cheat...\n\n"

choice = gets.chomp

if choice == "Sword"
damage = damage + 5
strength = strength + 5
print"Thy hast chosen Sword thine strength now equals #{strength}\n\n"
elsif choice == "Staff"
magic = magic + 5
maxhealth = maxhealth  + 5
health = health + 5
print"Thy hast chosen Staff thine magic now equals #{magic}\n\n"
elsif choice == "Runes"
magic = magic + 5
print"Thy hast chosen Runes thine magic now equals #{magic}\n\n"
elsif choice ==  "Bracers"
strength == strength + 5
print"Thy hast Bracers  thine magic now equals #{magic}\n\n"

end





while health > 0
print"THE BEST RPG EVER!\n\n"
print"(enter to continue)\n"
con=gets
print"A wise old man approaches you"
con = gets
print"whats your name young child?\n"
name=gets.chomp.to_s
print"#{name} huh?\n"
con = gets
print"I like it\n\n"
con=gets
while health > 0
print"#{name}, would you like to join my team,\n to fight the forces of evil?(1 for yes, 2 for no)\n"
ask = gets.to_i

if ask == 1
break
elsif ask == 2
print "Please? will you join us?\n"
next
else
next
end

end
print"YOU WILL?!?! YES!\n"
con = gets


print"lets start our journey!\n"
con = gets

while health > 0
print"What class do you want?\n(1 for scorcerer, 2 for knight, 3 for alchemist, 4 for paladin)\n"
myclass = gets.to_i

if myclass == 1
myclass = "scorcerer"
magic = magic + 4
print"Scorcerer huh?\n those are magic masters\n"
break
elsif myclass == 2
myclass = "knight"
strength = strength + 4
print"Knights huh?\n those are weapons and strength masters\n"
break
elsif myclass == 3
myclass = "alchemist"
strength = strength + 2
magic = magic + 2

print"Alchemists huh?\n they are skilled at magic and strength\n"
break
elsif myclass == 4
myclass = "paladin"
magic = magic + 3
health = health + 5
maxhealth = maxhealth + 5

print"paladin huh?\n they are magic masters, and have alot of health\n"
break
else
next
end
end

#----------------------------class is picked--------------------------
print" "
con = gets
while health > 0
print" What would you like as a weapon?\n(1 for sword, 2 for magic staff)\n"
weapon = gets. to_i
if weapon == 1
print"strength + 3\n"
con = gets
strength = strength + 3
break
elsif weapon == 2
print"magic + 3\n"
con = gets
magic = magic + 3
break
else
next
end
end


print"***********stats**************\n"
print"Health = #{health}/#{maxhealth}\n"
print"Strength = #{strength}\n"
print"Magic = #{magic}\n"
print"******************************\n\n\n"
con = gets

#------------------------------First Battle-----------------------------
print"An enemy appears!\n\n"

enemyhealth = rand(10) + 3
enemystrength = rand(2) + 1

while enemyhealth > 0
print"His health is #{enemyhealth}\n"
con = gets
print"Your health is #{health}/#{maxhealth}\n"

damage = rand(strength) + rand(strength)
magicdamage = rand(magic) + rand(magic)
enemydamage = rand(enemystrength) + 1


print"What would you like to do?\n(1 for attack, 2 for magic)\n"
action = gets.to_i
if action ==1
print"you attack and do #{damage} damage\n"
con = gets
enemyhealth = enemyhealth - damage

elsif action == 2
print"You use magic and do #{magicdamage} damage\n"
con = gets
enemyhealth = enemyhealth - magicdamage

else
print"Invalid Move\n"
con = gets
next
end


if enemyhealth <= 0
break
else
print"Enemy attacks and does #{enemydamage} damage\n"
con = gets
health = health - enemydamage
end

if health < 1
break
end
end
if health < 1
break
end
print"You have won your first battle!\n\n"
con = gets
#------------------------------Won first Battle-------------------------


#-------------------------------First level up-------------------------------
print"You leveled up!!\n"

print"magic + 1\n"
print"strength + 1\n"
print"health + 5\n\n"
con = gets
magic = magic + 1
strength = strength + 1
health = health + 5
maxhealth = maxhealth + 5


print"***********new stats**************\n"
print"Health = #{health}/#{maxhealth}\n"
print"Strength = #{strength}\n"
print"Magic = #{magic}\n"
print"******************************\n\n\n"
con = gets

#---------------------------------End of level up---------------------------


print"Good job #{name}!\n I knew I made a good choice asking you to join me!\n"
con = gets

while health > 0
print"what do you want as a second weapon?\n(1 for sword, 2 for staff, 3 for wand, 4 for mace)\n"
weapon2 = gets.to_i

if weapon2 == 1
print"strength + 3\n"
con = gets
strength = strength + 3
break
elsif weapon2 == 2
print"magic + 3\n"
con = gets
magic = magic + 3
break
elsif weapon2 == 3
print"magic + 5\n"
con = gets
magic = magic + 5
break
elsif weapon2 == 4
print"strength + 5\n"
con = gets
strength = strength + 5
break

else
next
end
end


print"Good Choice!\n"
con = gets

print"Lets head for the castle #{name}\n"
con = gets

print"You and the old man leave for the castle,\n to ward out the evil spirit inside\n"
con = gets

print"As you leave another enemy appears!\n"
con = gets
print"Enemyhealth is 18\n"
con = gets
print"Ill take care of this one #{name}\n"
con = gets
print"The old man pulls out a staff and uses magic\n"
con = gets
print"He does 24 damage\n"
con = gets
print"The enemy is defeated\n"
con = gets
print"You both continue toward the castle\n"
con = gets
print"After about 15 minutes of walking,\n You arrive\n"
con = gets
puts"___________________                  ___________________________                     "
puts"//   //    //    //                  ///////////////////////////                  "
puts"//   //    //    //                  ///////////////////////////                  "
puts"///////    //    //                  /////////           ///////                  "
puts"//   //    //    //                  /////////           ///////                  "
puts"//   //    //    // (Ye Old Castle)  ///////////////////////////                  "
puts"//   //    //    ///////////////////////////////////////////////                  "
puts"///////////////////                  ///////////////////////////                  "
puts"///+++++++++++++////////////////////////////////////////////////                  "
puts"///+++++++++++++////////////////////////////////////////////////                  "
puts"///+++++++++++++////////////////////////////////////////////////                  "
puts"///+++++++++++++//////////////////////////////            //////                  "
puts"///+++++++++++++///------------------/////////            //////                  "
puts"///+++++++++++++///------------------///////////////////////////                  "
puts"///+++++++++++++///------------------///////////////////////////                  "
puts"///////////////////------------------///////////////////////////                  "
puts"///////////////////------------------///////////////////////////                  "
puts"///////////////////------------------///////////////////////////                  "
puts"///////////////////------------------///////////////////////////                  "
puts"///////////////////------------------///////////////////////////                  "
puts"///////////////////------------------///////////////////////////                  "
puts"^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                  "
con = gets

print"you enter and stumble upon a healing fountain,\n Will you drink\n(1 for yes, 2 for no)"
action = gets.to_i

if action == 1
#-----------------------------------------------------
# Redo the text in the print statements
#-----------------------------------------------------

print "Health is restored...... Time to go kill some zombies!\n"
health = maxhealth
con = gets
print"O.M.G.....This is Princess Peach's Castle!!!\n"
con = gets
print"I wonder if there is a zombie Bowser?!?!\n"
con = gets
print "Not paying attention again you stumble off the tower,\nfall 100 feet,\n and find yourself in a weird underground abyss\n where screams of tortured souls fill the air...\n\n"
con = gets
print"Enemy appears!\n"
              
                                                                              
puts"      -.                                                                   "
puts"     /yy.                     .s:                                          "
puts"    +yyyo`          ^         -syy:                                        "
puts"  .+yyyyyy-        +o`      .syyyy/`        `:s`   `/`                     "
puts"  ssyyyysss.     `syyo`   .oyyyyyyyo.     .oys:     .ys-                   "
puts"    `.o.        :yyyyyo`  `..../o-..`     /yys      /yyy:                  "
puts"      +        +yyyyyyyo`      `/         /yyyso::-.oyyy:                  "
puts"      +       `....o....`      `/         `-syyyyyyyyys/.                  "
puts"      +            +           `/          -yyyyyyyyyy/                    "
puts"      +            +           ::          syyyyyyyyyyy`                   "
puts"      ::           +          -+           -yyyyyyyyyy/                    "
puts"       -/:.`       +        `/:             -oyyyyyys:                     "
puts"         `.--------o--------:.                `-yy/`                       "
puts"                   +                       -//::yy/.....                   "
puts"                   +                   .:ssyysyyyyyyyyyyo/`                "
puts"                   +                -/oyyy/-` `syyyo``.:syy/`              "
puts"                   +              -syyy+.      syyyo     :syy:             "
puts"                   +           .:syys`         syyyo       oyyo            "
puts"                   +      `-+syyyy/-           syyyo        :yys:          "
puts"                 -oyyo+++yyyyo/-.             -yyyyo         `/yys.        "
puts"                 oyyyys+++/-                  /yyyyo           .syys+.     "
puts"                  -o.                        .yyyyyo             `/oys.    "
puts"                   +                         syyyyyo                       "
puts"                   +                        :yyyyyyy/                      "
puts"                   +                       .yyyyyyyyy:                     "
puts"                   +                      .yyyyyyyyyys.                    "
puts"                   +                     `syyyyy/syyyy:                    "
puts"                   +                    `oyyyyy: `oyyys`                   "
puts"                   +                    /yyyyy:   -yyyy+                   "
puts"                   +                   /yyyyy:     -yyyo`                  "
puts"                   +                   syyys-       /yyy/                  "
puts"                   +                  :yyys.         syyy`                 "
puts"                   +                  +yyy:          syyy`                 "
puts"                   +                 .yyyy:          syyy`                 "
puts"                   +                 -yyyy:          syyy`                 "
puts"                   .                 syyyy-          syyy`                 "
puts"                                     `---`           :+ys                  \n\n"
con = gets


enemyhealth = rand(20) + 20
enemystrength = rand(10) + 1

if cheater == "1"
enemyhealth = rand(20) + 40

end
while enemyhealth > 0
print"His health is #{enemyhealth}\n"
con = gets
print"Your health is #{health}/#{maxhealth}\n"

damage = rand(strength) + rand(strength)
magicdamage = rand(magic) + rand(magic)
enemydamage = rand(enemystrength) + 1


print"What would you like to do?\n(1 for attack, 2 for magic)\n"
action = gets.to_i
if action ==1
print"you attack and do #{damage} damage\n"
con = gets
enemyhealth = enemyhealth - damage

elsif action == 2
print"You use magic and do #{magicdamage} damage\n"
con = gets
enemyhealth = enemyhealth - magicdamage

else
print"Invalid Move\n"
con = gets
next
end


if enemyhealth <= 0
break
else
print"Enemy attacks and does #{enemydamage} damage\n"
con = gets
health = health - enemydamage
end

if health < 1
break
end
end
if health < 1
break
end                        
                                                                                                                                                                        


print"You leveled up!!\n"

print"magic + 1\n"
print"strength + 1\n"
print"health + 5\n\n"
con = gets
magic = magic + 1
strength = strength + 1
health = health + 5
maxhealth = maxhealth + 5


print"***********new stats**************\n"
print"Health = #{health}/#{maxhealth}\n"
print"Strength = #{strength}\n"
print"Magic = #{magic}\n"
print"******************************\n\n\n"
con = gets



print"You leveled up AGAIN!!\n"

print"magic + 1\n"
print"strength + 1\n"
print"health + 5\n\n"
con = gets
magic = magic + 1
strength = strength + 1
health = health + 5
maxhealth = maxhealth + 5


print"***********new stats**************\n"
print"Health = #{health}/#{maxhealth}\n"
print"Strength = #{strength}\n"
print"Magic = #{magic}\n"
print"******************************\n\n\n"
con = gets




print"Sh!t 3 times?!?!?!?!!!\n"

print"magic + 1\n"
print"strength + 1\n"
print"health + 5\n\n"
con = gets
magic = magic + 1
strength = strength + 1
health = health + 5
maxhealth = maxhealth + 5


print"***********new stats**************\n"
print"Health = #{health}/#{maxhealth}\n"
print"Strength = #{strength}\n"
print"Magic = #{magic}\n"
print"******************************\n\n\n"
con = gets


print"Your soul ascends back to the earth,\n and you find yourself at the top of the castle\n"
con = gets
print"Princess peach offers you a potion\n She says it will heal you,\n will you drink?(1 for yes, 2 for no)\n\n"
action = gets.to_i

if action == 1
#-----------------------------------------------------
# Redo the text in the print statements
#-----------------------------------------------------
print "you drink and are poisoned\n You lose 10 health\nYou lose conciousness\n"
health = health - 10
con = gets
else
print"You say no thanks.\n and walk out\n\n"
con = gets
print"You see her with a discontent look on her face,\n as you leave you hear her scream in rage\n"
con = gets
print"You go back and are hit on the head,\n and knocked unconcious\n\n"
con = gets

end

print"You wake up to a cute little squirrel poking you in the leg\n"
con = gets
print"O.M.G.!!!!!!\n   its a RABID HAND GUN WIELDING SQUIRREL!!!!!!!!!!!!!\n"
con = gets

                                                                                        
puts"                                                  `..+/++o++/-```          "
puts"                                                `/yyssssssysyyhhhy+.       "
puts"                                             `-+sossssssyysyyhhyyhhhs-     "
puts"                 `.       .-                -ssyssssssyyyyyhyhhhhhhhhys:   "
puts"                :hh+``  .smd:              :hssssysssyyyyyhhhhhhhhhhhydd.  "
puts"                -shhyyosdddm-              oyyssyyyyhyhhhhhhhhhhhhhhhhh+   "
puts"             `+ysssyhdyhhhhdo`             /hyyyyhhhhhhhhhhhhhhhhhhyyhh-   "
puts"            .dyysyydmmyhhhhhh:.            -hhyhhhhhhhddddhhhhhhhhhhhd:    "
puts"            sssyhhhyhhhhyhhdhyysyyssssssso+:odhhhhhhhdddddddhdddhddhh/     "
puts"            yhyyhhhhhyhyhhhdhhhhhhhhhhhhhhhhhhhhdhhdddddddddmhsssss+.      "
puts"            :yyyddhysyhdmdddhhhhyyyhhhhhhhhhhhhhhddhdddddmd+-`             "
puts"    o-------..--/ss/ydhyoyhhhhyyyshhhhhhhhhhhhhhhhhhdddddmd`               "
puts"    yssssssso/hNNdyyyhmy+++yhhyyyhhhhhhhhhhhhhhhhhhdNmdmdm-                "
puts"            `:mMMmddddmhsyyyyhyhhhhhhhhhhhhhhhhhhdNMNmddd:                 "
puts"             `shddhyhhyyyyyhhhddddhhhhhhhhhhhhhmNMNmddddd                  "
puts"               `-:osssosyysssyhyooosssyyhhdmNNNNNdhyhdmdm                  "
puts"                        ``   .hdyyyyyhdmNNNmhyshdhhhhdddm-                 "
puts"                            :ymmNNNmmydmhhyoooohhhhhhhddy.                 "
puts"                           -dyhhs++++/hhyyyooooyhhhhhhds`                  "
puts"                           .yyhyo/////yhhhsoooshhhhyhhy                    "
puts"                            :yyhys////yhhhyssyhhhhhhhdo                    "
puts"                             .yyhh+/++yhhyhhhdddhhhdmm`                    "
puts"                              /yhhyyo-:shhhhhddddddmd:                     "
puts"                               yhhdo`  -hhhhds+oooo:`                      "
puts"                         `/ss+shds:``./ohhmds                              "
puts"                         ohyoo/-+yhhhhs+:.`                                "
puts"                                `ooo-                                      "
con = gets                                                          

enemyhealth = rand(100) + 100
enemystrength = rand(3) + 1

if cheater == "1"
enemyhealth = rand(200) + 100
enemystrength = rand(6) + 1
end
while enemyhealth > 0
print"His health is #{enemyhealth}\n"
con = gets
print"Your health is #{health}/#{maxhealth}\n"

damage = rand(strength) + rand(strength)
magicdamage = rand(magic) + rand(magic)
enemydamage = rand(enemystrength) + 1


print"What would you like to do?\n(1 for attack, 2 for magic)\n"
action = gets.to_i
if action ==1
print"you attack and do #{damage} damage\n"
con = gets
enemyhealth = enemyhealth - damage

elsif action == 2
print"You use magic and do #{magicdamage} damage\n"
con = gets
enemyhealth = enemyhealth - magicdamage

else
print"Invalid Move\n"
con = gets
next
end


if enemyhealth <= 0
break
else
print"Enemy attacks and does #{enemydamage} damage\n"
con = gets
health = health - enemydamage
end

if health < 1
break
end
end
if health < 1
break
end            

   print"You leveled up!!\n"

print"magic + 1\n"
print"strength + 1\n"
print"health + 5\n\n"
con = gets
magic = magic + 1
strength = strength + 1
health = health + 5
maxhealth = maxhealth + 5


print"***********new stats**************\n"
print"Health = #{health}/#{maxhealth}\n"
print"Strength = #{strength}\n"
print"Magic = #{magic}\n"
print"******************************\n\n\n"
con = gets


print"You leveled up again!!\n"

print"magic + 1\n"
print"strength + 1\n"
print"health + 5\n\n"
con = gets
magic = magic + 1
strength = strength + 1
health = health + 5
maxhealth = maxhealth + 5


print"***********new stats**************\n"
print"Health = #{health}/#{maxhealth}\n"
print"Strength = #{strength}\n"
print"Magic = #{magic}\n"
print"******************************\n\n\n"
con = gets


        
                  
print"You beat the squirrel,\n only to realize that was the baby,\nNow you have to fight the NOTHER SQUIRREL!!!!\n"
con = gets
print"With A SHOTGUN!!!!!!!!!!!!!!!\n\n"
con = gets





























                                                                                                                                                      









end

if health <= 0
break
end

















end







print"health = 0\n\n"
con = gets
print"Game Over\n\n"
con = gets








we need some new ideas,
any help?

know if you can imbed images in ruby as well?
User is offlineProfile CardPM
+Quote Post

PennyBoki
RE: Cool Fun Rpg In Ruby
8 Oct, 2007 - 04:57 PM
Post #2

system("revolution");
Group Icon

Joined: 11 Dec, 2006
Posts: 2,009



Thanked: 5 times
Dream Kudos: 500
Expert In: Java,C++,C

My Contributions
I like it it was fun smile.gif, no new ideas however..
User is offlineProfile CardPM
+Quote Post

spullen
RE: Cool Fun Rpg In Ruby
8 Oct, 2007 - 07:37 PM
Post #3

D.I.C Regular
Group Icon

Joined: 22 Mar, 2007
Posts: 330



Thanked: 1 times
Dream Kudos: 50
My Contributions
Cool game.
You could use SDL to embed images I think there is a rubygem for it too, but I don't think you can embed it in a console so you would have to make a little widget for it.
User is offlineProfile CardPM
+Quote Post

Amadeus
RE: Cool Fun Rpg In Ruby
11 Oct, 2007 - 06:57 AM
Post #4

g++ -o drink whiskey.cpp
Group Icon

Joined: 12 Jul, 2002
Posts: 12,228



Thanked: 40 times
Dream Kudos: 25
My Contributions
CODE

print"Thy hast chosen Sword thine strength now equals #{strength}\n\n"

I believe you want to use 'thou' here. Thy translates as 'yours', though translates as 'you'.
User is offlineProfile CardPM
+Quote Post

angelsgeek
RE: Cool Fun Rpg In Ruby
22 Oct, 2007 - 01:17 PM
Post #5

New D.I.C Head
*

Joined: 19 Oct, 2007
Posts: 22


My Contributions
I will try it tonight when I get home!
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 12/3/08 10:38PM

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month