Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- import java.util.Random;
- import java.lang.*;
- //legend: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = where i left off last
- public class Game {
- public static void main(String args[]) {
- // text game attempt 1
- Scanner scan = new Scanner(System.in);
- Random rand = new Random();
- //health define
- int health;
- health = 100;
- //END health
- //damage define
- int dmg;
- dmg = 10;
- //END damage
- //shield define
- int shield;
- shield = 10;
- //END shield
- //bandos
- int bandages = 0;
- //end bandos
- //ENEMY HEALTH ENEMY HEALTH
- int enemyhealth = 20;
- //END ENEMY HEALTH
- //ENEMY DAMAGE ENEMY DAMAGE
- int enemydmg = 12;
- //END ENEMY DAMAGE
- //BASE DAMAGE
- int basedmg = 0;
- //END BASE DAMAGE
- //ENEMY HEALTH MULTIPLYER
- int healthmultiplyer = 4;
- //END ENEMY HEALTH MULTIPLYER
- //ENEMY DAMAGE MULTIPLYER
- int damagemultiplyer = 0;
- //END ENEMY DAMAGE MULTIPLYER
- // START STORY
- System.out.println("Hello, and welcome to the battle arena");
- System.out.println("");
- System.out.println("What is your name, fighter?");
- System.out.println("");
- //name define
- //---->
- String name = scan.nextLine();
- System.out.println("");
- System.out.println("Nice to meet you " + name + ", now lets get to work. I'll show you how to fight");
- //start tutorial
- //make this into a thing that prints when the player does /help. make a class or something
- System.out.println("");
- System.out.println("This game will work in turns, so each time the game prompts you to type, you will have to make a choice.");
- System.out.println("");
- System.out.println("--------------------------------------------------");
- System.out.println("");
- //START CONTROLS TUTORIAL
- System.out.println("You can say \"attack\", to attack the enemy ");
- System.out.println("");
- System.out.println("You can say \"search\", to search your surroundings for useful materials ");
- System.out.println("");
- System.out.println("You can say \"heal\", to use any heals that you have in your inventory (you can not heal past 100 health)");
- System.out.println("");
- //END CONTROLS TUTORIAL
- System.out.println("This game works in turns, so you will make an action and then the enemy will respond. Each match with an enemy is 10 rounds,");
- System.out.println("so you only have 10 moves to defeat your enemy");
- System.out.println("");
- //end tutorial
- //SWITCHES
- int search = rand.nextInt(4) + 1;
- String searchResult = "";
- switch(search){
- case 1: searchResult = "You found a rock! + 3 damage to all attacks!";
- dmg = dmg + 3;break;
- case 2: searchResult = "You found bandages! They can heal you 15";
- bandages = bandages + 1;break;
- case 3: searchResult = "You found a sheild potion! + 10 shield!";
- shield = shield + 10;break;
- case 4: searchResult = "You found a stick! + 2 damage to all attacks!";
- dmg = dmg + 2;break;
- }
- int enemyswitch = rand.nextInt(8) + 1;
- String enemyType = "";
- switch(enemyswitch){
- case 1: enemyType = "baby dragon";break;
- case 2: enemyType = "smelly imp";break;
- case 3: enemyType = "skeleton warrior";break;
- case 4: enemyType = "spider";break;
- case 5: enemyType = "mage";break;
- case 6: enemyType = "quick archer";break;
- case 7: enemyType = "rouge assasin";break;
- case 8: enemyType = "smelly ogre";break;
- }
- //END SWITCHES
- //continue story
- System.out.println("");
- System.out.println("--------------------------------------------------");
- System.out.println("Now that you know the basics, lets do our first battle.");
- System.out.println("--------------------------------------------------");
- int rnd = 1; // DEFINE ROUND
- //end session
- int enemykills = 1;
- while (rnd < 10) {
- System.out.println("");
- System.out.println("Round " + Integer.toString(rnd));
- // use this ^ for toString
- System.out.println("");
- System.out.println("Your enemy is a " + enemyType +", and has " + enemyhealth + "hp, you have the choice to either attack, search, or heal");
- String round1;
- System.out.println("");
- round1 = scan.nextLine();
- System.out.println("");
- if (round1.equalsIgnoreCase("attack"))
- {
- enemyhealth = enemyhealth - dmg;
- System.out.println("You did "+ dmg + " damage to the " + enemyType + "! They now have " + enemyhealth + "hp!");
- //System.out.println(enemy1); //enemy1 = enemy's health
- }else if (round1.equalsIgnoreCase("search"))
- {
- //System.out.println(search); prints the number for the case result
- System.out.println(searchResult);
- }else if (round1.equalsIgnoreCase("heal"))
- {
- if (bandages > 0 && health < 100)
- {
- bandages = bandages - 1;
- health = health + 15;
- if (health > 100)
- {
- health = 100;
- }
- System.out.println("Your bandage healed you 15hp! You now have " + health + "hp!");
- } else
- {
- if (bandages > 0)
- {
- System.out.println("Cannot use bandages, your health is already 100!");
- }else
- {
- System.out.println("Sorry, you don't have any bandages");
- }
- }
- }
- System.out.println("--------------------------------------------------");
- System.out.println("Now the " + enemyType + " will act in response.");
- System.out.println("--------------------------------------------------");
- System.out.println("");
- basedmg = Math.abs(shield - enemydmg);
- // Math.abs makes the absolute value of something ()
- shield = shield - enemydmg;
- if (shield < 1){
- shield = 0;
- }
- health = health - basedmg;
- System.out.println("The " + enemyType + " attacks! It does " + enemydmg + " damage to you! You now have " + shield + " shield, and " + health + " health.");
- System.out.println("");
- System.out.println("This is the end of round " + Integer.toString(rnd) + ".");
- rnd = rnd + 1;
- if (enemyhealth < 1){ // if the enemy is dead
- healthmultiplyer = healthmultiplyer + 4;
- damagemultiplyer = damagemultiplyer + 3;
- System.out.println("");
- System.out.println("You killed the enemy! It took you " + (rnd - 1) + " rounds!");
- System.out.println("");
- rnd = 1;
- enemyhealth = 20;
- enemydmg = enemydmg + damagemultiplyer;
- enemyhealth = enemyhealth + healthmultiplyer;
- enemykills = enemykills + 1;
- System.out.println("Enemy " + enemykills);
- }
- //ENEMY BEING BUFFED
- //enemydmg = enemydmg + 3;
- //enemyhealth = enemyhealth + 4;
- }
- }
- } // make it so that each round is a method, at the end of the round, the variable rndNumber += 1, and the enemy health is randomized plus 5 % health and damage.
- //make a variable called hasweapon, and if you pick up a weapon, add to damage, and set hasweapon = 1. if you are trying to pick up another weapon, if hasweapon = 1, print "you cant take another"
- //aug 31, next step is to make it endless, rnd is t
- //Sept 17, its endless, now make it so when the enemy dies, something happens. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Add Comment
Please, Sign In to add comment