Combat System - UQcsse3200/2024-studio-2 GitHub Wiki

1. Introduction

1.1 Overview

The combat system is turn-based and follows a 1v1, single-turn system where the player faces off against an opposing enemy. There are three main moves used in battle: attack, guard and sleep. These moves work the same for every animal, but their efficacy depend on the user's stats and the stats of their opponent. The player can also choose to use an item instead of performing a move for their turn.

There is a fourth move that is used in combat by bosses: special moves. These are moves which inflict the player with a negative status effect, and buffs the boss. Bosses can have multiple special moves.

1.2 Terminology

  • Enemy: used interchangeably to refer to both standard enemies and bosses
  • User refers to the animal that is using the move (may refer to the player or enemy)
  • Opponent refers to the animal that the move is being used against (may refer to the player or enemy)
  • $At$ refers to the strength stat
  • $Df$ refers to the defense stat
  • $Sp$ refers to the speed stat
  • $St$ refers to the hunger stat
  • $Sb$ refers to the hunger bar

2. Statistics

Animals have five statistics that perform different roles in battle:

  • Health: the vitality of the animal, indicating how close they are to defeat
  • Strength: the martial prowess of the animal, indicating their attack power
  • Defense: the hardiness of the animal, indicating their resistance to attacks
  • Speed: the swiftness of the animal, indicating how quickly they perform attacks
  • Hunger: the endurance of the animal, indicating their fatigue in battle

3. Hunger

3.1 Overview

Hunger in battle $Sb$ is represented using a bar, where $0 \leq Sb \leq 100$

At the beginning of battle, the player's health and hunger bar values are passed in from the main game, while the enemy's health and hunger bar is full to their unique maximum value. After combat, the player's remaining health and hunger values are passed back into the main game screen. However, on a combat loss, the player is not sent back into the main game with 0 health or hunger - these stats are set to half of their respective maximum value.

3.2 Moves that Use Hunger

Attack and guard drain a user's hunger in battle. If an animal drains too much hunger, then attack moves become weaker.

  • Attack: for each attack turn the amount of hunger used is $10 - \lfloor0.05St\rfloor$.

    • Performing a multi-hit attack does not drain additional hunger.
  • Guard: for each guard turn the amount of hunger used is $5 - \lfloor0.05St\rfloor$.

3.3 Moves that Don't Use Hunger

Using an item or a special move in battle does not drain hunger.

3.4 Moves that Replenish Hunger

Sleep regains 25% of the user's hunger.

4. Attack

4.1 Overview

Attack is used to deal damage and lower the HP of the opponent. Attacks will generally only hit the opponent once per turn. If the opponent is asleep and the user chooses to attack on the same turn, then the user can hit the opponent multiple times. For the conditions for achieving multiple hits, see Section 6.1.

The formula for determining the damage of an attack is as follows:

$$\begin{equation} damage = \left\lfloor m_1m_2m_3m_4 \cdot \left(\frac{(Lvl + 2) \cdot At/Df}{2} + 2\right)\right\rfloor \end{equation}$$

  • $m_1$ is a damage multiplier for user's active buffs or debuffs
  • $m_2$ is a damage multiplier for user's hunger
  • $m_3$ is a damage multiplier for opponent's guard
  • $m_4$ is a damage multiplier for multi-hit attacks
  • $Lvl$ is the user's level
  • $At$ is the user's strength stat
  • $Df$ is the opponent's defense stat

Based on the Pokémon Gen 1 damage calculation (source).

4.2 Damage Multiplier for Buffs/Debuffs

This is the multiplier which represents buffs or debuffs to a user's damage in battle.

These are caused by using an item or being afflicted by a special move, e.g. 30% weakened attacks from the Shocked status effect.

$$\begin{align} &m_1 = 1, \text{by default}\ &m_1 > 1, \text{if a buff is applied}\ &m_1 < 1, \text{if a debuff is applied} \end{align}$$

4.3 Damage Multiplier for Hunger

The damage multiplier associated with user hunger is always less than or equal to 1.

The value for $m_2$ is less than 1 only when the user's hunger bar $Sb$ drops below 50.

$$m_2 = \begin{cases} \exp{\left(\frac{Sb}{50}-1\right)}, & Sb < 50\ 1, & Sb \geq 50 \end{cases}$$

4.4 Damage Multiplier for Opponent's Guard

If the opponent chooses to guard, then the damage they receive is reduced by 50%.

$$m_3 = \begin{cases} 0.5, &\text{if the opponent guards}\ 1, &\text{otherwise} \end{cases}$$

4.5 Damage Multiplier for Multi-Hit Attacks

If the player lands all hits in a multi-hit attack, they receive a damage bonus proportional to the number of hits $N$ in the attack.

$$m_4 = \begin{cases} 1 + 0.25N, &\text{all hits land perfectly}\ 1, &\text{otherwise} \end{cases}$$

5. Guard

Guard is a defensive move that reduces the amount of damage received from an attacking opponent by 50%. However, if the player is currently affected by the Bleeding status effect, incoming damage is only reduced by 30%.

If the player uses guard on the same turn that an enemy uses a negative special move, it is blocked (see Section 7).

6. Sleep

6.1 Overview

Sleep is a single-turn move which restores 25% of a user's hunger and 10% of their health. It is the only way for an animal to restore hunger during battle. However, if the player is currently affected by a Poisoned status effect, sleep will only replenish hunger but not health.

The downside to sleeping is that it makes the user more vulnerable to attacks. If an opponent attacks the sleeping user, they can hit them multiple times (ranges from 1-4 hits). Each hit is equivalent to performing 1 attack move and follows the same damage formula outlined in Section 4 above.

Even if an opponent can hit the sleeping user multiple times, not all the hits will necessarily land. The number of successful hits will depend on how many successful RNG rolls they perform.

The probability of success $s$ for each roll is calculated as:

$$s = \exp{\left(\frac{Sp}{250}\right)} - 0.5$$

Each roll is simulated using the Bernoulli distribution:

$$roll \sim \text{Bernoulli}(s)$$

For example, if an enemy can perform 4 hits but rolls {0,1,1,0} then they hit the player two times.

7. Special

A special move may be used by a Boss in place of the other three combat moves. Special moves apply a negative status effect to the player.

Status effects:

  • Bleeding (Kanga Boss): Lasts 3 turns. Guard will block only 30% of incoming damage instead of 50%. The player's health and hunger are also decreased by 9% (Turn 1 of Bleeding), 6% (Turn 2), then 3% (Turn 3) before each affected turn.
  • Poisoned (Water Boss): Lasts 2 turns. Sleep will restore hunger but not health. The Player's hunger is also decreased by 30% before each affected turn.
  • Shocked (Air Boss): Lasts 3 turns. Attacks are debuffed by 30%. The player's health is also decreased by 15% before each affected turn.
  • Confused: Lasts 1 turn. the enemy confuses the player causing them to use a random move.

Specifically, every Boss will randomly apply either Confused or their associated status effect. (E.g. The Kanga Boss will randomly apply one of Confused or Bleeding.)

8. Items

Items collected from the main game, such as food items and potions, may be used by the player during combat in place of a combat move. Only one item can be used each turn. Items that are used in battle are immediately consumed and removed from the player’s inventory.

9. Priority

9.1 Overview

The priorities for player and enemy moves is indicated in the table below.

Enemy Player Attack Guard Sleep Special
Attack Animal with the highest speed stat attacks first. Hunger decreases for both. Enemy guards first, and player's attack damage is reduced by 50%. Hunger decreases for both. Enemy falls asleep, raising its hunger & health. Player performs multi-hit attack. Player hunger decreases. Enemy's special is activated. Player performs attack. Player hunger decreases.
Guard Player guards first, and enemy’s attack damage is reduced by 50%. Hunger decreases for both. Both animals guard but nothing happens. Hunger decreases for both. Enemy falls asleep, raising its hunger & health. Player hunger decreases. Enemy’s special is activated. Negative specials are blocked by guard. Player hunger decreases.
Sleep Player falls asleep, raising its hunger & health. Enemy performs multi-hit attack. Enemy hunger decreases. Player falls asleep, raising its hunger & health. Enemy hunger decreases. Both animals fall asleep, raising their hunger & health. Enemy’s special is activated. Player falls asleep, raising hunger & health.
Item Player uses an item and its effects are applied. Enemy attacks player. Enemy hunger decreases. Player uses an item and its effects are applied. Enemy hunger decreases. Player uses an item and its effects are applied. Enemy falls asleep, raising its hunger & health. Player uses an item and its effects are applied. Enemy’s special is activated.

The priority of moves for enemy (top row) and player (left column)

9.2 Additional Priority Rules

  • Status effects are first applied at the start of the next round, after the player has selected their move.