Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 1. Make the Entity class abstract.
- Congratulations, Main is now broken!
- change "new Entity()" to "new "Human()" or "new Warrior()" so that it works again. Make sure you leave the Entity types entity. You can still store items of subclasses of Entity into variables of type Entity. That is the point!
- 2. Add and isDark method to the Attack class. Here is the code:
- 3. Create an Interface of type Nocturnal.
- Nocturnal has an abstract method called public void changeMessages();
- Nocturnal creatures only attack at night. They try to hide during the day. But we don't know exactly what they will do in the messages, so it is just abstract.
- 4. Modify the Attack.attack() method so it implements the following:
- If the attacker is an instanceof the Nocturnal class,
- if isDark() is true, then follow the normal attack rules.
- if isDark() is false, and the attacker is nocturnal, then the attacker does not attack and prints the passive message
- If isDark() and the defender is nocturnal, then there is a 50% chance the defender hides from attack, even if the attacker does attack. But there is a 50% chance the attack will be successful. You may need to add a statement about whether the attacker finds the defender.
- 5. Create a Ninja class. Ninja extends Warrior and implements Nocturnal.
- The stats on the Ninja class are identical to Warriors.
- The Messages are different based on whether it is day or night.
- if it is day (Attack.isDark() returns false) the Ninja "fades into the shadows." This would be put in the passive message.
- If it is night the Ninja attacks with one of the following attack messages
- 25% chance the ninja "swings his Ninja sword expertly."
- 25% chance the ninja "shoots a poisoned dart from his blowgun"
- 25% chance the ninja "bashes with his nunhcucks"
- 25% chance the ninja "flings a throwing star"
- 6. Create an Animal class. It is an abstract class. The default statistics should be wolf-like (35kg, fairly aggressive, a biting attack that is somewhat less effective than a human with a sword)
- 7. Create at least two classes that extend Animal. At least one animal should be nocturnal.
- 8. Create a Plant class that is abstract. The default statistics should be for some type of a tree. Use an Oak Tree. The stamina is going to be high, about 2200 KG. It will have nearly 0 strength. A typical plant will not be aggressive.
- 9. Create at least three plants.
- One plant is something like a daisy that is totally harmles and has very low stamina.
- One plant has some type of attack potential, but it is minimal. Perhaps an oak drops acorns or a pine tree drops pine cones. They don't have much strength.
- One plant is highly agressive and Nocturnal.
- 10. Set up contests to check your combatants in rounds of fighting.
Advertisement
Add Comment
Please, Sign In to add comment