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

src/include/spells.h File Reference

#include "unitsound.h"
#include "vec2i.h"

Go to the source code of this file.


Classes

class  SpellActionMissileLocation
class  SpellActionTypeAdjustVariable
class  SpellActionType
class  AreaAdjustVitals
class  SpawnMissile
class  Demolish
class  AreaBombardment
class  SpawnPortal
class  AdjustVariable
class  AdjustVitals
class  Polymorph
class  Summon
class  Capture
class  Target
class  ConditionInfoVariable
class  ConditionInfo
class  AutoCastInfo
class  SpellType

spells.h - The Spells.

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

Defines

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

Define Documentation

#define CONDITION_FALSE   1

#define CONDITION_ONLY   2

#define CONDITION_TRUE   0

#define INFINITE_RANGE   0xFFFFFFF

Max range of the target.


Enumeration Type Documentation

Different targets.

Enumerator:
LocBaseCaster 
LocBaseTarget 

enum TargetType

Different targets.

Enumerator:
TargetSelf 
TargetPosition 
TargetUnit 


Function Documentation

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:
caster Unit who can cast the spell.
spell Spell-type pointer.
Returns:
1 if spell is casted, 0 if not.

bool CanCastSpell ( const CUnit caster,
const SpellType spell,
const CUnit target,
int  x,
int  y 
)

returns true if spell can be casted (enough mana, valid target)

Check if unit can cast the spell.

Parameters:
caster Unit that casts the spell
spell Spell-type pointer
target Target unit that spell is addressed to
x X coord of target spot when/if target does not exist
y Y coord 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.

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:
l Lua state.
value scm 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.

void CleanSpells (  ) 

done spell tables

Cleanup the spell subsystem.

void InitSpells (  ) 

init spell tables

Spells constructor, inits spell id's and sounds

int SpellCast ( CUnit caster,
const SpellType spell,
CUnit target,
int  x,
int  y 
)

cast spell on target unit or place at x,y

Spell cast!

Parameters:
caster Unit that casts the spell
spell Spell-type pointer
target Target unit that spell is addressed to
x X coord of target spot when/if target does not exist
y Y coord of target spot when/if target does not exist
Returns:
!=0 if spell should/can continue or 0 to stop

void SpellCclRegister (  ) 

register fonction.

Register CCL features for Spell.

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.

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

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

return spell type by ident string

Get spell-type struct pointer by string identifier.

Parameters:
ident Spell identifier.
Returns:
spell-type struct pointer.


Variable Documentation

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-2011 by The Stratagus Project under the GNU General Public License.
All trademarks and copyrights on this page are owned by their respective owners.