public override void OnSkillDamage(SkillArg arg, SkillAttackResult result, int dmg, int bonusCount) { if (arg.Caster.ActorType == ActorType.PC && ((DateTime.Now - attackStamp).TotalMinutes > 5 || firstAttacker == null || (firstAttacker?.DistanceToActor(npc) > 200))) { firstAttacker = arg.Caster as ActorPC; attackStamp = DateTime.Now; } AI.OnDamage(arg, dmg); }
public override void OnSkillDamage(SkillArg arg, SkillAttackResult result, int dmg, int bonusCount) { base.OnSkillDamage(arg, result, dmg, bonusCount); System.Threading.Interlocked.Exchange(ref NPC.HP, NPC.MaxHP); if (arg.Caster is ActorPC pc) { if (pc.Quests.ContainsKey(235)) { Quest quest = pc.Quests[235]; if (quest.Step == 1 || quest.Step == 2 && quest.NextStep < 3) { quest.Step = 2; quest.NextStep = 2; if (arg.Skill.ID == 12106 && bonusCount >= 3)//Energy missile { quest.StepStatus = 1; switch (quest.Flag3) { case 1: quest.Flag3 = 3; break; case 3: quest.Flag3 = 5; break; case 5: { quest.Flag3 = 7; quest.NextStep = 3; quest.Flag1 = 3; quest.Flag2 = 3; SendNPCCommand("q226_1_finished"); BeginTask(); Delay(3); SpawnNPCTask(673, 1542, -2146, 11145, 555, 280, 367); Delay(3); SpawnNPCTask(673, 1542, -2215, 11061, 555, 1, 367); Delay(3); SpawnNPCTask(673, 1542, -2144, 10968, 555, 75, 367); Delay(3); SpawnNPCTask(673, 1542, -2038, 10997, 555, 130, 367); Delay(3); SpawnNPCTask(673, 1542, -2038, 11112, 555, 205, 367); StartTask(); } break; } Disappear(2339); UpdateQuest(pc, quest); } } } } }
public override void OnSkillDamage(SkillArg arg, SkillAttackResult result, int dmg, int bonusCount) { base.OnSkillDamage(arg, result, dmg, bonusCount); System.Threading.Interlocked.Exchange(ref NPC.HP, NPC.MaxHP); if (arg.Caster is ActorPC pc) { foreach (ushort i in new ushort[] { 226, 229, 235, 238 }) { if (pc.Quests.ContainsKey(i)) { Quest quest = pc.Quests[i]; if (quest.Step == 2 || quest.Step == 3) { quest.Step = 3; quest.NextStep = 3; List <uint> skillIDs = new List <uint>(); skillIDs.Add(10120); skillIDs.Add(15201); skillIDs.Add(12251); skillIDs.Add(11129); skillIDs.Add(11111); if ((skillIDs.Contains(arg.Skill.ID)) && result.IsHit())//blade stab { quest.StepStatus = 1; switch (quest.Flag3) { case 7: quest.Flag3 = 15; break; case 15: quest.Flag3 = 23; break; case 23: { ProcessQuest(pc, 3, quest); SendNPCCommand("q226_2_finished"); Disappear(2339); //Reset combat status pc.Client().ChangeCombatStatus(false); return; } } UpdateQuest(pc, quest); Disappear(2339); } } } } } }
private void Mine_OnAdditionEnd(Actor actor, Buff skill, bool cancel) { Map.Map map = Map.MapManager.Instance.GetMap(actor.MapInstanceID); ((ActorExt)actor).Tasks.TryRemove("Mine", out Task removed); UpdateEvent evt = new UpdateEvent() { Actor = actor, Target = actor, SkillSession = 128, AdditionID = 15208019, AdditionSession = 1, ExtraActivateMode = UpdateEvent.ExtraUpdateModes.Cancel }; evt.SkillSession = arg.SkillSession; evt.UpdateType = UpdateTypes.Actor; evt.UserData = new byte[] { 9, 3, 0 }; map.SendEventToAllActorsWhoCanSeeActor(MapEvents.EVENT_BROADCAST, evt, actor, true); evt = new UpdateEvent() { Actor = actor, Target = actor, AdditionSession = 1, AdditionID = 15208019, ExtraActivateMode = UpdateEvent.ExtraUpdateModes.Cancel, SkillSession = 128, UpdateType = UpdateTypes.ActorExtension }; map.SendEventToAllActorsWhoCanSeeActor(MapEvents.EVENT_BROADCAST, evt, actor, true); SkillManager.Instance.BroadcastSkillCast(arg, SkillMode.Abort); SkillManager.Instance.DoAttack(arg); foreach (SkillAffectedActor i in arg.AffectedActors) { SkillAttackResult res = i.Result; if (res != SkillAttackResult.Avoid && res != SkillAttackResult.Miss && res != SkillAttackResult.Parry && res != SkillAttackResult.TotalParry) { if (i.Target.Tasks.ContainsKey("ActorDown")) { Buff buff = i.Target.Tasks["ActorDown"] as Buff; buff.Deactivate(); } i.NoDamageBroadcast = true; Common.Additions.ActorDown add = new Common.Additions.ActorDown(arg, i.Target, 15208018, i.Damage); i.Target.Tasks["ActorDown"] = add; add.Activate(); } } SkillManager.Instance.BroadcastSkillCast(arg, SkillMode.End); }
public override void HandleSkillActivate(SkillArg arg) { SkillManager.Instance.DoAttack(arg); List <SkillAffectedActor> affected = arg.AffectedActors; bool noTarget = false; foreach (SkillAffectedActor i in affected) { SkillAttackResult res = i.Result; if (res != SkillAttackResult.Avoid && res != SkillAttackResult.Miss && res != SkillAttackResult.Parry && res != SkillAttackResult.TotalParry) { if (i.Target.Tasks.ContainsKey("ActorFrosen")) { Buff buff = i.Target.Tasks["ActorFrosen"] as Buff; buff.Deactivate(); } i.NoDamageBroadcast = true; Common.Additions.ActorFrosen add = new Common.Additions.ActorFrosen(arg, i.Target, additionID, i.Damage, 5000); i.Target.Tasks["ActorFrosen"] = add; add.Activate(); noTarget = true; } } Additions.FrosenSelf frosenSelf = new Additions.FrosenSelf(arg); frosenSelf.Activate(); arg.Caster.ChangeStance(Stances.Ice, arg.SkillSession, 12000002, 6); if (noTarget && arg.Caster.ActorType == ActorType.PC) { Interlocked.Add(ref arg.Caster.MP, 2); if (arg.Caster.MP > arg.Caster.MaxMP) { Interlocked.Exchange(ref arg.Caster.MP, arg.Caster.MaxMP); } Network.Client.GameSession client = ((ActorPC)arg.Caster).Client(); client?.SendPlayerMP(); } }
public override void HandleSkillActivate(SkillArg arg) { SkillManager.Instance.DoAttack(arg); foreach (SkillAffectedActor i in arg.AffectedActors) { SkillAttackResult res = i.Result; if (res != SkillAttackResult.Avoid && res != SkillAttackResult.Miss && res != SkillAttackResult.Parry && res != SkillAttackResult.TotalParry) { if (i.Target.Tasks.ContainsKey("ActorCatch")) { Buff buff = i.Target.Tasks["ActorCatch"] as Buff; buff.Deactivate(); } Common.Additions.ActorCatch add = new Common.Additions.ActorCatch(arg, i.Target, additionID, i.Damage, 5000); i.Target.Tasks["ActorCatch"] = add; add.Activate(); } } }
public void HandleSkillActivate(SkillArg arg) { SkillManager.Instance.DoAttack(arg); foreach (SkillAffectedActor i in arg.AffectedActors) { SkillAttackResult res = i.Result; i.NoDamageBroadcast = true; if (res != SkillAttackResult.Avoid && res != SkillAttackResult.Miss && res != SkillAttackResult.Parry && res != SkillAttackResult.TotalParry) { if (i.Target.Tasks.ContainsKey("ActorDown")) { Buff buff = i.Target.Tasks["ActorDown"] as Buff; buff.Deactivate(); } Common.Additions.ActorDown add = new Common.Additions.ActorDown(arg, i.Target, 11118010, i.Damage, 2000); i.Target.Tasks["ActorDown"] = add; add.Activate(); } } }
public override void OnSkillDamage(SkillArg arg, SkillAttackResult result, int dmg, int bonusCount) { base.OnSkillDamage(arg, result, dmg, bonusCount); System.Threading.Interlocked.Exchange(ref NPC.HP, NPC.MaxHP); }
public override void OnSkillDamage(SkillArg arg, SkillAttackResult result, int dmg, int bonusCount) { }
public override void OnSkillDamage(SkillArg arg, SkillAttackResult result, int dmg, int bonusCount) { base.OnSkillDamage(arg, result, dmg, bonusCount); System.Threading.Interlocked.Exchange(ref NPC.HP, NPC.MaxHP); if (arg.Caster is ActorPC pc) { foreach (ushort i in new ushort[] { 226, 229, 238 }) { if (pc.Quests.ContainsKey(i)) { Quest quest = pc.Quests[i]; if (quest.Step == 1 || quest.Step == 2 && quest.NextStep < 3) { quest.Step = 2; quest.NextStep = 2; if (((arg.Skill.ID == 10103) || (arg.Skill.ID == 10120) || (arg.Skill.ID == 11104) || (arg.Skill.ID == 15208)) && result.IsHit()) //blade stab { quest.StepStatus = 1; switch (quest.Flag3) { case 1: quest.Flag3 = 3; break; case 3: quest.Flag3 = 5; break; case 5: { quest.Flag3 = 7; quest.NextStep = 3; quest.Flag1 = 3; quest.Flag2 = 3; SendNPCCommand("q226_1_finished"); BeginTask(); Delay(3); SpawnNPCTask(673, 1542, -2146, 11145, 555, 280, 367); Delay(3); SpawnNPCTask(673, 1542, -2215, 11061, 555, 1, 367); Delay(3); SpawnNPCTask(673, 1542, -2144, 10968, 555, 75, 367); Delay(3); SpawnNPCTask(673, 1542, -2038, 10997, 555, 130, 367); Delay(3); SpawnNPCTask(673, 1542, -2038, 11112, 555, 205, 367); StartTask(); } break; } Disappear(2339); UpdateQuest(pc, quest); } } } } } }
public void HandleSkillActivate(SkillArg arg) { SkillManager.Instance.DoAttack(arg); foreach (SkillAffectedActor i in arg.AffectedActors) { SkillAttackResult res = i.Result; if (res != SkillAttackResult.Avoid && res != SkillAttackResult.Miss) { if (arg.Caster.Tasks.ContainsKey("ActorTakeDown")) { Buff buff = arg.Caster.Tasks["ActorTakeDown"] as Buff; buff.Deactivate(); } if (i.Target.Tasks.ContainsKey("ActorDown")) { Buff buff = i.Target.Tasks["ActorDown"] as Buff; buff.TotalLifeTime += 3000; } Buff add = new Buff(arg.Caster, "ActorTakeDown", 3000); add.OnAdditionStart += (actor, addition) => { Map.Map map = MapManager.Instance.GetMap(actor.MapInstanceID); if (!arg.Caster.Status.TakeDown) { arg.Caster.Status.TakeDown = true; i.Target.Status.TakenDown = true; i.Target.Status.StanceFlag1.SetValue(StanceU1.TakenDown, true); i.Target.Status.StanceFlag2.SetValue(StanceU2.TakenDown1, true); i.Target.Status.StanceFlag2.SetValue(StanceU2.TakenDown2, true); i.Target.Status.InteractWith = arg.Caster.ActorID; arg.Caster.Status.InteractWith = i.Target.ActorID; i.Target.Dir = (ushort)(arg.Caster.Dir + 180); if (i.Target.Dir >= 360) { i.Target.Dir -= 360; } UpdateEvent evt = new UpdateEvent() { Actor = arg.Caster, Target = arg.Caster, SkillSession = arg.SkillSession, ExtraActivateMode = UpdateEvent.ExtraUpdateModes.Activate, UpdateType = UpdateTypes.Actor }; evt.AddActorPara(PacketParameter.X, i.Target.X); evt.AddActorPara(PacketParameter.Y, i.Target.Y); //evt.AddActorPara(PacketParameter.InteractWith, (long)arg.Caster.Status.InteractWith); //evt.AddActorPara(PacketParameter.InteractionType, 1); //evt.AddActorPara(PacketParameter.InteractionRelation, 1); //evt.AddActorPara(PacketParameter.Unk74, 1); //evt.AddActorPara(PacketParameter.UnkD7, 1); map.SendEventToAllActorsWhoCanSeeActor(MapEvents.EVENT_BROADCAST, evt, i.Target, true); evt = new UpdateEvent() { Actor = arg.Caster, AdditionID = additionTarget, Target = i.Target, Skill = arg.Skill, SkillSession = arg.SkillSession, ExtraActivateMode = UpdateEvent.ExtraUpdateModes.Activate, UpdateType = UpdateTypes.Actor }; //evt.AddActorPara(PacketParameter.Unk7A, i.Target.Status.StanceFlag1.Value); //evt.AddActorPara(PacketParameter.Unk7B, i.Target.Status.StanceFlag2.Value); //evt.AddActorPara(PacketParameter.Dir, i.Target.Dir); //evt.AddActorPara(PacketParameter.InteractWith, (long)i.Target.Status.InteractWith); //evt.AddActorPara(PacketParameter.InteractionType, 1); //evt.AddActorPara(PacketParameter.InteractionRelation, 2); //evt.AddActorPara(PacketParameter.Unk74, 1); //evt.AddActorPara(PacketParameter.UnkD7, 1); map.SendEventToAllActorsWhoCanSeeActor(MapEvents.EVENT_BROADCAST, evt, i.Target, true); evt = UpdateEvent.NewActorAdditionExtEvent(i.Target, arg.SkillSession, 11, additionTarget, 3000, UpdateEvent.ExtraUpdateModes.Activate); map.SendEventToAllActorsWhoCanSeeActor(MapEvents.EVENT_BROADCAST, evt, i.Target, true); evt = new UpdateEvent() { Actor = arg.Caster, Target = arg.Caster, AdditionID = additionSelf, SkillSession = arg.SkillSession, ExtraActivateMode = UpdateEvent.ExtraUpdateModes.Activate, UpdateType = UpdateTypes.Actor }; map.SendEventToAllActorsWhoCanSeeActor(MapEvents.EVENT_BROADCAST, evt, i.Target, true); evt = UpdateEvent.NewActorAdditionExtEvent(arg.Caster, arg.SkillSession, 11, additionSelf, 3000, UpdateEvent.ExtraUpdateModes.Activate); map.SendEventToAllActorsWhoCanSeeActor(MapEvents.EVENT_BROADCAST, evt, arg.Caster, true); } }; add.OnAdditionEnd += (actor, addition, cancel) => { Map.Map map = MapManager.Instance.GetMap(actor.MapInstanceID); if (i.Target.Tasks.ContainsKey("ActorDown")) { Buff buff = i.Target.Tasks["ActorDown"] as Buff; buff.Deactivate(); } arg.Caster.Status.TakeDown = false; i.Target.Status.TakenDown = false; i.Target.Status.StanceFlag1.SetValue(StanceU1.TakenDown, false); i.Target.Status.StanceFlag2.SetValue(StanceU2.TakenDown1, false); i.Target.Status.StanceFlag2.SetValue(StanceU2.TakenDown2, false); i.Target.Status.InteractWith = 0; arg.Caster.Status.InteractWith = 0; arg.Caster.Tasks.TryRemove("ActorTakeDown", out Task removed); UpdateEvent evt = new UpdateEvent() { Actor = arg.Caster, Target = arg.Caster, SkillSession = arg.SkillSession, ExtraActivateMode = UpdateEvent.ExtraUpdateModes.Cancel, UpdateType = UpdateTypes.Actor }; //evt.AddActorPara(PacketParameter.X, arg.Caster.X); //evt.AddActorPara(PacketParameter.Y, arg.Caster.Y); //evt.AddActorPara(PacketParameter.InteractWith, (long)arg.Caster.Status.InteractWith); //evt.AddActorPara(PacketParameter.InteractionType, 0); //evt.AddActorPara(PacketParameter.InteractionRelation, 0); //evt.AddActorPara(PacketParameter.Unk74, 0); //evt.AddActorPara(PacketParameter.UnkD7, 0); map.SendEventToAllActorsWhoCanSeeActor(MapEvents.EVENT_BROADCAST, evt, i.Target, true); evt = UpdateEvent.NewActorAdditionExtEvent(arg.Caster, arg.SkillSession, 11, additionSelf, 3000, UpdateEvent.ExtraUpdateModes.Cancel); map.SendEventToAllActorsWhoCanSeeActor(MapEvents.EVENT_BROADCAST, evt, arg.Caster, true); evt = new UpdateEvent() { Actor = arg.Caster, AdditionID = additionTarget, Target = i.Target, Skill = arg.Skill, SkillSession = arg.SkillSession, ExtraActivateMode = UpdateEvent.ExtraUpdateModes.Cancel, UpdateType = UpdateTypes.Actor, //evt.AddActorPara(PacketParameter.Unk7A, i.Target.Status.StanceFlag1.Value); //evt.AddActorPara(PacketParameter.Unk7B, i.Target.Status.StanceFlag2.Value); //evt.AddActorPara(PacketParameter.InteractWith, (long)i.Target.Status.InteractWith); //evt.AddActorPara(PacketParameter.InteractionType, 0); //evt.AddActorPara(PacketParameter.InteractionRelation, 0); //evt.AddActorPara(PacketParameter.Unk74, 0); //evt.AddActorPara(PacketParameter.UnkD7, 0); UserData = new byte[] { 9, 1, 0 } }; map.SendEventToAllActorsWhoCanSeeActor(MapEvents.EVENT_BROADCAST, evt, i.Target, true); evt = UpdateEvent.NewActorAdditionExtEvent(i.Target, arg.SkillSession, 11, additionTarget, 3000, UpdateEvent.ExtraUpdateModes.Cancel); map.SendEventToAllActorsWhoCanSeeActor(MapEvents.EVENT_BROADCAST, evt, i.Target, true); }; arg.Caster.Tasks["ActorTakeDown"] = add; add.Activate(); } } }
public static bool IsHit(this SkillAttackResult res) { return(res != SkillAttackResult.Miss && res != SkillAttackResult.Avoid); }
public virtual void HandleSkillActivate(SkillArg arg) { SkillManager.Instance.DoAttack(arg); List <SkillAffectedActor> affected = arg.AffectedActors; bool pushedBack = false; Map.Map map = Map.MapManager.Instance.GetMap(arg.Caster.MapInstanceID); foreach (SkillAffectedActor i in affected) { SkillAttackResult res = i.Result; if (addMana && res != SkillAttackResult.Avoid && res != SkillAttackResult.Miss) { if (arg.Caster.ActorType == SmartEngine.Network.Map.ActorType.PC && arg.Caster.MP < arg.Caster.MaxMP) { Network.Client.GameSession client = ((ActorPC)arg.Caster).Client(); if (client != null) { Interlocked.Increment(ref arg.Caster.MP); ((ActorPC)arg.Caster).Client().SendPlayerMP(); } } } pushedBack = true; bool noPushBack = false; if (i.Target is ActorNPC) { noPushBack = ((ActorNPC)i.Target).BaseData.NoPushBack; } if (canPushBack > 0 && !noPushBack && res != SkillAttackResult.Miss && res != SkillAttackResult.Avoid) { Map.MoveArgument argu = new Map.MoveArgument() { BNSMoveType = Map.MoveType.PushBack }; bool pushed = map.HeightMapBuilder.GetMaximunPushBackPos(i.Target.X, i.Target.Y, i.Target.Z, arg.Caster.Dir, canPushBack, out argu.X, out argu.Y, out argu.Z); int delta = Math.Abs(argu.Z - i.Target.Z); if (pushed && delta < 50) { argu.PushBackSource = arg.Caster; argu.Dir = i.Target.Dir; argu.SkillSession = arg.SkillSession; //SmartEngine.Core.Logger.Log.Info(argu.Z.ToString()); map.MoveActor(i.Target, argu, true); if (stepForward > 0) { argu = new Map.MoveArgument() { BNSMoveType = Map.MoveType.StepForward }; pushed = map.HeightMapBuilder.GetMaximunPushBackPos(arg.Caster.X, arg.Caster.Y, arg.Caster.Z, arg.Caster.Dir, stepForward, out argu.X, out argu.Y, out argu.Z); argu.Dir = arg.Caster.Dir; delta = Math.Abs(argu.Z - arg.Caster.Z); //SmartEngine.Core.Logger.Log.Info(argu.Z.ToString()); if (pushed && delta < 50) { map.MoveActor(arg.Caster, argu, true); } } } } break; } if (canPushBack > 0 && !pushedBack && stepForward > 0) { Map.MoveArgument argu = new Map.MoveArgument() { BNSMoveType = Map.MoveType.StepForward }; bool pushed = map.HeightMapBuilder.GetMaximunPushBackPos(arg.Caster.X, arg.Caster.Y, arg.Caster.Z, arg.Caster.Dir, stepForward, out argu.X, out argu.Y, out argu.Z); argu.SkillSession = arg.SkillSession; int delta = Math.Abs(argu.Z - arg.Caster.Z); //SmartEngine.Core.Logger.Log.Info(argu.Z.ToString()); if (pushed && delta < 50) { argu.Dir = arg.Caster.Dir; map.MoveActor(arg.Caster, argu, true); } } }