public void OnImpact(NWCreature creature, NWObject target, int perkLevel, int spellTier) { int damage; int intMod = creature.IntelligenceModifier; switch (spellTier) { case 1: damage = 10 + intMod; break; case 2: damage = 15 + intMod; break; case 3: damage = 20 + ((intMod * 15) / 10); break; case 4: damage = 25 + ((intMod * 17) / 10); break; case 5: damage = 30 + (intMod * 2); break; default: throw new ArgumentOutOfRangeException(nameof(spellTier)); } var result = CombatService.CalculateAbilityResistance(creature, target.Object, SkillType.ForceAlter, ForceBalanceType.Universal, true); // +/- percent change based on resistance float delta = 0.01f * result.Delta; damage = damage + (int)(damage * delta); var targetLocation = _.GetLocation(creature); var delay = _.GetDistanceBetweenLocations(creature.Location, targetLocation) / 18.0f + 0.35f; creature.AssignCommand(() => { _.PlaySound("plr_force_blast"); DoFireball(target); }); creature.DelayAssignCommand(() => { _.ApplyEffectToObject(DurationType.Instant, _.EffectDamage(damage), target); _.ApplyEffectToObject(DurationType.Instant, _.EffectVisualEffect(VisualEffect.Vfx_Imp_Silence), target); _.ApplyEffectToObject(DurationType.Instant, _.EffectVisualEffect(VisualEffect.VFX_IMP_KIN_L), target); }, delay); if (creature.IsPlayer) { SkillService.RegisterPCToNPCForSkill(creature.Object, target, SkillType.ForceAlter); } }
private void ApplyEffect(NWCreature creature, NWObject target, int spellTier) { Effect effectMindShield; // Handle effects for differing spellTier values switch (spellTier) { case 1: effectMindShield = _.EffectImmunity(ImmunityType.Dazed); creature.AssignCommand(() => { _.ApplyEffectToObject(DurationType.Temporary, effectMindShield, target, 6.1f); }); break; case 2: effectMindShield = _.EffectImmunity(ImmunityType.Dazed); effectMindShield = _.EffectLinkEffects(effectMindShield, _.EffectImmunity(ImmunityType.Confused)); effectMindShield = _.EffectLinkEffects(effectMindShield, _.EffectImmunity(ImmunityType.Dominate)); // Force Pursuade is DOMINATION effect creature.AssignCommand(() => { _.ApplyEffectToObject(DurationType.Temporary, effectMindShield, target, 6.1f); }); break; case 3: effectMindShield = _.EffectImmunity(ImmunityType.Dazed); effectMindShield = _.EffectLinkEffects(effectMindShield, _.EffectImmunity(ImmunityType.Confused)); effectMindShield = _.EffectLinkEffects(effectMindShield, _.EffectImmunity(ImmunityType.Dominate)); // Force Pursuade is DOMINATION effect if (target.GetLocalInt("FORCE_DRAIN_IMMUNITY") == 1) { creature.SetLocalInt("FORCE_DRAIN_IMMUNITY", 0); } creature.DelayAssignCommand(() => { creature.DeleteLocalInt("FORCE_DRAIN_IMMUNITY"); }, 6.1f); creature.AssignCommand(() => { _.ApplyEffectToObject(DurationType.Temporary, effectMindShield, target, 6.1f); }); break; default: throw new ArgumentOutOfRangeException(nameof(spellTier)); } // Play VFX _.ApplyEffectToObject(DurationType.Instant, _.EffectVisualEffect(VisualEffect.Dur_Mind_Affecting_Positive), target); if (creature.IsPlayer) { SkillService.RegisterPCToAllCombatTargetsForSkill(creature.Object, SkillType.ForceControl, null); } }
public void OnImpact(NWCreature creature, NWObject target, int perkLevel, int spellTier) { int damage; int mod = creature.WisdomModifier; switch (spellTier) { case 1: damage = 5 + mod; break; case 2: damage = 10 + ((mod * 125) / 100); break; case 3: damage = 10 + ((mod * 15) / 10); break; case 4: damage = 15 + ((mod * 175) / 100); break; case 5: damage = 15 + (mod * 2); break; default: throw new ArgumentOutOfRangeException(nameof(spellTier)); } var result = CombatService.CalculateAbilityResistance(creature, target.Object, SkillType.ForceAlter, ForceBalanceType.Universal, true); // +/- percent change based on resistance var delta = 0.01f * result.Delta; damage = damage + (int)(damage * delta); var targetLocation = _.GetLocation(creature); var delay = _.GetDistanceBetweenLocations(creature.Location, targetLocation) / 18.0f + 0.35f; creature.AssignCommand(() => { DoRock(target); _.PlaySound("plr_force_throw"); }); creature.DelayAssignCommand(() => { _.ApplyEffectToObject(DurationType.Instant, _.EffectDamage(damage, DamageType.Bludgeoning), target); _.ApplyEffectToObject(DurationType.Instant, _.EffectVisualEffect(VisualEffect.Vfx_Imp_Dust_Explosion), target); }, delay); if (creature.IsPlayer) { SkillService.RegisterPCToNPCForSkill(creature.Object, target, SkillType.ForceAlter); } }
private void ApplyEffect(NWCreature creature, NWObject target, int spellTier) { Effect effectMindShield; // Handle effects for differing spellTier values switch (spellTier) { case 1: effectMindShield = _.EffectImmunity(IMMUNITY_TYPE_DAZED); creature.AssignCommand(() => { _.ApplyEffectToObject(_.DURATION_TYPE_TEMPORARY, effectMindShield, target, 6.1f); }); break; case 2: effectMindShield = _.EffectImmunity(IMMUNITY_TYPE_DAZED); effectMindShield = _.EffectLinkEffects(effectMindShield, _.EffectImmunity(IMMUNITY_TYPE_CONFUSED)); effectMindShield = _.EffectLinkEffects(effectMindShield, _.EffectImmunity(IMMUNITY_TYPE_DOMINATE)); // Force Pursuade is DOMINATION effect creature.AssignCommand(() => { _.ApplyEffectToObject(_.DURATION_TYPE_TEMPORARY, effectMindShield, target, 6.1f); }); break; case 3: effectMindShield = _.EffectImmunity(IMMUNITY_TYPE_DAZED); effectMindShield = _.EffectLinkEffects(effectMindShield, _.EffectImmunity(IMMUNITY_TYPE_CONFUSED)); effectMindShield = _.EffectLinkEffects(effectMindShield, _.EffectImmunity(IMMUNITY_TYPE_DOMINATE)); // Force Pursuade is DOMINATION effect if (target.GetLocalInt("FORCE_DRAIN_IMMUNITY") == 1) { creature.SetLocalInt("FORCE_DRAIN_IMMUNITY", 0); } creature.DelayAssignCommand(() => { creature.DeleteLocalInt("FORCE_DRAIN_IMMUNITY"); }, 6.1f); creature.AssignCommand(() => { _.ApplyEffectToObject(_.DURATION_TYPE_TEMPORARY, effectMindShield, target, 6.1f); }); break; default: throw new ArgumentOutOfRangeException(nameof(spellTier)); } // Play VFX _.ApplyEffectToObject(_.DURATION_TYPE_INSTANT, _.EffectVisualEffect(_.VFX_DUR_MIND_AFFECTING_POSITIVE), target); }
public void ApplyEffects(NWCreature user, NWItem item, NWObject target, Location targetLocation, CustomData customData) { DateTime now = DateTime.UtcNow; DateTime unlockDateTime = now; if (string.IsNullOrWhiteSpace(GetLocalString(user, "GRENADE_UNLOCKTIME"))) { unlockDateTime = unlockDateTime.AddSeconds(-1); } else { unlockDateTime = DateTime.ParseExact(GetLocalString(user, "GRENADE_UNLOCKTIME"), "yyyy-MM-dd hh:mm:ss", CultureInfo.InvariantCulture); } //Console.WriteLine("IsValidTarget - Current Time = " + now.ToString("yyyy-MM-dd hh:mm:ss", CultureInfo.InvariantCulture)); //Console.WriteLine("IsValidTarget - Unlocktime = " + unlockDateTime.ToString("yyyy-MM-dd hh:mm:ss", CultureInfo.InvariantCulture)); //Console.WriteLine("IsValidTarget - DateTime.Compare = " + DateTime.Compare(unlockDateTime, now)); // Check if we've passed the unlock date. Exit early if we have not. if (DateTime.Compare(unlockDateTime, now) > 0 || unlockDateTime > now) { string timeToWait = TimeService.GetTimeToWaitLongIntervals(now, unlockDateTime, false); //Console.WriteLine("IsValidTarget - That ability can be used in " + timeToWait + "."); SendMessageToPC(user, "That ability can be used in " + timeToWait + "."); return; } Effect impactEffect = null; var spellId = Spell.Invalid; string soundName = null; int perkLevel = 1 + PerkService.GetCreaturePerkLevel(user, PerkType.GrenadeProficiency); int skillLevel = 5 + SkillService.GetPCSkillRank((NWPlayer)user, SkillType.Throwing); if (perkLevel == 0) { perkLevel += 1; } if (GetIsObjectValid(target) == true) { targetLocation = GetLocation(target); } string grenadeType = item.GetLocalString("TYPE"); //Console.WriteLine("Throwing " + grenadeType + " grenade at perk level " + perkLevel); Location originalLocation = targetLocation; int roll = RandomService.D100(1); SendMessageToPC(user, roll + " vs. DC " + (100 - skillLevel)); if (roll < (100 - skillLevel)) { if (RandomService.D20(1) == 1) { SendMessageToPC(user, "You threw... poorly."); //targetLocation = VectorService.MoveLocation(targetLocation, GetFacing(user), (RandomService.D6(4) - 10) * 1.0f, targetLocation = VectorService.MoveLocation(user.Location, RandomService.D100(1) + RandomService.D100(1) + RandomService.D100(1) + 60, RandomService.D4(2) * 1.0f, RandomService.D100(1) + RandomService.D100(1) + RandomService.D100(1)); int count = 0; while ((GetSurfaceMaterial(targetLocation) == 0 || LineOfSightVector(GetPositionFromLocation(targetLocation), GetPosition(user)) == false) && count < 10) { count += 1; targetLocation = VectorService.MoveLocation(user.Location, RandomService.D100(1) + RandomService.D100(1) + RandomService.D100(1) + 60, RandomService.D4(2) * 1.0f, RandomService.D100(1) + RandomService.D100(1) + RandomService.D100(1)); } } else { SendMessageToPC(user, "Your throw was a bit off the mark."); //targetLocation = VectorService.MoveLocation(targetLocation, GetFacing(user), (RandomService.D6(4) - 10) * 1.0f, targetLocation = VectorService.MoveLocation(targetLocation, RandomService.D100(1) + RandomService.D100(1) + RandomService.D100(1) + 60, RandomService.D4(2) /*(RandomService.D6(4) - 10) */ * 1.0f, RandomService.D100(1) + RandomService.D100(1) + RandomService.D100(1)); int count = 0; while ((GetSurfaceMaterial(targetLocation) == 0 || LineOfSightVector(GetPositionFromLocation(targetLocation), GetPosition(user)) == false) && count < 10) { count += 1; targetLocation = VectorService.MoveLocation(targetLocation, RandomService.D100(1) + RandomService.D100(1) + RandomService.D100(1) + 60, RandomService.D4(2) /*(RandomService.D6(4) - 10) */ * 1.0f, RandomService.D100(1) + RandomService.D100(1) + RandomService.D100(1)); } } if (GetSurfaceMaterial(targetLocation) == 0 || LineOfSightVector(GetPositionFromLocation(targetLocation), GetPosition(user)) == false) { targetLocation = originalLocation; } } switch (grenadeType) { case "FRAG": impactEffect = EffectVisualEffect(VisualEffect.Fnf_Fireball); // force a specific spell id (for projectile model) for this grenade. spellId = Spell.Grenade10; soundName = "explosion2"; break; case "CONCUSSION": impactEffect = EffectVisualEffect(VisualEffect.Vfx_Fnf_Sound_Burst_Silent); impactEffect = EffectLinkEffects(EffectVisualEffect(VisualEffect.Vfx_Fnf_Screen_Shake), impactEffect); spellId = Spell.Grenade10; soundName = "explosion1"; break; case "FLASHBANG": impactEffect = EffectVisualEffect(VisualEffect.Vfx_Fnf_Mystical_Explosion); spellId = Spell.Grenade10; soundName = "explosion1"; break; case "ION": impactEffect = EffectVisualEffect(VisualEffect.Vfx_Fnf_Electric_Explosion); spellId = Spell.Grenade10; soundName = "explosion1"; break; case "BACTA": impactEffect = EffectVisualEffect(VisualEffect.Vfx_Fnf_Gas_Explosion_Nature); spellId = Spell.Grenade10; //soundName = "explosion1"; break; case "ADHESIVE": impactEffect = EffectVisualEffect(VisualEffect.Fnf_Dispel_Greater); spellId = Spell.Grenade10; //soundName = "explosion1"; break; case "SMOKE": impactEffect = null; spellId = Spell.Grenade10; //soundName = "explosion1"; break; case "BACTABOMB": impactEffect = null; spellId = Spell.Grenade10; //soundName = "explosion1"; break; case "INCENDIARY": impactEffect = null; spellId = Spell.Grenade10; //soundName = "explosion1"; break; case "GAS": impactEffect = null; spellId = Spell.Grenade10; //soundName = "explosion1"; break; default: throw new ArgumentOutOfRangeException(nameof(grenadeType)); } if (spellId == 0) { // start 974 through 979 in spells.2da for grenades // lets randomly assign a projectile appearance for flavor? spellId = (Spell)(RandomService.D6(1) + 973); } float delay = GetDistanceBetweenLocations(user.Location, targetLocation) / 18.0f + 0.75f; delay += 0.4f; // added for animation user.ClearAllActions(); //user.AssignCommand(() => _.ActionPlayAnimation(32)); //user.DelayAssignCommand(() => _.ActionPlayAnimation(32), 0.0f); user.AssignCommand(() => { ActionPlayAnimation(Animation.LoopingCustom12); ActionCastSpellAtLocation(spellId, targetLocation, MetaMagic.Any, true, ProjectilePathType.Ballistic, true); //ActionCastFakeSpellAtLocation(spellId, targetLocation, PROJECTILE_PATH_TYPE_BALLISTIC); }); if (soundName != null) { user.DelayAssignCommand(() => { PlaySound(soundName); }, delay); } if (impactEffect != null) { user.DelayAssignCommand(() => { ApplyEffectAtLocation(DurationType.Instant, impactEffect, targetLocation); }, delay); } user.DelayAssignCommand( () => { DoImpact(user, item, targetLocation, grenadeType, perkLevel, RadiusSize.Large, ObjectType.Creature); }, delay + 0.75f); perkLevel = PerkService.GetCreaturePerkLevel(user, PerkType.GrenadeProficiency); now = DateTime.UtcNow; DateTime unlockTime = now; if (perkLevel < 5) { unlockTime = unlockTime.AddSeconds(6); } else if (perkLevel < 10) { unlockTime = unlockTime.AddSeconds(3); } else { unlockTime = unlockTime.AddSeconds(2); } SetLocalString(user, "GRENADE_UNLOCKTIME", unlockTime.ToString("yyyy-MM-dd hh:mm:ss", CultureInfo.InvariantCulture)); //Console.WriteLine("StartUseItem - Current Time = " + now.ToString("yyyy-MM-dd hh:mm:ss", CultureInfo.InvariantCulture)); //Console.WriteLine("StartUseItem - Unlocktime Set To = " + unlockTime.ToString("yyyy-MM-dd hh:mm:ss", CultureInfo.InvariantCulture)); if (user.IsCreature) { DurabilityService.RunItemDecay((NWPlayer)user, item, 1.0f); } }
public void OnImpact(NWCreature player, NWObject target, int perkLevel, int spellTier) { NWItem weapon = player.RightHand; int iDamage; int iRange = 15; int iCount = 1; float fDelay = 0; int saberDamage = player.RightHand.DamageBonus; if (saberDamage > 40) { saberDamage = 40; } if (weapon.CustomItemType == CustomItemType.Lightsaber || weapon.CustomItemType == CustomItemType.Saberstaff) { iDamage = saberDamage + RandomService.D6(2) + player.StrengthModifier; } else { iDamage = (int)weapon.Weight + player.StrengthModifier + (saberDamage / 2); } NWObject oObject; // If player is in stealth mode, force them out of stealth mode. if (_.GetActionMode(player.Object, ActionMode.Stealth) == true) { _.SetActionMode(player.Object, ActionMode.Stealth, false); } // Make the player face their target. _.ClearAllActions(); BiowarePosition.TurnToFaceObject(target, player); player.AssignCommand(() => _.ActionPlayAnimation(Animation.LoopingCustom10, 2)); var result = CombatService.CalculateAbilityResistance(player, target.Object, SkillType.ForceAlter, ForceBalanceType.Universal); float delta = 0.01f * result.Delta; /* * // reset phenotype * player.DelayAssignCommand(() => * { * _.SetPhenoType(4, player); * }, 2.0f); * * player.DelayAssignCommand(() => * { * _.SetPhenoType(iPheno, player); * }, 2.5f); */ // Handle effects for differing spellTier values switch (spellTier) { case 1: iDamage = (int)(iDamage * 1.0); iDamage = iDamage + (int)(iDamage * delta); fDelay = _.GetDistanceBetween(player, target) / 10.0f; player.DelayAssignCommand(() => { _.ApplyEffectToObject(DurationType.Instant, _.EffectLinkEffects(_.EffectVisualEffect(VisualEffect.Vfx_Imp_Sonic), _.EffectDamage(iDamage, DamageType.BaseWeapon)), target); }, fDelay); if (player.IsPlayer) { SkillService.RegisterPCToNPCForSkill(player.Object, target, SkillType.ForceAlter); } break; case 2: iDamage = (int)(iDamage * 1.25); iDamage = iDamage + (int)(iDamage * delta); fDelay = _.GetDistanceBetween(player, target) / 10.0f; player.DelayAssignCommand(() => { _.ApplyEffectToObject(DurationType.Instant, _.EffectLinkEffects(_.EffectVisualEffect(VisualEffect.Vfx_Imp_Sonic), _.EffectDamage(iDamage, DamageType.BaseWeapon)), target); }, fDelay); if (player.IsPlayer) { SkillService.RegisterPCToNPCForSkill(player.Object, target, SkillType.ForceAlter); } break; case 3: iDamage = (int)(iDamage * 1.5); iDamage = iDamage + (int)(iDamage * delta); fDelay = _.GetDistanceBetween(player, target) / 10.0f; player.DelayAssignCommand(() => { _.ApplyEffectToObject(DurationType.Instant, _.EffectLinkEffects(_.EffectVisualEffect(VisualEffect.Vfx_Imp_Sonic), _.EffectDamage(iDamage, DamageType.BaseWeapon)), target); }, fDelay); if (player.IsPlayer) { SkillService.RegisterPCToNPCForSkill(player.Object, target, SkillType.ForceAlter); } break; case 4: iDamage = (int)(iDamage * 1.6); iDamage = iDamage + (int)(iDamage * delta); // apply to target fDelay = _.GetDistanceBetween(player, target) / 10.0f; player.DelayAssignCommand(() => { _.ApplyEffectToObject(DurationType.Instant, _.EffectLinkEffects(_.EffectVisualEffect(VisualEffect.Vfx_Imp_Sonic), _.EffectDamage(iDamage, DamageType.BaseWeapon)), target); }, fDelay); if (player.IsPlayer) { SkillService.RegisterPCToNPCForSkill(player.Object, target, SkillType.ForceAlter); } iCount += 1; // apply to next nearest creature in the spellcylinder oObject = _.GetFirstObjectInShape(Shape.SpellCone, iRange, target.Location, true, ObjectType.Creature, _.GetPosition(player)); while (oObject.IsValid && iCount < 3) { if (oObject != target && oObject != player) { fDelay = _.GetDistanceBetween(player, oObject) / 10.0f; var creature = oObject; player.DelayAssignCommand(() => { _.ApplyEffectToObject(DurationType.Instant, _.EffectLinkEffects(_.EffectVisualEffect(VisualEffect.Vfx_Imp_Sonic), _.EffectDamage(iDamage, DamageType.BaseWeapon)), creature); }, fDelay); if (player.IsPlayer) { SkillService.RegisterPCToNPCForSkill(player.Object, oObject, SkillType.ForceAlter); } iCount += 1; } oObject = _.GetNextObjectInShape(Shape.SpellCone, iRange, target.Location, true, ObjectType.Creature, _.GetPosition(player)); } break; case 5: iDamage = (int)(iDamage * 1.75); iDamage = iDamage + (int)(iDamage * delta); // apply to target fDelay = _.GetDistanceBetween(player, target) / 10.0f; player.DelayAssignCommand(() => { _.ApplyEffectToObject(DurationType.Instant, _.EffectLinkEffects(_.EffectVisualEffect(VisualEffect.Vfx_Imp_Sonic), _.EffectDamage(iDamage, DamageType.BaseWeapon)), target); }, fDelay); if (player.IsPlayer) { SkillService.RegisterPCToNPCForSkill(player.Object, target, SkillType.ForceAlter); } iCount += 1; // apply to next nearest creature in the spellcylinder oObject = _.GetFirstObjectInShape(Shape.SpellCylinder, iRange, target.Location, true, ObjectType.Creature, _.GetPosition(player)); while (oObject.IsValid && iCount < 4) { if (oObject != target && oObject != player) { fDelay = _.GetDistanceBetween(player, oObject) / 10.0f; var creature = oObject; player.DelayAssignCommand(() => { _.ApplyEffectToObject(DurationType.Instant, _.EffectLinkEffects(_.EffectVisualEffect(VisualEffect.Vfx_Imp_Sonic), _.EffectDamage(iDamage, DamageType.BaseWeapon)), creature); }, fDelay); if (player.IsPlayer) { SkillService.RegisterPCToNPCForSkill(player.Object, oObject, SkillType.ForceAlter); } iCount += 1; } oObject = _.GetNextObjectInShape(Shape.SpellCylinder, iRange, target.Location, true, ObjectType.Creature, _.GetPosition(player)); } break; default: throw new ArgumentOutOfRangeException(nameof(spellTier)); } }
public void OnImpact(NWCreature player, NWObject target, int perkLevel, int spellTier) { NWItem weapon = player.RightHand; int iDamage; int iRange = 15; int iCount = 1; float fDelay = 0; if (weapon.CustomItemType == CustomItemType.Lightsaber || weapon.CustomItemType == CustomItemType.Saberstaff) { iDamage = player.RightHand.DamageBonus + RandomService.D6(2) + player.IntelligenceModifier + player.StrengthModifier; } else { iDamage = (int)weapon.Weight + player.StrengthModifier; } NWObject oObject; // If player is in stealth mode, force them out of stealth mode. if (_.GetActionMode(player.Object, ACTION_MODE_STEALTH) == 1) { _.SetActionMode(player.Object, ACTION_MODE_STEALTH, 0); } // Make the player face their target. _.ClearAllActions(); BiowarePosition.TurnToFaceObject(target, player); player.AssignCommand(() => _.ActionPlayAnimation(30, 2)); _.SendMessageToPC(player, "Level " + spellTier); // Handle effects for differing spellTier values switch (spellTier) { case 1: iDamage = (int)(iDamage * 1.6); fDelay = _.GetDistanceBetween(player, target) / 10.0f; player.DelayAssignCommand(() => { _.ApplyEffectToObject(_.DURATION_TYPE_INSTANT, _.EffectLinkEffects(_.EffectVisualEffect(VFX_IMP_SONIC), _.EffectDamage(iDamage, _.DAMAGE_TYPE_BASE_WEAPON)), target); }, fDelay); if (player.IsPlayer) { SkillService.RegisterPCToNPCForSkill(player.Object, target, SkillType.ForceAlter); } break; case 2: iDamage = (int)(iDamage * 1.25); fDelay = _.GetDistanceBetween(player, target) / 10.0f; player.DelayAssignCommand(() => { _.ApplyEffectToObject(_.DURATION_TYPE_INSTANT, _.EffectLinkEffects(_.EffectVisualEffect(VFX_IMP_SONIC), _.EffectDamage(iDamage, _.DAMAGE_TYPE_BASE_WEAPON)), target); }, fDelay); if (player.IsPlayer) { SkillService.RegisterPCToNPCForSkill(player.Object, target, SkillType.ForceAlter); } break; case 3: iDamage = (int)(iDamage * 1.6); fDelay = _.GetDistanceBetween(player, target) / 10.0f; player.DelayAssignCommand(() => { _.ApplyEffectToObject(_.DURATION_TYPE_INSTANT, _.EffectLinkEffects(_.EffectVisualEffect(VFX_IMP_SONIC), _.EffectDamage(iDamage, _.DAMAGE_TYPE_BASE_WEAPON)), target); }, fDelay); if (player.IsPlayer) { SkillService.RegisterPCToNPCForSkill(player.Object, target, SkillType.ForceAlter); } break; case 4: iDamage = (int)(iDamage * 2.0); // apply to target fDelay = _.GetDistanceBetween(player, target) / 10.0f; player.DelayAssignCommand(() => { _.ApplyEffectToObject(_.DURATION_TYPE_INSTANT, _.EffectLinkEffects(_.EffectVisualEffect(VFX_IMP_SONIC), _.EffectDamage(iDamage, _.DAMAGE_TYPE_BASE_WEAPON)), target); }, fDelay); if (player.IsPlayer) { SkillService.RegisterPCToNPCForSkill(player.Object, target, SkillType.ForceAlter); } iCount += 1; // apply to next nearest creature in the spellcylinder oObject = _.GetFirstObjectInShape(_.SHAPE_SPELLCONE, iRange, target.Location, 1, _.OBJECT_TYPE_CREATURE, _.GetPosition(player)); while (oObject.IsValid && iCount < 3) { if (oObject != target && oObject != player) { fDelay = _.GetDistanceBetween(player, oObject) / 10.0f; var creature = oObject; player.DelayAssignCommand(() => { _.ApplyEffectToObject(_.DURATION_TYPE_INSTANT, _.EffectLinkEffects(_.EffectVisualEffect(VFX_IMP_SONIC), _.EffectDamage(iDamage, _.DAMAGE_TYPE_BASE_WEAPON)), creature); }, fDelay); if (player.IsPlayer) { SkillService.RegisterPCToNPCForSkill(player.Object, oObject, SkillType.ForceAlter); } iCount += 1; } oObject = _.GetNextObjectInShape(_.SHAPE_SPELLCONE, iRange, target.Location, 1, _.OBJECT_TYPE_CREATURE, _.GetPosition(player)); } break; case 5: iDamage = (int)(iDamage * 2.5); // apply to target fDelay = _.GetDistanceBetween(player, target) / 10.0f; player.DelayAssignCommand(() => { _.ApplyEffectToObject(_.DURATION_TYPE_INSTANT, _.EffectLinkEffects(_.EffectVisualEffect(VFX_IMP_SONIC), _.EffectDamage(iDamage, _.DAMAGE_TYPE_BASE_WEAPON)), target); }, fDelay); if (player.IsPlayer) { SkillService.RegisterPCToNPCForSkill(player.Object, target, SkillType.ForceAlter); } iCount += 1; // apply to next nearest creature in the spellcylinder oObject = _.GetFirstObjectInShape(_.SHAPE_SPELLCYLINDER, iRange, target.Location, 1, _.OBJECT_TYPE_CREATURE, _.GetPosition(player)); while (oObject.IsValid && iCount < 4) { if (oObject != target && oObject != player) { fDelay = _.GetDistanceBetween(player, oObject) / 10.0f; var creature = oObject; player.DelayAssignCommand(() => { _.ApplyEffectToObject(_.DURATION_TYPE_INSTANT, _.EffectLinkEffects(_.EffectVisualEffect(VFX_IMP_SONIC), _.EffectDamage(iDamage, _.DAMAGE_TYPE_BASE_WEAPON)), creature); }, fDelay); if (player.IsPlayer) { SkillService.RegisterPCToNPCForSkill(player.Object, oObject, SkillType.ForceAlter); } iCount += 1; } oObject = _.GetNextObjectInShape(_.SHAPE_SPELLCYLINDER, iRange, target.Location, 1, _.OBJECT_TYPE_CREATURE, _.GetPosition(player)); } break; default: throw new ArgumentOutOfRangeException(nameof(spellTier)); } }