_________ __ __ / _____// |_____________ _/ |______ ____ __ __ ______ \_____ \\ __\_ __ \__ \\ __\__ \ / ___\| | \/ ___/ / \| | | | \// __ \| | / __ \_/ /_/ > | /\___ \ /_______ /|__| |__| (____ /__| (____ /\___ /|____//____ > \/ \/ \//_____/ \/ ______________________ ______________________ T H E W A R B E G I N S Stratagus - A free fantasy real time strategy game engine
#include "stratagus.h"
#include "spells.h"
#include "actions.h"
#include "commands.h"
#include "map.h"
#include "sound.h"
#include "unit.h"
#include "unit_find.h"
#include "upgrade.h"
Classes | |
class | AutoCastPrioritySort |
spells.cpp - The spell cast action. | |
std::vector< SpellType * > | SpellTypeTable |
static Target * | NewTargetUnit (CUnit &unit) |
static bool | PassCondition (const CUnit &caster, const SpellType &spell, const CUnit *target, const Vec2i &goalPos, const ConditionInfo *condition) |
static Target * | SelectTargetUnitsOfAutoCast (CUnit &caster, const SpellType &spell) |
void | InitSpells () |
init spell tables More... | |
SpellType * | SpellTypeByIdent (const std::string &ident) |
return spell type by ident string More... | |
bool | SpellIsAvailable (const CPlayer &player, int spellid) |
return 1 if spell is available, 0 if not (must upgrade) More... | |
bool | CanCastSpell (const CUnit &caster, const SpellType &spell, const CUnit *target, const Vec2i &goalPos) |
returns true if spell can be casted (enough mana, valid target) More... | |
int | AutoCastSpell (CUnit &caster, const SpellType &spell) |
auto cast the spell if possible More... | |
int | SpellCast (CUnit &caster, const SpellType &spell, CUnit *target, const Vec2i &goalPos) |
cast spell on target unit or place at x,y More... | |
void | CleanSpells () |
done spell tables More... | |
auto cast the spell if possible
Check if the spell can be auto cast and cast it.
caster | Unit who can cast the spell. |
spell | Spell-type pointer. |
bool CanCastSpell | ( | const CUnit & | caster, |
const SpellType & | spell, | ||
const CUnit * | target, | ||
const Vec2i & | goalPos | ||
) |
returns true if spell can be casted (enough mana, valid target)
Check if unit can cast the spell.
caster | Unit that casts the spell |
spell | Spell-type pointer |
target | Target unit that spell is addressed to |
goalPos | coord of target spot when/if target does not exist |
void CleanSpells | ( | ) |
done spell tables
Cleanup the spell subsystem.
void InitSpells | ( | ) |
init spell tables
Spells constructor, inits spell id's and sounds
|
static |
Check the condition.
caster | Pointer to caster unit. |
spell | Pointer to the spell to cast. |
target | Pointer to target unit, or 0 if it is a position spell. |
goalPos | position, or {-1, -1} if it is a unit spell. |
condition | Pointer to condition info. |
Select the target for the autocast.
caster | Unit who would cast the spell. |
spell | Spell-type pointer. |
FIXME: should be global (for AI) ???
FIXME: write for position target.
cast spell on target unit or place at x,y
Spell cast!
caster | Unit that casts the spell |
spell | Spell-type pointer |
target | Target unit that spell is addressed to |
goalPos | coord of target spot when/if target does not exist |
bool SpellIsAvailable | ( | const CPlayer & | player, |
int | spellid | ||
) |
return 1 if spell is available, 0 if not (must upgrade)
Check if spell is research for player player
.
player | player for who we want to know if he knows the spell. |
spellid | id of the spell to check. |
SpellType* SpellTypeByIdent | ( | const std::string & | ident | ) |
return spell type by ident string
Get spell-type struct pointer by string identifier.
ident | Spell identifier. |
std::vector<SpellType *> SpellTypeTable |
Define the names and effects of all im play available spells.