##Turn based ruby game =begin GOAL Write a simple game that allows the user and the computer to take turns selecting moves to use against each other. Both the computer and the player should start out at the same amount of health (such as 100), and should be able to choose between the three moves: The first move should do moderate damage and has a small range (such as 18-25). The second move should have a large range of damage and can deal high or low damage (such as 10-35). The third move should heal whoever casts it a moderate amount, similar to the first move. After each move, a message should be printed out that tells the user what just happened, and how much health the user and computer have. Once the user or the computer's health reaches 0, the game should end. SUBGOALS When someone is defeated, make sure the game prints out that their health has reached 0, and not a negative number. When the computer's health reaches a set amount (such as 35%), increase it's chance to cast heal. Give each move a name. - Create player/ai - create health and attack - create game_loop - add dice roles - add attacks and hp system player need to be able to attack AI and vice versa =end class Super_char attr_accessor :name, :description, :attacks, :max_hp, :hp def initialize(name, description, max_hp) @name = name @description = description @attacks = attacks @max_hp @hp = max_hp end attacks_hashes = { :power_attack => 50, :quick_attack => 20, :multiple_attack => 5 } def string_hash attack_hashes.str end def heal_func [{:high_chance => 20, :Low_chance => 50}] end end class Player < Super_char def attack_choice loop do puts "which attack should we use? \n" puts attack_hashes attack = gets.chomp if attack = attack_hashes.keys[0] puts "you have selected #{attack_hashes.keys[0]} " break else break end end end end class AI < Super_char def attack_choice puts "attack choice" end end Player_01 = Player.new("player1", "player 1 descript", "100") puts Player_01.inspect AI_01 = AI.new("AI 01", "AI 01 descript", "101") puts AI_01.inspect