Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env ruby
- #Initialize all Classes
- #To start, we will create the classes for in game characters we can interact with
- require 'vector2d'
- class Sentient
- attr_accessor :my_name, :type, :stride, :x_pos, :y_pos, :region_name, :health_max
- attr_accessor :health_cur, :attack, :exp_gain
- def initialize(type, my_name)
- end
- end
- #Class for player
- class Human
- attr_accessor :my_name, :type, :location, :x_pos, :y_pos, :stride
- attr_accessor :fatigue, :level, :cur_exp, :exp_to_next_lvl, :stats, :inventory, :journal
- def initialize
- @stats = Stats.new
- @inventory = Inventory.new
- @journal = Journal.new
- end
- end
- class Stats
- attr_accessor :strength, :defense, :agility, :vitality, :stamina, :health_max, :health_cur, :attack
- def initialize
- @health_cur = health_cur
- end
- end
- ## End for entities
- #--- Establish Scenes
- class Scenes
- attr_accessor :scene_name, :region_name, :enemy_types, :size_total, :size_water, :size_land, :depth_water
- attr_accessor :height_land, :offset_land, :terrain, :description, :seed, :weather, :climate
- def initialize
- end
- end
- #--- Eastablish BattleScene
- class BattleScene
- attr_accessor :number_enemies, :turn, :enemy_type, :enemy_health_max, :enemy_health_cur, :enemy_attack, :exp_gain
- end
- #--- Establish current scene
- class Current_Scene < Scenes
- attr_accessor :current1_scene, :region_name, :x_pos, :y_pos, :object
- def initialize
- end
- def object
- @object = Obj.new
- end
- end
- #--- Establish Inventory
- ### Inventory
- class Inventory
- attr_accessor :name, :quantity, :qualifier, :id, :exp_set
- def initialize
- @qualifier = Items.new
- end
- end
- #--- Establish In Game Interactables
- ### Items
- class Items
- attr_accessor :item_name, :attack_bonus, :health_bonus, :health_gain, :fatigue_sub, :weight, :identified
- end
- #--- Declare Scenes
- #361 Total Scenes for the world
- # for climate
- # 1 - desert, 2 - rainforest, 3 - tundra, 4 - ice land, 5 - temperate
- #for weather
- # 1 - rain, 2 - snow, 3 - thunderstorm, 4 - blizzard, 5 - windy, 6 - cloudy, 7 - sunny, 8 - raining fire
- Scene1 = Scenes.new
- Scene1.scene_name = "Scene: 1"
- Scene1.region_name = "Northern Sea of Monsters"
- Scene1.enemy_types = "Sea Dragon"
- Scene1.seed = 5
- Scene1.size_total = 267 * 267
- Scene1.size_water = 267 * 267
- Scene1.size_land = 0
- Scene1.depth_water = 167
- Scene1.height_land = 0
- Scene1.offset_land = 0
- Scene1.terrain = "Sea"
- Scene1.description = "To the East, West and North is more sea. To the South you see land."
- Scene1.climate = 4
- Scene1.weather = 7
- Scene2 = Scenes.new
- Scene2.scene_name = "Scene: 2"
- Scene2.region_name = "Northern Sea of Monsters"
- Scene2.enemy_types = "Sea Farie Dragons"
- Scene2.seed = 7
- Scene2.size_total = 267 * 267
- Scene2.size_water = 267 * 267
- Scene2.size_land = 0
- Scene2.depth_water = 180
- Scene2.height_land = 0
- Scene2.offset_land = 0
- Scene2.terrain = "Sea"
- Scene2.description = "To the West and North is more sea. To the South you see a bay, to the East you see land."
- Scene2.climate = 4
- Scene2.weather = 7
- Scene3 = Scenes.new
- Scene3.scene_name = "Scene: 3"
- Scene3.region_name = "Northern Sea of Monsters | The Chase Penensula"
- Scene3.enemy_types = "Razor Sea Dragons"
- Scene3.seed = 3
- Scene3.size_total = 267 * 267
- Scene3.size_water = 267 * 187
- Scene3.size_land = 216 * 120
- Scene3.height_land = 1.5
- Scene3.offset_land = 187
- Scene3.depth_water = 90
- Scene3.terrain = "Sea | Beech"
- Scene3.description = "To the south, there is a beech. To the North, East and West are endless Seas. The beech looks ominous..."
- Scene3.climate = 3
- Scene3.weather = 7
- #Define Journal/History
- class Journal
- attr_accessor :page
- def initialize
- @page = []
- end
- end
- #--- Declare World Objects
- #--- Declare all world sentients
- Player = Human.new()
- Player.stride = 50
- Player.x_pos = 267/2
- Player.y_pos = 267/2
- Player.fatigue = 0
- Player.level = 0
- Player.cur_exp = 0
- Player.exp_to_next_lvl = 50
- Player.location = 1
- Player.inventory.name = []
- Player.inventory.qualifier = []
- 1000.times {Player.inventory.name << 0}
- count = 1
- 11.times do
- Player.inventory.name[count] = 5
- count += 1
- end
- #Set names of Inventory ids.
- Player.inventory.qualifier[1] = "Observation"
- Player.inventory.qualifier[2] = "Melee Combat"
- Player.inventory.qualifier[3] = "Defense"
- Player.inventory.qualifier[4] = "Crafting"
- Player.inventory.qualifier[5] = "Smithing"
- Player.inventory.qualifier[6] = "Alchemy"
- Player.inventory.qualifier[7] = "Communication"
- Player.inventory.qualifier[8] = "Magic"
- Player.inventory.qualifier[9] = "Ranged Combat"
- Player.inventory.qualifier[10] = "Spirituality"
- Player.inventory.qualifier[11] = "Unarmed Combat"
- #12 Obs exp, 13 Melee exp, 14 Def exp, 15 Craft exp, 16 Smit exp, 17 Alch exp, 18 com exp, 19 mag exp, 20, rang exp, 21 spirit exp, 22 unarm exp
- Player.inventory.qualifier[23] = "Look Around"
- Player.inventory.qualifier[24] = "Peer Into Soul"
- Player.inventory.qualifier[25] = "Read Thoughts"
- Player.inventory.qualifier[26] = "X-Ray Vision"
- Player.inventory.qualifier[27] = "Under Water Vision"
- Player.inventory.qualifier[28] = "Eagle Eyes"
- Player.inventory.qualifier[29] = "Star Charting"
- Player.inventory.qualifier[30] = "Fire-Eyes"
- Player.inventory.qualifier[31] = "Identify Objects"
- Player.inventory.qualifier[32] = "Observe a Sentient"
- Player.inventory.qualifier[33] = "Thrust"
- Player.inventory.qualifier[34] = "Slice"
- Player.inventory.qualifier[35] = "Smash"
- Player.inventory.qualifier[36] = "Hack"
- Player.inventory.qualifier[37] = "Jabb"
- Player.inventory.qualifier[38] = "Trapping"
- Player.inventory.qualifier[39] = "Naptha"
- Player.inventory.qualifier[40] = "Shield Attack"
- Player.inventory.qualifier[41] = "Chakra Attack"
- Player.inventory.qualifier[42] = "Place Holder"
- Player.inventory.qualifier[200] = "Health Potion"
- Player.inventory.qualifier[201] = "Dragon Steak"
- Player.inventory.qualifier[202] = "White Fish"
- def op_item(id, val)
- if id < 200
- puts "Error: id is not an item."
- elsif id > 600
- puts "Error: id is to large for an item."
- elsif Player.inventory.name[id.to_i] + val < 0
- Player.inventory.name[id.to_i] = 0; return
- elsif Player.inventory.name[id.to_i] + val > 32
- Player.inventory.name[id.to_i] = 32; return
- end
- Player.inventory.name[id.to_i] += val
- end
- def skill_disp(id)
- if id < 1
- puts "Error: id is not a skill tree."
- elsif id > 11
- puts "Error: id is too high for a skill tree."
- else
- puts "#{id} - #{Player.inventory.qualifier[id]} level #{Player.inventory.name[id]}"
- end
- end
- def skillexp(id,val)
- if id < 12
- puts "Error: id is to low for a skill experience."
- elsif id > 22
- puts "Error: id is to high for a skill experience."
- else
- Player.inventory.name[id] += val; return
- end
- end
- Player.stats.agility = 10
- Player.stats.strength = 25
- Player.stats.attack = Player.stats.strength / 5
- Player.stats.stamina = 10
- Player.stats.vitality = (Player.stats.strength + Player.stats.stamina) * Player.stats.agility
- Player.stats.health_max = 50
- Player.stats.health_cur = 50
- Player.journal.page[1] = "\n Page 1:\n"
- count = 1
- 360.times do
- count += 1
- Player.journal.page[count] = "\n Page #{count}:\n"
- end
- Player.journal.page[361] = "\n Page 361:\n Skills Log\n"
- Player.journal.page[362] = "\n Page 362:\n Observation Skill Tree\n Description: Observation is key to knowing the world around you.\n The higher the level of Observation the greater skills can be utilized.\n"
- Player.journal.page[362] += "Specials:\n 1- Look Around\n * Unlocks at level 5 Observation.\n -(5-10) See the surroundings.\n -(11-20) See enemies without locations.\n -(21-30) Know enemy locations.\n -(31-40) Know locations of objects, -(41+) Know everything there is for your line of sight.\n 2- Peer Into Soul\n * unlocks at Observation level 21\n -50% chance of seeing intentions of a Sentient.\n 3- Read Thoughts\n * Unleashes the psychic within you. Unlocks at level 10.\n - x% chance of knowing the thoughts of a Sentient.\n 4- X-Ray Vision\n * Unlocks at Spirituality 10 and Observation 10.\n - x% chance of seeing through objects.\n 5- Underwater Vision\n * Unlocks at Observation 5.\n - 25% chance of finding objects while under water.\n 6- Eagle Eyes\n * Allows you to see into the surrounding locations/scenes without having to be there. Unlocks at Observation 41.\n 7- Star Charting\n * Allows you to learn the locations in the world based on the stars in the sky.\n 8- Fire-Eyes\n * unlocks at Observation 10 and after consuming a dragon brain.\n - (Observation * 1.5) + attack.\n 9- Identify Objects\n * 1% chance per Observation of identifying mysterious objects, consumption is 100% successful otherwise. Ulocks at Observation 5.\n 10- Observe a Sentient\n * Allows you to see greater detail of other beings.\n - 0-50 see what they look like. 51-99 see what they are doing."
- Player.journal.page[363] = "\n Page 363:\n Melee Combat Tree\n Description: Melee is improtant for combat with a weapon.\n The higher the level of your Melee Combat the more proficiency with a melee weapon you become.\n"
- Player.journal.page[363] += "Specials:\n 1- Thrust\n * Requires a sword or hammer. Unlocks at Melee Combat 10.\n - (melee_combat * (attack + buffer_atk) + thrust) / fatigue.\n 2- Slice\n * Requires a sword or knife. Unlocks at level 5.\n - (melee_combat * (attack + buffer_atk) + Slice_level) / (fatigue - agility).\n 3- Smash\n * Requires a hammer or sword. Unlocks at level 20.\n - (melee_combat * (attack * buffer_atk) - (fatigue - agility)) * (1+(Smash / 100)).\n 4- Hack\n * Unlocks at Melee Combat 30.\n - (levelm * (attack * buffer_atk * strength) - fatigue - agility)\n 5- Jabb\n * Unlocks at Melee Combat 25.\n - (melee_combat * (attack + buffer_atk * agility) - (fatigue - agility)).\n 6- Trapping\n * Unlocks at Melee Combat 15.\n - (agility + melee_combat) * (buffer_def).\n 7- Naptha\n * Unlocks with Fire-Eyes special.\n - (melee_combat * (buffer_atk + attack) * (agility * observation)) - fatigue\n 8- Shield Attack\n * Requires a shield. Unlocks at Melee Combat 7.\n - (melee combat + buffer_atk) * (attack - fatigue)\n 9- Chakra Attack\n * Requires Spirituality 10. Talismen or Runes boost effectiveness.\n - (melee_combat * spirituality) + (buffer_atk - fatigue)\n 10- What do you think should be here?"
- def journal_load(val)
- line_num = 0
- Player.journal.page = Marshal.load File.read("#{val}.txt")
- end
- def journal_save(val)
- File.open("#{val}.txt", 'w') {|f| f.write(Marshal.dump(Player.journal.page))}
- end
- Lakmi = Sentient.new('Demi-God Human', 'Lakmi')
- Lakmi.my_name = 'Lakmi'
- Lakmi.type = 'Human Demi-God'
- Lakmi.stride = 90
- Sea_Dragon = Sentient.new('Sea Dragon', 'Enemy')
- Sea_Dragon.my_name = 'Enemy'
- Sea_Dragon.type = 'Sea Dragon'
- Sea_Dragon.stride = 70
- Sea_Dragon.region_name = 'Northern Sea of Monsters'
- Sea_Dragon.health_max = 25
- Sea_Dragon.health_cur = 25
- Sea_Dragon.attack = 4
- Sea_Dragon.exp_gain = 20
- Sea_Farie_Dragon = Sentient.new('Sea Farie Dragon', 'Enemy')
- Sea_Farie_Dragon.my_name = 'Enemy'
- Sea_Farie_Dragon.type = 'Sea Farie Dragon'
- Sea_Farie_Dragon.stride = 10
- Sea_Farie_Dragon.region_name = 'Northern Sea of Monsters'
- Sea_Farie_Dragon.health_max = 15
- Sea_Farie_Dragon.health_cur = 15
- Sea_Farie_Dragon.attack = 3
- Sea_Farie_Dragon.exp_gain = 15
- Razor_Sea_Dragon = Sentient.new('Razor Sea Dragon', 'Enemy')
- Razor_Sea_Dragon.my_name = 'Enemy'
- Razor_Sea_Dragon.type = 'Razor Sea Dragon'
- Razor_Sea_Dragon.stride = 20
- Razor_Sea_Dragon.region_name = 'Northern Sea of Monsters | Chase Penensula'
- Razor_Sea_Dragon.health_max = 30
- Razor_Sea_Dragon.health_cur = 30
- Razor_Sea_Dragon.attack = 7
- Razor_Sea_Dragon.exp_gain = 30
- #--- Declare items
- Potion = Items.new
- Potion.health_gain = 10
- Potion.attack_bonus = 5
- Potion.item_name = "Health Potion"
- Potion.weight = 1
- Dragon_Steak = Items.new
- Dragon_Steak.fatigue_sub = 5
- Dragon_Steak.health_bonus = 10
- Dragon_Steak.item_name = "Dragon Steak"
- Dragon_Steak.weight = 1.5
- White_Fish = Items.new
- White_Fish.fatigue_sub = 30
- White_Fish.health_gain = 5
- White_Fish.item_name = "White Fish"
- White_Fish.weight = 0.5
- White_Fish.identified = false
- #File methods
- Load_Player = Array.new
- load_pl = false
- line_num = 0
- #Methods for file function
- def new_game(saver)
- File.open("#{saver}-inv.txt", 'w') {|f| f.write(Marshal.dump(Player.inventory.name))}
- File.open("#{saver}","a") do |line|
- write_to = open(Player.my_name, 'w')
- write_to.write(Player.my_name)
- write_to.write("\n")
- write_to.write(Player.type)
- write_to.write("\n")
- write_to.write(Player.location)
- write_to.write("\n")
- write_to.write(Player.x_pos)
- write_to.write("\n")
- write_to.write(Player.y_pos)
- write_to.write("\n")
- write_to.write(Player.exp_to_next_lvl)
- write_to.write("\n")
- write_to.write(Player.cur_exp)
- write_to.write("\n")
- write_to.write(Player.fatigue)
- write_to.write("\n")
- write_to.write(Player.stats.agility)
- write_to.write("\n")
- write_to.write(Player.stats.attack)
- write_to.write("\n")
- write_to.write(Player.stats.defense)
- write_to.write("\n")
- write_to.write(Player.stats.health_cur)
- write_to.write("\n")
- write_to.write(Player.stats.health_max)
- write_to.write("\n")
- write_to.write(Player.stats.vitality)
- write_to.write("\n")
- write_to.write(Player.level)
- write_to.write("\n")
- end
- end
- def load_game(opener)
- line_num = 0
- Player.inventory.name = Marshal.load File.read("#{opener}-inv.txt")
- File.open("#{opener}").each do |line|
- line_num += 1
- Load_Player[line_num] = line.chomp
- end
- Player.my_name = Load_Player[1]
- Player.type = Load_Player[2]
- Player.location = Load_Player[3].to_i
- Player.x_pos = Load_Player[4].to_i
- Player.y_pos = Load_Player[5].to_i
- Player.exp_to_next_lvl = Load_Player[6].to_i
- Player.cur_exp = Load_Player[7].to_i
- Player.fatigue = Load_Player[8].to_i
- Player.stats.agility = Load_Player[9].to_i
- Player.stats.attack = Load_Player[10].to_i
- Player.stats.defense = Load_Player[11].to_i
- Player.stats.health_cur = Load_Player[12].to_i
- Player.stats.health_max = Load_Player[13].to_i
- Player.stats.vitality = Load_Player[14].to_i
- Player.level = Load_Player[15].to_i
- puts "#{Player.my_name}, we have been waiting for you..."
- end
- #--- Menu
- puts "Hello, I am #{Lakmi.my_name}, a #{Lakmi.type}."
- # Get Player Name
- puts "What is your name adventurer?"
- Player.my_name = gets.chomp
- if File.exists?("#{Player.my_name}")
- load_game(Player.my_name)
- journal_load("Journal-#{Player.my_name}")
- else
- puts "#{Player.my_name}, where do you hail from?"
- Player.type = gets.chomp
- new_game(Player.my_name)
- puts "It must be lonely coming all the way from #{Player.type} to Velsaron..."
- puts "Here, take this... The planet of Velsaron is so dastardly... These clothes will keep you warm..."
- puts "Starter Clothing added to inventory!"
- end
- #check to see if that human already has a file saved.
- sleep 4
- system("cls")
- #Game
- Scene = Player.location
- end_game = false
- input1 = ""
- Right_Now = Current_Scene.new
- options = ""
- battle_end = false
- item_find = 0
- item_select = ""
- item_find_ident = ""
- Battle = BattleScene.new
- new_place = true
- terrain_mult = 0
- sleep_on = false
- ### set up inventory
- total_value = 0
- while end_game == false
- if Player.location == 1 && new_place == true
- Right_Now.current1_scene = "#{Player.location} Scene"
- Right_Now.region_name = Scene1.region_name
- Right_Now.seed = rand(Scene1.seed)
- Right_Now.enemy_types = Scene1.enemy_types
- Sea_Dragon.x_pos = rand(267)
- Sea_Dragon.y_pos = rand(267)
- Right_Now.x_pos = Sea_Dragon.x_pos
- Right_Now.y_pos = Sea_Dragon.y_pos
- Right_Now.description = Scene1.description
- Right_Now.depth_water = Scene1.depth_water
- Right_Now.climate = Scene1.climate
- Right_Now.weather = Scene1.weather
- terrain_mult = 0.56
- new_place = false
- end
- if Player.location == 2 && new_place == true
- Right_Now.current1_scene = "#{Player.location} Scene"
- Right_Now.region_name = Scene2.region_name
- Right_Now.seed = rand(Scene2.seed)
- Right_Now.enemy_types = Scene2.enemy_types
- Sea_Farie_Dragon.x_pos = rand(267)
- Sea_Farie_Dragon.y_pos = rand(267)
- Right_Now.x_pos = Sea_Farie_Dragon.x_pos
- Right_Now.y_pos = Sea_Farie_Dragon.y_pos
- Right_Now.description = Scene2.description
- Right_Now.depth_water = Scene2.depth_water
- Right_Now.climate = Scene2.climate
- Right_Now.weather = Scene2.weather
- new_place = false
- terrain_mult = 0.56
- end
- if Player.location == 3 && new_place == true
- Right_Now.current1_scene = "#{Player.location} Scene"
- Right_Now.region_name = Scene3.region_name
- Right_Now.seed = rand(Scene3.seed)
- Right_Now.enemy_types = Scene2.enemy_types
- Razor_Dragon.x_pos = rand(267)
- Razor_Dragon.y_pos = rand(267)
- Right_Now.x_pos = Razor_Dragon.x_pos
- Right_Now.y_pos = Razor_Dragon.y_pos
- Right_Now.descriptiong = Scene3.description
- Right_Now.depth_water = Scene3.depth_water
- Right_Now.climate = Scene2.climate
- Right_Now.weather = Scene2.weather
- #code
- end
- display = ""
- puts Right_Now.current1_scene
- display = "(1)-Identify Region, (2)-Move in direction, (3)-Interact with Environment, (4)-Look Around, (5)-Self"
- puts display
- input1 = gets.chomp
- system("cls")
- case input1
- when ""
- puts "#{Lakmi.my_name}: 'Remember, you can exit the game anytime by typing the word Exit.'"
- end_game = false
- when "1"
- puts Right_Now.region_name
- end_game = false
- when "2"
- puts "Which direction do you wish to move in?"
- puts "(E)ast, (W)est, North, South, Down, Up?"
- move_amt = 0
- direction = gets.chomp
- case direction
- when "E"
- if Player.y_pos == Right_Now.y_pos && Player.x_pos - Player.stride == Right_Now.x_pos
- puts "An enemy is in the way."
- else
- move_amt = (Player.stride - (Player.fatigue - (Player.stats.agility * 1.5)))
- Player.x_pos += move_amt.abs
- end
- if Player.x_pos >= 267
- Player.location += 1
- Player.x_pos = 0
- new_place = true
- end
- when "W"
- if Player.x_pos - Player.stride == Right_Now.x_pos && Player.y_pos == Right_Now.y_pos
- puts "An enemy is in the way."
- else
- move_amt = (Player.stride - (Player.fatigue - (Player.stats.agility * 1.5)))
- Player.x_pos -= move_amt.abs
- end
- if Player.x_pos << 0
- Player.location -= 1
- Player.x_pos = 266
- new_place = true
- end
- end
- when "Exit"
- end_game = true
- puts "Game Over"
- when "3"
- options = ""
- if Right_Now.seed > 0
- options += "X-Battle #{Right_Now.enemy_types}"
- end
- if Right_Now.depth_water > 0
- options += " Y-Dive to #{Right_Now.depth_water} below the surface"
- end
- if Right_Now.seed > 0
- options += " M-Move to #{Right_Now.enemy_types}"
- end
- puts options
- interaction_input = gets.chomp.upcase
- when "4"
- puts Right_Now.description
- puts "There are #{Right_Now.seed} number of #{Right_Now.enemy_types}." if Player.inventory.name[11] >= 11
- puts "They seem to be at coordinates, #{Right_Now.x_pos}, #{Right_Now.y_pos}" if Player.inventory[11] >= 21
- #increase EXP for observation skill tree
- skillexp(12,20)
- Player.journal.page[361] += "\n#{Player.my_name} feels his eyes improving... but a factor of #{Player.inventory.name[1]}"
- puts "Journal log added."
- when "5"
- puts "You examine yourself..."
- puts "Your heatlh is at #{Player.stats.health_cur}."
- puts "Your attack strength is at #{Player.stats.attack}."
- puts "Your fatigue level is at #{Player.fatigue}."
- puts "(C)heck inventory, (S)tats, Sa(V)e, (T)he Journal, S(K)ill Tree"
- self_input = gets.chomp.upcase
- end
- case self_input
- when "K"
- puts "You have some nice skills...."
- count = 0
- 11.times do
- count += 1
- skill_disp(count)
- end
- puts "Enter a correspoding number to view the tree of Specials."
- skill_choic = gets.chomp
- self_input = ""
- case skill_choic
- when "1"
- puts "#{Player.inventory.qualifier[23]} level #{Player.inventory.name[23]}" if Player.inventory.name[1] >= 5
- puts "#{Player.inventory.qualifier[24]} level #{Player.inventory.name[24]}" if Player.inventory.name[1] >= 21
- puts "#{Player.inventory.qualifier[25]} level #{Player.inventory.name[25]}"
- puts "#{Player.inventory.qualifier[26]} level #{Player.inventory.name[26]}"
- puts "#{Player.inventory.qualifier[27]} level #{Player.inventory.name[27]}"
- puts "#{Player.inventory.qualifier[28]} level #{Player.inventory.name[28]}" if Player.inventory.name[1] >= 41
- puts "#{Player.inventory.qualifier[29]} level #{Player.inventory.name[29]}"
- puts "#{Player.inventory.qualifier[30]} level #{Player.inventory.name[30]}" if Player.inventory.name[1] >= 10
- puts "#{Player.inventory.qualifier[31]} level #{Player.inventory.name[31]}"
- puts "#{Player.inventory.qualifier[32]} level #{Player.inventory.name[32]}"
- end
- when "T"
- puts "You search yourself and try to locate your journal..."
- if File.exists?("Journal-#{Player.my_name}")
- journal_load("Journal-#{Player.my_name}")
- end
- puts "You pull out your Journal..."
- puts "Pages 2-361 are scene logs. Page 1 is your inventory log. Page 361 is your Skills log.\n Pages 362-373 are Skill Tree Specific."
- puts "What page do you wish to read?"
- self_input = ""
- p_sel = 0
- until self_input == "C" do
- self_input = gets.chomp
- case self_input
- when "F"
- p_sel += 1
- when "B"
- p_sel -= 1
- when "C"
- self_input = ""
- break
- else
- p_sel = self_input.to_i
- end
- puts Player.journal.page[p_sel.to_i]
- puts "Page (F)orward | Page (B)ackwards | (C)lose Journal ?"
- self_input = ""
- end
- when "C"
- cur_inventory = ""
- count = 0
- puts "Your inventory:"
- cur_inventory += "#{Player.inventory.name[200]} Health Potion " if Player.inventory.name[200] >= 1
- cur_inventory += "#{Player.inventory.name[201]} Dragon Steak " if Player.inventory.name[201] >= 1
- cur_inventory += "#{Player.inventory.name[202]} " if Player.inventory.name[202] >= 1
- cur_inventory += "#{White_Fish.item_name} " if Player.inventory.name[202] >= 1 && White_Fish.identified == true
- cur_inventory += "Unknown Item " if Player.inventory.name[202] >= 1 && White_Fish.identified == false
- puts cur_inventory
- puts "Enter the item you wish to use... Leave blank for none."
- puts "Type I-(Item Name) to inspect the item..."
- puts "Type ID to identify unknown items."
- inv_sel = gets.chomp
- self_input = ""
- case inv_sel
- ###Inspect item
- when "ID"
- puts "You begin to inspect the unknown items..."
- until White_Fish.identified == true || Player.inventory.name[1] >= 100
- if Player.inventory.name[202] >= 1 && White_Fish.identified == false
- ident = 0
- ident = rand(100)
- if ident <= (Player.inventory.name[25] + 25)
- White_Fish.identified = true
- puts "You identify one object as a White Fish."
- Player.inventory.name[12] += 20
- Player.journal.page[361] += "White Fish identified! Observation EXP increased 20 points!\n"
- else
- Player.inventory.name[12] += 10
- Player.journal.page[361] += "Identification of item failed. Observation EXP increased 10 points.\n"
- end
- end
- end
- when "I-Health Potion"
- puts "Health Potion:"
- if Player.inventory.name[200] > 0
- puts "Adds, #{Potion.health_gain} points of health."
- puts "Adds, #{Potion.attack_bonus} points to attack."
- puts "Weighs, #{Potion.weight} kilogram."
- else
- puts "You don't have any Health Potions."
- end
- when "I-Dragon Steak"
- puts "Dragon Steak:"
- if Player.inventory.name[201] > 0
- puts "Removes, #{Dragon_Steak.fatigue_sub} points of fatigue."
- puts "Adds, #{Dragon_Steak.health_bonus} points of health."
- puts "Weighs, #{Dragon_Steak.weight} kilograms."
- else
- puts "You don't have any Dragon Steaks."
- end
- when "I-White Fish"
- puts "White Fish" if White_Fish.identified == true
- puts "Unknown Item" if White_Fish.identified == false
- if Player.inventory.name[202] >= 1 && White_Fish.identified == true
- puts "Adds, #{White_Fish.health_gain} points of health."
- puts "Removes, #{White_Fish.fatigue_sub} points of Fatigue."
- puts "Weighs, #{White_Fish.weight} kilograms."
- elsif Player.inventory.name[202] >= 1 && White_Fish.identified == false
- puts "You don't know what this does yet..."
- elsif Player.inventory.name[202] <= 0
- puts "You don't have any of those."
- end
- ###Use Item
- when "White Fish"
- if Player.inventory.name[202] > 0
- Player.stats.health_cur += White_Fish.health_gain
- Player.fatigue -= White_Fish.fatigue_sub
- if Player.fatigue < 0
- Player.fatigue = 0
- end
- if Player.health_cur > Player.stats.health_max
- Player.stats.health_cur = Player.stats.health_max
- end
- puts "White Fish identified!" if White_Fish.identified == false
- White_Fish.identified = true
- puts "Your health is now at #{Player.stats.health_cur}!"
- puts "Your attack is now at #{Player.stats.attack}!"
- else
- puts "You don't have any of those."
- end
- when "Health Potion"
- if Player.inventory.name[200] > 0
- Player.stats.health_cur += Potion.health_gain
- Player.stats.attack += Potion.attack_bonus
- if Player.stats.health_cur > Player.stats.health_max
- Player.stats.health_cur = Player.stats.health_max
- end
- puts "Your health is now at, #{Player.stats.health_cur}!"
- puts "Your attack is now at, #{Player.stats.attack}!"
- else
- puts "You have no #{Player.inventory.qualifier[200]}s."
- end
- when "Dragon Steak"
- if Player.inventory.name[201] > 0
- Player.fatigue -= Dragon_Steak.fatigue_sub
- if Player.fatigue < 0.0
- Player.fatigue = 0.0
- end
- puts "Your fatigue level is now at, #{Player.fatigue}!"
- else
- puts "You have no #{Player.inventory.qualifier[201]}s."
- end
- end
- when "S"
- puts "Your current Level is #{Player.level}, your current Experience is at #{Player.cur_exp}."
- puts "Experience required to next Level is, #{Player.exp_to_next_lvl}."
- puts "Your location is (X,Y); #{Player.x_pos}, #{Player.y_pos}"
- self_input =""
- when "V"
- new_game(Player.my_name)
- journal_save("Journal-#{Player.my_name}")
- puts "Saved your information!"
- self_input = ""
- end
- #situation for environment interaction
- case interaction_input
- when "M"
- move_amt = Player.x_pos + 0.5 * ((Player.stride-Player.fatigue) + Player.stats.agility) * 1
- move_ang = 0
- move_ang = (Player.x_pos - Right_Now.x_pos) / (Player.y_pos - Right_Now.x_pos)
- Player.x_pos = move_amt + (0.5 * move_ang * move_ang)
- Player.y_pos = move_amt + (0.5 * move_ang * move_ang)
- puts "You have moved towards the #{Right_Now.enemy_types}."
- puts Player.x_pos
- puts Player.y_pos
- puts Right_Now.x_pos
- puts Right_Now.y_pos
- when "X"
- Battle.number_enemies = Right_Now.seed
- Battle.enemy_type = Right_Now.enemy_types
- Battle.turn = 0
- if Battle.number_enemies > 0
- battle_end = false
- else
- battle_end = true
- end
- if Player.location == 1
- Battle.enemy_health_max = Sea_Dragon.health_max
- Battle.enemy_attack = Sea_Dragon.attack
- Battle.enemy_health_cur = Sea_Dragon.health_cur
- Battle.exp_gain = Sea_Dragon.exp_gain
- end
- if Player.location == 2
- Battle.enemy_health_max = Sea_Farie_Dragon.health_max
- Battle.enemy_attack = Sea_Farie_Dragon.attack
- Battle.enemy_health_cur = Sea_Farie_Dragon.health_cur
- Battle.exp_gain = Sea_Farie_Dragon.exp_gain
- end
- Player.journal.page[Player.location + 1] = "Page 2:\n #{Right_Now.current1_scene};\n #{Player.my_name} had an encounter with #{Battle.enemy_type} at #{Time.now}, #{Player.x_pos}, #{Player.y_pos}." if Player.journal.page[1] == ""
- Player.journal.page[Player.location + 1] += "\n #{Player.my_name} had an encounter with #{Battle.enemy_type} at #{Time.now}, #{Player.x_pos}, #{Player.y_pos}." if Player.journal.page[1] != ""
- puts "Journal Entry added."
- while battle_end == false
- attack_cur = 0
- puts "#{Battle.number_enemies} #{Battle.enemy_type}"
- puts "You have, #{Player.stats.health_cur} of #{Player.stats.health_max} health points."
- puts "The enemy has #{Battle.enemy_health_cur} of #{Battle.enemy_health_max} health points."
- puts "(A) Attack; (R) Run."
- battle_choice = gets.chomp
- case battle_choice
- when "A"
- if Right_Now.seed > 0
- attack_cur = rand(Player.stats.attack) + 0.5
- Player.journal.page[Player.location + 1] += "\n #{Player.my_name} felt very strong and able to defeat the enemy #{Battle.enemy_type} inflicting #{Player.stats.attack / attack_cur} of his full attack on the enemy!"
- Player.journal.page[Player.location + 1] += "\n There was a sound of bone breaking from the enemy!" if (Player.stats.attack / attack_cur) >= 6
- Player.journal.page[Player.location + 1] += "\n There was little effort to harm the enemy in #{Player.my_name}'s attempt!" if (Player.stats.attack / attack_cur) <= 5
- Battle.enemy_health_cur -= attack_cur
- puts "You inflict #{attack_cur} of damage on #{Battle.enemy_type}"
- attack_cur = rand(Battle.enemy_attack) + 0.5
- Player.journal.page[Player.location + 1] += "\n #{Player.my_name} felt freight from the pressence of the enemy #{Battle.enemy_type} as he took #{attack_cur} damage!" if (Battle.enemy_health_cur / Battle.enemy_health_max) >= 0.5
- Player.journal.page[Player.location + 1] += "\n #{Player.my_name} had no fears when recieving #{attack_cur} damage." if Battle.enemy_health_cur / Battle.enemy_health_max <= 0.4
- Player.stats.health_cur -= attack_cur
- puts "#{Battle.enemy_type} inflicts #{attack_cur} of damage on you."
- Player.fatigue += 0.5
- else
- puts "There are no enemies to fight..."
- battle_end = true
- end
- when "R"
- battle_end = true
- interaction_input = ""
- puts "You have ran away."
- battle_choice = ""
- end
- if Battle.enemy_health_cur <= 0
- battle_end = true
- puts "The battle is over..."
- interaction_input = ""
- battle_choice = ""
- Player.journal.page[Player.location + 1] += "\n #{Player.my_name} defeated the enemy #{Battle.enemy_type} at #{Time.now}!"
- Player.cur_exp += Battle.exp_gain
- puts "You gained, #{Battle.exp_gain} experience points."
- item_find = rand(10)
- Right_Now.seed -= 1
- Player.journal.page[Player.location + 1] += "\n Thus clearing #{Right_Now.current1_scene}." if Right_Now.seed == 0
- puts "There are #{Right_Now.seed} enemy #{Battle.enemy_type} left."
- if item_find >= 5
- puts "You found a #{Dragon_Steak.item_name}!"
- op_item(201,1)
- puts "#{Dragon_Steak.item_name} added to inventory."
- Player.journal.page[1] += "\n Inventory Log;\n Dragon Steak added to inventory! \n Dragon Steak now at #{Player.inventory.name[201]}!"
- end
- puts "Journal entry logged."
- end
- if Player.stats.health_cur == 0
- end_game = true
- battle_end = true
- puts "You have died to #{Battle.enemy_type}"
- interaction_input = ""
- battle_choice = ""
- end
- end
- when "Y"
- interaction_input = ""
- puts "You dive to the bottom of the sea at #{Right_Now.depth_water} kilometers."
- puts "You find..."
- breath = 100
- find_suc = 1000
- until breath == 0 or find_suc <= Player.inventory.name[25] do
- item_find = rand(3)
- find_suc = rand(99)
- number_found = rand(4) + 1
- if item_find > 2 && find_suc <= Player.inventory.name[25]
- puts "#{number_found} Health Potions!"
- item_find_indent = "Health Potion"
- if Player.inventory.name[200] >= 32
- puts "You have max #{item_find_ident}."
- else
- op_item(200,number_found)
- puts "#{item_find_ident} added to inventory."
- Player.journal.page[1] = "Page:1" if Player.journal.page[1] == ""
- Player.journal.page[1] += "\n #{Player.my_name} found #{number_found} #{item_find_ident} at #{Right_Now.depth_water} below the surface. #{Time.now}"
- end
- else
- puts "#{Lakmi.my_name}: You know, with some improvement on your Observation Skill you could find some nice things."
- end
- if item_find < 2 && find_suc <= Player.inventory.name[25]
- puts "#{number_found} White Fish!"
- item_find_ident = "White Fish"
- if Player.inventory.name[202] >= 32
- puts "You have max #{item_find_ident}."
- else
- op_item(202,number_found)
- puts "#{item_find_ident} added to inventory."
- Player.journal.page[1] = "Page:1" if Player.journal.page[1] == ""
- Player.journal.page[1] += "\n #{Player.my_name} found #{number_found} #{item_find_ident} at #{Right_Now.depth_water} below the surface. #{Time.now}"
- end
- else
- puts "#{Lakmi.my_name}: You know, with some improvement on your Observation Skill you could find some nice things."
- end
- Player.inventory.name[12] += 10
- breath -= 10
- end
- end
- ###Allocate Fatigue to Human
- Player.fatigue += (Player.stats.stamina / (Player.stats.attack - 10)) * terrain_mult
- Player.fatigue = Player.fatigue.abs
- ###Put system in sleep for 15 seconds
- if sleep_on == true
- sleep 10
- end
- ### Clear the screen and check to see if the Human has leveled up
- level_up = false
- if Player.cur_exp >= Player.exp_to_next_lvl
- level_up = true
- end
- if level_up == true
- Player.level += 1
- Player.exp_to_next_lvl *= 2
- puts "Congratulations!"
- sleep 1
- puts "You have leveled up to Level: #{Player.level}"
- next_lvl = Player.exp_to_next_lvl - Player.cur_exp
- puts "You only need, #{next_lvl} more Experience!"
- end
- if Player.inventory.name[12] >= (100 +(Player.inventory.name[1] * 2))
- Player.inventory.name[12] = 0 if Player.inventory.name[1] < 99
- Player.inventory.name[1] += 1 if Player.inventory.name[1] < 99
- puts "Observation is now level #{Player.inventory.name[1]}!" if Player.inventory.name[1] < 99
- Player.inventory.name[150] += Player.inventory.name[1]
- until Player.inventory.name[150] == 0 do
- puts "#{Player.inventory.qualifier[23]} level #{Player.inventory.name[23]}" if Player.inventory.name[1] >= 5
- puts "#{Player.inventory.qualifier[24]} level #{Player.inventory.name[24]}" if Player.inventory.name[1] >= 21
- puts "#{Player.inventory.qualifier[25]} level #{Player.inventory.name[25]}"
- puts "#{Player.inventory.qualifier[26]} level #{Player.inventory.name[26]}"
- puts "#{Player.inventory.qualifier[27]} level #{Player.inventory.name[27]}"
- puts "#{Player.inventory.qualifier[28]} level #{Player.inventory.name[28]}" if Player.inventory.name[1] >= 41
- puts "#{Player.inventory.qualifier[29]} level #{Player.inventory.name[29]}"
- puts "#{Player.inventory.qualifier[30]} level #{Player.inventory.name[30]}" if Player.inventory.name[1] >= 10
- puts "#{Player.inventory.qualifier[31]} level #{Player.inventory.name[31]}"
- puts "#{Player.inventory.qualifier[32]} level #{Player.inventory.name[32]}"
- skill_choice1 = gets.chomp
- skill_choice1 = skill_choice1.to_i
- case skill_choice1
- when 1
- Player.inventory.name[21] += 1
- puts "Look Around increased!"
- Player.inventory.name[150] -= 1
- when 2
- if Player.inventory.name[1] >= 21
- Player.inventory.name[22] += 1
- puts "Peer Into Soul increased!"
- Player.inventory.name[150] -= 1
- end
- when 3
- Player.inventory.name[23] += 1
- puts "Read Thoughts increased!"
- Player.inventory.name[150] -= 1
- when 4
- Player.inventory.name[24] += 1
- puts "X-Ray Vision increased!"
- Player.inventory.name[150] -= 1
- when 5
- Player.inventory.name[25] += 1
- puts "Underwater Vision increased!"
- Player.inventory.name[150] -= 1
- when 6
- if Player.inventory.name[1] >= 41
- Plater.inventory.name[26] += 1
- puts "Eagle Eyes increased!"
- Player.inventory.name[150] -= 1
- #code
- end
- when 7
- Player.inventory.name[27] += 1
- puts "Star Charting increased!"
- Player.inventory.name[150] -= 1
- when 8
- if PLayer.inventory.name[1] >= 10
- Player.inventory.name[28] += 1
- puts "Fire-Eyes increased!"
- Player.inventory.name[150] -= 1
- #code
- end
- when 9
- Player.inventory.name[29] += 1
- puts "Identify Object increased!"
- Player.inventory.name[150] -= 1
- when 10
- Player.inventory.name[30] += 1
- puts "Observe Sentient increased!"
- Player.inventory.name[150] -= 1
- end
- end
- end
- ###change weather
- ###update Journal file
- journal_save("Journal-#{Player.my_name}")
- ###Move the entities around.
- end
Advertisement
Add Comment
Please, Sign In to add comment