3-B: Monster Project
Monster Battle Game - Project Assignment
Overview
Enhance your game by implementing monster special abilities and customizing the 4th action button. Make your game feel complete and polished!
Part 1: Monster Special Abilities (Required)
Goal: When monsters attack, check if they have special abilities and trigger unique effects.
Where to work: In the monsterAttack() method, after damage is dealt.
Steps:
Check each attacking monster's
special()ability (it returns a String)If the ability is not empty, add custom behavior based on the ability name
Display appropriate messages for each special ability
Example Pattern:
// After monster deals damage...
if (!monster.special().isEmpty()) {
if (monster.special().equals("Vampire")) {
// TODO: Monster heals itself for some of the damage dealt
// Hint: Use a variable to track damage before dealing it
}
else if (monster.special().equals("Poison")) {
// TODO: Add poison effect that damages over time
}
// Add more special abilities!
}Possible Special Abilities to Implement:
Vampire: Heals for 50% of damage dealt
Poison: Deals 5 extra damage for the next 2 turns
Rage: Increases damage by 25% when below 50% health
Thorns: Player takes 10 damage back when attacking this monster
Regeneration: Heals 10 HP at the end of each turn
Stun: Player misses their next turn (skip next action)
Tips:
You may need instance variables to track ongoing effects (like poison duration)
Update the
setupGame()to create monsters with different special abilitiesTest each ability one at a time
Part 2: Customize the 4th Button (Choose One)
Option A: Implement Use Item System
Make the 4th button use consumable items from your inventory.
Tasks:
Create health potions in
setupGame()(seeGameDemo.javafor examples)The
useItem()method already works - just add items!Create 2-3 different item types:
Health Potion: Heals 30 HP
Bomb: Damages all monsters for 20 HP
Shield Potion: Adds temporary shield
Your own creative item!
Option B: Implement Player Special Abilities
Replace "Use Item" with a unique special ability for each character class.
Tasks:
Change button label in
setupGame()to "Special"Add a
useSpecial()method with unique abilities per class:Fighter: Berserker Rage - Double damage for 2 turns
Tank: Iron Wall - Block all damage next turn
Healer: Group Heal - Heal 50 HP (cooldown: 3 turns)
Ninja: Shadow Strike - Attack all monsters for half damage
Track cooldowns to prevent spam (add instance variable)
Update
handlePlayerAction(3)to call your new method
Cooldown Pattern:
private int specialCooldown = 0; // Instance variable
private void useSpecial() {
if (specialCooldown > 0) {
gui.displayMessage("Special ability on cooldown! (" + specialCooldown + " turns)");
return;
}
// Do special ability...
specialCooldown = 3; // Set cooldown
}
// In gameLoop(), reduce cooldown each turn:
if (specialCooldown > 0) specialCooldown--;Part 3: Polish Your Game (Required)
Make your game feel professional and complete!
Required Improvements:
Victory Conditions: Display final stats when game ends (turns survived, damage dealt, etc.)
Better Targeting: Let player choose which monster to attack (hint: show monster numbers in message)
Status Display: Show active effects in messages (poison status, shield amount, cooldowns)
Balance Testing: Adjust character stats so all classes are viable
Bug Fixes: Ensure health can't go above max, shield doesn't go negative, etc.
Optional Enhancements:
Add more monster types with different stat ranges
Create boss monsters with multiple special abilities
Add difficulty scaling (monsters get stronger each wave)
Implement combo attacks (bonus damage for consecutive attacks)
Add critical hit chances
Create a scoring system
Add sound descriptions in messages ("💥 CRASH!", "✨ SPARKLE!")
Submission Checklist
Tips for Success
Test frequently: Run your game after each small change
Start simple: Get one special ability working perfectly before adding more
Use print statements: Add
System.out.println()to debug issuesStudy GameDemo.java: It shows many useful patterns
Ask for help: If stuck for 10+ minutes, ask a classmate or teacher
Be creative: Add your own unique abilities and features!
Example Monster Creation with Specials
// In setupGame(), create diverse monsters:
monsters.add(new Monster("Vampire"));
monsters.add(new Monster("Poison"));
monsters.add(new Monster("Rage"));
monsters.add(new Monster()); // Normal monster
monsters.add(new Monster()); // Normal monsterLast updated
Was this helpful?