public void OnImpact(NWPlayer player, NWObject target, int perkLevel) { int luck = _perk.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 (_random.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); }
public void OnImpact(NWPlayer player, NWObject target, int perkLevel) { int massLevel = _perk.GetPCPerkLevel(player, PerkType.MassTranquilizer); int tranqLevel = _perk.GetPCPerkLevel(player, PerkType.Tranquilizer); int luck = _perk.GetPCPerkLevel(player, 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 (_random.D100(1) <= luck) { duration *= 2; player.SendMessage("Lucky shot!"); } int current = 1; NWCreature nearest = _.GetNearestCreature(CREATURE_TYPE_IS_ALIVE, TRUE, target, current); while (nearest.IsValid) { if (_.GetDistanceBetween(nearest, target) > range) { break; } if (RemoveExistingEffect(target, duration)) { continue; } nearest.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); current++; nearest = _.GetNearestCreature(CREATURE_TYPE_IS_ALIVE, TRUE, target, current); } }