public override void OnApplied(Sprite Affected, Buff buff) { if (Affected is Aisling _aisling) { var client = (Affected as Aisling).Client; if (client.Aisling != null && !client.Aisling.Dead) { client.Aisling.Flags = AislingFlags.Invisible; if (client.Aisling.Invisible) { client.SendMessage(0x02, "You blend in to the shadows."); } var sound = new ServerFormat13 { Sound = 43 }; Affected.Show(Scope.NearbyAislings, sound); client.UpdateDisplay(); base.OnApplied(Affected, buff); } } }
public override void OnApplied(Sprite Affected, Debuff debuff) { base.OnApplied(Affected, debuff); if (AcModifer.Option == Operator.Add) Affected.BonusAc += AcModifer.Value; if (Affected is Aisling) { (Affected as Aisling) .Client .SendAnimation(265, (Affected as Aisling).Client.Aisling, (Affected as Aisling).Client.Aisling.Target ?? (Affected as Aisling).Client.Aisling); var hpbar = new ServerFormat13 { Serial = Affected.Serial, Health = 255, Sound = 64 }; (Affected as Aisling).Show(Scope.Self, hpbar); } else { var nearby = Affected.GetObjects<Aisling>(Affected.Map, i => i.WithinRangeOf(Affected)); foreach (var near in nearby) near.Client.SendAnimation(226, Affected, Affected); } }
public void SpriteSpellCastOrder(Sprite sprite, Sprite target) { var action = new ServerFormat1A { Serial = sprite.Serial, Number = 1, Speed = 30 }; var hpbar = new ServerFormat13 { Serial = target.Serial, Health = 255, Sound = Spell.Template.Sound }; target.Show(Scope.NearbyAislings, hpbar); target.SendAnimation(Spell.Template.Animation, target, sprite); if (target is Aisling) { (target as Aisling).Client .SendMessage(0x02, string.Format("{0} Attacks you with {1}.", (sprite is Monster ? (sprite as Monster).Template.Name : (sprite as Mundane).Template.Name) ?? "Monster", Spell.Template.Name)); } sprite.Show(Scope.NearbyAislings, action); }
private void SendCastSpellOrder(Sprite sprite, Sprite target, Network.Game.GameClient client, bool IsAttack = false) { var hpbar = new ServerFormat13 { Serial = sprite.Serial, Health = 255, Sound = Spell.Template.Sound }; var action = new ServerFormat1A { Serial = sprite.Serial, Number = (byte)(client.Aisling.Path == Class.Priest ? 0x80 : client.Aisling.Path == Class.Wizard ? 0x88 : 0x06), Speed = 30 }; client.SendStats(StatusFlags.StructB | StatusFlags.StructD); client.Aisling.Show(Scope.NearbyAislings, hpbar); client.SendAnimation(Spell.Template.Animation, target, sprite); client.SendMessage(0x02, string.Format("you cast {0}", Spell.Template.Name)); if (IsAttack) { if (target is Aisling) { (target as Aisling).Client.SendMessage(0x02, string.Format("{0} Attacks you with {1}.", client.Aisling.Username, Spell.Template.Name)); } } client.Aisling.Show(Scope.NearbyAislings, action); }
public override void OnApplied(Sprite Affected, Debuff debuff) { base.OnApplied(Affected, debuff); if (Affected is Aisling) { (Affected as Aisling) .Client .SendAnimation(40, (Affected as Aisling).Client.Aisling, (Affected as Aisling).Client.Aisling.Target ?? (Affected as Aisling).Client.Aisling); var hpbar = new ServerFormat13 { Serial = Affected.Serial, Health = 255, Sound = 123 }; (Affected as Aisling).Show(Scope.Self, hpbar); } else { var nearby = Affected.GetObjects <Aisling>(Affected.Map, i => i.WithinRangeOf(Affected)); foreach (var near in nearby) { near.Client.SendAnimation(40, Affected, Affected); } } }
public override void OnEnded(Sprite Affected, Debuff debuff) { if (Affected.CurrentMapId == ServerContextBase.GlobalConfig.DeathMap) { base.OnEnded(Affected, debuff); return; } if (Affected is Aisling && !debuff.Cancelled) { (Affected as Aisling) .Client .SendMessage(0x02, "You have died."); var hpbar = new ServerFormat13 { Serial = Affected.Serial, Health = 255, Sound = 5 }; (Affected as Aisling).Show(Scope.Self, hpbar); (Affected as Aisling).Flags = AislingFlags.Dead; (Affected as Aisling).CastDeath(); (Affected as Aisling).SendToHell(); } base.OnEnded(Affected, debuff); }
private void ShowDamage(Sprite target) { var hpbar = new ServerFormat13 { Serial = target.Serial, Health = (ushort)(100 * target.CurrentHp / target.MaximumHp), Sound = Spell.Template.Sound }; target.Show(Scope.NearbyAislings, hpbar); }
public void SendSound(byte sound, Scope scope = Scope.Self) { var empty = new ServerFormat13 { Serial = Aisling.Serial, Health = byte.MaxValue, Sound = sound }; Aisling.Show(scope, empty); }
public override void OnDurationUpdate(Sprite Affected, Debuff debuff) { if (Affected.CurrentMapId == ServerContextBase.GlobalConfig.DeathMap) { base.OnEnded(Affected, debuff); return; } if (Affected is Aisling) { (Affected as Aisling) .Client.SendAnimation(24, (Affected as Aisling).Client.Aisling, (Affected as Aisling).Client.Aisling.Target ?? (Affected as Aisling).Client.Aisling); var hpbar = new ServerFormat13 { Serial = Affected.Serial, Health = 255, Sound = 6 }; (Affected as Aisling).Show(Scope.Self, hpbar); (Affected as Aisling) .Client .SendMessage(0x02, Messages[_rnd.Next(Count) % Messages.Length]); } else { var nearby = Affected.GetObjects <Aisling>(Affected.Map, i => Affected.WithinRangeOf(i)); foreach (var near in nearby) { if (near == null || near.Client == null) { continue; } if (Affected == null) { continue; } var client = near.Client; client.SendAnimation(24, Affected, client.Aisling); } } base.OnDurationUpdate(Affected, debuff); }
public GameClient SendSound(byte sound, Scope scope = Scope.Self) { var empty = new ServerFormat13 { Serial = Aisling.Serial, Health = byte.MaxValue, Sound = sound }; Aisling.Show(scope, empty); return(this); }
public override void OnDurationUpdate(Sprite Affected, Debuff debuff) { if (Affected is Aisling) { (Affected as Aisling) .Client.SendLocation(); (Affected as Aisling) .Client.SendAnimation(32, (Affected as Aisling).Client.Aisling, (Affected as Aisling).Client.Aisling.Target ?? (Affected as Aisling).Client.Aisling); var hpbar = new ServerFormat13 { Serial = Affected.Serial, Health = 255, Sound = 8 }; (Affected as Aisling).Show(Scope.NearbyAislings, hpbar); (Affected as Aisling) .Client .SendMessage(0x02, "You have been put to sleep."); } else { var nearby = Affected.GetObjects <Aisling>(i => Affected.WithinRangeOf(i)); foreach (var near in nearby) { if (near == null || near.Client == null) { continue; } if (Affected == null) { continue; } var client = near.Client; client.SendAnimation(32, Affected, client.Aisling); } } base.OnDurationUpdate(Affected, debuff); }
public override void OnSuccess(Sprite sprite, Sprite target) { if (sprite is Aisling) { var client = (sprite as Aisling).Client; client.TrainSpell(Spell); var buff = new buff_armachd(); if (!target.HasBuff(buff.Name)) { buff.OnApplied(target, buff); if (target is Aisling) { (target as Aisling).Client .SendMessage(0x02, string.Format("{0} casts {1} on you.", client.Aisling.Username, Spell.Template.Name)); } client.SendMessage(0x02, string.Format("you cast {0}", Spell.Template.Name)); client.SendAnimation(Spell.Template.Animation, target, sprite); var action = new ServerFormat1A { Serial = sprite.Serial, Number = (byte)(client.Aisling.Path == Class.Priest ? 0x80 : client.Aisling.Path == Class.Wizard ? 0x88 : 0x06), Speed = 30 }; var hpbar = new ServerFormat13 { Serial = sprite.Serial, Health = 255, Sound = 1 }; client.Aisling.Show(Scope.NearbyAislings, action); client.Aisling.Show(Scope.NearbyAislings, hpbar); } else { client.SendMessage(0x02, "You already cast this."); } } }
public override void OnApplied(Sprite Affected, Debuff debuff) { /* GM Character's don't die. */ if (Affected is Aisling) { if ((Affected as Aisling).GameMaster) { return; } } base.OnApplied(Affected, debuff); if (Affected.CurrentMapId == ServerContextBase.GlobalConfig.DeathMap) { base.OnEnded(Affected, debuff); return; } if (Affected is Aisling) { (Affected as Aisling) .Client .SendAnimation(24, (Affected as Aisling).Client.Aisling, (Affected as Aisling).Client.Aisling.Target ?? (Affected as Aisling).Client.Aisling); var hpbar = new ServerFormat13 { Serial = Affected.Serial, Health = 255, Sound = 6 }; (Affected as Aisling).Show(Scope.Self, hpbar); } else { var nearby = Affected.GetObjects <Aisling>(Affected.Map, i => i.WithinRangeOf(Affected)); foreach (var near in nearby) { near.Client.SendAnimation(24, Affected, Affected); } } }
public Aisling Cast(Spell spell, Sprite target, byte actionSpeed = 30) { var action = new ServerFormat1A { Serial = Serial, Number = (byte)(Path == Class.Priest ? 0x80 : Path == Class.Wizard ? 0x88 : 0x06), Speed = actionSpeed }; if (target != null) { if (Aisling(target)?.SendAnimation(spell.Template.Animation, target, this) == null) { SendAnimation(spell.Template.Animation, target, this); } if (target.CurrentHp > 0) { var hpbar = new ServerFormat13 { Serial = target.Serial, Health = (ushort)(100 * target.CurrentHp / target.MaximumHp), Sound = spell.Template.Sound }; target.Show(Scope.NearbyAislings, hpbar); } Show(Scope.NearbyAislings, action); CurrentMp -= spell.Template.ManaCost; if (CurrentMp < 0) { CurrentMp = 0; } Client.SendMessage(0x02, "you cast " + spell.Template.Name + "."); } return(this); }
public override void OnEnded(Sprite Affected, Debuff debuff) { if (Affected is Aisling && !debuff.Cancelled) { (Affected as Aisling) .Client .SendMessage(0x02, "You have died."); var hpbar = new ServerFormat13 { Serial = Affected.Serial, Health = 255, Sound = 5 }; (Affected as Aisling).Show(Scope.Self, hpbar); (Affected as Aisling).Flags = AislingFlags.Dead; GrimReaper.CastDeath((Affected as Aisling).Client); GrimReaper.SendToHell((Affected as Aisling).Client); } base.OnEnded(Affected, debuff); }
public virtual void Format13Handler(ServerFormat13 format) { }
public override void OnSuccess(Sprite sprite, Sprite target) { if (sprite is Aisling) { var client = (sprite as Aisling).Client; if (target.HasDebuff("mor fas nadur") || target.HasDebuff("fas nadur")) { client.SendMessage(0x02, "You have already casted that spell."); return; } client.TrainSpell(Spell); var debuff = new debuff_fasnadur(); if (!target.HasDebuff(debuff.Name)) { debuff.OnApplied(target, debuff); if (target is Aisling) { (target as Aisling).Client .SendMessage(0x02, string.Format("{0} Casts {1} on you. Elements augmented.", client.Aisling.Username, Spell.Template.Name)); } client.SendMessage(0x02, string.Format("you cast {0}", Spell.Template.Name)); client.SendAnimation(246, target, sprite); var action = new ServerFormat1A { Serial = sprite.Serial, Number = (byte)(client.Aisling.Path == Class.Priest ? 0x80 : client.Aisling.Path == Class.Wizard ? 0x88 : 0x06), Speed = 30 }; var hpbar = new ServerFormat13 { Serial = client.Aisling.Serial, Health = byte.MaxValue, Sound = 20 }; client.Aisling.Show(Scope.NearbyAislings, action); client.Aisling.Show(Scope.NearbyAislings, hpbar); } else { client.SendMessage(0x02, "You have already casted that spell."); } } else { var debuff = new debuff_fasnadur(); if (target.HasDebuff("mor fas nadur") || target.HasDebuff("fas nadur")) { return; } if (!target.HasDebuff(debuff.Name)) { debuff.OnApplied(target, debuff); if (target is Aisling) { (target as Aisling).Client .SendMessage(0x02, string.Format("{0} Casts {1} on you. Elements augmented.", (sprite is Monster ? (sprite as Monster).Template.Name : (sprite as Mundane).Template.Name) ?? "Monster", Spell.Template.Name)); } target.SendAnimation(246, target, sprite); var action = new ServerFormat1A { Serial = sprite.Serial, Number = 1, Speed = 30 }; var hpbar = new ServerFormat13 { Serial = target.Serial, Health = byte.MaxValue, Sound = 20 }; sprite.Show(Scope.NearbyAislings, action); target.Show(Scope.NearbyAislings, hpbar); } } }
public override void OnSuccess(Sprite sprite, Sprite target) { if (sprite is Aisling) { var client = (sprite as Aisling).Client; client.TrainSpell(Spell); var debuff = new Debuff_poison("beag puinsein", 100, 35, 25, 0.10); var curses = target.Debuffs.Values.OfType <Debuff_poison>().ToList(); if (curses.Count == 0) { if (!target.HasDebuff(debuff.Name)) { debuff.OnApplied(target, debuff); if (target is Aisling) { (target as Aisling).Client .SendMessage(0x02, $"{client.Aisling.Username} Attacks you with {Spell.Template.Name}."); } client.SendMessage(0x02, $"you cast {Spell.Template.Name}"); client.SendAnimation(Spell.Template.Animation, target, sprite); var action = new ServerFormat1A { Serial = sprite.Serial, Number = (byte)(client.Aisling.Path == Class.Priest ? 0x80 : client.Aisling.Path == Class.Wizard ? 0x88 : 0x06), Speed = 30 }; var hpbar = new ServerFormat13 { Serial = sprite.Serial, Health = 255, Sound = Spell.Template.Sound }; client.Aisling.Show(Scope.NearbyAislings, action); client.Aisling.Show(Scope.NearbyAislings, hpbar); } } else { var c = curses.FirstOrDefault(); if (c != null) { client.SendMessage(0x02, $"Another poison is already applied. [{c.Name}]."); } } } else { var debuff = new Debuff_poison("beag puinsein", 100, 35, 25, 0.10); var curses = target.Debuffs.Values.OfType <Debuff_poison>().ToList(); if (curses.Count == 0) { if (!target.HasDebuff(debuff.Name)) { debuff.OnApplied(target, debuff); if (target is Aisling) { (target as Aisling).Client .SendMessage(0x02, $"{(sprite is Monster ? (sprite as Monster).Template.Name : (sprite as Mundane).Template.Name) ?? "Monster"} Attacks you with {Spell.Template.Name}."); } target.SendAnimation(Spell.Template.Animation, target, sprite); var action = new ServerFormat1A { Serial = sprite.Serial, Number = 1, Speed = 30 }; var hpbar = new ServerFormat13 { Serial = target.Serial, Health = 255, Sound = Spell.Template.Sound }; sprite.Show(Scope.NearbyAislings, action); target.Show(Scope.NearbyAislings, hpbar); } } } }
public override void OnSuccess(Sprite sprite, Sprite target) { if (sprite is Aisling) { var client = (sprite as Aisling).Client; client.TrainSpell(Spell); var debuff = Clone <debuff_beagcradh>(Debuff); var curses = target.Debuffs.Values.OfType <debuff_cursed>().ToList(); client.SendMessage(0x02, $"you cast {Spell.Template.Name}"); client.SendAnimation(Spell.Template.Animation, target, sprite); var action = new ServerFormat1A { Serial = sprite.Serial, Number = (byte)(client.Aisling.Path == Class.Priest ? 0x80 : client.Aisling.Path == Class.Wizard ? 0x88 : 0x06), Speed = 30 }; var hpbar = new ServerFormat13 { Serial = client.Aisling.Serial, Health = 255, Sound = Spell.Template.Sound }; client.Aisling.Show(Scope.NearbyAislings, action); client.Aisling.Show(Scope.NearbyAislings, hpbar); if (curses.Count > 0) { if (target.HasDebuff(debuff.Name)) { if (target.RemoveDebuff(debuff.Name, true)) { if (target is Aisling) { (target as Aisling).Client .SendMessage(0x02, $"{client.Aisling.Username} Removes {Spell.Template.Name} from you."); } } } else { var c = curses.FirstOrDefault(); if (c != null) { client.SendMessage(0x02, $"A greater cure is required [{c.Name}]"); } } } } else { var debuff = Clone <debuff_beagcradh>(Debuff); var curses = target.Debuffs.Values.OfType <debuff_cursed>().ToList(); if (curses.Count > 0) { if (target.HasDebuff(debuff.Name)) { if (target.RemoveDebuff(debuff.Name, true)) { if (target is Aisling) { (target as Aisling).Client .SendMessage(0x02, $"{(sprite is Monster ? (sprite as Monster).Template.Name : (sprite as Mundane).Template.Name) ?? "Monster"} Removes {Spell.Template.Name} from you."); } } } } target.SendAnimation(Spell.Template.Animation, target, sprite); var action = new ServerFormat1A { Serial = sprite.Serial, Number = 1, Speed = 30 }; var hpbar = new ServerFormat13 { Serial = target.Serial, Health = 255, Sound = Spell.Template.Sound }; sprite.Show(Scope.NearbyAislings, action); target.Show(Scope.NearbyAislings, hpbar); } }
public override void OnUse(Sprite sprite, Sprite target) { if (sprite is Aisling) { var client = (sprite as Aisling).Client; if (client.Aisling.CurrentMp >= Spell.Template.ManaCost) { client.TrainSpell(Spell); var action = new ServerFormat1A { Serial = sprite.Serial, Number = (byte)(client.Aisling.Path == Class.Priest ? 0x80 : client.Aisling.Path == Class.Wizard ? 0x88 : 0x06), Speed = 30 }; client.Aisling.CurrentMp -= Spell.Template.ManaCost; foreach (var obj in client.Aisling.PartyMembers) { if (obj == null || obj.Dead) { continue; } obj.CurrentHp += obj.MaximumHp / 10; if (obj.CurrentHp > obj.MaximumHp) { obj.CurrentHp = obj.MaximumHp; } if (client.Aisling.CurrentMp < 0) { client.Aisling.CurrentMp = 0; } if (obj.CurrentHp > 0) { var hpbar = new ServerFormat13 { Serial = obj.Serial, Health = (ushort)(100 * obj.CurrentHp / obj.MaximumHp), Sound = 8 }; obj.Show(Scope.NearbyAislings, hpbar); } obj.Client.SendStats(StatusFlags.StructB); client.SendAnimation(0x04, obj, client.Aisling); } client.Aisling.Show(Scope.NearbyAislings, action); client.SendMessage(0x02, "you cast " + Spell.Template.Name + "."); client.SendStats(StatusFlags.All); } else { if (sprite is Aisling) { (sprite as Aisling).Client.SendMessage(0x02, ServerContextBase.GlobalConfig.NoManaMessage); } } } else { sprite.CurrentHp = sprite.MaximumHp; var hpbar = new ServerFormat13 { Serial = sprite.Serial, Health = (ushort)(100 * sprite.CurrentHp / sprite.MaximumHp), Sound = 8 }; sprite.SendAnimation(0x04, sprite, sprite); sprite.Show(Scope.NearbyAislings, hpbar); } }
public override void OnSuccess(Sprite sprite, Sprite target) { if (sprite is Aisling) { var client = (sprite as Aisling).Client; client.TrainSpell(Spell); var buff = Clone(Spell.Template.Buff); if (target.Buffs.FirstOrDefault(i => i.Name.Equals(buff.Name, StringComparison.OrdinalIgnoreCase)) == null) { buff.OnApplied(target, buff); if (target is Aisling) { (target as Aisling).Client .SendMessage(0x02, string.Format("{0} casts {1} on you.", client.Aisling.Username, Spell.Template.Name)); } client.SendMessage(0x02, string.Format("you cast {0}", Spell.Template.Name)); client.SendAnimation(Spell.Template.Animation, target, sprite); var action = new ServerFormat1A { Serial = sprite.Serial, Number = 0x80, Speed = 30 }; var hpbar = new ServerFormat13 { Serial = sprite.Serial, Health = 255, Sound = 1 }; client.Aisling.Show(Scope.NearbyAislings, action); client.Aisling.Show(Scope.NearbyAislings, hpbar); } else { client.SendMessage(0x02, "You already cast this."); } } else { if (!(target is Aisling)) { return; } var client = (target as Aisling).Client; var buff = Clone(Spell.Template.Debuff); if (target.Buffs.FirstOrDefault(i => i.Name.Equals(buff.Name, StringComparison.OrdinalIgnoreCase)) == null) { buff.OnApplied(target, buff); (target as Aisling).Client .SendMessage(0x02, string.Format("{0} Attacks you with {1}.", (sprite is Monster ? (sprite as Monster).Template.Name : (sprite as Mundane).Template.Name) ?? "Monster", Spell.Template.Name)); client.SendAnimation(Spell.Template.Animation, target, sprite); var action = new ServerFormat1A { Serial = sprite.Serial, Number = 0x80, Speed = 30 }; var hpbar = new ServerFormat13 { Serial = client.Aisling.Serial, Health = 255, Sound = 1 }; client.Aisling.Show(Scope.NearbyAislings, action); client.Aisling.Show(Scope.NearbyAislings, hpbar); } } }
public override void OnUse(Sprite sprite, Sprite target) { if (target is Aisling && sprite is Aisling) { var client = (sprite as Aisling).Client; if (client.Aisling.CurrentMp >= Spell.Template.ManaCost) { var action = new ServerFormat1A { Serial = sprite.Serial, Number = (byte)(client.Aisling.Path == Class.Priest ? 0x80 : client.Aisling.Path == Class.Wizard ? 0x88 : 0x06), Speed = 30 }; target.Client.SendAnimation(34, target, client.Aisling); client.Aisling.Show(Scope.NearbyAislings, action); sprite.CurrentMp -= Spell.Template.ManaCost; target.CurrentHp += (200 + ((Spell.Level + sprite.Wis) * 26)); if (target.CurrentHp > target.MaximumHp) { target.CurrentHp = target.MaximumHp; } if (client.Aisling.CurrentMp < 0) { client.Aisling.CurrentMp = 0; } if (target.CurrentHp > 0) { var hpbar = new ServerFormat13 { Serial = target.Serial, Health = (ushort)(100 * target.CurrentHp / target.MaximumHp), Sound = 8 }; target.Show(Scope.NearbyAislings, hpbar); } sprite.Client.SendStats(StatusFlags.StructB); client.SendMessage(0x02, "you cast " + Spell.Template.Name + "."); client.SendStats(StatusFlags.All); client.TrainSpell(Spell); } else { if (sprite is Aisling) { (sprite as Aisling).Client.SendMessage(0x02, ServerContext.Config.NoManaMessage); } return; } } else { var action = new ServerFormat1A { Serial = sprite.Serial, Number = 80, Speed = 30 }; if (sprite is Mundane) { var nearby = target.GetObjects(sprite.Map, i => i.CurrentMapId == sprite.CurrentMapId && i.CurrentHp != i.MaximumHp, Get.Aislings); if (nearby.Count() > 0) { foreach (var s in nearby) { target = s; target.CurrentHp += (200 * ((Spell.Level + sprite.Wis) + 26)); if (target.CurrentHp > target.MaximumHp) { target.CurrentHp = target.MaximumHp; } var hpbar = new ServerFormat13 { Serial = target.Serial, Health = (ushort)(100 * target.CurrentHp / target.MaximumHp), Sound = 8 }; target.Show(Scope.NearbyAislings, hpbar); sprite.Show(Scope.NearbyAislings, action); target.SendAnimation(34, target, target); if (target is Aisling) { (target as Aisling).Client.SendStats(StatusFlags.StructB); } } } } else { target.CurrentHp += (200 * ((Spell.Level + sprite.Wis) + 26)); if (target.CurrentHp > target.MaximumHp) { target.CurrentHp = target.MaximumHp; } var hpbar = new ServerFormat13 { Serial = target.Serial, Health = (ushort)(100 * target.CurrentHp / target.MaximumHp), Sound = 8 }; target.Show(Scope.NearbyAislings, hpbar); sprite.Show(Scope.NearbyAislings, action); target.SendAnimation(34, target, sprite); if (target is Aisling) { (target as Aisling).Client.SendStats(StatusFlags.StructB); } } } }
public override void OnSuccess(Sprite sprite, Sprite target) { if (sprite is Aisling) { var client = (sprite as Aisling).Client; client.TrainSpell(Spell); var debuff = new debuff_blind(); if (!target.HasDebuff(debuff.Name)) { debuff.OnApplied(target, debuff); if (target is Aisling aisling) { aisling.Client .SendMessage(0x02, $"{client.Aisling.Username} Attacks you with {Spell.Template.Name}."); } client.SendMessage(0x02, $"you cast {Spell.Template.Name}"); client.SendAnimation(Spell.Template.Animation, target, sprite); var action = new ServerFormat1A { Serial = sprite.Serial, Number = (byte)(client.Aisling.Path == Class.Priest ? 0x80 : client.Aisling.Path == Class.Wizard ? 0x88 : 0x06), Speed = 30 }; var hpbar = new ServerFormat13 { Serial = sprite.Serial, Health = 255, Sound = Spell.Template.Sound }; client.Aisling.Show(Scope.NearbyAislings, action); client.Aisling.Show(Scope.NearbyAislings, hpbar); } } else { var debuff = new debuff_blind(); if (!target.HasDebuff(debuff.Name)) { debuff.OnApplied(target, debuff); if (target is Aisling aisling) { aisling.Client .SendMessage(0x02, $"{(sprite is Monster monster ? monster.Template.Name : (sprite as Mundane)?.Template.Name) ?? "Monster"} Attacks you with {Spell.Template.Name}."); } target.SendAnimation(Spell.Template.Animation, target, sprite); var action = new ServerFormat1A { Serial = sprite.Serial, Number = 1, Speed = 30 }; var hpbar = new ServerFormat13 { Serial = target.Serial, Health = 255, Sound = Spell.Template.Sound }; sprite.Show(Scope.NearbyAislings, action); target.Show(Scope.NearbyAislings, hpbar); } } }
public override void OnSuccess(Sprite sprite, Sprite target) { if (sprite is Aisling) { var client = (sprite as Aisling).Client; client.TrainSpell(Spell); var debuff = Clone <Debuff_poison>(Debuff); var curses = target.Debuffs.Values.OfType <Debuff_poison>().ToList(); client.SendMessage(0x02, $"you cast {Spell.Template.Name}"); client.SendAnimation(Spell.Template.Animation, target, sprite); var action = new ServerFormat1A { Serial = sprite.Serial, Number = (byte)(client.Aisling.Path == Class.Priest ? 0x80 : client.Aisling.Path == Class.Wizard ? 0x88 : 0x06), Speed = 30 }; var hpbar = new ServerFormat13 { Serial = client.Aisling.Serial, Health = 255, Sound = Spell.Template.Sound }; client.Aisling.Show(Scope.NearbyAislings, action); client.Aisling.Show(Scope.NearbyAislings, hpbar); if (curses.Count > 0) { var dn = target.GetDebuffName(i => i.Name.ToLower().Contains("puinsein")); if (dn != string.Empty) { if (target.RemoveDebuff(dn, true)) { if (sprite.Serial != target.Serial) { if (target is Aisling) { (target as Aisling).Client .SendMessage(0x02, $"{client.Aisling.Username} Removes {Spell.Template.Name} from you."); } } } } } } else { var debuff = Clone <Debuff_poison>(Debuff); var curses = target.Debuffs.Values.OfType <Debuff_poison>().ToList(); if (curses.Count > 0) { var dn = target.GetDebuffName(i => i.Name.ToLower().Contains("puinsein")); if (dn != string.Empty) { if (target.RemoveDebuff(dn, true)) { if (target is Aisling) { (target as Aisling).Client .SendMessage(0x02, $"{(sprite is Monster ? (sprite as Monster).Template.Name : (sprite as Mundane).Template.Name) ?? "Monster"} Removes {Spell.Template.Name} from you."); } } } } target.SendAnimation(Spell.Template.Animation, target, sprite); var action = new ServerFormat1A { Serial = sprite.Serial, Number = 1, Speed = 30 }; var hpbar = new ServerFormat13 { Serial = target.Serial, Health = 255, Sound = Spell.Template.Sound }; sprite.Show(Scope.NearbyAislings, action); target.Show(Scope.NearbyAislings, hpbar); } }
public void ApplyDamage(Sprite Source, int dmg, bool truedamage = false, byte sound = 1, Action <int> dmgcb = null) { if (!Attackable) { return; } if (!CanBeAttackedHere(Source)) { return; } if (this is Monster) { (this as Monster)?.AppendTags(Source); (this as Monster)?.Script?.OnAttacked(Source?.Client); } if (Source is Aisling) { var client = Source as Aisling; if (client.EquipmentManager.Weapon != null && client.EquipmentManager.Weapon.Item != null && client.Weapon > 0) { var weapon = client.EquipmentManager.Weapon.Item; lock (rnd) { dmg += rnd.Next(weapon.Template.DmgMin + 1, weapon.Template.DmgMax + 5) * client.BonusDmg; } } } if (this is Aisling) { var client = this as Aisling; if (client != null && client.DamageCounter++ % 2 == 0 && dmg > 0) { client.EquipmentManager.DecreaseDurability(); } } if (truedamage) { CurrentHp -= dmg; if (CurrentHp < 0) { CurrentHp = 0; } } else { Target = Source; if (HasBuff("dion") || HasBuff("mor dion")) { var empty = new ServerFormat13 { Serial = Serial, Health = byte.MaxValue, Sound = sound }; Show(Scope.NearbyAislings, empty); } else { if (HasDebuff("sleep")) { dmg <<= 1; } RemoveDebuff("sleep"); var amplifier = ElementTable[ (int)Source.OffenseElement, (int)DefenseElement]; dmg = ComputeDmgFromAc(dmg); if (dmg <= 0) { dmg = 1; } if (CurrentHp > MaximumHp) { CurrentHp = MaximumHp; } var dealth = (int)(dmg * amplifier); CurrentHp -= dealth; if (CurrentHp < 0) { CurrentHp = 0; } dmgcb?.Invoke(dealth); var hpbar = new ServerFormat13 { Serial = Serial, Health = (ushort)((double)100 * CurrentHp / MaximumHp), Sound = sound }; //send hpbar to client Show(Scope.NearbyAislings, hpbar); } } (this as Aisling)?.Client.SendStats(StatusFlags.StructB); (Source as Aisling)?.Client.SendStats(StatusFlags.StructB); }
public override void OnUse(Sprite sprite, Sprite target) { if (sprite is Aisling) { if (sprite.CurrentMp - Spell.Template.ManaCost > 0) { sprite.CurrentMp -= Spell.Template.ManaCost; } else { if (sprite is Aisling) (sprite as Aisling).Client.SendMessage(0x02, ServerContext.Config.NoManaMessage); return; } if (sprite.CurrentMp < 0) sprite.CurrentMp = 0; var targets = GetObjects(sprite.Map, i => i.WithinRangeOf(sprite), Get.Aislings | Get.Monsters | Get.Mundanes); var client = (sprite as Aisling).Client; client.TrainSpell(Spell); foreach (var t in targets) { if (t.Serial == sprite.Serial) continue; if (t.CurrentHp == 0) continue; client.SendAnimation(Spell.Template.Animation, t, sprite); lock (rand) { if (rand.Next((sprite.Hit * 5).Clamp(0, 100), 100) > t.Mr) { OnSuccess(sprite, t); if (t is Aisling) (t as Aisling).Client .SendMessage(0x02, string.Format("{0} Attacks you with {1}.", client.Aisling.Username, Spell.Template.Name)); } else { OnFailed(sprite, t); } } } client.SendMessage(0x02, string.Format("you cast {0}", Spell.Template.Name)); var action = new ServerFormat1A { Serial = sprite.Serial, Number = (byte) (client.Aisling.Path == Class.Priest ? 0x80 : client.Aisling.Path == Class.Wizard ? 0x88 : 0x06), Speed = 30 }; client.Aisling.Show(Scope.NearbyAislings, action); if (sprite is Aisling) (sprite as Aisling) .Client .SendStats(StatusFlags.StructB); } else { var targets = GetObjects(sprite.Map, i => i.WithinRangeOf(sprite), Get.Monsters); foreach (var t in targets) { if (t.Serial == sprite.Serial) continue; if (t.CurrentHp == 0) continue; var dmg = sprite.GetBaseDamage(t, MonsterDamageType.Elemental); t.ApplyDamage(sprite, dmg, Spell.Template.ElementalProperty, Spell.Template.Sound); t.SendAnimation(Spell.Template.Animation, t, sprite); var action = new ServerFormat1A { Serial = sprite.Serial, Number = 0x80, Speed = 30 }; var hpbar = new ServerFormat13 { Serial = t.Serial, Health = (ushort) (100 * t.CurrentHp / t.MaximumHp), Sound = Spell.Template.Sound }; t.Show(Scope.NearbyAislings, hpbar); sprite.Show(Scope.NearbyAislings, action); } } }
public void Attack(Sprite _obj) { if (!CanUpdate()) { return; } //Formula: = H6 + I6 + J6 + K6 + L6 * 10 var dmg = 0; if (this is Monster || this is Mundane) { if (this is Monster) { var obj = this as Monster; _Str = (byte)(int)(obj.Template.Level * ServerContext.Config.MonsterDamageFactor); dmg = obj.Template.Level * _Str + 5; _obj.ApplyDamage(this, dmg, false, 1, applied => { }); } else if (this is Mundane) { var obj = this as Mundane; _Str = (byte)(int)(obj.Template.Level * ServerContext.Config.MonsterDamageFactor); dmg = obj.Template.Level * Str * ServerContext.Config.MonsterDamageMultipler; _obj.ApplyDamage(this, dmg, false, 1); } } var target = _obj; var action = new ServerFormat1A { Serial = Serial, Number = 0x01, Speed = 20 }; if (target.CurrentHp > 0) { var hpbar = new ServerFormat13 { Serial = target.Serial, Health = (ushort)(100 * target.CurrentHp / target.MaximumHp), Sound = 1, Source = _obj.Serial, }; var nearby = GetObjects <Aisling>(i => i.WithinRangeOf(this)); foreach (var aisling in nearby) { aisling.Show(Scope.Self, action); aisling.Show(Scope.Self, hpbar); } } else { target.RemoveBuffsAndDebuffs(); } }
public override void OnSuccess(Sprite sprite, Sprite target) { if (sprite is Aisling) { var client = (sprite as Aisling).Client; client.TrainSpell(Spell); var debuff = new debuff_cradh(); var curses = target.Debuffs.Values.OfType <debuff_cursed>().ToList(); if (curses.Count == 0) { if (!target.HasDebuff(debuff.Name)) { debuff.OnApplied(target, debuff); if (target is Aisling) { (target as Aisling).Client .SendMessage(0x02, string.Format("{0} Attacks you with {1}.", client.Aisling.Username, Spell.Template.Name)); } client.SendMessage(0x02, string.Format("you cast {0}", Spell.Template.Name)); client.SendAnimation(258, target, sprite); var action = new ServerFormat1A { Serial = sprite.Serial, Number = (byte)(client.Aisling.Path == Class.Priest ? 0x80 : client.Aisling.Path == Class.Wizard ? 0x88 : 0x06), Speed = 30 }; var hpbar = new ServerFormat13 { Serial = sprite.Serial, Health = 255, Sound = 27 }; client.Aisling.Show(Scope.NearbyAislings, action); client.Aisling.Show(Scope.NearbyAislings, hpbar); } } else { var c = curses.FirstOrDefault(); if (c != null) { client.SendMessage(0x02, string.Format("Another curse is afflicted [{0}].", c.Name)); } } } else { var debuff = new debuff_cradh(); var curses = target.Debuffs.Values.OfType <debuff_cursed>().ToList(); if (curses.Count == 0) { if (!target.HasDebuff(debuff.Name)) { debuff.OnApplied(target, debuff); if (target is Aisling) { (target as Aisling).Client .SendMessage(0x02, string.Format("{0} Attacks you with {1}.", (sprite is Monster ? (sprite as Monster).Template.Name : (sprite as Mundane).Template.Name) ?? "Monster", Spell.Template.Name)); } target.SendAnimation(258, target, sprite); var action = new ServerFormat1A { Serial = sprite.Serial, Number = 1, Speed = 30 }; var hpbar = new ServerFormat13 { Serial = target.Serial, Health = 255, Sound = 27 }; sprite.Show(Scope.NearbyAislings, action); target.Show(Scope.NearbyAislings, hpbar); } } } }
public override void OnSuccess(Sprite sprite, Sprite target) { if (sprite is Aisling) { var client = (sprite as Aisling).Client; client.TrainSpell(Spell); var debuff = Clone(Spell.Template.Debuff); var curses = target.Debuffs.OfType <debuff_cursed>().ToList(); if (curses.Count == 0) { if (target.Debuffs.FirstOrDefault(i => i.Name == debuff.Name) == null) { debuff.OnApplied(target, debuff); if (target is Aisling) { (target as Aisling).Client .SendMessage(0x02, string.Format("{0} Attacks you with {1}.", client.Aisling.Username, Spell.Template.Name)); } client.SendMessage(0x02, string.Format("you cast {0}", Spell.Template.Name)); client.SendAnimation(243, target, sprite); var action = new ServerFormat1A { Serial = client.Aisling.Serial, Number = 0x80, Speed = 30 }; var hpbar = new ServerFormat13 { Serial = sprite.Serial, Health = 255, Sound = 27 }; client.Aisling.Show(Scope.NearbyAislings, action); client.Aisling.Show(Scope.NearbyAislings, hpbar); } } else { var c = curses.FirstOrDefault(); if (c != null) { client.SendMessage(0x02, string.Format("Another curse is afflicted [{0}].", c.Name)); } } } else { if (!(target is Aisling)) { return; } var client = (target as Aisling).Client; var debuff = Clone(Spell.Template.Debuff); var curses = target.Debuffs.OfType <debuff_cursed>().ToList(); if (curses.Count == 0) { if (target.Debuffs.FirstOrDefault(i => i.Name == debuff.Name) == null) { debuff.OnApplied(target, debuff); (target as Aisling).Client .SendMessage(0x02, string.Format("{0} Attacks you with {1}.", (sprite is Monster ? (sprite as Monster).Template.Name : (sprite as Mundane).Template.Name) ?? "Monster", Spell.Template.Name)); client.SendAnimation(243, target, sprite); var action = new ServerFormat1A { Serial = sprite.Serial, Number = 0x80, Speed = 30 }; var hpbar = new ServerFormat13 { Serial = client.Aisling.Serial, Health = 255, Sound = 8 }; client.Aisling.Show(Scope.NearbyAislings, action); client.Aisling.Show(Scope.NearbyAislings, hpbar); } } } }
public override void OnSuccess(Sprite sprite, Sprite target) { if (target == null) { return; } target.RemoveBuffsAndDebuffs(); target.SendAnimation(Spell.Template.Animation, target, sprite); if (sprite is Aisling) { var client = (sprite as Aisling).Client; client.TrainSpell(Spell); client.SendMessage(0x02, string.Format("you cast {0}", Spell.Template.Name)); var action = new ServerFormat1A { Serial = sprite.Serial, Number = (byte)(client.Aisling.Path == Class.Priest ? 0x80 : client.Aisling.Path == Class.Wizard ? 0x88 : 0x06), Speed = 30 }; var hpbar = new ServerFormat13 { Serial = client.Aisling.Serial, Health = 255, Sound = Spell.Template.Sound }; client.Aisling.Show(Scope.NearbyAislings, action); client.Aisling.Show(Scope.NearbyAislings, hpbar); if (target is Aisling) { (target as Aisling).Client.SendStats(StatusFlags.All); (target as Aisling).Client .SendMessage(0x02, string.Format("{0} Attacks you with {1}.", client.Aisling.Username, Spell.Template.Name)); } } else { if (target is Aisling) { (target as Aisling).Client.SendStats(StatusFlags.All); (target as Aisling).Client .SendMessage(0x02, string.Format("{0} Attacks you with {1}.", (sprite is Monster ? (sprite as Monster).Template.Name : (sprite as Mundane).Template.Name) ?? "Monster", Spell.Template.Name)); } var action = new ServerFormat1A { Serial = sprite.Serial, Number = 1, Speed = 30 }; var hpbar = new ServerFormat13 { Serial = target.Serial, Health = 255, Sound = Spell.Template.Sound }; sprite.Show(Scope.NearbyAislings, action); target.Show(Scope.NearbyAislings, hpbar); } }