Contact me
Home About me Projects Resume Art Portfolio Articles LinkedIn

PROJECTS

Wizard Battle


Date: April 2023 | Author(s): Sydney Tsin

Wizard Battle is a Game that allows a Player to play a Wizard and unlock three other Wizards to fight off Monsters in a turn-based RPG-style battle. There are three types of Monsters from level 1 to level 3 difficulty and the final boss.

Link to Wizard Battle in Github

Demo of Wizard Battle in JApplet.

Languages and tools used: JApplet, BlueJ, Java, Procreate

A Player can increase the level of a Wizard by +1 after defeating three level 1 Monsters defeating two level 2 Monsters , or one level 3 Monster. Each Monster has its own vulnerabilities to certain elemental types and resistances. A Player can take a possibility of 6 actions during a battle: swap Wizard, check vulnerability, check resistance, use a special skill, skip a turn, or forfeit; however, they can only choose one. The Monster will still attack regardless of the action they take during their turn. They can also use their special skill which will cause a Monster to be vulnerable to a specific element at level 4. When hit with an elemental type a Monster is vulnerable to, they will deal double damage. When hit with an elemental type a Monster is resistant to, they will deal half damage.
A Wizard can have a level from 1-5. Each Wizard can cast Spells of a specific elemental type. Each wizard has three Spells: a level 1 Spell, a level 2 Spell, and a level 3 Spell. The Player has access to their level 1 Spell from levels 1-5, level 2 Spells from 2-5, and level 3 Spells from 4-5. A Wizard can only cast a level 3 Spell twice per battle, a level 2 Spell three times per battle, and a level 1 Spell as many times as they want. The Spells are stored in a type-specific ArrayList called SpellBook and will reset every time a new Battle starts. The ArrayList will contain the number of level 2 and level 3 Spells that the Player is allowed to use that round. If the player has not unlocked level 3 Spells, then there will be no level 3 Spells in the ArrayList. Since the Player can use as many level 1 Spells as they want, they are not included in the ArrayList. I will use sequential search to locate and remove the proper Spell from the ArrayList. Damage will be calculated using the random() method from the Math Class and will be stored in the Wizard class.
A Player will fight 10 battles of Monsters before reaching the final boss. A player may deploy one Wizard at a time and will fight against a maximum of three Monsters at a time. The Battle class will contain information about the levels and if the Player knows any of the vulnerabilities or weaknesses of any of the deployed Monsters . If the Player knows any of the vulnerabilities of the Monsters on the Field, The Battle class will contain an array of booleans which will be true if the Player is on that level and will turn false after they beat it. The battle will loop switching between who’s turn it is during the battle until all Monsters or all Wizards are dead. The Wizards that are not being used have their HP (hit points) while another Wizard is deployed but their level does not increase. If a Player has found out the vulnerabilities or resistances of a Monster during a previous level, they will be notified before the battle starts and before they choose their Wizard to deploy to battle. If a Wizard dies in battle they will be able to be revived once per round. If a Wizard falls, the Player can choose to revive the Wizard to full health and continue the battle where they left off or deploy a different Wizard. The final boss battle will allow the Player to deploy all Wizards at full health and at the levels they finished at. The final boss does not have any vulnerabilities and will have increased HP and attack damages. Defeating the final boss will result in a win and the game will end.

Class Descriptions

Character is an interface that has the methods for a Wizard and a Monster.
A Wizard is a class that implements the Character interface. A Wizard has an HP, elemental class, level, Spells, life status, special skill, Spell slots, and deployed status. There are four elemental classes for each Wizard: fire, ice, necrotic, and radiant. The starter Wizard will be a fire elemental, second ice, third necrotic, and fourth radiant. A Wizard can have a level from 1-5 (HP scaling in the table below). Every time a Wizard drops a Monster’s HP to 0, their level increases based on the chart below. Every time a Wizard is hit, they take damage and it is subtracted from their total HP. If a Wizard’s HP drops to 0, their life status is changed and they can revive a Wizard once every battle. If they have already revived a Wizard during that battle, they will no longer be able to deploy that Wizard until the next battle. At the final battle, all four Wizards will be deployed at full health and will fight at whatever level the Player increased them by. A Wizard can only cast a level 3 Spell twice per battle, a level 2 Spell three times per battle, and a level 1 Spell as many times as they want.
A Spell has an elemental type, max and min damage, and level. Spells can have a level 1-3. The damage range of Spells is specified in the tables below. A Spell can have an elemental type of fire, ice, necrotic, and radiant.
A Monster has a level, vulnerability, resistance, HP, attacks, life status, and deployed status. A Monster can have a level of 1-3 except for the final boss which has a level of 10 (HP scaling in the table below). A Monster will also have 1 vulnerability and 1 resistance (specified in the table below). If a Monster is hit with an attack with an elemental type they are vulnerable to, they will receive double damage. If a Monster is hit with an attack with an elemental type they are resistant to, they will receive half the damage. The Player is not notified if a Monster is hit with an attack they are vulnerable or resistant to unless they use their action to check it. If a Monster’s HP drops to 0, its life status and deployed status are updated and the Player’s level is increased accordingly (HP and level increase specified below). The Monster will attack the active Wizard after the Player takes an action regardless of what action they take (attack scaling specified in the table below). A Monster does not have an elemental attack type and only does basic slashing attacks.
The Player has a type-specific ArrayList of Wizards . The Player will start off with one fire-type Wizard and will gain a second, third, and fourth Wizard in their corresponding levels. A Player can deploy only one Wizard at a time until the final battle. A Player can take 6 actions during a battle: swap Wizard, check vulnerability, check resistance, use special skill, skip a turn, or forfeit. The Monster will still attack regardless of the action they take during their turn.
The Battle class contains a level, number of Monsters , turn, vulnerabilities and resistances pop-up, end battle variable, and defeated variable. The levels can go from 1-11, 11 being the final boss, and after the game would end. If the Player loses all Wizards during a battle the game will end and the Player can choose to start again. There should also be a pop-up notification every time a battle starts that indicates the vulnerabilities and resistances of each Monster type on the battlefield if the Player has already used it on that specific Monster before. There should also be a certain amount of Monsters on each level 1-3 Monsters from levels 1-3 (specified in the table below) in levels 1-10. Level 11 will contain the final boss who has a level 10. Players and Monsters take turns. A Player always starts a battle and can choose from their 6 options. A Monster will always attack its turn. If all the Monsters have been defeated then the end battle variable will be true and the next Battle will begin. If the Player’s Wizards have been defeated, then the defeated variable will be set to true, and the game will end and ask the Player if they want to start again from level 1.

Method Descriptions

List of Methods in Character Interface:
  1. int attack() - returns damage of the attack.
  2. boolean isDeployed() - true if the Character is on the battlefield and false if they are not. If this is false at the end of the battle then their full HP will be restored.
  3. boolean isAlive() - true if the Character is on the battlefield and still alive or resting and still alive. False if the Character’s HP is 0.
  4. int getHP() - returns the current Character’s HP (cannot be below 0).
  5. void setHP(int health) - sets the new HP of the current Character (cannot be greater than the max HP for their level).
  6. int getLevel() - returns the current Character’s level.
  7. void setLevel(int level) - sets the level to the integer provided (cannot be greater than 5 or less than 1 for Wizard or greater than 3 or less than 1 for Monster).

List of Methods in the Wizard Class:
  1. void showSpells() - prints out the Spells the Wizard currently has access to.
  2. boolean specialSkillUnlocked() - true if the Wizard is level 4 or higher. False if they are level 3 or below.
  3. void setSpellSlots(int level, int SpellSlots) - sets the number of spell slots for the given level.
  4. int getWizardNum() - returns the number associated with the elemental Wizard.
  5. String getElement() - returns the element associated with the Wizard.

List of Methods in Spell Class:
  1. String getElement() - returns the element of the Spell.
  2. int getLevel() - returns the Spell’s level.
  3. int getMax() - returns the max value of the Spell.
  4. int getMin() - returns the min value of the Spell.
  5. void setMax(int m) - sets the max value of the Spell.
  6. void setMin(int m) - sets the min value of the Spell.

List of Methods in the Monster Class:
  1. boolean vKnown() - returns true if the Player knows the vulnerability of this level Monster. Otherwise, returns false.
  2. boolean rKnown() - returns true if the Player knows the resistance of this level Monster. Otherwise, returns false.
  3. String getVulnerable() - returns the vulnerability of the current Monster.
  4. String getResistant() - returns the resistance of the current Monster.

List of Methods in the Player Class:
  1. ArrayList getWizards() - returns the list of Wizards the Player currently has access to. Excludes Wizards that are not unlocked or are dead.
  2. Wizard activeWizard(int num) - returns the deployed Wizard.
  3. void addWizard(Wizard w) - will add a Wizard to the Player’s ArrayList of Wizards .

List of Methods in Battle Class:
  1. boolean specialSkillAvailable() - false if the special skill has been used already in this battle or if the deployed Wizard is below level 4. True if it has not been used and can be by the deployed Wizard.
  2. boolean reviveAvailable() - false if the revive has already been used once this battle. True if it is still available in this battle. Will be set to true after continuing to the next battle.
  3. int switchWizard(int x) - Fire Wizard has an integer of 0, Ice - 1, Necrotic - 2, and Radiant - 3. Whichever number is passed through.
  4. boolean turn() - true if it is the Player’s turn and false if it is the Monster’s turn.
  5. boolean won() - true if either the Monster or Player won.
  6. boolean victor() - true if Player won, false if Monster won. If Monster won, the Player would have the option to start from the beginning. If the Player won, automatically moves on to the next level.
  7. int getLevel() - returns current battle level 1-11.

Important Information Tables


Spells and Spell Damage for each Element and Level
Level Fire Ice Necrotic Radiant Damage Range
1 Firebolt Cone of Cold Bestow Curse Sacred Flame 1-6
2 Hellish Rebuke Sleet Storm Blight Moonbeam 2-12
3 Fireball Blizzard Hallow Holy Aura 6-18

Monster Level, Vulnerabilities, and Resistances
Level Vulnerability Resistance
1 Fire Ice
2 Ice Necrotic
3 Radiant Fire

Player level and HP
Level HP
1 10
2 18
3 25
4 34
5 46

Monster level and HP
Level HP
1 6
2 12
3 21
Final boss 70

Player level increase based on Monsters Killed
Monster Level Number of Monsters
1 2
2 2
3 1

Number and Max Level of Monsters per Battle based on Battle Level
Level Number of Monsters Max level of Monsters
1 1 1
2 2 1
3 3 1
4 2 2
5 2 2
6 3 2
7 1 3
8 2 3
9 2 3
10 3 3

Monster Level and attack damage range
Level Damage range
1 1-3
2 1-5
3 2-10
Final Boss 6-20