public void CmdCastSpell(int unitId, CommandTarget.Type targetType, int targetUnitId, Vector2 targetPoint, string activeSkill, bool obstinate) { Unit unit = World.Current.GetUnit(unitId); CommandTarget target; switch (targetType) { default: target = new CommandTarget(); break; case CommandTarget.Type.kUnitTarget: target = new CommandTarget(World.Current.GetUnit(targetUnitId)); break; case CommandTarget.Type.kPointTarget: target = new CommandTarget(targetPoint); break; } foreach (ActiveSkill skill in unit.ActiveSkills) { if (skill.name == activeSkill) { unit.CommandCastSpell(target, skill, obstinate); break; } } }
public ActiveSkill(string name, float coolDown, CommandTarget.Type castType = CommandTarget.Type.kNoTarget, ForceEffective effectiveTypeFlags = ForceEffective.kSelf | ForceEffective.kOwn | ForceEffective.kAlly | ForceEffective.kEnemy) : base(name, coolDown) { m_castTargetType = castType; m_effectiveTypeFlags = effectiveTypeFlags; }