protected bool CheckIfValidTarget(IAttackableUnit unit) { if (!Target.IsSimpleTarget || unit == null || ObjectsHit.Contains(unit)) { return(false); } if (unit.Team == Owner.Team && !((SpellData.Flags & (int)SpellFlag.SPELL_FLAG_AFFECT_FRIENDS) > 0)) { return(false); } if (unit.Team == TeamId.TEAM_NEUTRAL && !((SpellData.Flags & (int)SpellFlag.SPELL_FLAG_AFFECT_NEUTRAL) > 0)) { return(false); } if (unit.Team != Owner.Team && unit.Team != TeamId.TEAM_NEUTRAL && !((SpellData.Flags & (int)SpellFlag.SPELL_FLAG_AFFECT_ENEMIES) > 0)) { return(false); } if (unit.IsDead && !((SpellData.Flags & (int)SpellFlag.SPELL_FLAG_AFFECT_DEAD) > 0)) { return(false); } switch (unit) { // Order is important case ILaneMinion _ when((SpellData.Flags & (int)SpellFlag.SPELL_FLAG_AFFECT_MINIONS) > 0): return(true); case IMinion _ when((SpellData.Flags & (int)SpellFlag.SPELL_FLAG_AFFECT_USEABLE) > 0): if (!(unit is ILaneMinion)) { return(true); } return(false); // already got checked in ILaneMinion case IBaseTurret _ when((SpellData.Flags & (int)SpellFlag.SPELL_FLAG_AFFECT_TURRETS) > 0): return(true); case IInhibitor _ when((SpellData.Flags & (int)SpellFlag.SPELL_FLAG_AFFECT_BUILDINGS) > 0): return(true); case INexus _ when((SpellData.Flags & (int)SpellFlag.SPELL_FLAG_AFFECT_BUILDINGS) > 0): return(true); case IChampion _ when((SpellData.Flags & (int)SpellFlag.SPELL_FLAG_AFFECT_HEROES) > 0): return(true); default: return(false); } }
protected bool CheckIfValidTarget(IAttackableUnit unit) { if (!Target.IsSimpleTarget || unit == null || ObjectsHit.Contains(unit)) { return(false); } if (unit.Team == Owner.Team && !((SpellData.Flags & (int)SpellFlag.SPELL_FLAG_AFFECT_FRIENDS) > 0)) { return(false); } if (unit.Team == TeamId.TEAM_NEUTRAL && !((SpellData.Flags & (int)SpellFlag.SPELL_FLAG_AFFECT_NEUTRAL) > 0)) { return(false); } if (unit.Team != Owner.Team && unit.Team != TeamId.TEAM_NEUTRAL && !((SpellData.Flags & (int)SpellFlag.SPELL_FLAG_AFFECT_ENEMIES) > 0)) { return(false); } if (unit.IsDead && !((SpellData.Flags & (int)SpellFlag.SPELL_FLAG_AFFECT_DEAD) > 0)) { return(false); } switch (unit) { case ILaneMinion _ when !((SpellData.Flags & (int)SpellFlag.SPELL_FLAG_AFFECT_MINIONS) > 0): case IMinion _ when !((SpellData.Flags & (int)SpellFlag.SPELL_FLAG_AFFECT_USEABLE) > 0): case IBaseTurret _ when !((SpellData.Flags & (int)SpellFlag.SPELL_FLAG_AFFECT_TURRETS) > 0): return(false); } if ((unit is IInhibitor || unit is INexus) && !((SpellData.Flags & (int)SpellFlag.SPELL_FLAG_AFFECT_BUILDINGS) > 0)) { return(false); } return(unit is IChampion || (SpellData.Flags & (int)SpellFlag.SPELL_FLAG_AFFECT_HEROES) > 0); }
public override void update(long diff) { if (Target == null) { setToRemove(); return; } if (Target.IsSimpleTarget) { // Skillshot var objects = _game.Map.GetObjects(); foreach (var it in objects) { if (isToRemove()) { return; } if (Collide(it.Value)) { if (ObjectsHit.Contains(it.Value)) { continue; } var u = it.Value as Unit; if (u == null) { continue; } if (u.Team == Owner.Team && !((_flags & (int)SpellFlag.SPELL_FLAG_AffectFriends) > 0)) { continue; } if (u.Team == TeamId.TEAM_NEUTRAL && !((_flags & (int)SpellFlag.SPELL_FLAG_AffectNeutral) > 0)) { continue; } if (u.Team != Owner.Team && u.Team != TeamId.TEAM_NEUTRAL && !((_flags & (int)SpellFlag.SPELL_FLAG_AffectEnemies) > 0)) { continue; } if (u.IsDead && !((_flags & (int)SpellFlag.SPELL_FLAG_AffectDead) > 0)) { continue; } var m = u as Minion; if (m != null && !((_flags & (int)SpellFlag.SPELL_FLAG_AffectMinions) > 0)) { continue; } var p = u as Placeable; if (p != null && !((_flags & (int)SpellFlag.SPELL_FLAG_AffectUseable) > 0)) { continue; } var t = u as BaseTurret; if (t != null && !((_flags & (int)SpellFlag.SPELL_FLAG_AffectTurrets) > 0)) { continue; } var i = u as Inhibitor; var n = u as Nexus; if ((i != null || n != null) && !((_flags & (int)SpellFlag.SPELL_FLAG_AffectBuildings) > 0)) { continue; } var c = u as Champion; if (c != null && !((_flags & (int)SpellFlag.SPELL_FLAG_AffectHeroes) > 0)) { continue; } ObjectsHit.Add(u); _originSpell.applyEffects(u, this); } } } else { var u = Target as Unit; if (u != null && Collide(u)) { // Autoguided spell if (_originSpell != null) { _originSpell.applyEffects(u, this); } else { // auto attack Owner.autoAttackHit(u); setToRemove(); } } } base.update(diff); }
protected virtual void CheckFlagsForUnit(AttackableUnit unit) { if (Target == null) { return; } if (Target.IsSimpleTarget) { // Skillshot if (unit == null || ObjectsHit.Contains(unit)) { return; } if (unit.Team == Owner.Team && !((SpellData.Flags & (int)SpellFlag.SPELL_FLAG_AFFECT_FRIENDS) > 0)) { return; } if (unit.Team == TeamId.TEAM_NEUTRAL && !((SpellData.Flags & (int)SpellFlag.SPELL_FLAG_AFFECT_NEUTRAL) > 0)) { return; } if (unit.Team != Owner.Team && unit.Team != TeamId.TEAM_NEUTRAL && !((SpellData.Flags & (int)SpellFlag.SPELL_FLAG_AFFECT_ENEMIES) > 0)) { return; } if (unit.IsDead && !((SpellData.Flags & (int)SpellFlag.SPELL_FLAG_AFFECT_DEAD) > 0)) { return; } if (unit is Minion m && !((SpellData.Flags & (int)SpellFlag.SPELL_FLAG_AFFECT_MINIONS) > 0)) { return; } if (unit is Placeable p && !((SpellData.Flags & (int)SpellFlag.SPELL_FLAG_AFFECT_USEABLE) > 0)) { return; } if (unit is BaseTurret t && !((SpellData.Flags & (int)SpellFlag.SPELL_FLAG_AFFECT_TURRETS) > 0)) { return; } if ((unit is Inhibitor i || unit is Nexus n) && !((SpellData.Flags & (int)SpellFlag.SPELL_FLAG_AFFECT_BUILDINGS) > 0)) { return; } if (unit is Champion c && !((SpellData.Flags & (int)SpellFlag.SPELL_FLAG_AFFECT_HEROES) > 0)) { return; } ObjectsHit.Add(unit); var attackableUnit = unit; if (attackableUnit != null) { _originSpell.ApplyEffects(attackableUnit, this); } } else { if (Target is AttackableUnit u) { // Autoguided spell if (_originSpell != null) { _originSpell.ApplyEffects(u, this); } else { // auto attack if (Owner is ObjAiBase ai) { ai.AutoAttackHit(u); } SetToRemove(); } } } }
protected override void CheckFlagsForUnit(AttackableUnit unit) { if (!Target.IsSimpleTarget) { return; } if (unit == null || ObjectsHit.Contains(unit)) { return; } if (unit.Team == Owner.Team && !((SpellData.Flags & (int)SpellFlag.SPELL_FLAG_AffectFriends) > 0)) { return; } if (unit.Team == TeamId.TEAM_NEUTRAL && !((SpellData.Flags & (int)SpellFlag.SPELL_FLAG_AffectNeutral) > 0)) { return; } if (unit.Team != Owner.Team && unit.Team != TeamId.TEAM_NEUTRAL && !((SpellData.Flags & (int)SpellFlag.SPELL_FLAG_AffectEnemies) > 0)) { return; } if (unit.IsDead && !((SpellData.Flags & (int)SpellFlag.SPELL_FLAG_AffectDead) > 0)) { return; } var m = unit as Minion; if (m != null && !((SpellData.Flags & (int)SpellFlag.SPELL_FLAG_AffectMinions) > 0)) { return; } var p = unit as Placeable; if (p != null && !((SpellData.Flags & (int)SpellFlag.SPELL_FLAG_AffectUseable) > 0)) { return; } var t = unit as BaseTurret; if (t != null && !((SpellData.Flags & (int)SpellFlag.SPELL_FLAG_AffectTurrets) > 0)) { return; } var i = unit as Inhibitor; var n = unit as Nexus; if ((i != null || n != null) && !((SpellData.Flags & (int)SpellFlag.SPELL_FLAG_AffectBuildings) > 0)) { return; } var c = unit as Champion; if (c != null && !((SpellData.Flags & (int)SpellFlag.SPELL_FLAG_AffectHeroes) > 0)) { return; } ObjectsHit.Add(unit); var attackableUnit = unit as AttackableUnit; if (attackableUnit != null) { _originSpell.applyEffects(attackableUnit, this); } }
private bool CheckIfValidTarget(AttackableUnit unit) { if (!Target.IsSimpleTarget) { return(false); } if (unit == null || ObjectsHit.Contains(unit)) { return(false); } if (unit.Team == Owner.Team && !((SpellData.Flags & (int)SpellFlag.SPELL_FLAG_AFFECT_FRIENDS) > 0)) { return(false); } if (unit.Team == TeamId.TEAM_NEUTRAL && !((SpellData.Flags & (int)SpellFlag.SPELL_FLAG_AFFECT_NEUTRAL) > 0)) { return(false); } if (unit.Team != Owner.Team && unit.Team != TeamId.TEAM_NEUTRAL && !((SpellData.Flags & (int)SpellFlag.SPELL_FLAG_AFFECT_ENEMIES) > 0)) { return(false); } if (unit.IsDead && !((SpellData.Flags & (int)SpellFlag.SPELL_FLAG_AFFECT_DEAD) > 0)) { return(false); } var m = unit as Minion; if (m != null && !((SpellData.Flags & (int)SpellFlag.SPELL_FLAG_AFFECT_MINIONS) > 0)) { return(false); } var p = unit as Placeable; if (p != null && !((SpellData.Flags & (int)SpellFlag.SPELL_FLAG_AFFECT_USEABLE) > 0)) { return(false); } var t = unit as BaseTurret; if (t != null && !((SpellData.Flags & (int)SpellFlag.SPELL_FLAG_AFFECT_TURRETS) > 0)) { return(false); } var i = unit as Inhibitor; var n = unit as Nexus; if ((i != null || n != null) && !((SpellData.Flags & (int)SpellFlag.SPELL_FLAG_AFFECT_BUILDINGS) > 0)) { return(false); } var c = unit as Champion; if (c != null && !((SpellData.Flags & (int)SpellFlag.SPELL_FLAG_AFFECT_HEROES) > 0)) { return(false); } return(true); }
protected virtual void CheckFlagsForUnit(Unit unit) { if (Target == null) { return; } if (Target.IsSimpleTarget) { // Skillshot if (unit == null || ObjectsHit.Contains(unit)) { return; } if (unit.Team == Owner.Team && !((SpellData.Flags & (int)SpellFlag.SPELL_FLAG_AffectFriends) > 0)) { return; } if (unit.Team == TeamId.TEAM_NEUTRAL && !((SpellData.Flags & (int)SpellFlag.SPELL_FLAG_AffectNeutral) > 0)) { return; } if (unit.Team != Owner.Team && unit.Team != TeamId.TEAM_NEUTRAL && !((SpellData.Flags & (int)SpellFlag.SPELL_FLAG_AffectEnemies) > 0)) { return; } if (unit.IsDead && !((SpellData.Flags & (int)SpellFlag.SPELL_FLAG_AffectDead) > 0)) { return; } var m = unit as Minion; if (m != null && !((SpellData.Flags & (int)SpellFlag.SPELL_FLAG_AffectMinions) > 0)) { return; } var p = unit as Placeable; if (p != null && !((SpellData.Flags & (int)SpellFlag.SPELL_FLAG_AffectUseable) > 0)) { return; } var t = unit as BaseTurret; if (t != null && !((SpellData.Flags & (int)SpellFlag.SPELL_FLAG_AffectTurrets) > 0)) { return; } var i = unit as Inhibitor; var n = unit as Nexus; if ((i != null || n != null) && !((SpellData.Flags & (int)SpellFlag.SPELL_FLAG_AffectBuildings) > 0)) { return; } var c = unit as Champion; if (c != null && !((SpellData.Flags & (int)SpellFlag.SPELL_FLAG_AffectHeroes) > 0)) { return; } ObjectsHit.Add(unit); _originSpell.applyEffects(unit, this); } else { var u = Target as Unit; if (u != null) { // Autoguided spell if (_originSpell != null) { _originSpell.applyEffects(u, this); } else { // auto attack Owner.AutoAttackHit(u); setToRemove(); } } } }