$treeview $search $mathjax
Stratagus
2.2.7
$projectbrief
|
$projectbrief
|
$searchbox |
_________ __ __ / _____// |_____________ _/ |______ ____ __ __ ______ \_____ \\ __\_ __ \__ \\ __\__ \ / ___\| | \/ ___/ / \| | | | \// __ \| | / __ \_/ /_/ > | /\___ \ /_______ /|__| |__| (____ /__| (____ /\___ /|____//____ > \/ \/ \//_____/ \/ ______________________ ______________________ 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 "commands.h"
#include "map.h"
#include "sound.h"
#include "unit.h"
#include "unit_find.h"
#include "upgrade.h"
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 &, const ConditionInfo *condition) |
static Target * | SelectTargetUnitsOfAutoCast (CUnit &caster, const SpellType &spell) |
void | InitSpells () |
init spell tables | |
SpellType * | SpellTypeByIdent (const std::string &ident) |
return spell type by ident string | |
bool | SpellIsAvailable (const CPlayer &player, int spellid) |
return 1 if spell is availible, 0 if not (must upgrade) | |
bool | CanCastSpell (const CUnit &caster, const SpellType &spell, const CUnit *target, const Vec2i &goalPos) |
int | AutoCastSpell (CUnit &caster, const SpellType &spell) |
auto cast the spell if possible | |
int | SpellCast (CUnit &caster, const SpellType &spell, CUnit *target, const Vec2i &goalPos) |
void | CleanSpells () |
done spell tables |
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 | |||
) |
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 bool PassCondition | ( | const CUnit & | caster, | |
const SpellType & | spell, | |||
const CUnit * | target, | |||
const Vec2i & | , | |||
const ConditionInfo * | condition | |||
) | [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. |
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 availible, 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.