private int CalculateAmount(NWPlayer player) { var effectiveStats = PlayerStatService.GetPlayerItemEffectiveStats(player); int perkLevel = PerkService.GetPCPerkLevel(player, PerkType.Meditate); int amount; switch (perkLevel) { default: amount = 2; break; case 4: case 5: case 6: amount = 3; break; case 7: amount = 4; break; } amount += effectiveStats.Meditate; return(amount); }
public string IsValidTarget(NWCreature user, NWItem item, NWObject target, Location targetLocation) { if (!target.IsCreature || target.IsDM) { return("Only creatures may be targeted with this item."); } if (target.CurrentHP > -11) { return("Your target is not dead."); } if (user.IsInCombat) { return("You are in combat."); } int perkLevel = PerkService.GetPCPerkLevel(user.Object, PerkType.ResuscitationDevices); int requiredLevel = item.GetLocalInt("RANK"); if (perkLevel < requiredLevel) { return("You must have the Resuscitation Devices perk at level " + requiredLevel + " to use this item."); } return(null); }
public string IsValidTarget(NWCreature user, NWItem item, NWObject target, Location targetLocation) { NWArea area = user.Area; if (area.GetLocalInt("BUILDING_TYPE") != (int)Enumeration.BuildingType.Starship) { return("This repair kit may only be used inside a starship"); } string structureID = area.GetLocalString("PC_BASE_STRUCTURE_ID"); PCBaseStructure pcbs = DataService.Single <PCBaseStructure>(x => x.ID.ToString() == structureID); BaseStructure structure = DataService.Get <BaseStructure>(pcbs.BaseStructureID); if (structure.Durability == pcbs.Durability) { return("This starship is already fully repaired."); } bool canRepair = (PerkService.GetPCPerkLevel(new NWPlayer(user), PerkType.CombatRepair) >= 1); PCBase pcBase = DataService.Get <PCBase>(pcbs.PCBaseID); if (!canRepair && SpaceService.IsLocationSpace(pcBase.ShipLocation)) { return("You need the Combat Repair perk to repair ships in space."); } return(""); }
public float Seconds(NWCreature user, NWItem item, NWObject target, Location targetLocation, CustomData customData) { NWPlayer userPlayer = (user.Object); NWItem targetItem = (target.Object); float perkBonus = 0.0f; if (ArmorBaseItemTypes.Contains(targetItem.BaseItemType)) { perkBonus = PerkService.GetPCPerkLevel(userPlayer, PerkType.SpeedyArmorsmith) * 0.1f; } else if (WeaponsmithBaseItemTypes.Contains(targetItem.BaseItemType)) { perkBonus = PerkService.GetPCPerkLevel(userPlayer, PerkType.SpeedyWeaponsmith) * 0.1f; } else if (EngineeringBaseItemTypes.Contains(targetItem.BaseItemType)) { perkBonus = PerkService.GetPCPerkLevel(userPlayer, PerkType.SpeedyEngineering) * 0.1f; } float seconds = 18.0f - (18.0f * perkBonus); if (seconds <= 0.1f) { seconds = 0.1f; } return(seconds); }
private void ApplyFeatChanges(NWPlayer oPC, NWItem oItem) { NWItem equipped = oItem ?? oPC.RightHand; if (Equals(equipped, oItem) || equipped.CustomItemType != CustomItemType.Baton) { NWNXCreature.RemoveFeat(oPC, FEAT_POWER_ATTACK); NWNXCreature.RemoveFeat(oPC, FEAT_IMPROVED_POWER_ATTACK); if (_.GetActionMode(oPC, ACTION_MODE_POWER_ATTACK) == TRUE) { _.SetActionMode(oPC, ACTION_MODE_POWER_ATTACK, FALSE); } if (_.GetActionMode(oPC, ACTION_MODE_IMPROVED_POWER_ATTACK) == TRUE) { _.SetActionMode(oPC, ACTION_MODE_IMPROVED_POWER_ATTACK, FALSE); } return; } int perkLevel = PerkService.GetPCPerkLevel(oPC, PerkType.BluntPowerAttack); NWNXCreature.AddFeat(oPC, FEAT_POWER_ATTACK); if (perkLevel >= 2) { NWNXCreature.AddFeat(oPC, FEAT_IMPROVED_POWER_ATTACK); } }
public float Seconds(NWCreature user, NWItem item, NWObject target, Location targetLocation, CustomData customData) { if (PerkService.GetPCPerkLevel(new NWPlayer(user), PerkType.CombatRepair) >= 2) { return(6.0f); } return(12.0f); }
private bool CheckValidity(NWPlaceable forge, NWPlayer pc, NWItem item) { if (pc.IsBusy) { ReturnItemToPC(pc, item, "You are too busy."); return(false); } if (_.GetIsObjectValid(forge.GetLocalObject("FORGE_USER")) == _.TRUE) { ReturnItemToPC(pc, item, "This forge is currently in use. Please wait..."); return(false); } string[] allowed = { "power_core", "raw_veldite", "raw_scordspar", "raw_plagionite", "raw_keromber", "raw_jasioclase", "raw_hemorgite", "raw_ochne", "raw_croknor", "raw_arkoxit", "raw_bisteiss" }; if (!allowed.Contains(item.Resref)) { ReturnItemToPC(pc, item, "Only power cores and raw materials may be placed inside."); return(false); } int level = CraftService.GetIngotLevel(item.Resref); int rank = SkillService.GetPCSkillRank(pc, SkillType.Harvesting); int delta = rank - level; if (delta <= -4) { ReturnItemToPC(pc, item, "You do not have enough skill to refine this material."); return(false); } int pcPerkLevel = PerkService.GetPCPerkLevel(pc, PerkType.Refining); int orePerkLevel = CraftService.GetIngotPerkLevel(item.Resref); if (pcPerkLevel < orePerkLevel) { ReturnItemToPC(pc, item, "You do not have the perk necessary to refine this material."); return(false); } return(true); }
public void ApplyEffects(NWCreature user, NWItem item, NWObject target, Location targetLocation, CustomData customData) { NWPlayer player = (user.Object); var effectiveStats = PlayerStatService.GetPlayerItemEffectiveStats(player); target.RemoveEffect(EFFECT_TYPE_REGENERATE); int rank = SkillService.GetPCSkillRank(player, SkillType.Medicine); int luck = PerkService.GetPCPerkLevel(player, PerkType.Lucky); int perkDurationBonus = PerkService.GetPCPerkLevel(player, PerkType.HealingKitExpert) * 6 + (luck * 2); float duration = 30.0f + (rank * 0.4f) + perkDurationBonus; int restoreAmount = 1 + item.GetLocalInt("HEALING_BONUS") + effectiveStats.Medicine + item.MedicineBonus; int delta = item.RecommendedLevel - rank; float effectivenessPercent = 1.0f; if (delta > 0) { effectivenessPercent = effectivenessPercent - (delta * 0.1f); } restoreAmount = (int)(restoreAmount * effectivenessPercent); int perkBlastBonus = PerkService.GetPCPerkLevel(player, PerkType.ImmediateImprovement); if (perkBlastBonus > 0) { int blastHeal = restoreAmount * perkBlastBonus; if (RandomService.Random(100) + 1 <= luck / 2) { blastHeal *= 2; } _.ApplyEffectToObject(DURATION_TYPE_INSTANT, _.EffectHeal(blastHeal), target.Object); } float interval = 6.0f; BackgroundType background = (BackgroundType)player.Class1; if (background == BackgroundType.Medic) { interval *= 0.5f; } _.PlaySound("use_bacta"); Effect regeneration = _.EffectRegenerate(restoreAmount, interval); _.ApplyEffectToObject(DURATION_TYPE_TEMPORARY, regeneration, target.Object, duration); player.SendMessage("You successfully treat " + target.Name + "'s wounds. The healing kit will expire in " + duration + " seconds."); _.DelayCommand(duration + 0.5f, () => { player.SendMessage("The healing kit that you applied to " + target.Name + " has expired."); }); if (target.IsPlayer) { int xp = (int)SkillService.CalculateRegisteredSkillLevelAdjustedXP(300, item.RecommendedLevel, rank); SkillService.GiveSkillXP(player, SkillType.Medicine, xp); } }
public float Seconds(NWCreature user, NWItem item, NWObject target, Location targetLocation, CustomData customData) { if (RandomService.Random(100) + 1 <= PerkService.GetPCPerkLevel((NWPlayer)user, PerkType.SpeedyFirstAid) * 10) { return(0.1f); } int rank = SkillService.GetPCSkillRank((NWPlayer)user, SkillType.Medicine); return(12.0f - (rank * 0.1f)); }
public float Seconds(NWCreature user, NWItem item, NWObject target, Location targetLocation, CustomData customData) { const float BaseScanningTime = 16.0f; float scanningTime = BaseScanningTime; if (user.IsPlayer) { var player = (user.Object); scanningTime = BaseScanningTime - BaseScanningTime * (PerkService.GetPCPerkLevel(player, PerkType.SpeedyResourceScanner) * 0.1f); } return(scanningTime); }
public void OnImpact(NWPlayer player, NWObject target, int perkLevel, int spellFeatID) { var effectiveStats = PlayerStatService.GetPlayerItemEffectiveStats(player); float length; int ab; int chance; switch (perkLevel) { case 1: length = 12.0f; ab = 1; chance = 10; break; case 2: length = 12.0f; ab = 1; chance = 20; break; case 3: length = 12.0f; ab = 2; chance = 20; break; case 4: length = 12.0f; ab = 2; chance = 30; break; case 5: length = 12.0f; ab = 3; chance = 30; break; default: return; } int luck = PerkService.GetPCPerkLevel(player, PerkType.Lucky) + effectiveStats.Luck; chance += luck; if (RandomService.Random(100) + 1 <= chance) { _.ApplyEffectToObject(_.DURATION_TYPE_TEMPORARY, _.EffectAttackIncrease(ab), player.Object, length); player.SendMessage(ColorTokenService.Combat("You perform a defensive maneuver.")); } }
public void ApplyEffects(NWCreature user, NWItem item, NWObject target, Location targetLocation, CustomData customData) { NWPlayer player = (user.Object); var effectiveStats = PlayerStatService.GetPlayerItemEffectiveStats(player); int rank = SkillService.GetPCSkillRank(player, SkillType.Medicine); int luck = PerkService.GetPCPerkLevel(player, PerkType.Lucky); int perkDurationBonus = PerkService.GetPCPerkLevel(player, PerkType.HealingKitExpert) * 6 + (luck * 2); float duration = 30.0f + (rank * 0.4f) + perkDurationBonus; int restoreAmount = 1 + item.GetLocalInt("HEALING_BONUS") + effectiveStats.Medicine + item.MedicineBonus; int delta = item.RecommendedLevel - rank; float effectivenessPercent = 1.0f; if (delta > 0) { effectivenessPercent = effectivenessPercent - (delta * 0.1f); } restoreAmount = (int)(restoreAmount * effectivenessPercent); int perkBlastBonus = PerkService.GetPCPerkLevel(player, PerkType.ImmediateForcePack); if (perkBlastBonus > 0) { int blastHeal = restoreAmount * perkBlastBonus; if (RandomService.Random(100) + 1 <= luck / 2) { blastHeal *= 2; } AbilityService.RestoreFP(target.Object, blastHeal); } float interval = 6.0f; BackgroundType background = (BackgroundType)player.Class1; if (background == BackgroundType.Medic) { interval *= 0.5f; } string data = (int)interval + ", " + restoreAmount; CustomEffectService.ApplyCustomEffect(user, target.Object, CustomEffectType.ForcePack, (int)duration, restoreAmount, data); player.SendMessage("You successfully apply a force pack to " + target.Name + ". The force pack will expire in " + duration + " seconds."); _.DelayCommand(duration + 0.5f, () => { player.SendMessage("The force pack that you applied to " + target.Name + " has expired."); }); int xp = (int)SkillService.CalculateRegisteredSkillLevelAdjustedXP(300, item.RecommendedLevel, rank); SkillService.GiveSkillXP(player, SkillType.Medicine, xp); }
public bool ReducesItemCharge(NWCreature user, NWItem item, NWObject target, Location targetLocation, CustomData customData) { int consumeChance = PerkService.GetPCPerkLevel((NWPlayer)user, PerkType.FrugalMedic) * 10; BackgroundType background = (BackgroundType)user.Class1; if (background == BackgroundType.Medic) { consumeChance += 5; } return(RandomService.Random(100) + 1 > consumeChance); }
public float Seconds(NWCreature user, NWItem item, NWObject target, Location targetLocation, CustomData customData) { NWPlayer player = (user.Object); var effectiveStats = PlayerStatService.GetPlayerItemEffectiveStats(player); if (RandomService.Random(100) + 1 <= PerkService.GetPCPerkLevel(player, PerkType.SpeedyFirstAid) * 10) { return(0.1f); } int rank = SkillService.GetPCSkillRank(player, SkillType.Medicine); return(12.0f - (rank + effectiveStats.Medicine / 2) * 0.1f); }
public void OnImpact(NWPlayer player, NWObject target, int perkLevel, int spellFeatID) { // Mark the player as performing a recovery blast. // This is later picked up in the OnApplyDamage event to reduce all damage to 0. player.SetLocalInt("RECOVERY_BLAST_ACTIVE", 1); var members = player.PartyMembers.Where(x => _.GetDistanceBetween(x, target) <= 10.0f); int luck = PerkService.GetPCPerkLevel(player, PerkType.Lucky); foreach (var member in members) { HealTarget(member, perkLevel, luck); } }
public float CooldownTime(NWPlayer oPC, float baseCooldownTime, int spellFeatID) { int perkRank = PerkService.GetPCPerkLevel(oPC, PerkType.SneakAttack); float cooldown = baseCooldownTime; if (perkRank == 2) { cooldown -= 30f; } else if (perkRank > 2) { cooldown -= 60f; } return(cooldown); }
public float Seconds(NWCreature user, NWItem item, NWObject target, Location targetLocation, CustomData customData) { if (RandomService.Random(100) + 1 <= PerkService.GetPCPerkLevel(user.Object, PerkType.SpeedyFirstAid) * 10) { return(0.1f); } int rank = SkillService.GetPCSkillRank(user.Object, SkillType.Medicine); float seconds = 6.0f - (rank * 0.2f); if (seconds < 1.0f) { seconds = 1.0f; } return(seconds); }
public void OnImpact(NWPlayer player, NWObject target, int perkLevel, int spellFeatID) { var effectiveStats = PlayerStatService.GetPlayerItemEffectiveStats(player); int chance; int amount; switch (perkLevel) { case 1: chance = 50; amount = 1; break; case 2: chance = 50; amount = 2; break; case 3: chance = 50; amount = 3; break; case 4: chance = 75; amount = 3; break; case 5: chance = 75; amount = 4; break; default: return; } int luck = PerkService.GetPCPerkLevel(player, PerkType.Lucky) + effectiveStats.Luck; chance += luck; if (RandomService.Random(100) + 1 <= chance) { Effect heal = _.EffectHeal(amount); _.ApplyEffectToObject(_.DURATION_TYPE_INSTANT, heal, player.Object); } }
private void StartSmelt(NWPlaceable forge, NWPlayer pc, NWItem item) { int charges = forge.GetLocalInt("FORGE_CHARGES"); if (item.Resref == "power_core") { item.Destroy(); charges += 10 + CalculatePerkCoalBonusCharges(pc) + GetPowerCoreDurability(item) * 2; forge.SetLocalInt("FORGE_CHARGES", charges); NWPlaceable flames = (forge.GetLocalObject("FORGE_FLAMES")); if (!flames.IsValid) { Vector flamePosition = BiowarePosition.GetChangedPosition(forge.Position, 0.36f, forge.Facing); Location flameLocation = _.Location(forge.Area.Object, flamePosition, 0.0f); flames = (_.CreateObject(_.OBJECT_TYPE_PLACEABLE, "forge_flame", flameLocation)); forge.SetLocalObject("FORGE_FLAMES", flames.Object); } return; } else if (charges <= 0) { ReturnItemToPC(pc, item, "You must power the refinery with a power unit before refining."); return; } // Ready to smelt float baseCraftDelay = 18.0f - (18.0f * PerkService.GetPCPerkLevel(pc, PerkType.SpeedyRefining) * 0.1f); pc.IsBusy = true; NWNXPlayer.StartGuiTimingBar(pc, baseCraftDelay, string.Empty); // Any component bonuses on the ore get applied to the end product. var itemProperties = item.ItemProperties.Where(x => _.GetItemPropertyType(x) == (int)CustomItemPropertyType.ComponentBonus || _.GetItemPropertyType(x) == (int)CustomItemPropertyType.RecommendedLevel).ToList(); string itemResref = item.Resref; pc.DelayEvent <CompleteSmelt>(baseCraftDelay, pc, itemResref, itemProperties); _.ApplyEffectToObject(_.DURATION_TYPE_TEMPORARY, _.EffectCutsceneImmobilize(), pc.Object, baseCraftDelay); pc.AssignCommand(() => _.ActionPlayAnimation(_.ANIMATION_LOOPING_GET_MID, 1.0f, baseCraftDelay)); item.Destroy(); }
private void ApplyFeatChanges(NWPlayer oPC, NWItem oItem) { NWItem mainEquipped = oItem ?? oPC.RightHand; NWItem offEquipped = oItem ?? oPC.LeftHand; // oItem was unequipped. if (Equals(mainEquipped, oItem) || Equals(offEquipped, oItem)) { RemoveFeats(oPC); return; } // Main or offhand was invalid (i.e not equipped) if (!mainEquipped.IsValid || !offEquipped.IsValid) { RemoveFeats(oPC); return; } // Main or offhand is not acceptable item type. if (mainEquipped.CustomItemType != CustomItemType.Vibroblade && mainEquipped.CustomItemType != CustomItemType.Baton && mainEquipped.CustomItemType != CustomItemType.FinesseVibroblade || offEquipped.CustomItemType != CustomItemType.Vibroblade && offEquipped.CustomItemType != CustomItemType.Baton && offEquipped.CustomItemType != CustomItemType.FinesseVibroblade) { RemoveFeats(oPC); return; } int perkLevel = PerkService.GetPCPerkLevel(oPC, PerkType.OneHandedDualWielding); NWNXCreature.AddFeat(oPC, FEAT_TWO_WEAPON_FIGHTING); if (perkLevel >= 2) { NWNXCreature.AddFeat(oPC, FEAT_AMBIDEXTERITY); } if (perkLevel >= 3) { NWNXCreature.AddFeat(oPC, FEAT_IMPROVED_TWO_WEAPON_FIGHTING); } }
public float CooldownTime(NWPlayer oPC, float baseCooldownTime, int spellFeatID) { int perkRank = PerkService.GetPCPerkLevel(oPC, PerkType.Provoke); if (perkRank == 2) { baseCooldownTime -= 5.0f; } else if (perkRank == 3) { baseCooldownTime -= 10.0f; } else if (perkRank == 4) { baseCooldownTime -= 15.0f; } return(baseCooldownTime); }
public float CooldownTime(NWPlayer oPC, float baseCooldownTime, int spellFeatID) { int perkLevel = PerkService.GetPCPerkLevel(oPC, PerkType.Rest); switch (perkLevel) { case 1: return 300.0f; case 2: return 270.0f; case 3: case 4: return 240.0f; case 5: return 210.0f; case 6: case 7: return 180.0f; default: return 300.0f; } }
private int CalculatePerkCoalBonusCharges(NWPlayer pc) { int perkLevel = PerkService.GetPCPerkLevel(pc, PerkType.RefineryManagement); switch (perkLevel) { case 1: return(2); case 2: return(3); case 3: return(4); case 4: return(5); case 5: return(8); case 6: return(10); default: return(0); } }
public bool Run(params object[] args) { NWPlayer oPC = (_.GetLastDisturbed()); if (!oPC.IsPlayer) { return(false); } NWItem oItem = (_.GetInventoryDisturbItem()); NWPlaceable point = (Object.OBJECT_SELF); int disturbType = _.GetInventoryDisturbType(); if (disturbType == _.INVENTORY_DISTURB_TYPE_ADDED) { ItemService.ReturnItem(oPC, oItem); } else { if (!point.InventoryItems.Any() && point.GetLocalInt("SCAVENGE_POINT_FULLY_HARVESTED") == 1) { string seed = point.GetLocalString("SCAVENGE_POINT_SEED"); if (!string.IsNullOrWhiteSpace(seed)) { _.CreateObject(_.OBJECT_TYPE_ITEM, seed, point.Location); int perkLevel = PerkService.GetPCPerkLevel(oPC, PerkType.SeedPicker); if (RandomService.Random(100) + 1 <= perkLevel * 10) { _.CreateObject(_.OBJECT_TYPE_ITEM, seed, point.Location); } } point.Destroy(); FarmingService.RemoveGrowingPlant(point); } } return(true); }
public void ApplyEffects(NWCreature user, NWItem item, NWObject target, Location targetLocation, CustomData customData) { if (target.ObjectType != _.OBJECT_TYPE_CREATURE) { user.SendMessage("You may only use stim packs on creatures!"); return; } NWPlayer player = user.Object; int ability = item.GetLocalInt("ABILITY_TYPE"); int amount = item.GetLocalInt("AMOUNT") + item.MedicineBonus; int rank = player.IsPlayer ? SkillService.GetPCSkillRank(player, SkillType.Medicine) : 0; int recommendedLevel = item.RecommendedLevel; float duration = 30.0f; int perkLevel = player.IsPlayer ? PerkService.GetPCPerkLevel(player, PerkType.StimFiend) : 0; float percentIncrease = perkLevel * 0.25f; duration = duration + (duration * percentIncrease); Effect effect = _.EffectAbilityIncrease(ability, amount); effect = _.TagEffect(effect, "STIM_PACK_EFFECT"); _.ApplyEffectToObject(_.DURATION_TYPE_TEMPORARY, effect, target, duration); user.SendMessage("You inject " + target.Name + " with a stim pack. The stim pack will expire in " + duration + " seconds."); _.DelayCommand(duration + 0.5f, () => { player.SendMessage("The stim pack that you applied to " + target.Name + " has expired."); }); if (!Equals(user, target)) { NWCreature targetCreature = target.Object; targetCreature.SendMessage(user.Name + " injects you with a stim pack."); } int xp = (int)SkillService.CalculateRegisteredSkillLevelAdjustedXP(300, item.RecommendedLevel, rank); SkillService.GiveSkillXP(player, SkillType.Medicine, xp); }
private void ApplyFeatChanges(NWPlayer oPC, NWItem unequippedItem) { NWItem equipped = unequippedItem ?? oPC.RightHand; if (Equals(equipped, unequippedItem) || equipped.CustomItemType != CustomItemType.Saberstaff) { RemoveFeats(oPC); return; } int perkLevel = PerkService.GetPCPerkLevel(oPC, PerkType.SaberstaffMastery); NWNXCreature.AddFeat(oPC, FEAT_TWO_WEAPON_FIGHTING); if (perkLevel >= 2) { NWNXCreature.AddFeat(oPC, FEAT_AMBIDEXTERITY); } if (perkLevel >= 3) { NWNXCreature.AddFeat(oPC, FEAT_IMPROVED_TWO_WEAPON_FIGHTING); } }
public float CooldownTime(NWPlayer oPC, float baseCooldownTime, int spellFeatID) { int perkLevel = PerkService.GetPCPerkLevel(oPC, PerkType.Meditate); switch (perkLevel) { case 1: return(300.0f); case 2: return(270.0f); case 3: case 4: return(240.0f); case 5: return(210.0f); case 6: case 7: return(180.0f); default: return(300.0f); } }
private int ProcessProperty(int amount, int maxBonuses, ComponentBonusType bonus, float levelsPerBonus = 1.0f) { string resref = _componentType.ReassembledResref; int penalty = 0; int luck = PerkService.GetPCPerkLevel(_player, PerkType.Lucky) + (_playerItemStats.Luck / 3); int xp = 0; ItemPropertyUnpacked bonusIP = new ItemPropertyUnpacked { Property = (int)CustomItemPropertyType.ComponentBonus, SubType = (int)bonus, CostTable = 62, CostTableValue = 0, Param1 = 255, Param1Value = 0, UsesPerDay = 255, ChanceToAppear = 100, IsUseable = true, SpellID = -1 }; while (amount > 0) { int chanceToTransfer = CraftService.CalculateReassemblyChance(_player, penalty); // Roll to see if the item can be created. bool success = RandomService.Random(0, 100) <= chanceToTransfer; // Do a lucky roll if we failed the first time. if (!success && luck > 0 && RandomService.Random(0, 100) <= luck) { _player.SendMessage("Lucky reassemble!"); success = true; } if (amount >= maxBonuses) { if (success) { int levelIncrease = (int)(maxBonuses * levelsPerBonus); // Roll succeeded. Create item. bonusIP.CostTableValue = maxBonuses; ItemProperty bonusIPPacked = NWNXItemProperty.PackIP(bonusIP); NWItem item = _.CreateItemOnObject(resref, _player); item.RecommendedLevel = levelIncrease; BiowareXP2.IPSafeAddItemProperty(item, bonusIPPacked, 0.0f, AddItemPropertyPolicy.ReplaceExisting, true, false); xp += (150 * maxBonuses + RandomService.Random(0, 5)); } else { _player.SendMessage(ColorTokenService.Red("You failed to create a component. (+" + maxBonuses + ")")); xp += (50 + RandomService.Random(0, 5)); } // Penalty to chance increases regardless if item was created or not. penalty += (maxBonuses * 5); amount -= maxBonuses; } else { if (success) { int levelIncrease = (int)(amount * levelsPerBonus); bonusIP.CostTableValue = amount; ItemProperty bonusIPPacked = NWNXItemProperty.PackIP(bonusIP); NWItem item = _.CreateItemOnObject(resref, _player); item.RecommendedLevel = levelIncrease; BiowareXP2.IPSafeAddItemProperty(item, bonusIPPacked, 0.0f, AddItemPropertyPolicy.ReplaceExisting, true, false); xp += (150 * amount + RandomService.Random(0, 5)); } else { _player.SendMessage(ColorTokenService.Red("You failed to create a component. (+" + amount + ")")); xp += (50 + RandomService.Random(0, 5)); } break; } } return(xp); }
public void OnImpact(NWPlayer player, NWObject target, int perkLevel, int spellFeatID) { float recoveryPercent; int basePotency; const float Tier1Modifier = 1; const float Tier2Modifier = 2; const float Tier3Modifier = 0; const float Tier4Modifier = 0; switch (perkLevel) { case 1: basePotency = 10; recoveryPercent = 0.2f; break; case 2: basePotency = 15; recoveryPercent = 0.2f; break; case 3: basePotency = 20; recoveryPercent = 0.4f; break; case 4: basePotency = 25; recoveryPercent = 0.4f; break; case 5: basePotency = 30; recoveryPercent = 0.5f; break; default: return; } var effectiveStats = PlayerStatService.GetPlayerItemEffectiveStats(player); int luck = PerkService.GetPCPerkLevel(player, PerkType.Lucky) + effectiveStats.Luck; if (RandomService.Random(100) + 1 <= luck) { recoveryPercent = 1.0f; player.SendMessage("Lucky drain life!"); } var calc = CombatService.CalculateForceDamage( player, target.Object, ForceAbilityType.Dark, basePotency, Tier1Modifier, Tier2Modifier, Tier3Modifier, Tier4Modifier); _.AssignCommand(player, () => { int heal = (int)(calc.Damage * recoveryPercent); if (heal > target.CurrentHP) { heal = target.CurrentHP; } _.ApplyEffectToObject(DURATION_TYPE_INSTANT, _.EffectDamage(calc.Damage), target); _.ApplyEffectToObject(DURATION_TYPE_INSTANT, _.EffectHeal(heal), player); _.ApplyEffectToObject(DURATION_TYPE_TEMPORARY, _.EffectVisualEffect(VFX_BEAM_MIND), target, 1.0f); }); _.PlaySound("v_pro_drain"); SkillService.RegisterPCToAllCombatTargetsForSkill(player, SkillType.ForceCombat, target.Object); CombatService.AddTemporaryForceDefense(target.Object, ForceAbilityType.Dark); }
public float MaxDistance(NWCreature user, NWItem item, NWObject target, Location targetLocation) { return(3.5f + PerkService.GetPCPerkLevel(user.Object, PerkType.RangedHealing)); }