23 #ifndef TACTICS3DACTION_H
24 #define TACTICS3DACTION_H
28 #include "../Libs/Utils_LIB/UTypes.h"
48 std::vector<OpenSkyNet::Utils::TaggedUnion>
_params;
55 virtual void getPrePerformInfo(
char* buffer_,
int bufferLen_)
const { memset(buffer_,0,bufferLen_); }
56 virtual void getAnimationName(
char* buffer_,
int bufferLen_)
const { memset(buffer_,0,bufferLen_); }
57 static void getPlayerInfo(
char* buffer_,
int bufferLen_) { memset(buffer_,0,bufferLen_); }
109 _params.push_back(attackRange_);
123 virtual void getAnimationName(
char* buffer_,
int bufferLen_)
const { strncpy(buffer_,
"attack", bufferLen_); }
133 std::vector<Warrior*> defenders_,
134 std::vector<OpenSkyNet::Utils::TaggedUnion>& specialMoveParams_);
158 std::vector<Warrior*> defenders;
159 int numDefenders =
_params[2].getInt();
160 assert(numDefenders > -1);
161 assert(static_cast<OpenSkyNet::Utils::uint>(numDefenders) <=
MAX_DEFENDERS);
162 defenders.reserve(numDefenders);
164 std::size_t indexAfterLastDefender = numDefenders + 3;
165 assert(
_params.size() >= indexAfterLastDefender);
166 for (std::size_t i = 3; i < indexAfterLastDefender; ++i)
167 defenders.push_back(static_cast<Warrior*>(
_params[i].getPointer()));
174 std::vector<OpenSkyNet::Utils::TaggedUnion> specialMoveParams;
176 int numDefenders =
_params[2].getInt();
177 int numSpecialMoveParams =
_params[numDefenders + 3].getInt();
179 if (numSpecialMoveParams) {
180 int firstSpecialMoveParam = numDefenders + 3 + 1;
181 int indexAfterLastSpecialMoveParam = firstSpecialMoveParam + numSpecialMoveParams;
182 specialMoveParams.reserve(numSpecialMoveParams);
183 for (
int i = firstSpecialMoveParam; i < indexAfterLastSpecialMoveParam; ++i)
184 specialMoveParams.push_back(
_params[i]);
187 return specialMoveParams;
214 int numTargets =
_params[1].getInt();
215 assert(numTargets > -1);
216 assert(static_cast<OpenSkyNet::Utils::uint>(numTargets) <=
MAX_TARGETS);
217 targets.reserve(numTargets);
219 std::size_t indexAfterLastTarget = numTargets + 2;
220 assert(
_params.size() >= indexAfterLastTarget);
221 for (std::size_t i = 2; i < indexAfterLastTarget; ++i)
222 targets.push_back(static_cast<Warrior*>(
_params[i].getPointer()));
231 int numTargets =
_params[1].getInt();
232 int numSuperPowerParams =
_params[numTargets + 2].getInt();
234 if (numSuperPowerParams) {
235 int firstSuperPowerParam = numTargets + 2 + 1;
236 int indexAfterLastSuperPowerParam = firstSuperPowerParam + numSuperPowerParams;
237 superPowerParams.reserve(numSuperPowerParams);
238 for (
int i = firstSuperPowerParam; i < indexAfterLastSuperPowerParam; ++i)
239 superPowerParams.push_back(
_params[i]);
242 return superPowerParams;
247 #endif //TACTICS3DACTION_H
static void getPlayerInfo(char *buffer_, int bufferLen_)
Definition: Tactics3DAction.cpp:49
virtual bool canRotate() const
Definition: Tactics3DFightingStyle.h:105
virtual void perform()
Definition: Tactics3DAction.cpp:132
SPECIAL_MOVE
Definition: Tactics3DFightingStyle.h:37
virtual void getPrePerformInfo(char *buffer_, int bufferLen_) const
Definition: Tactics3DFightingStyle.h:100
virtual void perform()
Definition: Tactics3DAction.cpp:32
const ACTION_TYPE _type
Definition: Tactics3DAction.h:44
Definition: Tactics3DAction.h:40
BreakGrappleAction()
Definition: Tactics3DAction.h:96
Definition: Tactics3DAction.h:38
virtual bool canTranslate() const
Definition: Tactics3DFightingStyle.h:104
RepairThrustersAction()
Definition: Tactics3DAction.h:88
Definition: Tactics3DAction.h:191
virtual void getAnimationName(char *buffer_, int bufferLen_) const
Definition: Tactics3DSuperPower.h:62
static const OpenSkyNet::Utils::uint MAX_TARGETS
Definition: Tactics3DAction.h:192
static void getPlayerInfo(char *buffer_, int bufferLen_)
Definition: Tactics3DAction.cpp:83
Definition: Tactics3DAction.h:103
std::vector< Warrior * > getDefenders() const
Definition: Tactics3DAction.h:156
virtual bool canRotate() const
Definition: Tactics3DAction.h:82
SuperPowerAction(Warrior *performer_, SUPER_POWER superPower_, SuperPower::Warriors &targets_, SuperPower::Params &superPowerParams_)
Definition: Tactics3DAction.cpp:108
virtual void perform()
Definition: Tactics3DAction.h:63
Definition: Tactics3DAction.h:95
virtual bool canRotate() const
Definition: Tactics3DAction.h:142
Definition: Tactics3DAction.h:38
virtual bool canRotate() const
Definition: Tactics3DAction.h:61
virtual void getPrePerformInfo(char *buffer_, int bufferLen_) const
Definition: Tactics3DSuperPower.h:61
Definition: Tactics3DSuperPower.h:37
std::vector< OpenSkyNet::Utils::TaggedUnion > getSpecialMoveParams() const
Definition: Tactics3DAction.h:172
virtual ~Action()
Definition: Tactics3DAction.h:53
std::vector< OpenSkyNet::Utils::TaggedUnion > _params
Definition: Tactics3DAction.h:48
std::string _name
Definition: Tactics3DAction.h:43
Definition: Tactics3DWarrior.h:42
SuperPower::Warriors getTargets() const
Definition: Tactics3DAction.h:211
virtual bool canTranslate() const
Definition: Tactics3DSuperPower.h:65
std::vector< Warrior * > Warriors
Definition: Tactics3DSuperPower.h:43
virtual bool canRotate() const
Definition: Tactics3DAction.h:202
Definition: Tactics3DAction.h:129
static void getPlayerInfo(char *buffer_, int bufferLen_)
Definition: Tactics3DAction.cpp:25
Definition: Tactics3DAction.h:38
virtual void getPrePerformInfo(char *buffer_, int bufferLen_) const
Definition: Tactics3DAction.h:196
Definition: Tactics3DAction.h:87
virtual bool canMoveInSameRound() const
Definition: Tactics3DSuperPower.h:64
virtual bool canMoveInSameRound() const
Definition: Tactics3DFightingStyle.h:103
MoveAction()
Definition: Tactics3DAction.h:77
SuperPower::Params getSuperPowerParams() const
Definition: Tactics3DAction.h:227
virtual bool canTranslate() const
Definition: Tactics3DAction.h:60
virtual bool canMoveInSameRound() const
Definition: Tactics3DAction.h:59
static const OpenSkyNet::Utils::uint MAX_PARAMS
Definition: Tactics3DAction.h:41
bool _isAuto
Definition: Tactics3DAction.h:45
virtual void perform()
Definition: Tactics3DAction.cpp:21
virtual bool canRotate() const
Definition: Tactics3DSuperPower.h:66
virtual void getAnimationName(char *buffer_, int bufferLen_) const
Definition: Tactics3DAction.h:56
Definition: Tactics3DAction.h:38
virtual void getPrePerformInfo(char *buffer_, int bufferLen_) const
Definition: Tactics3DAction.h:136
NoPAction()
Definition: Tactics3DAction.h:67
std::map< SUPER_POWER, const SuperPower * > g_superPowers
Definition: Tactics3DSuperPower.cpp:18
Definition: Tactics3DAction.h:76
Tactics3D::Warrior * _performer
Definition: Tactics3DAction.h:47
ACTION_TYPE
Definition: Tactics3DAction.h:38
Definition: Tactics3DAction.h:70
Definition: Tactics3DAttackRange.h:33
const AttackRange * getAttackRange() const
Definition: Tactics3DAction.h:151
virtual void perform()
Definition: Tactics3DAction.cpp:55
virtual void perform()
Definition: Tactics3DAction.cpp:44
virtual void perform()
Definition: Tactics3DAction.cpp:89
virtual void getAnimationName(char *buffer_, int bufferLen_) const
Definition: Tactics3DFightingStyle.h:101
static void getPlayerInfo(char *buffer_, int bufferLen_)
Definition: Tactics3DAction.cpp:15
unsigned int uint
Definition: UTypes.h:39
Warrior * getDefender() const
Definition: Tactics3DAction.h:118
SUPER_POWER
Definition: Tactics3DSuperPower.h:35
Action(const std::string &name_="NO_ACTION", ACTION_TYPE type_=NO_ACTION, bool isAuto_=true)
Definition: Tactics3DAction.h:50
AttackAction(Warrior *performer_, const AttackRange *attackRange_, Warrior *defender_)
Definition: Tactics3DAction.h:106
Definition: Tactics3DAction.h:38
Definition: Tactics3DAction.h:38
virtual void getAnimationName(char *buffer_, int bufferLen_) const
Definition: Tactics3DAction.h:137
bool _isContinuous
Definition: Tactics3DAction.h:46
static void getPlayerInfo(char *buffer_, int bufferLen_)
Definition: Tactics3DAction.cpp:126
const SuperPower * getSuperPower() const
Definition: Tactics3DAction.h:206
virtual void getPrePerformInfo(char *buffer_, int bufferLen_) const
Definition: Tactics3DAction.h:55
std::vector< OpenSkyNet::Utils::TaggedUnion > Params
Definition: Tactics3DSuperPower.h:44
static void getPlayerInfo(char *buffer_, int bufferLen_)
Definition: Tactics3DAction.cpp:9
Definition: Tactics3DAction.h:38
SpecialMoveAction(Warrior *performer_, SPECIAL_MOVE specialMove_, const AttackRange *attackRange_, std::vector< Warrior * > defenders_, std::vector< OpenSkyNet::Utils::TaggedUnion > &specialMoveParams_)
Definition: Tactics3DAction.cpp:64
AttackAction()
Definition: Tactics3DAction.h:104
const SpecialMove * getSpecialMove() const
Definition: Tactics3DAction.h:146
virtual bool canMoveInSameRound() const
Definition: Tactics3DAction.h:200
Definition: Tactics3DAction.h:38
DelayAction()
Definition: Tactics3DAction.h:71
virtual bool canTranslate() const
Definition: Tactics3DAction.h:201
virtual bool canMoveInSameRound() const
Definition: Tactics3DAction.h:140
static void getPlayerInfo(char *buffer_, int bufferLen_)
Definition: Tactics3DAction.cpp:36
const AttackRange * getAttackRange() const
Definition: Tactics3DAction.h:113
static void getPlayerInfo(char *buffer_, int bufferLen_)
Definition: Tactics3DAction.h:57
virtual bool canTranslate() const
Definition: Tactics3DAction.h:141
static const OpenSkyNet::Utils::uint MAX_DEFENDERS
Definition: Tactics3DAction.h:130
virtual void getAnimationName(char *buffer_, int bufferLen_) const
Definition: Tactics3DAction.h:197
virtual void getAnimationName(char *buffer_, int bufferLen_) const
Definition: Tactics3DAction.h:123
Definition: Tactics3DFightingStyle.h:61
virtual bool canTranslate() const
Definition: Tactics3DAction.h:81
Definition: Tactics3DAction.h:38
Definition: Tactics3DAction.h:66
std::map< SPECIAL_MOVE, const SpecialMove * > g_specialMoves
Definition: Tactics3DFightingStyle.cpp:283