Add specific spell header
This commit is contained in:
parent
9b5664e1c1
commit
5f54853efe
23 changed files with 678 additions and 222 deletions
|
@ -457,6 +457,19 @@ set(stratagus_animation_HDRS
|
|||
src/include/animation/animation_wait.h
|
||||
)
|
||||
|
||||
set(stratagus_spell_HDRS
|
||||
src/include/spell/spell_adjustvariable.h
|
||||
src/include/spell/spell_adjustvital.h
|
||||
src/include/spell/spell_areaadjustvital.h
|
||||
src/include/spell/spell_areabombardment.h
|
||||
src/include/spell/spell_capture.h
|
||||
src/include/spell/spell_demolish.h
|
||||
src/include/spell/spell_polymorph.h
|
||||
src/include/spell/spell_spawnmissile.h
|
||||
src/include/spell/spell_spawnportal.h
|
||||
src/include/spell/spell_summon.h
|
||||
)
|
||||
|
||||
set(stratagus_generic_HDRS
|
||||
src/ai/ai_local.h
|
||||
src/video/intern_video.h
|
||||
|
@ -528,8 +541,10 @@ source_group(include FILES ${stratagus_generic_HDRS})
|
|||
source_group(include\\action FILES ${stratagus_action_HDRS})
|
||||
source_group(include\\animation FILES ${stratagus_animation_HDRS})
|
||||
source_group(include\\guichan FILES ${stratagus_guichan_HDRS})
|
||||
source_group(include\\spell FILES ${stratagus_spell_HDRS})
|
||||
|
||||
set (stratagus_HDRS ${stratagus_generic_HDRS} ${stratagus_action_HDRS} ${stratagus_animation_HDRS} ${stratagus_guichan_HDRS})
|
||||
|
||||
set (stratagus_HDRS ${stratagus_generic_HDRS} ${stratagus_action_HDRS} ${stratagus_animation_HDRS} ${stratagus_guichan_HDRS} ${stratagus_spell_HDRS})
|
||||
|
||||
# Additional platform checks
|
||||
|
||||
|
|
83
src/include/spell/spell_adjustvariable.h
Normal file
83
src/include/spell/spell_adjustvariable.h
Normal file
|
@ -0,0 +1,83 @@
|
|||
// _________ __ __
|
||||
// / _____// |_____________ _/ |______ ____ __ __ ______
|
||||
// \_____ \\ __\_ __ \__ \\ __\__ \ / ___\| | \/ ___/
|
||||
// / \| | | | \// __ \| | / __ \_/ /_/ > | /\___ |
|
||||
// /_______ /|__| |__| (____ /__| (____ /\___ /|____//____ >
|
||||
// \/ \/ \//_____/ \/
|
||||
// ______________________ ______________________
|
||||
// T H E W A R B E G I N S
|
||||
// Stratagus - A free fantasy real time strategy game engine
|
||||
//
|
||||
//
|
||||
// (c) Copyright 1999-2012 by Vladi Belperchinov-Shabanski,
|
||||
// Joris DAUPHIN, and Jimmy Salmon
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; only version 2 of the License.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
// 02111-1307, USA.
|
||||
//
|
||||
|
||||
#ifndef SPELL_ADJUSTVARIABLE_H
|
||||
#define SPELL_ADJUSTVARIABLE_H
|
||||
|
||||
//@{
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
-- Includes
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
#include "spells.h"
|
||||
|
||||
class SpellActionTypeAdjustVariable
|
||||
{
|
||||
public:
|
||||
SpellActionTypeAdjustVariable() : Enable(0), Value(0), Max(0), Increase(0),
|
||||
ModifEnable(0), ModifValue(0), ModifMax(0), ModifIncrease(0),
|
||||
InvertEnable(0), AddValue(0), AddMax(0), AddIncrease(0), IncreaseTime(0),
|
||||
TargetIsCaster(0) {};
|
||||
|
||||
int Enable; /// Value to affect to this field.
|
||||
int Value; /// Value to affect to this field.
|
||||
int Max; /// Value to affect to this field.
|
||||
int Increase; /// Value to affect to this field.
|
||||
|
||||
char ModifEnable; /// true if we modify this field.
|
||||
char ModifValue; /// true if we modify this field.
|
||||
char ModifMax; /// true if we modify this field.
|
||||
char ModifIncrease; /// true if we modify this field.
|
||||
|
||||
char InvertEnable; /// true if we invert this field.
|
||||
int AddValue; /// Add this value to this field.
|
||||
int AddMax; /// Add this value to this field.
|
||||
int AddIncrease; /// Add this value to this field.
|
||||
int IncreaseTime; /// How many time increase the Value field.
|
||||
char TargetIsCaster; /// true if the target is the caster.
|
||||
};
|
||||
|
||||
|
||||
class AdjustVariable : public SpellActionType
|
||||
{
|
||||
public:
|
||||
AdjustVariable() : Var(NULL) {};
|
||||
~AdjustVariable() { delete [](this->Var); };
|
||||
virtual int Cast(CUnit &caster, const SpellType &spell,
|
||||
CUnit *target, const Vec2i &goalPos);
|
||||
virtual void Parse(lua_State *l, int startIndex, int endIndex);
|
||||
|
||||
private:
|
||||
SpellActionTypeAdjustVariable *Var;
|
||||
};
|
||||
|
||||
//@}
|
||||
|
||||
#endif // SPELL_ADJUSTVARIABLE_H
|
59
src/include/spell/spell_adjustvital.h
Normal file
59
src/include/spell/spell_adjustvital.h
Normal file
|
@ -0,0 +1,59 @@
|
|||
// _________ __ __
|
||||
// / _____// |_____________ _/ |______ ____ __ __ ______
|
||||
// \_____ \\ __\_ __ \__ \\ __\__ \ / ___\| | \/ ___/
|
||||
// / \| | | | \// __ \| | / __ \_/ /_/ > | /\___ |
|
||||
// /_______ /|__| |__| (____ /__| (____ /\___ /|____//____ >
|
||||
// \/ \/ \//_____/ \/
|
||||
// ______________________ ______________________
|
||||
// T H E W A R B E G I N S
|
||||
// Stratagus - A free fantasy real time strategy game engine
|
||||
//
|
||||
//
|
||||
// (c) Copyright 1999-2012 by Vladi Belperchinov-Shabanski,
|
||||
// Joris DAUPHIN, and Jimmy Salmon
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; only version 2 of the License.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
// 02111-1307, USA.
|
||||
//
|
||||
|
||||
#ifndef SPELL_ADJUSTVITAL_H
|
||||
#define SPELL_ADJUSTVITAL_H
|
||||
|
||||
//@{
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
-- Includes
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
#include "spells.h"
|
||||
|
||||
class AdjustVital : public SpellActionType
|
||||
{
|
||||
public:
|
||||
AdjustVital() : SpellActionType(1), HP(0), Mana(0), MaxMultiCast(0) {};
|
||||
virtual int Cast(CUnit &caster, const SpellType &spell,
|
||||
CUnit *target, const Vec2i &goalPos);
|
||||
virtual void Parse(lua_State *l, int startIndex, int endIndex);
|
||||
|
||||
private:
|
||||
int HP; /// Target HP gain.(can be negative)
|
||||
int Mana; /// Target Mana gain.(can be negative)
|
||||
/// This spell is designed to be used wit very small amounts. The spell
|
||||
/// can scale up to MaxMultiCast times. Use 0 for infinite.
|
||||
int MaxMultiCast;
|
||||
};
|
||||
|
||||
//@}
|
||||
|
||||
#endif // SPELL_ADJUSTVITAL_H
|
56
src/include/spell/spell_areaadjustvital.h
Normal file
56
src/include/spell/spell_areaadjustvital.h
Normal file
|
@ -0,0 +1,56 @@
|
|||
// _________ __ __
|
||||
// / _____// |_____________ _/ |______ ____ __ __ ______
|
||||
// \_____ \\ __\_ __ \__ \\ __\__ \ / ___\| | \/ ___/
|
||||
// / \| | | | \// __ \| | / __ \_/ /_/ > | /\___ |
|
||||
// /_______ /|__| |__| (____ /__| (____ /\___ /|____//____ >
|
||||
// \/ \/ \//_____/ \/
|
||||
// ______________________ ______________________
|
||||
// T H E W A R B E G I N S
|
||||
// Stratagus - A free fantasy real time strategy game engine
|
||||
//
|
||||
//
|
||||
// (c) Copyright 1999-2012 by Vladi Belperchinov-Shabanski,
|
||||
// Joris DAUPHIN, and Jimmy Salmon
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; only version 2 of the License.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
// 02111-1307, USA.
|
||||
//
|
||||
|
||||
#ifndef SPELL_AREAADJUSTVITAL_H
|
||||
#define SPELL_AREAADJUSTVITAL_H
|
||||
|
||||
//@{
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
-- Includes
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
#include "spells.h"
|
||||
|
||||
class AreaAdjustVital : public SpellActionType
|
||||
{
|
||||
public:
|
||||
AreaAdjustVital() : HP(0), Mana(0) {};
|
||||
virtual int Cast(CUnit &caster, const SpellType &spell,
|
||||
CUnit *target, const Vec2i &goalPos);
|
||||
virtual void Parse(lua_State *l, int startIndex, int endIndex);
|
||||
|
||||
private:
|
||||
int HP; /// Target HP gain.(can be negative)
|
||||
int Mana; /// Target Mana gain.(can be negative)
|
||||
};
|
||||
|
||||
//@}
|
||||
|
||||
#endif // SPELL_AREAADJUSTVITAL_H
|
61
src/include/spell/spell_areabombardment.h
Normal file
61
src/include/spell/spell_areabombardment.h
Normal file
|
@ -0,0 +1,61 @@
|
|||
// _________ __ __
|
||||
// / _____// |_____________ _/ |______ ____ __ __ ______
|
||||
// \_____ \\ __\_ __ \__ \\ __\__ \ / ___\| | \/ ___/
|
||||
// / \| | | | \// __ \| | / __ \_/ /_/ > | /\___ |
|
||||
// /_______ /|__| |__| (____ /__| (____ /\___ /|____//____ >
|
||||
// \/ \/ \//_____/ \/
|
||||
// ______________________ ______________________
|
||||
// T H E W A R B E G I N S
|
||||
// Stratagus - A free fantasy real time strategy game engine
|
||||
//
|
||||
//
|
||||
// (c) Copyright 1999-2012 by Vladi Belperchinov-Shabanski,
|
||||
// Joris DAUPHIN, and Jimmy Salmon
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; only version 2 of the License.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
// 02111-1307, USA.
|
||||
//
|
||||
|
||||
#ifndef SPELL_AREABOMBARDMENT_H
|
||||
#define SPELL_AREABOMBARDMENT_H
|
||||
|
||||
//@{
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
-- Includes
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
#include "spells.h"
|
||||
|
||||
class AreaBombardment : public SpellActionType
|
||||
{
|
||||
public:
|
||||
AreaBombardment() : Fields(0), Shards(0), Damage(0),
|
||||
StartOffsetX(0), StartOffsetY(0), Missile(NULL) {};
|
||||
virtual int Cast(CUnit &caster, const SpellType &spell,
|
||||
CUnit *target, const Vec2i &goalPos);
|
||||
virtual void Parse(lua_State *l, int startIndex, int endIndex);
|
||||
|
||||
private:
|
||||
int Fields; /// The size of the affected square.
|
||||
int Shards; /// Number of shards thrown.
|
||||
int Damage; /// Damage for every shard.
|
||||
int StartOffsetX; /// The offset of the missile start point to the hit location.
|
||||
int StartOffsetY; /// The offset of the missile start point to the hit location.
|
||||
MissileType *Missile; /// Missile fired on cast
|
||||
};
|
||||
|
||||
//@}
|
||||
|
||||
#endif // SPELL_AREABOMBARDMENT_H
|
58
src/include/spell/spell_capture.h
Normal file
58
src/include/spell/spell_capture.h
Normal file
|
@ -0,0 +1,58 @@
|
|||
// _________ __ __
|
||||
// / _____// |_____________ _/ |______ ____ __ __ ______
|
||||
// \_____ \\ __\_ __ \__ \\ __\__ \ / ___\| | \/ ___/
|
||||
// / \| | | | \// __ \| | / __ \_/ /_/ > | /\___ |
|
||||
// /_______ /|__| |__| (____ /__| (____ /\___ /|____//____ >
|
||||
// \/ \/ \//_____/ \/
|
||||
// ______________________ ______________________
|
||||
// T H E W A R B E G I N S
|
||||
// Stratagus - A free fantasy real time strategy game engine
|
||||
//
|
||||
//
|
||||
// (c) Copyright 1999-2012 by Vladi Belperchinov-Shabanski,
|
||||
// Joris DAUPHIN, and Jimmy Salmon
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; only version 2 of the License.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
// 02111-1307, USA.
|
||||
//
|
||||
|
||||
#ifndef SPELL_CAPTURE_H
|
||||
#define SPELL_CAPTURE_H
|
||||
|
||||
//@{
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
-- Includes
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
#include "spells.h"
|
||||
|
||||
class Capture : public SpellActionType
|
||||
{
|
||||
public:
|
||||
Capture() : SacrificeEnable(0), Damage(0), DamagePercent(0) {};
|
||||
virtual int Cast(CUnit &caster, const SpellType &spell,
|
||||
CUnit *target, const Vec2i &goalPos);
|
||||
virtual void Parse(lua_State *l, int startIndex, int endIndex);
|
||||
|
||||
private:
|
||||
char SacrificeEnable; /// true if the caster dies after casting.
|
||||
int Damage; /// damage the spell does if unable to caputre
|
||||
int DamagePercent; /// percent the target must be damaged for a
|
||||
/// capture to suceed.
|
||||
};
|
||||
|
||||
//@}
|
||||
|
||||
#endif // SPELL_CAPTURE_H
|
57
src/include/spell/spell_demolish.h
Normal file
57
src/include/spell/spell_demolish.h
Normal file
|
@ -0,0 +1,57 @@
|
|||
// _________ __ __
|
||||
// / _____// |_____________ _/ |______ ____ __ __ ______
|
||||
// \_____ \\ __\_ __ \__ \\ __\__ \ / ___\| | \/ ___/
|
||||
// / \| | | | \// __ \| | / __ \_/ /_/ > | /\___ |
|
||||
// /_______ /|__| |__| (____ /__| (____ /\___ /|____//____ >
|
||||
// \/ \/ \//_____/ \/
|
||||
// ______________________ ______________________
|
||||
// T H E W A R B E G I N S
|
||||
// Stratagus - A free fantasy real time strategy game engine
|
||||
//
|
||||
//
|
||||
// (c) Copyright 1999-2012 by Vladi Belperchinov-Shabanski,
|
||||
// Joris DAUPHIN, and Jimmy Salmon
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; only version 2 of the License.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
// 02111-1307, USA.
|
||||
//
|
||||
|
||||
#ifndef SPELL_DEMOLISH_H
|
||||
#define SPELL_DEMOLISH_H
|
||||
|
||||
//@{
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
-- Includes
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
#include "spells.h"
|
||||
|
||||
class Demolish : public SpellActionType
|
||||
{
|
||||
public:
|
||||
Demolish() : Damage(0), Range(0) {};
|
||||
virtual int Cast(CUnit &caster, const SpellType &spell,
|
||||
CUnit *target, const Vec2i &goalPos);
|
||||
virtual void Parse(lua_State *l, int startIndex, int endIndex);
|
||||
|
||||
private:
|
||||
int Damage; /// Damage for every unit in range.
|
||||
int Range; /// Range of the explosion.
|
||||
};
|
||||
|
||||
|
||||
//@}
|
||||
|
||||
#endif // SPELL_DEMOLISH_H
|
57
src/include/spell/spell_polymorph.h
Normal file
57
src/include/spell/spell_polymorph.h
Normal file
|
@ -0,0 +1,57 @@
|
|||
// _________ __ __
|
||||
// / _____// |_____________ _/ |______ ____ __ __ ______
|
||||
// \_____ \\ __\_ __ \__ \\ __\__ \ / ___\| | \/ ___/
|
||||
// / \| | | | \// __ \| | / __ \_/ /_/ > | /\___ |
|
||||
// /_______ /|__| |__| (____ /__| (____ /\___ /|____//____ >
|
||||
// \/ \/ \//_____/ \/
|
||||
// ______________________ ______________________
|
||||
// T H E W A R B E G I N S
|
||||
// Stratagus - A free fantasy real time strategy game engine
|
||||
//
|
||||
//
|
||||
// (c) Copyright 1999-2012 by Vladi Belperchinov-Shabanski,
|
||||
// Joris DAUPHIN, and Jimmy Salmon
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; only version 2 of the License.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
// 02111-1307, USA.
|
||||
//
|
||||
|
||||
#ifndef SPELL_POLYMORPH_H
|
||||
#define SPELL_POLYMORPH_H
|
||||
|
||||
//@{
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
-- Includes
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
#include "spells.h"
|
||||
|
||||
class Polymorph : public SpellActionType
|
||||
{
|
||||
public:
|
||||
Polymorph() : SpellActionType(1), NewForm(NULL), PlayerNeutral(0) {};
|
||||
virtual int Cast(CUnit &caster, const SpellType &spell,
|
||||
CUnit *target, const Vec2i &goalPos);
|
||||
virtual void Parse(lua_State *l, int startIndex, int endIndex);
|
||||
|
||||
private:
|
||||
CUnitType *NewForm; /// The new form
|
||||
int PlayerNeutral; /// Convert the unit to the neutral player, or to the caster's player.
|
||||
// TODO: temporary polymorphs would be awesome, but hard to implement
|
||||
};
|
||||
|
||||
//@}
|
||||
|
||||
#endif // SPELL_POLYMORPH_H
|
90
src/include/spell/spell_spawnmissile.h
Normal file
90
src/include/spell/spell_spawnmissile.h
Normal file
|
@ -0,0 +1,90 @@
|
|||
// _________ __ __
|
||||
// / _____// |_____________ _/ |______ ____ __ __ ______
|
||||
// \_____ \\ __\_ __ \__ \\ __\__ \ / ___\| | \/ ___/
|
||||
// / \| | | | \// __ \| | / __ \_/ /_/ > | /\___ |
|
||||
// /_______ /|__| |__| (____ /__| (____ /\___ /|____//____ >
|
||||
// \/ \/ \//_____/ \/
|
||||
// ______________________ ______________________
|
||||
// T H E W A R B E G I N S
|
||||
// Stratagus - A free fantasy real time strategy game engine
|
||||
//
|
||||
//
|
||||
// (c) Copyright 1999-2012 by Vladi Belperchinov-Shabanski,
|
||||
// Joris DAUPHIN, and Jimmy Salmon
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; only version 2 of the License.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
// 02111-1307, USA.
|
||||
//
|
||||
|
||||
#ifndef SPELL_SPAWNMISSILE_H
|
||||
#define SPELL_SPAWNMISSILE_H
|
||||
|
||||
//@{
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
-- Includes
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
#include "spells.h"
|
||||
|
||||
/**
|
||||
** Different targets.
|
||||
*/
|
||||
enum LocBaseType {
|
||||
LocBaseCaster,
|
||||
LocBaseTarget
|
||||
};
|
||||
|
||||
/**
|
||||
** This struct is used for defining a missile start/stop location.
|
||||
**
|
||||
** It's evaluated like this, and should be more or less flexible.:
|
||||
** base coordinates(caster or target) + (AddX,AddY) + (rand()%AddRandX,rand()%AddRandY)
|
||||
*/
|
||||
class SpellActionMissileLocation
|
||||
{
|
||||
public:
|
||||
SpellActionMissileLocation(LocBaseType base) : Base(base), AddX(0), AddY(0),
|
||||
AddRandX(0), AddRandY(0) {} ;
|
||||
|
||||
LocBaseType Base; /// The base for the location (caster/target)
|
||||
int AddX; /// Add to the X coordinate
|
||||
int AddY; /// Add to the X coordinate
|
||||
int AddRandX; /// Random add to the X coordinate
|
||||
int AddRandY; /// Random add to the X coordinate
|
||||
};
|
||||
|
||||
class SpawnMissile : public SpellActionType
|
||||
{
|
||||
public:
|
||||
SpawnMissile() : Damage(0), TTL(-1), Delay(0), UseUnitVar(false),
|
||||
StartPoint(LocBaseCaster), EndPoint(LocBaseTarget), Missile(0) {}
|
||||
virtual int Cast(CUnit &caster, const SpellType &spell,
|
||||
CUnit *target, const Vec2i &goalPos);
|
||||
virtual void Parse(lua_State *lua, int startIndex, int endIndex);
|
||||
|
||||
private:
|
||||
int Damage; /// Missile damage.
|
||||
int TTL; /// Missile TTL.
|
||||
int Delay; /// Missile original delay.
|
||||
bool UseUnitVar; /// Use the caster's damage parameters
|
||||
SpellActionMissileLocation StartPoint; /// Start point description.
|
||||
SpellActionMissileLocation EndPoint; /// Start point description.
|
||||
MissileType *Missile; /// Missile fired on cast
|
||||
};
|
||||
|
||||
|
||||
//@}
|
||||
|
||||
#endif // SPELL_SPAWNMISSILE_H
|
56
src/include/spell/spell_spawnportal.h
Normal file
56
src/include/spell/spell_spawnportal.h
Normal file
|
@ -0,0 +1,56 @@
|
|||
// _________ __ __
|
||||
// / _____// |_____________ _/ |______ ____ __ __ ______
|
||||
// \_____ \\ __\_ __ \__ \\ __\__ \ / ___\| | \/ ___/
|
||||
// / \| | | | \// __ \| | / __ \_/ /_/ > | /\___ |
|
||||
// /_______ /|__| |__| (____ /__| (____ /\___ /|____//____ >
|
||||
// \/ \/ \//_____/ \/
|
||||
// ______________________ ______________________
|
||||
// T H E W A R B E G I N S
|
||||
// Stratagus - A free fantasy real time strategy game engine
|
||||
//
|
||||
//
|
||||
// (c) Copyright 1999-2012 by Vladi Belperchinov-Shabanski,
|
||||
// Joris DAUPHIN, and Jimmy Salmon
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; only version 2 of the License.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
// 02111-1307, USA.
|
||||
//
|
||||
|
||||
#ifndef SPELL_SPAWNPORTAL_H
|
||||
#define SPELL_SPAWNPORTAL_H
|
||||
|
||||
//@{
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
-- Includes
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
#include "spells.h"
|
||||
|
||||
class SpawnPortal : public SpellActionType
|
||||
{
|
||||
public:
|
||||
SpawnPortal() : PortalType(0) {};
|
||||
virtual int Cast(CUnit &caster, const SpellType &spell,
|
||||
CUnit *target, const Vec2i &goalPos);
|
||||
virtual void Parse(lua_State *l, int startIndex, int endIndex);
|
||||
|
||||
private:
|
||||
CUnitType *PortalType; /// The unit type spawned
|
||||
};
|
||||
|
||||
|
||||
//@}
|
||||
|
||||
#endif // SPELL_SPAWNPORTAL_H
|
58
src/include/spell/spell_summon.h
Normal file
58
src/include/spell/spell_summon.h
Normal file
|
@ -0,0 +1,58 @@
|
|||
// _________ __ __
|
||||
// / _____// |_____________ _/ |______ ____ __ __ ______
|
||||
// \_____ \\ __\_ __ \__ \\ __\__ \ / ___\| | \/ ___/
|
||||
// / \| | | | \// __ \| | / __ \_/ /_/ > | /\___ |
|
||||
// /_______ /|__| |__| (____ /__| (____ /\___ /|____//____ >
|
||||
// \/ \/ \//_____/ \/
|
||||
// ______________________ ______________________
|
||||
// T H E W A R B E G I N S
|
||||
// Stratagus - A free fantasy real time strategy game engine
|
||||
//
|
||||
//
|
||||
// (c) Copyright 1999-2012 by Vladi Belperchinov-Shabanski,
|
||||
// Joris DAUPHIN, and Jimmy Salmon
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; only version 2 of the License.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
// 02111-1307, USA.
|
||||
//
|
||||
|
||||
#ifndef SPELL_SUMMON_H
|
||||
#define SPELL_SUMMON_H
|
||||
|
||||
//@{
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
-- Includes
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
#include "spells.h"
|
||||
|
||||
class Summon : public SpellActionType
|
||||
{
|
||||
public:
|
||||
Summon() : SpellActionType(1), UnitType(NULL), TTL(0), RequireCorpse(0) {};
|
||||
virtual int Cast(CUnit &caster, const SpellType &spell,
|
||||
CUnit *target, const Vec2i &goalPos);
|
||||
virtual void Parse(lua_State *l, int startIndex, int endIndex);
|
||||
|
||||
private:
|
||||
CUnitType *UnitType; /// Type of unit to be summoned.
|
||||
int TTL; /// Time to live for summoned unit. 0 means infinite
|
||||
int RequireCorpse; /// Corpse consumed while summoning.
|
||||
};
|
||||
|
||||
|
||||
//@}
|
||||
|
||||
#endif // SPELL_SUMMON_H
|
|
@ -55,69 +55,6 @@ class MissileType;
|
|||
-- Definitons
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
** Different targets.
|
||||
*/
|
||||
enum TargetType {
|
||||
TargetSelf,
|
||||
TargetPosition,
|
||||
TargetUnit
|
||||
};
|
||||
|
||||
/**
|
||||
** Different targets.
|
||||
*/
|
||||
enum LocBaseType {
|
||||
LocBaseCaster,
|
||||
LocBaseTarget
|
||||
};
|
||||
|
||||
/**
|
||||
** This struct is used for defining a missile start/stop location.
|
||||
**
|
||||
** It's evaluated like this, and should be more or less flexible.:
|
||||
** base coordinates(caster or target) + (AddX,AddY) + (rand()%AddRandX,rand()%AddRandY)
|
||||
*/
|
||||
class SpellActionMissileLocation
|
||||
{
|
||||
public:
|
||||
SpellActionMissileLocation(LocBaseType base) : Base(base), AddX(0), AddY(0),
|
||||
AddRandX(0), AddRandY(0) {} ;
|
||||
|
||||
LocBaseType Base; /// The base for the location (caster/target)
|
||||
int AddX; /// Add to the X coordinate
|
||||
int AddY; /// Add to the X coordinate
|
||||
int AddRandX; /// Random add to the X coordinate
|
||||
int AddRandY; /// Random add to the X coordinate
|
||||
};
|
||||
|
||||
class SpellActionTypeAdjustVariable
|
||||
{
|
||||
public:
|
||||
SpellActionTypeAdjustVariable() : Enable(0), Value(0), Max(0), Increase(0),
|
||||
ModifEnable(0), ModifValue(0), ModifMax(0), ModifIncrease(0),
|
||||
InvertEnable(0), AddValue(0), AddMax(0), AddIncrease(0), IncreaseTime(0),
|
||||
TargetIsCaster(0) {};
|
||||
|
||||
int Enable; /// Value to affect to this field.
|
||||
int Value; /// Value to affect to this field.
|
||||
int Max; /// Value to affect to this field.
|
||||
int Increase; /// Value to affect to this field.
|
||||
|
||||
char ModifEnable; /// true if we modify this field.
|
||||
char ModifValue; /// true if we modify this field.
|
||||
char ModifMax; /// true if we modify this field.
|
||||
char ModifIncrease; /// true if we modify this field.
|
||||
|
||||
char InvertEnable; /// true if we invert this field.
|
||||
int AddValue; /// Add this value to this field.
|
||||
int AddMax; /// Add this value to this field.
|
||||
int AddIncrease; /// Add this value to this field.
|
||||
int IncreaseTime; /// How many time increase the Value field.
|
||||
char TargetIsCaster; /// true if the target is the caster.
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
** Generic spell action virtual class.
|
||||
** Spells are sub class of this one
|
||||
|
@ -135,155 +72,14 @@ public:
|
|||
const int ModifyManaCaster;
|
||||
};
|
||||
|
||||
//
|
||||
// Specific spells.
|
||||
//
|
||||
|
||||
class AreaAdjustVital : public SpellActionType
|
||||
{
|
||||
public:
|
||||
AreaAdjustVital() : HP(0), Mana(0) {};
|
||||
virtual int Cast(CUnit &caster, const SpellType &spell,
|
||||
CUnit *target, const Vec2i &goalPos);
|
||||
virtual void Parse(lua_State *l, int startIndex, int endIndex);
|
||||
|
||||
private:
|
||||
int HP; /// Target HP gain.(can be negative)
|
||||
int Mana; /// Target Mana gain.(can be negative)
|
||||
} ;
|
||||
|
||||
class SpawnMissile : public SpellActionType
|
||||
{
|
||||
public:
|
||||
SpawnMissile() : Damage(0), TTL(-1), Delay(0), UseUnitVar(false),
|
||||
StartPoint(LocBaseCaster), EndPoint(LocBaseTarget), Missile(0) {}
|
||||
virtual int Cast(CUnit &caster, const SpellType &spell,
|
||||
CUnit *target, const Vec2i &goalPos);
|
||||
virtual void Parse(lua_State *lua, int startIndex, int endIndex);
|
||||
|
||||
private:
|
||||
int Damage; /// Missile damage.
|
||||
int TTL; /// Missile TTL.
|
||||
int Delay; /// Missile original delay.
|
||||
bool UseUnitVar; /// Use the caster's damage parameters
|
||||
SpellActionMissileLocation StartPoint; /// Start point description.
|
||||
SpellActionMissileLocation EndPoint; /// Start point description.
|
||||
MissileType *Missile; /// Missile fired on cast
|
||||
};
|
||||
|
||||
class Demolish : public SpellActionType
|
||||
{
|
||||
public:
|
||||
Demolish() : Damage(0), Range(0) {};
|
||||
virtual int Cast(CUnit &caster, const SpellType &spell,
|
||||
CUnit *target, const Vec2i &goalPos);
|
||||
virtual void Parse(lua_State *l, int startIndex, int endIndex);
|
||||
|
||||
private:
|
||||
int Damage; /// Damage for every unit in range.
|
||||
int Range; /// Range of the explosion.
|
||||
};
|
||||
|
||||
class AreaBombardment : public SpellActionType
|
||||
{
|
||||
public:
|
||||
AreaBombardment() : Fields(0), Shards(0), Damage(0),
|
||||
StartOffsetX(0), StartOffsetY(0), Missile(NULL) {};
|
||||
virtual int Cast(CUnit &caster, const SpellType &spell,
|
||||
CUnit *target, const Vec2i &goalPos);
|
||||
virtual void Parse(lua_State *l, int startIndex, int endIndex);
|
||||
|
||||
private:
|
||||
int Fields; /// The size of the affected square.
|
||||
int Shards; /// Number of shards thrown.
|
||||
int Damage; /// Damage for every shard.
|
||||
int StartOffsetX; /// The offset of the missile start point to the hit location.
|
||||
int StartOffsetY; /// The offset of the missile start point to the hit location.
|
||||
MissileType *Missile; /// Missile fired on cast
|
||||
};
|
||||
|
||||
class SpawnPortal : public SpellActionType
|
||||
{
|
||||
public:
|
||||
SpawnPortal() : PortalType(0) {};
|
||||
virtual int Cast(CUnit &caster, const SpellType &spell,
|
||||
CUnit *target, const Vec2i &goalPos);
|
||||
virtual void Parse(lua_State *l, int startIndex, int endIndex);
|
||||
|
||||
private:
|
||||
CUnitType *PortalType; /// The unit type spawned
|
||||
};
|
||||
|
||||
class AdjustVariable : public SpellActionType
|
||||
{
|
||||
public:
|
||||
AdjustVariable() : Var(NULL) {};
|
||||
~AdjustVariable() { delete [](this->Var); };
|
||||
virtual int Cast(CUnit &caster, const SpellType &spell,
|
||||
CUnit *target, const Vec2i &goalPos);
|
||||
virtual void Parse(lua_State *l, int startIndex, int endIndex);
|
||||
|
||||
private:
|
||||
SpellActionTypeAdjustVariable *Var;
|
||||
};
|
||||
|
||||
class AdjustVital : public SpellActionType
|
||||
{
|
||||
public:
|
||||
AdjustVital() : SpellActionType(1), HP(0), Mana(0), MaxMultiCast(0) {};
|
||||
virtual int Cast(CUnit &caster, const SpellType &spell,
|
||||
CUnit *target, const Vec2i &goalPos);
|
||||
virtual void Parse(lua_State *l, int startIndex, int endIndex);
|
||||
|
||||
private:
|
||||
int HP; /// Target HP gain.(can be negative)
|
||||
int Mana; /// Target Mana gain.(can be negative)
|
||||
/// This spell is designed to be used wit very small amounts. The spell
|
||||
/// can scale up to MaxMultiCast times. Use 0 for infinite.
|
||||
int MaxMultiCast;
|
||||
};
|
||||
|
||||
class Polymorph : public SpellActionType
|
||||
{
|
||||
public:
|
||||
Polymorph() : SpellActionType(1), NewForm(NULL), PlayerNeutral(0) {};
|
||||
virtual int Cast(CUnit &caster, const SpellType &spell,
|
||||
CUnit *target, const Vec2i &goalPos);
|
||||
virtual void Parse(lua_State *l, int startIndex, int endIndex);
|
||||
|
||||
private:
|
||||
CUnitType *NewForm; /// The new form
|
||||
int PlayerNeutral; /// Convert the unit to the neutral player, or to the caster's player.
|
||||
// TODO: temporary polymorphs would be awesome, but hard to implement
|
||||
};
|
||||
|
||||
class Summon : public SpellActionType
|
||||
{
|
||||
public:
|
||||
Summon() : SpellActionType(1), UnitType(NULL), TTL(0), RequireCorpse(0) {};
|
||||
virtual int Cast(CUnit &caster, const SpellType &spell,
|
||||
CUnit *target, const Vec2i &goalPos);
|
||||
virtual void Parse(lua_State *l, int startIndex, int endIndex);
|
||||
|
||||
private:
|
||||
CUnitType *UnitType; /// Type of unit to be summoned.
|
||||
int TTL; /// Time to live for summoned unit. 0 means infinite
|
||||
int RequireCorpse; /// Corpse consumed while summoning.
|
||||
};
|
||||
|
||||
class Capture : public SpellActionType
|
||||
{
|
||||
public:
|
||||
Capture() : SacrificeEnable(0), Damage(0), DamagePercent(0) {};
|
||||
virtual int Cast(CUnit &caster, const SpellType &spell,
|
||||
CUnit *target, const Vec2i &goalPos);
|
||||
virtual void Parse(lua_State *l, int startIndex, int endIndex);
|
||||
|
||||
private:
|
||||
char SacrificeEnable; /// true if the caster dies after casting.
|
||||
int Damage; /// damage the spell does if unable to caputre
|
||||
int DamagePercent; /// percent the target must be damaged for a
|
||||
/// capture to suceed.
|
||||
/**
|
||||
** Different targets.
|
||||
*/
|
||||
enum TargetType {
|
||||
TargetSelf,
|
||||
TargetPosition,
|
||||
TargetUnit
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
|
@ -36,6 +36,16 @@
|
|||
|
||||
#include "spells.h"
|
||||
|
||||
#include "spell/spell_adjustvariable.h"
|
||||
#include "spell/spell_adjustvital.h"
|
||||
#include "spell/spell_areaadjustvital.h"
|
||||
#include "spell/spell_areabombardment.h"
|
||||
#include "spell/spell_capture.h"
|
||||
#include "spell/spell_demolish.h"
|
||||
#include "spell/spell_polymorph.h"
|
||||
#include "spell/spell_spawnmissile.h"
|
||||
#include "spell/spell_spawnportal.h"
|
||||
#include "spell/spell_summon.h"
|
||||
#include "script_sound.h"
|
||||
#include "script.h"
|
||||
#include "unittype.h"
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
|
||||
#include "stratagus.h"
|
||||
|
||||
#include "spells.h"
|
||||
#include "spell/spell_adjustvariable.h"
|
||||
|
||||
#include "script.h"
|
||||
#include "unit.h"
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
|
||||
#include "stratagus.h"
|
||||
|
||||
#include "spells.h"
|
||||
#include "spell/spell_adjustvital.h"
|
||||
|
||||
#include "script.h"
|
||||
#include "unit.h"
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
|
||||
#include "stratagus.h"
|
||||
|
||||
#include "spells.h"
|
||||
#include "spell/spell_areaadjustvital.h"
|
||||
|
||||
#include "map.h"
|
||||
#include "script.h"
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
|
||||
#include "stratagus.h"
|
||||
|
||||
#include "spells.h"
|
||||
#include "spell/spell_areabombardment.h"
|
||||
|
||||
#include "map.h"
|
||||
#include "missile.h"
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
|
||||
#include "stratagus.h"
|
||||
|
||||
#include "spells.h"
|
||||
#include "spell/spell_capture.h"
|
||||
|
||||
#include "script.h"
|
||||
#include "unit.h"
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
|
||||
#include "stratagus.h"
|
||||
|
||||
#include "spells.h"
|
||||
#include "spell/spell_demolish.h"
|
||||
|
||||
#include "script.h"
|
||||
#include "map.h"
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
|
||||
#include "stratagus.h"
|
||||
|
||||
#include "spells.h"
|
||||
#include "spell/spell_polymorph.h"
|
||||
|
||||
#include "map.h"
|
||||
#include "script.h"
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
|
||||
#include "stratagus.h"
|
||||
|
||||
#include "spells.h"
|
||||
#include "spell/spell_spawnmissile.h"
|
||||
|
||||
#include "map.h"
|
||||
#include "missile.h"
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
|
||||
#include "stratagus.h"
|
||||
|
||||
#include "spells.h"
|
||||
#include "spell/spell_spawnportal.h"
|
||||
|
||||
#include "script.h"
|
||||
#include "unit.h"
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
|
||||
#include "stratagus.h"
|
||||
|
||||
#include "spells.h"
|
||||
#include "spell/spell_summon.h"
|
||||
|
||||
#include "actions.h"
|
||||
#include "map.h"
|
||||
|
|
Loading…
Reference in a new issue