1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-24 08:32:34 +02:00
vcmi/lib/HeroBonus.h
Michał W. Urbańczyk 05b3e3215c * magic well support
* improvements in the recruitment window
* improvements for pregame  
[cf http://vcmi.antypika.aplus.pl/forum/viewtopic.php?t=97 issues 12-15 and 21 - 22]
* minor changes
2009-02-06 11:15:39 +00:00

40 lines
1.2 KiB
C++

#pragma once
#include "../global.h"
#include <string>
struct DLL_EXPORT HeroBonus
{
enum BonusType{NONE, MOVEMENT, LAND_MOVEMENT, SEA_MOVEMENT, MORALE, LUCK, MORALE_AND_LUCK};
enum BonusDuration{PERMANENT, ONE_BATTLE, ONE_DAY, ONE_WEEK};
enum BonusSource{ARTIFACT, OBJECT};
ui8 duration; //uses BonusDuration values
ui8 type; //uses BonusType values - says to what is this bonus
ui8 source;//uses BonusSource values - what gave that bonus
si32 val;//for morale/luck [-3,+3], others any
ui32 id; //id of object/artifact
std::string description;
HeroBonus(ui8 Dur, ui8 Type, ui8 Src, si32 Val, ui32 ID, std::string Desc)
:duration(Dur), type(Type), source(Src), val(Val), id(ID), description(Desc)
{}
HeroBonus(){};
template <typename Handler> void serialize(Handler &h, const int version)
{
h & duration & type & source & val & id & description;
}
static bool OneDay(const HeroBonus &hb)
{
return hb.duration==HeroBonus::ONE_DAY;
}
static bool OneWeek(const HeroBonus &hb)
{
return hb.duration==HeroBonus::ONE_WEEK;
}
static bool OneBattle(const HeroBonus &hb)
{
return hb.duration==HeroBonus::ONE_BATTLE;
}
};