00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #ifndef __ACTION_SPELLCAST_H__
00031 #define __ACTION_SPELLCAST_H__
00032
00033 #include "actions.h"
00034
00036
00037 class COrder_SpellCast : public COrder
00038 {
00039 friend COrder *COrder::NewActionSpellCast(const SpellType &spell, const Vec2i &pos, CUnit *target);
00040 public:
00041 COrder_SpellCast() : COrder(UnitActionSpellCast), Spell(NULL), State(0), Range(0) {
00042 goalPos.x = -1;
00043 goalPos.y = -1;
00044 }
00045
00046 virtual COrder_SpellCast *Clone() const { return new COrder_SpellCast(*this); }
00047
00048 virtual bool IsValid() const;
00049
00050 virtual void Save(CFile &file, const CUnit &unit) const;
00051 virtual bool ParseSpecificData(lua_State *l, int &j, const char *value, const CUnit &unit);
00052
00053 virtual void Execute(CUnit &unit);
00054 virtual PixelPos Show(const CViewport &vp, const PixelPos &lastScreenPos) const;
00055 virtual void UpdatePathFinderData(PathFinderInput &input);
00056
00057 virtual void OnAnimationAttack(CUnit &unit);
00058
00059 const SpellType &GetSpell() const { return *Spell; }
00060 void SetSpell(const SpellType &spell) { Spell = &spell; }
00061 private:
00062 bool CheckForDeadGoal(CUnit &unit);
00063 bool SpellMoveToTarget(CUnit &unit);
00064 private:
00065 const SpellType *Spell;
00066 int State;
00067 int Range;
00068 Vec2i goalPos;
00069 };
00070
00072
00073 #endif // !__ACTION_SPELLCAST_H__