[+] Added CclDefineSpell parameter "force-use-animation" to use animation code for "self" targeted spells (enables to use spells as some type of commands promted through button panel)

This commit is contained in:
cybermind 2013-05-10 22:16:08 +06:00
parent cb88d6b3f7
commit 9cbf372306
4 changed files with 6 additions and 2 deletions

View file

@ -333,7 +333,7 @@ bool COrder_SpellCast::SpellMoveToTarget(CUnit &unit)
}
// FALL THROUGH
case 2: // Cast spell on the target.
if (!spell.IsCasterOnly()) {
if (!spell.IsCasterOnly() || spell.ForceUseAnimation) {
AnimateActionSpellCast(unit, *this);
if (unit.Anim.Unbreakable) {
return ;

View file

@ -224,6 +224,7 @@ public:
bool IsCasterOnly() const {
return !Range && Target == TargetSelf;
}
bool ForceUseAnimation;
};

View file

@ -333,6 +333,9 @@ static int CclDefineSpell(lua_State *l)
} else if (!strcmp(value, "repeat-cast")) {
spell->RepeatCast = 1;
--i;
} else if (!strcmp(value, "force-use-animation")) {
spell->ForceUseAnimation = true;
--i;
} else if (!strcmp(value, "target")) {
value = LuaToString(l, i + 1);
if (!strcmp(value, "self")) {

View file

@ -485,7 +485,7 @@ SpellType::SpellType(int slot, const std::string &ident) :
Ident(ident), Slot(slot), Target(), Action(),
Range(0), ManaCost(0), RepeatCast(0),
DependencyId(-1), Condition(NULL),
AutoCast(NULL), AICast(NULL)
AutoCast(NULL), AICast(NULL), ForceUseAnimation(false)
{
memset(Costs, 0, sizeof(Costs));
}