public void OnImpact(NWCreature creature, NWObject target, int perkLevel, int spellTier) { float percent = 0.0f; switch (spellTier) { case 1: percent = 0.10f; break; case 2: percent = 0.20f; break; case 3: percent = 0.35f; break; case 4: percent = 0.50f; break; } int recovery = (int)(target.CurrentHP * percent); if (recovery < 1) { recovery = 1; } // Damage user. _.ApplyEffectToObject(_.DURATION_TYPE_INSTANT, _.EffectDamage(recovery), creature); // Check lucky chance. int luck = PerkService.GetCreaturePerkLevel(creature, PerkType.Lucky); if (RandomService.D100(1) <= luck) { recovery *= 2; creature.SendMessage("Lucky Force Body!"); } // Recover FP on target. AbilityService.RestorePlayerFP(target.Object, recovery); // Play VFX _.ApplyEffectToObject(_.DURATION_TYPE_INSTANT, _.EffectVisualEffect(_.VFX_IMP_HEAD_ODD), target); // Grant XP, if player. if (creature.IsPlayer) { SkillService.GiveSkillXP(creature.Object, SkillType.ForceControl, recovery * 2); } }
public void OnImpact(NWCreature creature, NWObject target, int perkLevel, int spellTier) { float duration = 0.0f; switch (spellTier) { case 1: duration = 6f; break; case 2: duration = 12f; break; case 3: duration = 18f; break; case 4: duration = 24f; break; } var result = CombatService.CalculateAbilityResistance(creature, target.Object, SkillType.ForceAlter, ForceBalanceType.Universal); // Resisted - Only apply slow for six seconds if (result.IsResisted) { _.ApplyEffectToObject(DurationType.Temporary, _.EffectSlow(), target, 6.0f); } // Not resisted - Apply knockdown for the specified duration else { // Check lucky chance. int luck = PerkService.GetCreaturePerkLevel(creature, PerkType.Lucky); if (RandomService.D100(1) <= luck) { duration *= 2; creature.SendMessage("Lucky Force Push!"); } _.ApplyEffectToObject(DurationType.Temporary, AbilityService.EffectKnockdown(target, 3.0f), target, 3.0f); _.ApplyEffectToObject(DurationType.Temporary, _.EffectSlow(), target, duration); } if (creature.IsPlayer) { SkillService.RegisterPCToAllCombatTargetsForSkill(creature.Object, SkillType.ForceAlter, target.Object); } _.ApplyEffectToObject(DurationType.Instant, _.EffectVisualEffect(VisualEffect.Vfx_Com_Blood_Spark_Small), target); }
public void Main() { NWCreature oTarget = _.GetSpellTargetObject(); if (RandomService.D100(1) > 5) { return; } CustomEffectService.ApplyCustomEffect(NWGameObject.OBJECT_SELF, oTarget, CustomEffectType.Bleeding, 12, 1, null); }
public bool Run(params object[] args) { NWCreature oTarget = _.GetSpellTargetObject(); if (RandomService.D100(1) > 5) { return(false); } CustomEffectService.ApplyCustomEffect(Object.OBJECT_SELF, oTarget, CustomEffectType.Bleeding, 12, 1, null); return(true); }
private void DoDiceRoll(NWPlayer user, int sides, int number) { int value; if (number < 1) { number = 1; } else if (number > 10) { number = 10; } switch (sides) { case 2: value = RandomService.D2(number); break; case 4: value = RandomService.D4(number); break; case 6: value = RandomService.D6(number); break; case 8: value = RandomService.D8(number); break; case 10: value = RandomService.D10(number); break; case 20: value = RandomService.D20(number); break; case 100: value = RandomService.D100(number); break; default: value = 0; break; } string dieRoll = number + "d" + sides; string message = ColorTokenService.SkillCheck("Dice Roll: ") + dieRoll + ": " + value; user.SpeakString(message); }
public void OnImpact(NWCreature creature, NWObject target, int perkLevel, int spellTier) { float duration = 0.0f; switch (spellTier) { case 1: duration = 6f; break; case 2: duration = 12f; break; case 3: duration = 18f; break; case 4: duration = 24f; break; } var result = CombatService.CalculateAbilityResistance(creature, target.Object, SkillType.ForceAlter, ForceBalanceType.Universal); // Resisted - Only apply slow for six seconds if (result.IsResisted) { _.ApplyEffectToObject(_.DURATION_TYPE_TEMPORARY, _.EffectSlow(), target, 6.0f); } // Not resisted - Apply knockdown for the specified duration else { // Check lucky chance. int luck = PerkService.GetCreaturePerkLevel(creature, PerkType.Lucky); if (RandomService.D100(1) <= luck) { duration *= 2; creature.SendMessage("Lucky Force Push!"); } _.ApplyEffectToObject(_.DURATION_TYPE_TEMPORARY, _.EffectKnockdown(), target, duration); } if (creature.IsPlayer) { SkillService.RegisterPCToAllCombatTargetsForSkill(creature.Object, SkillType.ForceAlter, target.Object); } _.ApplyEffectToObject(_.DURATION_TYPE_INSTANT, _.EffectVisualEffect(_.VFX_COM_BLOOD_SPARK_SMALL), target); }
public void OnImpact(NWCreature creature, NWObject target, int perkLevel, int spellTier) { int chance = perkLevel * 25; // Failed to interrupt. if (RandomService.D100(1) > chance) { creature.SendMessage("You fail to interrupt your target's concentration."); return; } NWCreature targetCreature = target.Object; var effect = AbilityService.GetActiveConcentrationEffect(targetCreature); if (effect.Type != PerkType.Unknown) { targetCreature.SendMessage("Your concentration effect has been interrupted by " + creature.Name + "."); AbilityService.EndConcentrationEffect(target.Object); } }
private void HealTarget(NWCreature member, int level, int luck) { int amount; switch (level) { case 1: amount = RandomService.D12(1); break; case 2: amount = RandomService.D8(2); break; case 3: amount = RandomService.D8(3); break; case 4: amount = RandomService.D8(4); break; case 5: amount = RandomService.D8(5); break; case 6: amount = RandomService.D8(6); break; default: return; } if (RandomService.D100(1) <= luck) { amount *= 2; } _.ApplyEffectToObject(DURATION_TYPE_INSTANT, _.EffectHeal(amount), member); _.ApplyEffectToObject(DURATION_TYPE_INSTANT, _.EffectVisualEffect(VFX_IMP_HEALING_S), member); }
private void HealTarget(NWCreature member, int level, int luck) { int amount; switch (level) { case 1: amount = RandomService.D12(1); break; case 2: amount = RandomService.D8(2); break; case 3: amount = RandomService.D8(3); break; case 4: amount = RandomService.D8(4); break; case 5: amount = RandomService.D8(5); break; case 6: amount = RandomService.D8(6); break; default: return; } if (RandomService.D100(1) <= luck) { amount *= 2; } _.ApplyEffectToObject(DurationType.Instant, _.EffectHeal(amount), member); _.ApplyEffectToObject(DurationType.Instant, _.EffectVisualEffect(VisualEffect.Vfx_Imp_Healing_S), member); }
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 creature, NWObject target, int perkLevel, int spellTier) { Effect effect; float duration; switch (spellTier) { case 1: effect = _.EffectMovementSpeedIncrease(10); effect = _.EffectLinkEffects(effect, _.EffectAbilityIncrease(AbilityType.Dexterity, 2)); duration = 60f; break; case 2: effect = _.EffectMovementSpeedIncrease(20); effect = _.EffectLinkEffects(effect, _.EffectAbilityIncrease(AbilityType.Dexterity, 4)); duration = 90f; break; case 3: effect = _.EffectMovementSpeedIncrease(30); effect = _.EffectLinkEffects(effect, _.EffectAbilityIncrease(AbilityType.Dexterity, 6)); effect = _.EffectLinkEffects(effect, _.EffectModifyAttacks(1)); duration = 120f; break; case 4: effect = _.EffectMovementSpeedIncrease(40); effect = _.EffectLinkEffects(effect, _.EffectAbilityIncrease(AbilityType.Dexterity, 8)); effect = _.EffectLinkEffects(effect, _.EffectModifyAttacks(1)); duration = 150f; break; case 5: effect = _.EffectMovementSpeedIncrease(50); effect = _.EffectLinkEffects(effect, _.EffectAbilityIncrease(AbilityType.Dexterity, 10)); effect = _.EffectLinkEffects(effect, _.EffectModifyAttacks(1)); duration = 180f; break; default: throw new ArgumentException(nameof(perkLevel) + " invalid. Value " + perkLevel + " is unhandled."); } // Check lucky chance. int luck = PerkService.GetCreaturePerkLevel(creature, PerkType.Lucky); if (RandomService.D100(1) <= luck) { duration *= 2; creature.SendMessage("Lucky Force Speed!"); } _.ApplyEffectToObject(DurationType.Temporary, effect, target, duration); _.ApplyEffectToObject(DurationType.Instant, _.EffectVisualEffect(VisualEffect.Vfx_Imp_Ac_Bonus), target); if (creature.IsPlayer) { NWPlayer player = creature.Object; int skillLevel = SkillService.GetPCSkillRank(player, SkillType.ForceControl); int xp = skillLevel * 10 + 50; SkillService.GiveSkillXP(player, SkillType.ForceControl, xp); } }
public void OnImpact(NWCreature creature, NWObject target, int perkLevel, int spellTier) { int massLevel = PerkService.GetCreaturePerkLevel(creature, PerkType.MassTranquilizer); int tranqLevel = PerkService.GetCreaturePerkLevel(creature, PerkType.Tranquilizer); int luck = PerkService.GetCreaturePerkLevel(creature, PerkType.Lucky); float duration; float range = 5 * massLevel; switch (tranqLevel) { case 0: duration = 6; break; case 1: duration = 12; break; case 2: duration = 24; break; case 3: duration = 36; break; case 4: duration = 48; break; case 5: duration = 60; break; case 6: duration = 72; break; case 7: duration = 84; break; case 8: duration = 96; break; case 9: duration = 108; break; case 10: duration = 120; break; default: return; } if (RandomService.D100(1) <= luck) { duration *= 2; creature.SendMessage("Lucky shot!"); } // Check if Mind Shield is on target. var concentrationEffect = AbilityService.GetActiveConcentrationEffect(target.Object); if (concentrationEffect.Type == PerkType.MindShield) { creature.SendMessage("Your target is immune to tranquilization effects."); } else { // Apply to the target. if (!RemoveExistingEffect(target, duration)) { target.SetLocalInt("TRANQUILIZER_EFFECT_FIRST_RUN", 1); Effect effect = _.EffectDazed(); effect = _.EffectLinkEffects(effect, _.EffectVisualEffect(VFX_DUR_IOUNSTONE_BLUE)); effect = _.TagEffect(effect, "TRANQUILIZER_EFFECT"); _.ApplyEffectToObject(DURATION_TYPE_TEMPORARY, effect, target, duration); } } // Iterate over all nearby hostiles. Apply the effect to them if they meet the criteria. int current = 1; NWCreature nearest = _.GetNearestCreature(CREATURE_TYPE_IS_ALIVE, TRUE, target, current); while (nearest.IsValid) { float distance = _.GetDistanceBetween(nearest, target); // Check distance. Exit loop if we're too far. if (distance > range) { break; } concentrationEffect = AbilityService.GetActiveConcentrationEffect(nearest); // If this creature isn't hostile to the attacking player or if this creature is already tranquilized, move to the next one. if (_.GetIsReactionTypeHostile(nearest, creature) == FALSE || nearest.Object == target.Object || RemoveExistingEffect(nearest, duration) || concentrationEffect.Type == PerkType.MindShield) { current++; nearest = _.GetNearestCreature(CREATURE_TYPE_IS_ALIVE, TRUE, target, current); continue; } target.SetLocalInt("TRANQUILIZER_EFFECT_FIRST_RUN", 1); Effect effect = _.EffectDazed(); effect = _.EffectLinkEffects(effect, _.EffectVisualEffect(VFX_DUR_IOUNSTONE_BLUE)); effect = _.TagEffect(effect, "TRANQUILIZER_EFFECT"); _.ApplyEffectToObject(DURATION_TYPE_TEMPORARY, effect, nearest, duration); current++; nearest = _.GetNearestCreature(CREATURE_TYPE_IS_ALIVE, TRUE, target, current); } }
public void OnImpact(NWCreature creature, NWObject target, int perkLevel, int spellTier) { Effect effect; float duration; switch (spellTier) { case 1: effect = _.EffectMovementSpeedIncrease(10); effect = _.EffectLinkEffects(effect, _.EffectAbilityIncrease(_.ABILITY_DEXTERITY, 2)); duration = 60f; break; case 2: effect = _.EffectMovementSpeedIncrease(20); effect = _.EffectLinkEffects(effect, _.EffectAbilityIncrease(_.ABILITY_DEXTERITY, 4)); duration = 90f; break; case 3: effect = _.EffectMovementSpeedIncrease(30); effect = _.EffectLinkEffects(effect, _.EffectAbilityIncrease(_.ABILITY_DEXTERITY, 6)); effect = _.EffectLinkEffects(effect, _.EffectModifyAttacks(1)); duration = 120f; break; case 4: effect = _.EffectMovementSpeedIncrease(40); effect = _.EffectLinkEffects(effect, _.EffectAbilityIncrease(_.ABILITY_DEXTERITY, 8)); effect = _.EffectLinkEffects(effect, _.EffectModifyAttacks(1)); duration = 150f; break; case 5: effect = _.EffectMovementSpeedIncrease(50); effect = _.EffectLinkEffects(effect, _.EffectAbilityIncrease(_.ABILITY_DEXTERITY, 10)); effect = _.EffectLinkEffects(effect, _.EffectModifyAttacks(1)); duration = 180f; break; default: throw new ArgumentException(nameof(perkLevel) + " invalid. Value " + perkLevel + " is unhandled."); } // Check lucky chance. int luck = PerkService.GetCreaturePerkLevel(creature, PerkType.Lucky); if (RandomService.D100(1) <= luck) { duration *= 2; creature.SendMessage("Lucky Force Speed!"); } _.ApplyEffectToObject(_.DURATION_TYPE_TEMPORARY, effect, target, duration); _.ApplyEffectToObject(_.DURATION_TYPE_INSTANT, _.EffectVisualEffect(_.VFX_IMP_AC_BONUS), target); if (creature.IsPlayer) { NWPlayer player = creature.Object; int skillLevel = SkillService.GetPCSkillRank(player, SkillType.ForceControl); int xp = skillLevel * 10 + 10; SkillService.GiveSkillXP(player, SkillType.ForceControl, xp); } }
private void OnCompleteSmelt(OnCompleteSmelt data) { NWPlayer player = data.Player; string oreResref = data.OreResref; List <ItemProperty> itemProperties = data.ItemProperties; player.IsBusy = false; int rank = SkillService.GetPCSkillRank(player, SkillType.Harvesting); int level = CraftService.GetIngotLevel(oreResref); string ingotResref = CraftService.GetIngotResref(oreResref); if (level < 0 || string.IsNullOrWhiteSpace(ingotResref)) { return; } int delta = rank - level; int count = 2; if (delta > 2) { count = delta; } if (count > 4) { count = 4; } if (RandomService.Random(100) + 1 <= PerkService.GetCreaturePerkLevel(player, PerkType.Lucky)) { count++; } if (RandomService.Random(100) + 1 <= PerkService.GetCreaturePerkLevel(player, PerkType.ProcessingEfficiency) * 10) { count++; } for (int x = 1; x <= count; x++) { var item = (_.CreateItemOnObject(ingotResref, player.Object)); int chance; switch (x) { case 1: case 2: chance = 100; break; case 3: chance = 70; break; case 4: chance = 60; break; case 5: chance = 50; break; default: chance = 30; break; } foreach (var ip in itemProperties) { if (RandomService.D100(1) <= chance) { BiowareXP2.IPSafeAddItemProperty(item, ip, 0.0f, AddItemPropertyPolicy.IgnoreExisting, true, true); } } } var effectiveStats = PlayerStatService.GetPlayerItemEffectiveStats(player); int harvestingSkill = SkillService.GetPCSkillRank(player, SkillType.Harvesting); int perkBonus = PerkService.GetCreaturePerkLevel(player, PerkType.StronidiumRefining) + 1; int stronidiumAmount = 10 + effectiveStats.Harvesting + harvestingSkill + RandomService.Random(1, 5); stronidiumAmount *= perkBonus; _.CreateItemOnObject("stronidium", player.Object, stronidiumAmount); int xp = (int)SkillService.CalculateRegisteredSkillLevelAdjustedXP(100, level, rank); SkillService.GiveSkillXP(player, SkillType.Harvesting, xp); }
public void OnImpact(NWCreature creature, NWObject target, int perkLevel, int spellTier) { var concentrationEffect = AbilityService.GetActiveConcentrationEffect(target.Object); if (concentrationEffect.Type == PerkType.MindShield) { creature.SendMessage("Your target is immune to tranquilization effects."); return; } int luck = PerkService.GetCreaturePerkLevel(creature, PerkType.Lucky); float duration; switch (perkLevel) { case 1: duration = 12; break; case 2: duration = 24; break; case 3: duration = 36; break; case 4: duration = 48; break; case 5: duration = 60; break; case 6: duration = 72; break; case 7: duration = 84; break; case 8: duration = 96; break; case 9: duration = 108; break; case 10: duration = 120; break; default: return; } if (RandomService.D100(1) <= luck) { duration *= 2; creature.SendMessage("Lucky shot!"); } if (RemoveExistingEffect(target, duration)) { creature.SendMessage("A more powerful effect already exists on your target."); return; } target.SetLocalInt("TRANQUILIZER_EFFECT_FIRST_RUN", 1); Effect effect = _.EffectDazed(); effect = _.EffectLinkEffects(effect, _.EffectVisualEffect(VFX_DUR_IOUNSTONE_BLUE)); effect = _.TagEffect(effect, "TRANQUILIZER_EFFECT"); _.ApplyEffectToObject(DURATION_TYPE_TEMPORARY, effect, target, duration); }
public void OnImpact(NWPlayer player, NWObject target, int perkLevel, int spellFeatID) { int luck = PerkService.GetPCPerkLevel(player, PerkType.Lucky); float duration; switch (perkLevel) { case 1: duration = 12; break; case 2: duration = 24; break; case 3: duration = 36; break; case 4: duration = 48; break; case 5: duration = 60; break; case 6: duration = 72; break; case 7: duration = 84; break; case 8: duration = 96; break; case 9: duration = 108; break; case 10: duration = 120; break; default: return; } if (RandomService.D100(1) <= luck) { duration *= 2; player.SendMessage("Lucky shot!"); } if (RemoveExistingEffect(target, duration)) { player.SendMessage("A more powerful effect already exists on your target."); return; } target.SetLocalInt("TRANQUILIZER_EFFECT_FIRST_RUN", 1); Effect effect = _.EffectDazed(); effect = _.EffectLinkEffects(effect, _.EffectVisualEffect(VFX_DUR_IOUNSTONE_BLUE)); effect = _.TagEffect(effect, "TRANQUILIZER_EFFECT"); _.ApplyEffectToObject(DURATION_TYPE_TEMPORARY, effect, target, duration); }