So, as mentioned in Chapter 1, Getting Started with RPG Design in Unreal, combat is turn-based. All characters first choose an action to perform; then, the actions are executed in order.
Combat will be split into two main phases: Decision, in which all characters decide on their course of action; and Action, in which all characters execute their chosen course of action.
Let's create a class with an empty parent to handle combat for us, which we'll call CombatEngine
, and path it to a new directory located in Source/RPG/Combat
, where we can organize all of our combat-related classes. Formulate the header file to look like this:
#pragma once #include "RPG.h" #include "GameCharacter.h" enum class CombatPhase : uint8 { CPHASE_Decision, CPHASE_Action, CPHASE_Victory, CPHASE_GameOver, }; class RPG_API CombatEngine { public: TArray<UGameCharacter*> combatantOrder; TArray<UGameCharacter*> playerParty; TArray<UGameCharacter*> enemyParty; CombatPhase...