Assignment # 45 and Adventure

Code

    /// Name: Tommy Oyuntseren
    /// Period: 7
    /// Program Name: Adventure
    /// File Name: Adventure.java
    /// Date: 11/16/2015

import java.util.Scanner;

public class Adventure
{
    public static void main(String[] args)
    {
        byte type = 99;
        Scanner keyboard = new Scanner(System.in);
        
        System.out.println( "Welcome to the Tommy's Awesome Adventure!!!" );
        
        System.out.println( "You are an adventure seeker wandering the Middle-earth." );
        System.out.println( "You are chased by orcs and have to hide.");
        System.out.println( "You see a \"cave\" and a \"grove\", where would you hide?");
        String answer = keyboard.next();
        
        switch (answer)
        {
            case "cave": type = 0;
                break;
            case "grove": type = 1;
                break;
            default: type = 99; 
        }
        
        if (type==0)
        {
            System.out.println( "You enter the cave, which turned out to be nasty and musty." );
            System.out.println( "You spot a giant spider on the ceiling.");
            System.out.println( "Would you silently \"escape\" or \"attack\" the spider?");
            answer = keyboard.next();
            
            switch (answer)
            {
                case "escape": type = 0;
                    break;
                case "attack": type = 1;
                    break;
                default: type = 99;
            }
           
            if (type==0)
            {
                System.out.println( "You run out of the cave, but the orcs are there." );
                System.out.println( "You are surrounded and can't run away.");
                System.out.println( "Would you \"attack\" the orcs or try to \"talk\" your way out?");
                answer = keyboard.next();
                
                switch (answer)
                {
                    case "attack": type = 0;
                        break;
                    case "talk": type = 1;
                        break;
                    default: type = 99;
                }
                
                if (type==0)
                {
                    System.out.println( "You fight like a champion, but you are outnumbered." );
                    System.out.println( "At last, you receive a fatal blow with an ax and die.");
                    System.out.println( "You lost, but thanks for playing anyway!!");
                    type = 99;
                }
                
                if (type==1)
                {
                    System.out.println( "You try to convince the orcs not to kill you." );
                    System.out.println( "But all the creatures want is to taste some human meat, so they attack and kill you.");
                    System.out.println( "You lost, but thanks for playing anyway!!!");
                    type = 99;
                }
            }
            
            
            if (type==1)
            {
                System.out.println( "You decide to attack and kill the spider." );
                System.out.println( "Would you charge at the monster with a \"sword\", or snipe it with your \"bow\"?");
                answer = keyboard.next();
                
                switch (answer)
                {
                    case "sword": type = 0;
                        break;
                    case "bow": type = 1;
                        break;
                    default: type = 99;
                }
                
                if (type==0)
                {
                    System.out.println( "You charge at the spider with your sword" );
                    System.out.println( "The creature only pretended to be sleeping, it jumps at you and bites you with its poisonous fangs.");
                    System.out.println( "You lost, but thanks for playing anyway!!!");
                    type = 99;
                }
                
                if (type==1)
                {
                    System.out.println( "You draw your bow, take a good aim and the spider drops dead, pierced with an arrow." );
                    System.out.println( "You hide in the cave while the orcs searched the area, and then safely flee home.");
                    System.out.println( "You won the game, congrats!!!");
                    type = 99;
                }
            }
            
            
        }
        
        if (type==1)
        {
            System.out.println( "You enter the grove, which contanins some climable trees." );
            System.out.println( "You are in desperation to hide.");
            System.out.println( "Would you \"climb\" a tree or \"hide\" in the underbrush?");
            answer = keyboard.next();
            
            switch (answer)
            {
                case "climb": type = 0;
                    break;
                case "hide": type = 1;
                    break;
                default: type = 99;
            }
           
            if (type==0)
            {
                System.out.println( "As soon you climb the tree, orcs appear in the grove." );
                System.out.println( "Orcs split up and search the grove for you.");
                System.out.println( "One of them scans the trees, so he will expose you soon, but you have a dagger.");
                System.out.println( "Would you throw the \"dagger\", risking to expose yourself, or hide in the \"leaves\"?");
                answer = keyboard.next();

                switch (answer)
                {
                    case "dagger": type = 0;
                        break;
                    case "leaves": type = 1;
                        break;
                    default: type = 99;
                }
                
                if (type==0)
                {
                    System.out.println( "You throw the dagger right into orc's eye, immediately killing him." );
                    System.out.println( "Other orcs are scared, since they do not know where the danger came from, so they flee from the grove.");
                    System.out.println( "You won the game, congrats!!!");
                    type = 99;
                }
                
                if (type==1)
                {
                    System.out.println( "You hide in the leaves, but eventually the orc spots you and shouts for his comrades" );
                    System.out.println( "Orcs cut down the tree and kill you.");
                    System.out.println( "You lost, but thanks for playing anyway!!!");
                    type = 99;
                }
            }
            
            
            if (type==1)
            {
                System.out.println( "You decide to hide in the underbrush." );
                System.out.println( "Orcs appear in the grove and start to search it for you, until they discover you behind the bush." );
                System.out.println( "Would you \"attack\" the orcs or try to \"talk\" your way out?");
                answer = keyboard.next();
                
                switch (answer)
                {
                    case "attack": type = 0;
                        break;
                    case "talk": type = 1;
                        break;
                    default: type = 99;
                }
                
            }
            
            
        }
        
    }
}
    
   
  

Picture of the output

Assignment 45