_________ __                 __
        /   _____//  |_____________ _/  |______     ____  __ __  ______
        \_____  \\   __\_  __ \__  \\   __\__  \   / ___\|  |  \/  ___/
        /        \|  |  |  | \// __ \|  |  / __ \_/ /_/  >  |  /\___ \
       /_______  /|__|  |__|  (____  /__| (____  /\___  /|____//____  >
               \/                  \/          \//_____/            \/
    ______________________                           ______________________
                          T H E   W A R   B E G I N S
                   Stratagus - A free fantasy real time strategy game engine

Classes | Macros
spells.h File Reference
#include "luacallback.h"
#include "unitsound.h"
#include "vec2i.h"

Go to the source code of this file.

Classes

class  SpellActionType
 
class  Target
 
class  ConditionInfoVariable
 
class  ConditionInfo
 
class  AutoCastInfo
 
class  SpellType
 

Macros

#define CONDITION_FALSE   1
 
#define CONDITION_TRUE   0
 
#define CONDITION_ONLY   2
 
#define ACP_NOVALUE   -1
 
#define ACP_DISTANCE   -2
 
#define INFINITE_RANGE   0xFFFFFFF
 Max range of the target. More...
 

spells.h - The Spells.

enum  TargetType { TargetSelf, TargetPosition, TargetUnit }
 
std::vector< SpellType * > SpellTypeTable
 
void SpellCclRegister ()
 register fonction. More...
 
void InitSpells ()
 init spell tables More...
 
void CleanSpells ()
 done spell tables 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 SpellCast (CUnit &caster, const SpellType &spell, CUnit *target, const Vec2i &goalPos)
 cast spell on target unit or place at x,y More...
 
int AutoCastSpell (CUnit &caster, const SpellType &spell)
 auto cast the spell if possible More...
 
SpellTypeSpellTypeByIdent (const std::string &ident)
 return spell type by ident string More...
 
char Ccl2Condition (lua_State *l, const char *value)
 return 0, 1, 2 for true, only, false. More...
 

Macro Definition Documentation

◆ ACP_DISTANCE

#define ACP_DISTANCE   -2

◆ ACP_NOVALUE

#define ACP_NOVALUE   -1

◆ CONDITION_FALSE

#define CONDITION_FALSE   1

◆ CONDITION_ONLY

#define CONDITION_ONLY   2

◆ CONDITION_TRUE

#define CONDITION_TRUE   0

◆ INFINITE_RANGE

#define INFINITE_RANGE   0xFFFFFFF

Max range of the target.

Enumeration Type Documentation

◆ TargetType

enum TargetType

Different targets.

Enumerator
TargetSelf 
TargetPosition 
TargetUnit 

Function Documentation

◆ AutoCastSpell()

int AutoCastSpell ( CUnit caster,
const SpellType spell 
)

auto cast the spell if possible

Check if the spell can be auto cast and cast it.

Parameters
casterUnit who can cast the spell.
spellSpell-type pointer.
Returns
1 if spell is casted, 0 if not.

◆ CanCastSpell()

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.

Parameters
casterUnit that casts the spell
spellSpell-type pointer
targetTarget unit that spell is addressed to
goalPoscoord of target spot when/if target does not exist
Returns
=!0 if spell should/can casted, 0 if not
Note
caster must know the spell, and spell must be researched.

◆ Ccl2Condition()

char Ccl2Condition ( lua_State *  l,
const char *  value 
)

return 0, 1, 2 for true, only, false.

Get a condition value from a scm object.

Parameters
lLua state.
valuescm value to convert.
Returns
CONDITION_TRUE, CONDITION_FALSE, CONDITION_ONLY or -1 on error.
Note
This is a helper function to make CclSpellCondition shorter and easier to understand.

◆ CleanSpells()

void CleanSpells ( )

done spell tables

Cleanup the spell subsystem.

◆ InitSpells()

void InitSpells ( )

init spell tables

Spells constructor, inits spell id's and sounds

◆ SpellCast()

int SpellCast ( CUnit caster,
const SpellType spell,
CUnit target,
const Vec2i goalPos 
)

cast spell on target unit or place at x,y

Spell cast!

Parameters
casterUnit that casts the spell
spellSpell-type pointer
targetTarget unit that spell is addressed to
goalPoscoord of target spot when/if target does not exist
Returns
!=0 if spell should/can continue or 0 to stop

◆ SpellCclRegister()

void SpellCclRegister ( )

register fonction.

Register CCL features for Spell.

◆ SpellIsAvailable()

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.

Parameters
playerplayer for who we want to know if he knows the spell.
spellidid of the spell to check.
Returns
0 if spell is not available, else no null.

◆ SpellTypeByIdent()

SpellType* SpellTypeByIdent ( const std::string &  ident)

return spell type by ident string

Get spell-type struct pointer by string identifier.

Parameters
identSpell identifier.
Returns
spell-type struct pointer.

Variable Documentation

◆ SpellTypeTable

std::vector<SpellType *> SpellTypeTable

Define the names and effects of all available spells.

Define the names and effects of all im play available spells.

(C) Copyright 1998-2012 by The Stratagus Project under the GNU General Public License.
All trademarks and copyrights on this page are owned by their respective owners.