I am just starting out with java and I have to make a decision based text game. I keep getting some errors and I feel like I am missing an else or some curly braces somewhere, any help?
import java.util.*;
public class TextGame
{
Scanner scan = new Scanner(System.in);
int health = 100;
int magik = 20;
int strength = 20;
int dexterity = 20;
int bravery = 20;
boolean axe = false;
boolean sword = false;
boolean dragonTrain = false;
boolean dragonClaw = false;
boolean dragonScale = false;
boolean armsAttached = true;
boolean crystal = false;
public void play()
{
scene1();
scene2();
scene3();
}
public void scene1()
{
System.out.println("You wake up. You can't see anything. It's dark, very dark. You turn around");
System.out.println("and see a faint light in the distance. You walk toward it and as you come closer you see");
System.out.println("a door in front of you, with a SWORD far on the left and an AXE far on the right. The door");
System.out.println("begins to close and you have time to grab only one weapon. Which one do you choose?"); //First scene situation
String choice1 = scan.nextLine();
choice1.trim();
if(choice1.equalsIgnoreCase("Axe")) //User picks axe
{
strength = strength + 5;
axe = true;
System.out.println("A smart decision, your strength has increased by 5 as a result.");
}
else if(choice1.equalsIgnoreCase("Sword")) //User picks sword
{
sword = true;
dexterity = dexterity + 5;
System.out.println("A smart decision, your dexterity has increased by 5 as a result.");
}
else //User picks nothing
{
bravery = bravery + 5;
System.out.println("You decide to go on without a weapon. Your bravery increases by 5.");
}
}
public void scene2()
{
System.out.println("You enter the door and see a beautiful landscape covered in rolling hills and sparkling");
System.out.println("blue rivers. Off in the distance you see something flying toward you. As it comes closer");
System.out.println("you realize it is a dragon. Should you FIGHT it, attempt to TRAIN it, or RUN?"); //Second scene situation
String choice2 = scan.nextLine();
choice2.trim();
if(choice2.equalsIgnoreCase("FIGHT")) //User fights
{
if(sword == true || axe == true) //If the user has a weapon
{
System.out.println("It seems that you have a weapon, would you like to use it?");
String weaponAvailable = scan.nextLine();
if(weaponAvailable.equalsIgnoreCase("Yes"))
{
if(sword = true) //User has the sword
{
System.out.println("You throw your sword at the dragon and it comes crashing down. You have killed it.");
System.out.println("You recieved a dragon claw.");
dragonClaw = true;
}
else //User has an axe
{
System.out.println("You strike the dragon with your axe as it lands. You have killed it.");
System.out.println("You recieved a dragon scale.");
dragonScale = true;
}
}
else
{
System.out.println("You punch the dragon square in the face. It starts to cry and flies away.");
}
}
else if(choice2.equalsIgnoreCase("Train"))
{
if(sword == true || axe == true) //If the user has a weapon
{
System.out.println("You mezmerize the dragon with your weapon and it becomes your friend.");
dragonTrain = true;
String weaponAvailable = scan.nextLine();
}
else
{
System.out.println("You wave your arms around and the dragon eats them.");
armsAttached = false;
}
}
else if(choice2.equalsIgnoreCase("Run"))
{
System.out.println("You run away and discover a cave. You find a Crystal!");
System.out.println("All stats increase by 10!");
crystal = true;
health = health + 10;
magik = magik + 10;
strength = strength + 10;
dexterity = dexterity + 10;
bravery = bravery + 10;
}
else
{
System.out.println("You just stand there. The dragon becomes confused and falls into a lake.");
}
}
public void scene3()
{
System.out.println("You continue onward and finally reach an enourmous castle standing in your way.");
System.out.println("The castle seems to consume all light in the area. Darkness fills the air, as");
System.out.println("well as your mind. You continue onward to find yourself confronted with the");
System.out.println("owner of this depressing establishment. With a crown of bones upon his head and");
System.out.println("a sword in his hand, he looks to be the only one there, and the one responsible");
System.out.println("for the lack of luminescence. He signals to you with his hand, pulling you in.");
System.out.println("Should you FIGHT him, JOIN him, or LEAVE?");
String choice3 = scan.nextLine();
if(choice3.equalsIgnoreCase("Fight"))
{
System.out.println("You have chosen to fight him!");
if(dragonTrain = true)
{
System.out.println("Would you like to use your dragon?");
String useDragon = scan.nextLine();
if(useDragon.equalsIgnoreCase("Yes"))
{
System.out.println("Would you also like to use your weapon?");
String useWeapon = scan.nextLine();
if(useWeapon.equalsIgnoreCase("Yes"))
{
if(sword = true)
{
System.out.println("You fly toward the Aphotic King at full speed. He sees you coming and you quickly");
System.out.println("jump off the dragon, sword in hand. The King cannot believe it, but you swiftly");
System.out.println("approach him and slice him in half using your blade. He screams in agony as you"); //Ending using dragon and sword
System.out.println("come to a halt and smoke pours from his body followed by the lost light. The land");
System.out.println("returns to what it once was, and you have completed your journey knowing you have");
System.out.println("made a difference.");
}
else
{
System.out.println("You fly toward the Aphotic King at full speed. The dragon bends down and looks");
System.out.println("down and makes a quick turn, heading for the King. You slide off the dragon's");
System.out.println("back and place your axe directly between the King's eyes. He screams in agony as you"); //Ending using dragon and axe
System.out.println("come to a halt and smoke pours from his body followed by the lost light. The land");
System.out.println("returns to what it once was, and you have completed your journey knowing you have");
System.out.println("made a difference.");
}
} //End if fighting with dragon and weapons
else
{
System.out.println("You fly toward the Aphotic King at full speed. You and the dragon glance at");
System.out.println("each other and although your journey has been short, the bond between you two");
System.out.println("has been like nothing else. You both realize what you must do. You continue");
System.out.println("on your way to the King and crash into him, instantly ending his life, but at"); //Ending using only dragon
System.out.println("the cost of your own, as well as your dragon's. He screams in agony as you");
System.out.println("come to a halt and smoke pours from his body followed by the lost light. The land");
System.out.println("returns to what it once was, and you have completed your journey, as well as your");
System.out.println("life, hopefully with the knowledge that you made a difference.");
}
}
else
{
if(sword = true)
{
System.out.println("You charge toward the Aphotic King, knowing full well you are putting your life");
System.out.println("at risk. As you reach him, you realize how powerful he is, but you do not back down.");
System.out.println("You strike your sword to his and continue doing so until finally he slips up and you"); System.out.println("steal the opportunity and thrust your sword straight into his heart. He falls as you");
System.out.println("realize that you have bested him came out on top. He screams in agony as you");
System.out.println("come to a halt and smoke pours from his body followed by the lost light. The land");
System.out.println("returns to what it once was, and you have completed your journey, knowing you have");
System.out.println("made a difference.");
}
else if(axe = true)
{
System.out.println("You charge toward the Aphotic King, knowing full well you are putting your life");
System.out.println("at risk. As you reach him, you realize how powerful he is, but you do not back down.");
System.out.println("You strike your axe to his sword and continue doing so until finally he slips up and you");
System.out.println("steal the opportunity and throw your axe straight at his face. He falls as you");
System.out.println("realize that you have bested him came out on top. He screams in agony as you");
System.out.println("come to a halt and smoke pours from his body followed by the lost light. The land");
System.out.println("returns to what it once was, and you have completed your journey, knowing you have"); System.out.println("made a difference.");
}
else
{
if(armsAttached = true)
{
if(crystal = true)
{
System.out.println("You charge toward the Aphotic King, knowing full well you are putting your life");
System.out.println("at risk. As you reach him, you realize how powerful he is, but you do not back down.");
System.out.println("You attack him with your bare hands, hoping the crystal helped enough to defeat him.");
System.out.println("You give him a final strike to the head, killing him instantly, and his sword comes");
System.out.println("toward you, but you quickly dodge the object. He screams in agony as you");
System.out.println("come to a halt and smoke pours from his body followed by the lost light. The land");
System.out.println("returns to what it once was, and you have completed your journey, knowing you have");
System.out.println("made a difference");
}
else
{
System.out.println("You charge toward the Aphotic King, knowing full well you are putting your life");
System.out.println("at risk. As you reach him, you realize how powerful he is, but you do not back down.");
System.out.println("You attack him with your bare hands, hoping that they are enough to defeat him.");
System.out.println("You give him a final strike to the head, killing him instantly, however, his sword");
System.out.println("has also pierced your heart, and you both fall. He screams in agony as you");
System.out.println("come to a halt and smoke pours from his body followed by the lost light. The land");
System.out.println("returns to what it once was, and you have completed your journey, as well as your");
System.out.println("life, hopefully with the knowledge that you made a difference.");
}
}
}
}
} //End if fighting using only dragon
else
{
if(sword == true || axe == true)
{
System.out.println("Would you like to use your weapon?");
String useWeaponNoDragon = scan.nextLine();
if(useWeaponNoDragon.equalsIgnoreCase("Yes"))
{
if(sword = true)
{
System.out.println("You charge toward the Aphotic King, knowing full well you are putting your life");
System.out.println("at risk. As you reach him, you realize how powerful he is, but you do not back down.");
System.out.println("You strike your sword to his and continue doing so until finally he slips up and you");
System.out.println("steal the opportunity and thrust your sword straight into his heart. He falls as you");
System.out.println("realize that you have bested him came out on top. He screams in agony as you");
System.out.println("come to a halt and smoke pours from his body followed by the lost light. The land");
System.out.println("returns to what it once was, and you have completed your journey, knowing you have");
System.out.println("made a difference.");
}
else
{
System.out.println("You charge toward the Aphotic King, knowing full well you are putting your life");
System.out.println("at risk. As you reach him, you realize how powerful he is, but you do not back down.");
System.out.println("You strike your axe to his sword and continue doing so until finally he slips up and you");
System.out.println("steal the opportunity and throw your axe straight at his face. He falls as you");
System.out.println("realize that you have bested him came out on top. He screams in agony as you");
System.out.println("come to a halt and smoke pours from his body followed by the lost light. The land");
System.out.println("returns to what it once was, and you have completed your journey, knowing you have");
System.out.println("made a difference.");
}
} //End if fighting using weapon with no dragon
else
{
if(armsAttached = true)
{
if(crystal = true)
{
System.out.println("You charge toward the Aphotic King, knowing full well you are putting your life");
System.out.println("at risk. As you reach him, you realize how powerful he is, but you do not back down.");
System.out.println("You attack him with your bare hands, hoping the crystal helped enough to defeat him.");
System.out.println("You give him a final strike to the head, killing him instantly, and his sword comes");
System.out.println("toward you, but you quickly dodge the object. He screams in agony as you");
System.out.println("come to a halt and smoke pours from his body followed by the lost light. The land");
System.out.println("returns to what it once was, and you have completed your journey, knowing you have");
System.out.println("made a difference");
}
else
{
System.out.println("You charge toward the Aphotic King, knowing full well you are putting your life");
System.out.println("at risk. As you reach him, you realize how powerful he is, but you do not back down.");
System.out.println("You attack him with your bare hands, hoping that they are enough to defeat him.");
System.out.println("You give him a final strike to the head, killing him instantly, however, his sword");
System.out.println("has also pierced your heart, and you both fall. He screams in agony as you");
System.out.println("come to a halt and smoke pours from his body followed by the lost light. The land");
System.out.println("returns to what it once was, and you have completed your journey, as well as your");
System.out.println("life, hopefully with the knowledge that you made a difference.");
}
} //End if fighting with arms
else
{
System.out.println("You charge toward the Aphotic King, knowing full well you are putting your life");
System.out.println("at risk. As you reach him, you realize how powerful he is, but you do not back down.");
System.out.println("You attack him with your feet, repeatedly kicking him in the head with your boots.");
System.out.println("You try to give one final kick in the temple, but he moves out of the way.");
System.out.println("The King strikes you in the head with his sword and you fall. You have come all");
System.out.println("this way, and for what? Your journey ends, as does your life.");
}
} //End if fighting using no weapon and no dragon
}
else
{
if(armsAttached = true)
{
if(crystal = true)
{
System.out.println("You charge toward the Aphotic King, knowing full well you are putting your life");
System.out.println("at risk. As you reach him, you realize how powerful he is, but you do not back down.");
System.out.println("You attack him with your bare hands, hoping the crystal helped enough to defeat him.");
System.out.println("You give him a final strike to the head, killing him instantly, and his sword comes");
System.out.println("toward you, but you quickly dodge the object. He screams in agony as you");
System.out.println("come to a halt and smoke pours from his body followed by the lost light. The land");
System.out.println("returns to what it once was, and you have completed your journey, knowing you have");
System.out.println("made a difference");
}
else
{
System.out.println("You charge toward the Aphotic King, knowing full well you are putting your life");
System.out.println("at risk. As you reach him, you realize how powerful he is, but you do not back down.");
System.out.println("You attack him with your bare hands, hoping that they are enough to defeat him.");
System.out.println("You give him a final strike to the head, killing him instantly, however, his sword");
System.out.println("has also pierced your heart, and you both fall. He screams in agony as you");
System.out.println("come to a halt and smoke pours from his body followed by the lost light. The land");
System.out.println("returns to what it once was, and you have completed your journey, as well as your");
System.out.println("life, hopefully with the knowledge that you made a difference.");
}
} //End if fighting with arms
else
{
System.out.println("You charge toward the Aphotic King, knowing full well you are putting your life");
System.out.println("at risk. As you reach him, you realize how powerful he is, but you do not back down.");
System.out.println("You attack him with your feet, repeatedly kicking him in the head with your boots.");
System.out.println("You try to give one final kick in the temple, but he moves out of the way.");
System.out.println("The King strikes you in the head with his sword and you fall. You have come all");
System.out.println("this way, and for what? Your journey ends, as does your life.");
}
}
} //End if fighting with no weapon or dragon
}
} //End "Fight" option
else if(choice3.equalsIgnoreCase("Join"))
{
System.out.println("You have chosen to join him!");
if(dragonTrain = true)
{
System.out.println("Would you like to show off your dragon?");
String useDragon = scan.nextLine();
if(useDragon.equalsIgnoreCase("Yes"))
{
System.out.println("Would you also like to show off your weapon?");
String useWeapon = scan.nextLine();
if(useWeapon.equalsIgnoreCase("Yes"))
{
if(sword = true)
{
System.out.println("You fly toward the Aphotic King, sword in hand. He sees you coming and is very");
System.out.println("impressed by your abilities and dexterity. You land down upon the dark ground");
System.out.println("and he offers his hand, which you proudly shake. He requests that you train his"); //Ending joining using dragon and sword
System.out.println("army in the art of sword fighting and dragon flying and that you become his general.");
System.out.println("You gladly accept and start your journey of evils upon humanity.");
}
else
{
System.out.println("You fly toward the Aphotic King, sword in hand. He sees you coming and is very");
System.out.println("impressed by your abilities and strength. You land down upon the dark ground");
System.out.println("and he offers his hand, which you proudly shake. He requests that you train his"); //Ending joining using dragon and axe
System.out.println("army in the art of axe fighting and dragon flying and that you become his general.");
System.out.println("You gladly accept and start your journey of evils upon humanity.");
}
} //End if joining with dragon and weapons
else
{
System.out.println("You fly toward the Aphotic King, sword in hand. He sees you coming and is very");
System.out.println("impressed by your abilities and strength. You land down upon the dark ground");
System.out.println("and he offers his hand, which you proudly shake. He requests that you train his"); //Ending joining using dragon only
System.out.println("army in the art of dragon flying and that you become his general. You gladly accept");
System.out.println("and start your journey of evils upon humanity.");
}
}
else
{
if(sword == true || axe == true)
{
System.out.println("Would you like to use your weapon?");
String useWeaponNoDragon = scan.nextLine();
if(useWeaponNoDragon.equalsIgnoreCase("Yes"))
{
if(sword = true)
{
System.out.println("You charge toward the Aphotic King, knowing full well you are putting your life");
System.out.println("at risk. As you reach him, you realize how powerful he is, and admire him.");
System.out.println("You strike your sword to his and continue doing so until finally he slips up and you");
System.out.println("tell him you wish to join his side in order to remove all light from the world.");
System.out.println("He offers his hand, which you proudly shake. He requests that you train his"); //Ending joining using dragon only
System.out.println("army in the art of sword fighting and that you become his general. You gladly accept");
System.out.println("and start your journey of evils upon humanity.");
}
else
{
System.out.println("You charge toward the Aphotic King, knowing full well you are putting your life");
System.out.println("at risk. As you reach him, you realize how powerful he is, and admire him.");
System.out.println("You strike your axe to his and continue doing so until finally he slips up and you");
System.out.println("tell him you wish to join his side in order to remove all light from the world.");
System.out.println("He offers his hand, which you proudly shake. He requests that you train his"); //Ending joining using dragon only
System.out.println("army in the art of axe fighting and that you become his general. You gladly accept");
System.out.println("and start your journey of evils upon humanity.");
}
} //End if fighting using weapon with no dragon
else
{
if(armsAttached = true)
{
if(crystal = true)
{
System.out.println("You charge toward the Aphotic King, knowing full well you are putting your life");
System.out.println("at risk. As you reach him, you realize how powerful he is, and admire him.");
System.out.println("You attack him with your bare hands, hoping the crystal made you strong enough.");
System.out.println("You strike your fist to his side and continue doing so until finally he slips up and you");
System.out.println("tell him you wish to join his side in order to remove all light from the world.");
System.out.println("He offers his hand, which you proudly shake. He requests that you train his"); //Ending joining using dragon only
System.out.println("army in the art of boxing and that you become his general. You gladly accept");
System.out.println("and start your journey of evils upon humanity.");
}
else
{
System.out.println("You charge toward the Aphotic King, knowing full well you are putting your life");
System.out.println("at risk. As you reach him, you realize how powerful he is, and admire him.");
System.out.println("You attack him with your bare hands, hoping that you are strong enough.");
System.out.println("You strike your fist to his side and continue doing so until finally you stop.");
System.out.println("His word has pierced your heart. He tells you you are not strong enough and");
System.out.println("you realize your journey was a waste as you pass away."); //Ending joining using dragon only
}
} //End if fighting with arms
else
{
System.out.println("You charge toward the Aphotic King, knowing full well you are putting your life");
System.out.println("at risk. As you reach him, you realize how powerful he is, but you do not back down.");
System.out.println("You attack him with your feet, repeatedly kicking him in the head with your boots.");
System.out.println("You try to give one final kick in the temple, but he moves out of the way.");
System.out.println("The King strikes you in the head with his sword and you fall. You have come all");
System.out.println("this way, and for what? Your journey ends, as does your life.");
}
} //End if fighting using no weapon and no dragon
}
}
} //End if fighting using only dragon
else
{
if(sword == true || axe == true)
{
System.out.println("Would you like to use your weapon?");
String useWeaponNoDragon = scan.nextLine();
if(useWeaponNoDragon.equalsIgnoreCase("Yes"))
{
if(sword = true)
{
System.out.println("You charge toward the Aphotic King, knowing full well you are putting your life");
System.out.println("at risk. As you reach him, you realize how powerful he is, and admire him.");
System.out.println("You strike your sword to his and continue doing so until finally he slips up and you");
System.out.println("tell him you wish to join his side in order to remove all light from the world.");
System.out.println("He offers his hand, which you proudly shake. He requests that you train his"); //Ending joining using dragon only
System.out.println("army in the art of sword fighting and that you become his general. You gladly accept");
System.out.println("and start your journey of evils upon humanity.");
}
else
{
System.out.println("You charge toward the Aphotic King, knowing full well you are putting your life");
System.out.println("at risk. As you reach him, you realize how powerful he is, and admire him.");
System.out.println("You strike your axe to his and continue doing so until finally he slips up and you");
System.out.println("tell him you wish to join his side in order to remove all light from the world.");
System.out.println("He offers his hand, which you proudly shake. He requests that you train his"); //Ending joining using dragon only
System.out.println("army in the art of axe fighting and that you become his general. You gladly accept");
System.out.println("and start your journey of evils upon humanity.");
}
} //End if fighting using weapon with no dragon
else
{
if(armsAttached = true)
{
if(crystal = true)
{
System.out.println("You charge toward the Aphotic King, knowing full well you are putting your life");
System.out.println("at risk. As you reach him, you realize how powerful he is, and admire him.");
System.out.println("You attack him with your bare hands, hoping the crystal made you strong enough.");
System.out.println("You strike your fist to his side and continue doing so until finally he slips up and you");
System.out.println("tell him you wish to join his side in order to remove all light from the world.");
System.out.println("He offers his hand, which you proudly shake. He requests that you train his"); //Ending joining using dragon only
System.out.println("army in the art of boxing and that you become his general. You gladly accept");
System.out.println("and start your journey of evils upon humanity.");
}
else
{
System.out.println("You charge toward the Aphotic King, knowing full well you are putting your life");
System.out.println("at risk. As you reach him, you realize how powerful he is, and admire him.");
System.out.println("You attack him with your bare hands, hoping that you are strong enough.");
System.out.println("You strike your fist to his side and continue doing so until finally you stop.");
System.out.println("His word has pierced your heart. He tells you you are not strong enough and");
System.out.println("you realize your journey was a waste as you pass away."); //Ending joining using dragon only
}
} //End if joinging with arms
else
{
System.out.println("You charge toward the Aphotic King, knowing full well you are putting your life");
System.out.println("at risk. As you reach him, you realize how powerful he is, but you do not back down.");
System.out.println("You attack him with your feet, repeatedly kicking him in the head with your boots.");
System.out.println("You try to give one final kick in the temple, but he moves out of the way.");
System.out.println("The King strikes you in the head with his sword and you fall. You have come all");
System.out.println("this way, and for what? Your journey ends, as does your life.");
}
} //End if joining using no weapon and no dragon
}
}
else
{
if(armsAttached = true)
{
if(crystal = true)
{
System.out.println("You charge toward the Aphotic King, knowing full well you are putting your life");
System.out.println("at risk. As you reach him, you realize how powerful he is, and admire him.");
System.out.println("You attack him with your bare hands, hoping the crystal made you strong enough.");
System.out.println("You strike your fist to his side and continue doing so until finally he slips up and you");
System.out.println("tell him you wish to join his side in order to remove all light from the world.");
System.out.println("He offers his hand, which you proudly shake. He requests that you train his"); //Ending joining using dragon only
System.out.println("army in the art of boxing and that you become his general. You gladly accept");
System.out.println("and start your journey of evils upon humanity.");
}
else
{
System.out.println("You charge toward the Aphotic King, knowing full well you are putting your life");
System.out.println("at risk. As you reach him, you realize how powerful he is, and admire him.");
System.out.println("You attack him with your bare hands, hoping that you are strong enough.");
System.out.println("You strike your fist to his side and continue doing so until finally you stop.");
System.out.println("His word has pierced your heart. He tells you you are not strong enough and");
System.out.println("you realize your journey was a waste as you pass away."); //Ending joining using dragon only
}
} //End if joinging with arms
else
{
System.out.println("You charge toward the Aphotic King, knowing full well you are putting your life");
System.out.println("at risk. As you reach him, you realize how powerful he is, but you do not back down.");
System.out.println("You attack him with your feet, repeatedly kicking him in the head with your boots.");
System.out.println("You try to give one final kick in the temple, but he moves out of the way.");
System.out.println("The King strikes you in the head with his sword and you fall. You have come all");
System.out.println("this way, and for what? Your journey ends, as does your life.");
}
}
}
else
{
if(dragonTrain = true)
{
System.out.println("You attempt to flee with your dragon, however, the Aphotic King sees");
System.out.println("your feeble attempt and launches his sword at you. You die instantly,");
System.out.println("and as a coward.");
}
else
{
System.out.println("You attempt to run away, however, the Aphotic King sees");
System.out.println("your feeble attempt and launches his sword at you. You die instantly,");
System.out.println("and as a coward.");
}
}
}
}