/*public override void SetToRemove() * { * base.SetToRemove(); * _game.PacketNotifier.NotifyProjectileDestroy(this); * }*/ private void ApplyEffects(IAttackableUnit unit) { ObjectsHit.Add(unit); if (unit != null) { OriginSpell.ApplyEffects(unit, this); } }
// todo refactor this protected virtual void CheckFlagsForUnit(IAttackableUnit unit) { if (Target == null) { return; } if (Target.IsSimpleTarget) { // Skillshot if (!CheckIfValidTarget(unit)) { return; } ObjectsHit.Add(unit); var attackableUnit = unit; if (attackableUnit != null) { OriginSpell.ApplyEffects(attackableUnit, this); } } else { if (Target is IAttackableUnit u) { // Autoguided spell if (OriginSpell != null) { OriginSpell.ApplyEffects(u, this); } else { // auto attack if (Owner is IObjAiBase ai) { ai.AutoAttackHit(u); } SetToRemove(); } } } }