____ _ __
/ __ )____ _____ | | / /___ ___________
/ __ / __ \/ ___/ | | /| / / __ `/ ___/ ___/
/ /_/ / /_/ (__ ) | |/ |/ / /_/ / / (__ )
/_____/\____/____/ |__/|__/\__,_/_/ /____/
A futuristic real-time strategy game.
This file is part of Bos Wars.
(C) Copyright 2001-2007 by the Bos Wars and Stratagus Project.
Distributed under the "GNU General Public License"
#include <string>
#include <vector>
#include "unitsound.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 |
Defines | |
| #define | CONDITION_FALSE 1 |
| #define | CONDITION_TRUE 0 |
| #define | CONDITION_ONLY 2 |
| #define | INFINITE_RANGE 0xFFFFFFF |
Enumerations | |
| enum | TargetType { TargetSelf, TargetPosition, TargetUnit } |
| enum | LocBaseType { LocBaseCaster, LocBaseTarget } |
Functions | |
| void | SpellCclRegister (void) |
| < register fonction. | |
| void | InitSpells (void) |
| done spell tables | |
| void | CleanSpells (void) |
| return 1 if spell is availible, 0 if not (must upgrade) | |
| bool | SpellIsAvailable (const CPlayer *player, int SpellId) |
| returns true if spell can be casted (enough mana, valid target) | |
| bool | CanCastSpell (const CUnit *caster, const SpellType *spell, const CUnit *target, int x, int y) |
| cast spell on target unit or place at x,y | |
| int | SpellCast (CUnit *caster, const SpellType *spell, CUnit *target, int x, int y) |
| auto cast the spell if possible | |
| int | AutoCastSpell (CUnit *caster, const SpellType *spell) |
| return spell type by ident string | |
| SpellType * | SpellTypeByIdent (const std::string &ident) |
| return 0, 1, 2 for true, only, false. | |
| char | Ccl2Condition (lua_State *l, const char *value) |
Variables | |
| std::vector< SpellType * > | SpellTypeTable |
Definition in file spells.h.
| #define CONDITION_FALSE 1 |
| #define CONDITION_ONLY 2 |
Definition at line 313 of file spells.h.
Referenced by Ccl2Condition(), PassCondition(), and SelectTargetUnitsOfAutoCast().
| #define CONDITION_TRUE 0 |
Definition at line 312 of file spells.h.
Referenced by Ccl2Condition(), PassCondition(), and SelectTargetUnitsOfAutoCast().
| #define INFINITE_RANGE 0xFFFFFFF |
Definition at line 366 of file spells.h.
Referenced by CclDefineSpell(), and HandleActionSpellCast().
| enum LocBaseType |
| enum TargetType |
return spell type by ident string
Check if the spell can be auto cast and cast it.
| caster | Unit who can cast the spell. | |
| spell | Spell-type pointer. |
Definition at line 1036 of file spells.cpp.
References CommandSpellCast(), FlushCommands, MANA_INDEX, SpellType::ManaCost, CUnit::Player, SelectTargetUnitsOfAutoCast(), SpellType::Slot, SpellIsAvailable(), Target::Unit, CVariable::Value, CUnit::Variable, Target::X, and Target::Y.
Referenced by AiCheckMagic(), AutoCast(), CButtonPanel::DoClicked(), GetButtonStatus(), and CUnit::Init().
| bool CanCastSpell | ( | const CUnit * | caster, | |
| const SpellType * | spell, | |||
| const CUnit * | target, | |||
| int | x, | |||
| int | y | |||
| ) |
cast spell on target unit or place at x,y
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 | |
| x | X coord of target spot when/if target does not exist | |
| y | Y coord of target spot when/if target does not exist |
Definition at line 1019 of file spells.cpp.
References SpellType::Condition, PassCondition(), SpellType::Target, and TargetUnit.
Referenced by AreaAdjustVitals::Cast(), CclDefineSpell(), HandleActionSpellCast(), and SpellCast().
| char Ccl2Condition | ( | lua_State * | l, | |
| const char * | value | |||
| ) |
Get a condition value from a scm object.
| l | Lua state. | |
| value | scm value to convert. |
Definition at line 477 of file script_spell.cpp.
References _C_, CONDITION_FALSE, CONDITION_ONLY, CONDITION_TRUE, and LuaError.
Referenced by CclSpellAutocast(), and CclSpellCondition().
| void CleanSpells | ( | void | ) |
return 1 if spell is availible, 0 if not (must upgrade)
Cleanup the spell subsystem.
Definition at line 1157 of file spells.cpp.
References DebugPrint, and SpellTypeTable.
Referenced by CleanModules().
| void InitSpells | ( | void | ) |
done spell tables
Spells constructor, inits spell id's and sounds
Definition at line 967 of file spells.cpp.
Referenced by CreateGame(), and InitModules().
auto cast the spell if possible
Spell cast!
| 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 |
Definition at line 1069 of file spells.cpp.
References _C_, SpellType::Action, CanCastSpell(), DebugPrint, SpellType::Ident, MANA_INDEX, SpellType::ManaCost, MaxSampleVolume, CUnitType::Name, PlayGameSound(), SpellType::RepeatCast, SoundConfig::Sound, SpellType::SoundWhenCast, SpellType::Target, TargetSelf, CUnit::Type, CVariable::Value, CUnit::Variable, CUnit::X, and CUnit::Y.
Referenced by HandleActionSpellCast(), and UnitShowAnimationScaled().
| void SpellCclRegister | ( | void | ) |
< register fonction.
init spell tables
Register CCL features for Spell.
Definition at line 753 of file script_spell.cpp.
References CclDefineSpell(), and Lua.
Referenced by InitCcl().
| bool SpellIsAvailable | ( | const CPlayer * | player, | |
| int | spellid | |||
| ) |
returns true if spell can be casted (enough mana, valid target)
Check if spell is available for player player.
| player | player for who we want to know if he knows the spell. | |
| spellid | id of the spell to check. |
Definition at line 999 of file spells.cpp.
References SpellTypeTable.
Referenced by AiCheckMagic(), AutoCastSpell(), and IsButtonAllowed().
| SpellType* SpellTypeByIdent | ( | const std::string & | ident | ) |
return 0, 1, 2 for true, only, false.
Get spell-type struct pointer by string identifier.
| ident | Spell identifier. |
Definition at line 978 of file spells.cpp.
References SpellTypeTable.
Referenced by AddButton(), CclDefineSpell(), CclDefineUnitType(), CclParseOrder(), and CclUnit().
| std::vector<SpellType *> SpellTypeTable |
Define the names and effects of all available spells.
Define the names and effects of all im play available spells.
Definition at line 70 of file spells.cpp.
Referenced by AiCheckMagic(), AutoCast(), CclDefineSpell(), CclDefineUnitType(), CclUnit(), CleanSpells(), CButtonPanel::DoClicked(), DoRightButton(), CUnit::Init(), ParseCommand(), SaveUnit(), SendCommandSpellCast(), SpellIsAvailable(), SpellTypeByIdent(), and UpdateStatusLineForButton().
1.5.6