11-01-2013

posted Nov 1, 2013, 4:23 AM by Samuel Konstantinovich   [ updated Nov 1, 2013, 4:23 AM ]
(THIS IS A SIGNIFICANT GROUP PROJECT, SINCE IT INCLUDES YOUR ORIGINAL PROJECT + NEW STUFF) You will recieve a grade, and it will count more than a quiz, less than a test. You are in control over your grade. =)

Due Tuesday morning. Don't wait until Monday!!!
Use the mailing list for questions since I am absent today. 

1.You will learn to use the scanner class to make your simulation interactive.
2. You will make the simulation have more features

1. Look up the scanner class and examples of how it is used. Here is a good place to look: http://docs.oracle.com/javase/7/docs/api/java/util/Scanner.html

2. You already implemented attack. Now you will implement flee, which allows you to run away from the current battle. Use the speed of your character, and the speed of the other character to calculate if you succeed. 

2a. Make a fleeRate(Character c) method that is part of the character class. That returns the % chance you can run away. The flee rate should always be between 5% and 95%. Adjust your flee rate if it is out of bounds. 


2b. You will make a method in your driver class public static void playerCombat(Character p, Character other)
-assume that p is controlled by the player. 
-decide who goes first using the speed of p, and the speed of other. This should be randomized each turn. 
-the other character behaves in 2 ways:
   -health > 25%  attack
   -otherwise flee()
-when it is p's turn, prompt the user: attack, flee. When they type an invalid string, print an error, and ask again.  (this requires the use of the scanner)

3. Implement a leveling system. 
3a-You will write a Character method  boolean needToLevel?() which returns true if the player has enough experience to gain a level. You decide on how much experience is required. 
3b-Write a Character method: levelup() which adds one to the character's level, and adds 2 to all of the character's stats. 
3c-You will allow the player to gain experience after winning a round of combat (display how much experience is gained). You decide how much. 
3d-Anytime a player gains experience, check if they needToLevel?() and levelup() when required. 
3f- Sometimes your attacks to bonus damage, this is called a critical hit. It should happen sometimes, you decide on the mechanics. Your combat message should reflect this bonus damage. 


4. Modify the driver: 
4a-Allow a single random character player to fight 30 random characters. 
4b-Allow the player to control this single character by using the playerCombat() method. 
4c-When a character loses a match, print a disheartening message, but allow them to continue. 
4d-When a player wins, they should be gaining experience because of part 3 of this assignment. 


Comments