2011-02-06 19:26:27 +02:00
|
|
|
#pragma once
|
2009-04-16 14:14:13 +03:00
|
|
|
#ifndef __BATTLEACTION_H__
|
|
|
|
#define __BATTLEACTION_H__
|
|
|
|
|
2010-12-25 03:43:40 +02:00
|
|
|
#include "../global.h"
|
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
|
|
|
*/
|
|
|
|
|
2010-12-25 03:43:40 +02:00
|
|
|
class CStack;
|
|
|
|
|
|
|
|
struct DLL_EXPORT 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,
|
2010-12-04 21:15:20 +02:00
|
|
|
enum ActionType
|
|
|
|
{
|
2010-12-25 03:43:40 +02:00
|
|
|
INVALID = -1, NO_ACTION = 0, HERO_SPELL, WALK, DEFEND, RETREAT, SURRENDER, WALK_AND_ATTACK, SHOOT, WAIT, CATAPULT, MONSTER_SPELL, BAD_MORALE, STACK_HEAL
|
2010-12-04 21:15:20 +02:00
|
|
|
};
|
2011-01-07 12:48:31 +02:00
|
|
|
ui8 actionType; //use ActionType enum for values
|
2010-03-07 19:40:33 +02:00
|
|
|
//10 = Monster casts a spell (i.e. Faerie Dragons) 11 - Bad morale freeze 12 - stacks heals another stack
|
2011-01-08 20:33:40 +02:00
|
|
|
THex 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
|
|
|
|
template <typename Handler> void serialize(Handler &h, const int version)
|
|
|
|
{
|
|
|
|
h & side & stackNumber & actionType & destinationTile & additionalInfo;
|
|
|
|
}
|
2010-12-25 03:43:40 +02:00
|
|
|
|
|
|
|
BattleAction();
|
|
|
|
|
|
|
|
static BattleAction makeDefend(const CStack *stack);
|
|
|
|
static BattleAction makeWait(const CStack *stack);
|
2011-01-08 20:33:40 +02:00
|
|
|
static BattleAction makeMeleeAttack(const CStack *stack, const CStack * attacked, THex attackFrom = THex::INVALID);
|
2010-12-25 03:43:40 +02:00
|
|
|
static BattleAction makeShotAttack(const CStack *shooter, const CStack *target);
|
|
|
|
static BattleAction makeMove(const CStack *stack, THex dest);
|
2009-04-16 14:14:13 +03:00
|
|
|
};
|
|
|
|
#endif // __BATTLEACTION_H__
|