Combat Programming Guide - UQcsse3200/2024-studio-2 GitHub Wiki
Combat System Implementation Guide
The combat functionality in this game is a complex system composed of multiple interrelated features and components. These elements interact across several classes, each with unique responsibilities. This guide provides a step-by-step breakdown of the key components related to combat and how they are implemented.
CombatScreen
The CombatScreen
class is the entry point for the combat functionality. When a player collides with an enemy or boss NPC, a new instance of the CombatScreen
class is generated and switched to as the current screen. This section explains:
- How the CombatScreen class is generated.
- Methods and attributes within CombatScreen.
- Relationships and dependencies with other classes.
Combat Manager
This section explains the logic of the CombatManager
class, responsible for controlling the turn-based combat system between two entities: the player and the enemy. It highlights:
- Initialisation and Construction
- Significant Methods
- Interactions with Other Classes
CombatStatsDisplay
This component of the combat screen UI shows and updates the health, stamina, and other stats of both the player and enemies. This section explains:
- How different stats are animated and updated.
- Listener and trigger logic for updating these stats.
- Interactions with other classes like
CombatActions
.
CombatActions
The CombatActions
class serves as the link between the combat screen UI (CombatStatsDisplay
) and the combat logic controller (CombatManager
). This section details:
- How combat actions are triggered and managed.
- Event handling and listener logic in the context of combat.
- Interactions with other key classes like
CombatManager
.
CombatArea
The CombatArea
class handles the loading of terrain and entities into the combat screen. It plays a critical role in setting the environment for combat. This section covers:
- How the terrain factory is invoked and its uses.
- How entities such as players and enemies are spawned on the terrain.
- Its dependencies on other components like
CombatTerrainFactory
.
CombatTerrainFactory
The CombatTerrainFactory
class handles the creation of the background terrains for combat so that they may be loaded in the Combat Area. It is responsible for creating an enhanced visual background pertinent to each kingdom. This section covers:
- The methods invoked to produce a terrain consistent with each kingdom i.e. land, sea, sky
- How the class and its methods are referenced through Combat Area
CombatButtonDisplay
The CombatButtonDisplay
class manages the buttons for combat actions such as Attack, Guard, Sleep, etc. This section explains:
- How the move buttons are displayed and interacted with.
- Event listeners and triggers tied to player inputs.
- Attributes, methods, and relationships with other UI components.
CombatInventoryDisplay
The CombatInventoryDisplay
class is responsible for the full player inventory during combat. Here, you'll find:
- How the inventory is displayed and updated during combat.
- Logic for using items in combat scenarios.
- Trigger events related to item usage and their effects on gameplay.
CombatAnimationDisplay
The CombatAnimationDisplay
class organizes general animations during combat. It handles the visual effects for various combat actions and player movements. Learn about:
- How animations are implemented for players and enemies.
- Communication between animation and combat-related classes.
Combat Animal Animations
This section covers the move and idle animations for both player and enemy animals during combat. It includes:
- Logic related to animations for different entities.
- Interactions with classes like
CombatAnimationController
andCombatAnimalFactory
.
Combat Status Effect Display
Here you'll find an explanation of how status effects like Bleeding, Shocked, and Poisoned are visually displayed during combat. This page covers:
- How the status effect UI is generated.
- Classes and methods responsible for updating the status effect display.
- Flow of logic from
CombatStatsComponent
toCombatStatsDisplay
.
Combat Action Illustration
This section explains the logic added to multiple combat classes to make Dialogue Boxes functional. It highlights:
- Classes involved, such as
CombatButtonDisplay
,CombatManager
, andCombatActions
. - Code for handling dialogue box triggers and how they are displayed.
- A step-by-step guide to the logical flow behind this feature.
Combat System
This section explains the overall logic related to the actual combat that is occuring. It does not contain any code, rather it highlights:
- Calculations for stats changes for each of the different moves, and their relations to different entity statistics.
- Priority System Explanation in Combat
- Status Effect Explanation
- Statistics Explanation
Combat Moves
This section explains the Combat Moves
class, responsible for implementing the main moves in combat. It highlights:
- Key Components of CombatMoves
- Explanation of Implementations of Each Move
- In-Depth Testing Plan for the
CombatMoves
CombatStatsChangePopup
This section explains the CombatStatsChangePopup
class, responsible for displaying changes in health and hunger stats caused by combat moves. It covers:
- How combat stats change animations are implemented.
- Communication between popup and combat-related classes.