private void ProcessSkill(Creature creature, List <UseSkillArgs> argsList, Skill skill) { creature.Attack = new Attack(creature, argsList[0], () => GlobalLogic.AttackStageEnd(creature), () => GlobalLogic.AttackFinished(creature)); VisibleService.Send(creature, new SpAttack(creature, creature.Attack)); VisibleService.Send(creature, new SpAttackDestination(creature, creature.Attack)); ProcessStages(creature, skill); ProcessMove(creature, skill); AiLogic.OnUseSkill(creature, skill); ProcessTargets(creature, skill); }
private void ProcessSkill(Creature creature, UseSkillArgs args, Skill skill, Projectile projectile = null) { bool isProjectileSkill = skill.Type == SkillType.Projectile || skill.Type == SkillType.Userslug; if (!isProjectileSkill) { if (skill.ChargingStageList == null || skill.ChargingStageList.ChargeStageList.Count == 0) { if (skill.Precondition.Cost.Hp > 0) { CreatureLogic.HpChanged(creature, creature.LifeStats.MinusHp(skill.Precondition.Cost.Hp)); } if (skill.Precondition.Cost.Mp > 0) { CreatureLogic.MpChanged(creature, creature.LifeStats.MinusMp(skill.Precondition.Cost.Mp)); } } if (!args.IsDelaySkill || args.IsDelayStart) { if (args.TargetPosition.IsNull()) { double angle = args.StartPosition.Heading * Math.PI / 32768; args.StartPosition.CopyTo(args.TargetPosition); args.TargetPosition.X += 100 * (float)Math.Cos(angle); args.TargetPosition.Y += 100 * (float)Math.Sin(angle); } // ReSharper disable ImplicitlyCapturedClosure creature.Attack = new Attack(creature, args, () => GlobalLogic.AttackStageEnd(creature), () => GlobalLogic.AttackFinished(creature)); // ReSharper restore ImplicitlyCapturedClosure VisibleService.Send(creature, new SpAttack(creature, creature.Attack)); VisibleService.Send(creature, new SpAttackDestination(creature, creature.Attack)); if (!args.IsDelaySkill) { ProcessStages(creature, skill); } else { Player player = creature as Player; if (player != null && skill.BaseId == 20100 && (player.PlayerData.Class == PlayerClass.Berserker || player.PlayerData.Class == PlayerClass.Lancer)) { player.EffectsImpact.ResetChanges(player); //Set IsBlockFrontAttacks } } ProcessMove(creature, skill); } } else { creature.Attack.Args.IsTargetAttack = args.IsTargetAttack; creature.Attack.Args.Targets = args.Targets; ProcessProjectileTargets(creature, skill, projectile); } AiLogic.OnUseSkill(creature, skill); if (skill.ChargingStageList != null) { if (args.IsDelayStart) { int uid = creature.Attack.UID; ThreadPool.QueueUserWorkItem( o => { Thread.Sleep(750); for (int i = 1; i < skill.ChargingStageList.ChargeStageList.Count; i++) { if (creature.Attack.UID != uid) { return; } creature.Attack.NextStage(); if (i != 3) { Thread.Sleep(750); } } }); } } else { ProcessTargets(creature, skill); } }