2011-02-06 19:26:27 +02:00
|
|
|
#pragma once
|
2009-04-16 14:14:13 +03:00
|
|
|
|
2011-12-14 00:23:17 +03:00
|
|
|
|
2011-12-22 16:05:19 +03:00
|
|
|
#include "BattleHex.h"
|
2011-12-14 00:23:17 +03:00
|
|
|
|
2009-04-15 17:03:31 +03:00
|
|
|
/*
|
|
|
|
* BattleAction.h, part of VCMI engine
|
|
|
|
*
|
|
|
|
* Authors: listed in file AUTHORS in main folder
|
|
|
|
*
|
|
|
|
* License: GNU General Public License v2.0 or later
|
|
|
|
* Full text of license available in license.txt file, in main folder
|
|
|
|
*
|
2009-04-16 14:14:13 +03:00
|
|
|
*/
|
|
|
|
|
2011-02-22 13:52:36 +02:00
|
|
|
/// A struct which handles battle actions like defending, walking,... - represents a creature stack in a battle
|
2010-12-25 03:43:40 +02:00
|
|
|
class CStack;
|
|
|
|
|
2011-12-14 00:23:17 +03:00
|
|
|
struct DLL_LINKAGE BattleAction
|
2009-04-16 14:14:13 +03:00
|
|
|
{
|
|
|
|
ui8 side; //who made this action: false - left, true - right player
|
|
|
|
ui32 stackNumber;//stack ID, -1 left hero, -2 right hero,
|
2013-02-04 00:05:44 +03:00
|
|
|
Battle::ActionType actionType; //use ActionType enum for values
|
2011-12-22 16:05:19 +03:00
|
|
|
BattleHex destinationTile;
|
2009-04-16 14:14:13 +03:00
|
|
|
si32 additionalInfo; // e.g. spell number if type is 1 || 10; tile to attack if type is 6
|
2012-04-28 22:40:27 +03:00
|
|
|
si32 selectedStack; //spell subject for teleport / sacrifice
|
|
|
|
|
2009-04-16 14:14:13 +03:00
|
|
|
template <typename Handler> void serialize(Handler &h, const int version)
|
|
|
|
{
|
2012-04-28 22:40:27 +03:00
|
|
|
h & side & stackNumber & actionType & destinationTile & additionalInfo & selectedStack;
|
2009-04-16 14:14:13 +03:00
|
|
|
}
|
2010-12-25 03:43:40 +02:00
|
|
|
|
|
|
|
BattleAction();
|
|
|
|
|
|
|
|
static BattleAction makeDefend(const CStack *stack);
|
|
|
|
static BattleAction makeWait(const CStack *stack);
|
2011-12-22 16:05:19 +03:00
|
|
|
static BattleAction makeMeleeAttack(const CStack *stack, const CStack * attacked, BattleHex attackFrom = BattleHex::INVALID);
|
2010-12-25 03:43:40 +02:00
|
|
|
static BattleAction makeShotAttack(const CStack *shooter, const CStack *target);
|
2011-12-22 16:05:19 +03:00
|
|
|
static BattleAction makeMove(const CStack *stack, BattleHex dest);
|
2011-02-12 18:12:48 +02:00
|
|
|
static BattleAction makeEndOFTacticPhase(ui8 side);
|
2009-04-16 14:14:13 +03:00
|
|
|
};
|