From 56dd6194a1c3a4c6594d200e1675cd595aff8b7f Mon Sep 17 00:00:00 2001 From: Lucca Faria Ferri Date: Sun, 18 Jun 2023 21:16:26 -0700 Subject: [PATCH] Rewrote Necromancer's CorpseExplosions `HeroSkill` - it appears to have an issue with Rune_A still, investigating. --- .../Implementations/HeroSkills/Crusader.cs | 4 +- .../Implementations/HeroSkills/Necromancer.cs | 82 +++++++++++-------- .../PowerSystem/Payloads/AttackPayload.cs | 4 +- 3 files changed, 52 insertions(+), 38 deletions(-) diff --git a/src/DiIiS-NA/D3-GameServer/GSSystem/PowerSystem/Implementations/HeroSkills/Crusader.cs b/src/DiIiS-NA/D3-GameServer/GSSystem/PowerSystem/Implementations/HeroSkills/Crusader.cs index 5de07be..6f00fd8 100644 --- a/src/DiIiS-NA/D3-GameServer/GSSystem/PowerSystem/Implementations/HeroSkills/Crusader.cs +++ b/src/DiIiS-NA/D3-GameServer/GSSystem/PowerSystem/Implementations/HeroSkills/Crusader.cs @@ -148,7 +148,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations if (Rune_B > 0) DmgType = DamageType.Lightning; //Electrify AttackPayload attack = new AttackPayload(this); attack.Targets = GetEnemiesInArcDirection(User.Position, TargetPosition, 12f, Rune_D > 0 ? 120f : 90f); //Carve - if (Rune_C > 0) attack.chcBonus = ScriptFormula(14); //Crush + if (Rune_C > 0) attack.ChcBonus = ScriptFormula(14); //Crush attack.AddWeaponDamage(ScriptFormula(0), DmgType); attack.OnHit = hitPayload => { @@ -3150,7 +3150,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations attack.Targets = GetEnemiesInRadius(point, 12f); attack.AddWeaponDamage(ScriptFormula(3), DamageType.Physical); if (Rune_B > 0) //Annihilate - attack.chcBonus = 1f; //will be capped to 85% anyway + attack.ChcBonus = 1f; //will be capped to 85% anyway attack.OnHit = (hitPayload) => { if (Rune_A > 0) //Barrels of tar diff --git a/src/DiIiS-NA/D3-GameServer/GSSystem/PowerSystem/Implementations/HeroSkills/Necromancer.cs b/src/DiIiS-NA/D3-GameServer/GSSystem/PowerSystem/Implementations/HeroSkills/Necromancer.cs index 7628543..94630fa 100644 --- a/src/DiIiS-NA/D3-GameServer/GSSystem/PowerSystem/Implementations/HeroSkills/Necromancer.cs +++ b/src/DiIiS-NA/D3-GameServer/GSSystem/PowerSystem/Implementations/HeroSkills/Necromancer.cs @@ -1264,7 +1264,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations } } #endregion - //Done + //Done - testing, apparently Rune_A not working. #region CorpseExlosion [ImplementsPowerSNO(SkillsSystem.Skills.Necromancer.ExtraSkills.CorpseExlosion)] @@ -1272,72 +1272,86 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations { public override IEnumerable Main() { - //ScriptFormulaDetails_Fields - //PowerDefinition_Fields - //Мертвячинка) - if (player.SkillSet.HasPassive(208594)) 454066 - if (Rune_B > 0) - ((Player) User).AddPercentageHP(-2); - float Radius = 20f; - float Damage = 10.5f; - DamageType DType = DamageType.Physical; - var PowerData = (DiIiS_NA.Core.MPQ.FileFormats.Power)MPQStorage.Data.Assets[SNOGroup.Power][PowerSNO].Data; - var Point = SpawnEffect(ActorSno._p6_necro_bonespikes, TargetPosition, 0, WaitSeconds(0.2f)); - Point.PlayEffect(Effect.PlayEffectGroup, RuneSelect(459954, 473926, 459954, 473907, 459954//D - , 473864)); + // Initializing main variables for Bonespikes ability. + float radius = 20f; + float damage = 10.5f; + DamageType damageType = DamageType.Physical; + + // Fetching the data for the respective Power from the MPQ cache. + var powerData = (DiIiS_NA.Core.MPQ.FileFormats.Power)MPQStorage.Data.Assets[SNOGroup.Power][PowerSNO].Data; + + // Creating a point effect on the target position, playing various effect groups depending on the selected Rune. + var point = SpawnEffect(ActorSno._p6_necro_bonespikes, TargetPosition, 0, WaitSeconds(0.2f)); + point.PlayEffect(Effect.PlayEffectGroup, RuneSelect(459954, 473926, 459954, 473907, 459954, 473864)); + + // Depending on a specific game attribute, either spawn a new monster at the target position, or select up to five existing corpses. var actors = User.Attributes[GameAttributes.Necromancer_Corpse_Free_Casting] ? new List { User.World.SpawnMonster(ActorSno._p6_necro_corpse_flesh, TargetPosition).GlobalID } - : User.GetActorsInRange(TargetPosition, 11).Where(x => x.SNO == ActorSno._p6_necro_corpse_flesh).Select(x => x.GlobalID).Take(5).ToList(); - if (Rune_D > 0) - Radius = 25f; - else if (Rune_C > 0)//licking action - { Damage = 15.75f; DType = DamageType.Poison; } - else if (Rune_A > 0) - DType = DamageType.Poison; + : User.GetActorsInRange(TargetPosition, 11).Where(x => x.SNO == ActorSno._p6_necro_corpse_flesh) + .Select(x => x.GlobalID).Take(5).ToList(); + // Modifying main parameters of the ability depending on the selected Rune. + if (Rune_D > 0) + { + radius = 25f; + } + else if (Rune_C > 0) // Licking action. + { + damage = 15.75f; + damageType = DamageType.Poison; + } + else if (Rune_A > 0) + { + damageType = DamageType.Poison; + } + + // Applying the effects of the Bonespikes ability on the selected corpses. foreach (var actor in actors) { - if (Rune_B > 0) { var bomb = World.GetActorByGlobalId(actor); var nearestEnemy = bomb.GetActorsInRange(20f).First(); if (nearestEnemy != null) bomb.Teleport(nearestEnemy.Position); - } - - var Explosion = SpawnEffect( + + // Spawning explosion effect. + var explosionEffect = SpawnEffect( ActorSno._p6_necro_corpseexplosion_projectile_spawn, World.GetActorByGlobalId(actor).Position, ActorSystem.Movement.MovementHelpers.GetFacingAngle(User, World.GetActorByGlobalId(actor)), WaitSeconds(0.2f) ); - Explosion.PlayEffect(Effect.PlayEffectGroup, RuneSelect(457183, 471539, 471258, 471249, 471247, 471236)); + explosionEffect.PlayEffect(Effect.PlayEffectGroup, + RuneSelect(457183, 471539, 471258, 471249, 471247, 471236)); + explosionEffect.UpdateDelay = 0.1f; - Explosion.UpdateDelay = 0.1f; - Explosion.OnUpdate = () => + explosionEffect.OnUpdate = () => { - AttackPayload attack = new AttackPayload(this) + // Creating the attack payload. + AttackPayload attack = new(this) { - Targets = GetEnemiesInRadius(User.Position, Radius) + Targets = GetEnemiesInRadius(User.Position, radius) }; if (Rune_E > 0) - DType = DamageType.Cold; - - attack.AddWeaponDamage(Damage, DType); + damageType = DamageType.Cold; + + // Applying weapon damage. + attack.AddWeaponDamage(damage, damageType); attack.OnHit = hitPayload => { if (Rune_E > 0) AddBuff(hitPayload.Target, new DebuffFrozen(WaitSeconds(2f))); }; + // Applying the attack. attack.Apply(); }; + // Destroying the selected corpse. World.GetActorByGlobalId(actor).Destroy(); } - - //}); yield break; } } diff --git a/src/DiIiS-NA/D3-GameServer/GSSystem/PowerSystem/Payloads/AttackPayload.cs b/src/DiIiS-NA/D3-GameServer/GSSystem/PowerSystem/Payloads/AttackPayload.cs index d4a1ced..12dc3a5 100644 --- a/src/DiIiS-NA/D3-GameServer/GSSystem/PowerSystem/Payloads/AttackPayload.cs +++ b/src/DiIiS-NA/D3-GameServer/GSSystem/PowerSystem/Payloads/AttackPayload.cs @@ -16,7 +16,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Payloads // list of targets to try and hit with this payload, must be set before calling Apply() public TargetList Targets; - public float chcBonus = 0f; + public float ChcBonus = 0f; // list of each amount and type of damage the attack will contain public class DamageEntry @@ -115,7 +115,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Payloads if (target == null || target.World == null || target.World != null && target.World.PowerManager.IsDeletingActor(target)) continue; - var payload = new HitPayload(this, _DoCriticalHit(Context.User, target, chcBonus) + var payload = new HitPayload(this, _DoCriticalHit(Context.User, target, ChcBonus) , target); payload.AutomaticHitEffects = AutomaticHitEffects; payload.OnDeath = OnDeath;