public void ProcessSpell(MapObject ob) { switch (Effect) { case SpellEffect.PoisonousCloud: if (!Owner.CanHelpTarget(ob)) { return; } BuffInfo buff = ob.Buffs.FirstOrDefault(x => x.Type == BuffType.PoisonousCloud); TimeSpan remaining = TickTime - SEnvir.Now; if (buff != null) { if (buff.RemainingTime > remaining) { return; } } ob.BuffAdd(BuffType.PoisonousCloud, remaining, new Stats { [Stat.Agility] = Power }, false, false, TimeSpan.Zero); break; case SpellEffect.FireWall: case SpellEffect.Tempest: PlayerObject player = Owner as PlayerObject; if (player == null || !player.CanAttackTarget(ob)) { return; } int damage = player.MagicAttack(new List <UserMagic> { Magic }, ob, true); if (damage > 0 && ob.Race == ObjectType.Player) { foreach (SpellObject spell in player.SpellList) { if (spell.Effect != Effect) { continue; } spell.TickCount--; } } break; case SpellEffect.MonsterFireWall: MonsterObject monster = Owner as MonsterObject; if (monster == null || !monster.CanAttackTarget(ob)) { return; } monster.Attack(ob, monster.GetDC(), Element.Fire); break; case SpellEffect.DarkSoulPrison: player = Owner as PlayerObject; if (player == null || !player.CanAttackTarget(ob)) { return; } damage = player.MagicAttack(new List <UserMagic> { Magic }, ob, true); if (damage > 0 && ob.Race == ObjectType.Player) { foreach (SpellObject spell in player.SpellList) { if (spell.Effect != Effect) { continue; } spell.TickCount--; } } break; } }
public override void Process() { base.Process(); if (Owner != null && (Owner.Node == null || Owner.Dead)) { Despawn(); return; } if (SEnvir.Now < TickTime) { return; } if (TickCount-- <= 0) { switch (Effect) { case SpellEffect.MonsterDeathCloud: MonsterObject monster = Owner as MonsterObject; if (monster == null) { break; } for (int i = CurrentCell.Objects.Count - 1; i >= 0; i--) { if (i >= CurrentCell.Objects.Count) { continue; } MapObject ob = CurrentCell.Objects[i]; if (!monster.CanAttackTarget(ob)) { continue; } monster.Attack(ob, 4000, Element.None); monster.Attack(ob, 4000, Element.None); } break; } Despawn(); return; } TickTime = SEnvir.Now + TickFrequency; switch (Effect) { case SpellEffect.TrapOctagon: for (int i = Targets.Count - 1; i >= 0; i--) { MapObject ob = Targets[i]; if (ob.Node != null && ob.ShockTime != DateTime.MinValue) { continue; } Targets.Remove(ob); } if (Targets.Count == 0) { Despawn(); } break; default: if (CurrentCell == null) { SEnvir.Log($"[ERROR] {Effect} CurrentCell Null."); return; } if (CurrentCell.Objects == null) { SEnvir.Log($"[ERROR] {Effect} CurrentCell.Objects Null."); return; } for (int i = CurrentCell.Objects.Count - 1; i >= 0; i--) { if (i >= CurrentCell.Objects.Count) { continue; } if (CurrentCell.Objects[i] == this) { continue; } ProcessSpell(CurrentCell.Objects[i]); if (CurrentCell == null) { SEnvir.Log($"[ERROR] {Effect} CurrentCell Null Loop."); return; } if (CurrentCell.Objects == null) { SEnvir.Log($"[ERROR] {Effect} CurrentCell.Objects Null Loop."); return; } } break; } }
public override void Process() { base.Process(); if (Owner != null && (Owner.Node == null || Owner.Dead)) { Despawn(); return; } if (SEnvir.Now < TickTime) { return; } if (TickCount-- <= 0) { switch (Effect) { case SpellEffect.SwordOfVengeance: PlayerObject player = Owner as PlayerObject; if (player == null) { break; } List <Cell> cells = CurrentMap.GetCells(CurrentLocation, 0, 3); foreach (Cell cell in cells) { if (cell.Objects != null) { for (int i = cell.Objects.Count - 1; i >= 0; i--) { if (i >= cell.Objects.Count) { continue; } MapObject target = cell.Objects[i]; if (!player.CanAttackTarget(target)) { continue; } int damage = player.MagicAttack(new List <UserMagic> { Magic }, target, true); ActionList.Add(new DelayedAction( SEnvir.Now.AddMilliseconds(500), ActionType.DelayMagic, new List <UserMagic> { Magic }, target)); } } } break; case SpellEffect.MonsterDeathCloud: MonsterObject monster = Owner as MonsterObject; if (monster == null) { break; } for (int i = CurrentCell.Objects.Count - 1; i >= 0; i--) { if (i >= CurrentCell.Objects.Count) { continue; } MapObject ob = CurrentCell.Objects[i]; if (!monster.CanAttackTarget(ob)) { continue; } monster.Attack(ob, 4000, Element.None); monster.Attack(ob, 4000, Element.None); } break; } Despawn(); return; } TickTime = SEnvir.Now + TickFrequency; switch (Effect) { case SpellEffect.TrapOctagon: for (int i = Targets.Count - 1; i >= 0; i--) { MapObject ob = Targets[i]; if (ob.Node != null && ob.ShockTime != DateTime.MinValue) { continue; } Targets.Remove(ob); } if (Targets.Count == 0) { Despawn(); } break; default: if (CurrentCell == null) { SEnvir.Log($"[ERROR] {Effect} CurrentCell Null."); return; } if (CurrentCell.Objects == null) { SEnvir.Log($"[ERROR] {Effect} CurrentCell.Objects Null."); return; } for (int i = CurrentCell.Objects.Count - 1; i >= 0; i--) { if (i >= CurrentCell.Objects.Count) { continue; } if (CurrentCell.Objects[i] == this) { continue; } ProcessSpell(CurrentCell.Objects[i]); if (CurrentCell == null) { SEnvir.Log($"[ERROR] {Effect} CurrentCell Null Loop."); return; } if (CurrentCell.Objects == null) { SEnvir.Log($"[ERROR] {Effect} CurrentCell.Objects Null Loop."); return; } } break; } }