private void ApplyFeatChanges(NWCreature creature, NWItem oItem) { NWItem equipped = oItem ?? creature.RightHand; if (Equals(equipped, oItem) || equipped.CustomItemType != CustomItemType.Vibroblade) { NWNXCreature.RemoveFeat(creature, Feat.PowerAttack); NWNXCreature.RemoveFeat(creature, Feat.ImprovedPowerAttack); if (_.GetActionMode(creature, ActionMode.PowerAttack) == true) { _.SetActionMode(creature, ActionMode.PowerAttack, false); } if (_.GetActionMode(creature, ActionMode.ImprovedPowerAttack) == true) { _.SetActionMode(creature, ActionMode.ImprovedPowerAttack, false); } return; } int perkLevel = PerkService.GetCreaturePerkLevel(creature, PerkType.BladePowerAttack); NWNXCreature.AddFeat(creature, Feat.PowerAttack); if (perkLevel >= 2) { NWNXCreature.AddFeat(creature, Feat.ImprovedPowerAttack); } }
public void DoAction(NWPlayer user, NWObject target, NWLocation targetLocation, params string[] args) { // Did the player pass in the 'end' argument? If so, we're ending the concentration effect. bool doEnd = args.Length > 0 && args[0] == "end"; if (doEnd) { AbilityService.EndConcentrationEffect(user); user.SendMessage("You have ended your concentration ability."); } // Otherwise just notify them about what effect is currently active. else { var effect = AbilityService.GetActiveConcentrationEffect(user); if (effect.Type == PerkType.Unknown) { user.SendMessage("No concentration ability is currently active."); } else { var perk = PerkService.GetPerkByID((int)effect.Type); user.SendMessage("Currently active concentration ability: " + perk.Name); } } }
private int CalculateAmount(NWPlayer player) { var effectiveStats = PlayerStatService.GetPlayerItemEffectiveStats(player); int perkLevel = PerkService.GetPCPerkLevel(player, PerkType.Rest); int amount; switch (perkLevel) { default: amount = 2; break; case 4: case 5: case 6: amount = 3; break; case 7: amount = 4; break; } amount += effectiveStats.Rest; return(amount); }
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 void ApplyEffects(NWCreature user, NWItem item, NWObject target, Location targetLocation, CustomData customData) { NWPlayer player = user.Object; var ability = (AbilityType)item.GetLocalInt("ABILITY_TYPE"); int amount = item.GetLocalInt("AMOUNT") + (item.MedicineBonus * 2); int rank = player.IsPlayer ? SkillService.GetPCSkillRank(player, SkillType.Medicine) : 0; int recommendedLevel = item.RecommendedLevel; float duration = 30.0f * (rank / 10); int perkLevel = player.IsPlayer ? PerkService.GetCreaturePerkLevel(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(DurationType.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(NWCreature creature, NWItem oItem) { NWItem equipped = oItem ?? creature.RightHand; if (Equals(equipped, oItem) || equipped.CustomItemType != CustomItemType.Vibroblade) { NWNXCreature.RemoveFeat(creature, FEAT_POWER_ATTACK); NWNXCreature.RemoveFeat(creature, FEAT_IMPROVED_POWER_ATTACK); if (_.GetActionMode(creature, ACTION_MODE_POWER_ATTACK) == TRUE) { _.SetActionMode(creature, ACTION_MODE_POWER_ATTACK, FALSE); } if (_.GetActionMode(creature, ACTION_MODE_IMPROVED_POWER_ATTACK) == TRUE) { _.SetActionMode(creature, ACTION_MODE_IMPROVED_POWER_ATTACK, FALSE); } return; } int perkLevel = PerkService.GetCreaturePerkLevel(creature, PerkType.BladePowerAttack); NWNXCreature.AddFeat(creature, FEAT_POWER_ATTACK); if (perkLevel >= 2) { NWNXCreature.AddFeat(creature, FEAT_IMPROVED_POWER_ATTACK); } }
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); }
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"); Guid structureGuid = new Guid(structureID); PCBaseStructure pcbs = DataService.PCBaseStructure.GetByID(structureGuid); BaseStructure structure = DataService.BaseStructure.GetByID(pcbs.BaseStructureID); if (structure.Durability == pcbs.Durability) { return("This starship is already fully repaired."); } bool canRepair = (PerkService.GetCreaturePerkLevel(new NWPlayer(user), PerkType.CombatRepair) >= 1); PCBase pcBase = DataService.PCBase.GetByID(pcbs.PCBaseID); if (!canRepair && SpaceService.IsLocationSpace(pcBase.ShipLocation)) { return("You need the Combat Repair perk to repair ships in space."); } return(""); }
private int CalculateAmount(NWPlayer player) { var effectiveStats = PlayerStatService.GetPlayerItemEffectiveStats(player); int perkLevel = PerkService.GetCreaturePerkLevel(player, PerkType.Meditate); int amount; switch (perkLevel) { default: amount = 6; break; case 4: case 5: case 6: amount = 10; break; case 7: amount = 14; 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.GetCreaturePerkLevel(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); }
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.GetCreaturePerkLevel(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 IHttpActionResult GetById(int perkId) { PerkService perkService = CreatePerkService(); var perk = perkService.GetPerkById(perkId); perk.GameURL = "https://" + HttpContext.Current.Request.Url.Authority + "/api/Game?GameId=" + perk.GameId; return(Ok(perk)); }
public float Seconds(NWCreature user, NWItem item, NWObject target, Location targetLocation, CustomData customData) { if (PerkService.GetCreaturePerkLevel(new NWPlayer(user), PerkType.CombatRepair) >= 2) { return(6.0f); } return(12.0f); }
private void DoPerkRemoval() { if (!CanRefundPerk()) { return; } var model = GetDialogCustomData <Model>(); var player = GetPC(); var pcPerk = DataService.PCPerk.GetByID(model.PCPerkID); var perk = DataService.Perk.GetByID(pcPerk.PerkID); var minimumLevel = 1; if (IsGrantedByBackground((PerkType)perk.ID)) { minimumLevel = 2; } var refundAmount = DataService.PerkLevel.GetAllByPerkID(perk.ID) .Where(x => x.Level <= pcPerk.PerkLevel && x.Level >= minimumLevel).Sum(x => x.Price); var dbPlayer = DataService.Player.GetByID(player.GlobalID); dbPlayer.DatePerkRefundAvailable = DateTime.UtcNow.AddHours(24); RemovePerkItem(perk); RemovePerkFeat(perk); CustomEffectService.RemoveStance(GetPC()); PlayerStatService.ApplyStatChanges(GetPC(), null); dbPlayer.UnallocatedSP += refundAmount; var refundAudit = new PCPerkRefund { PlayerID = player.GlobalID, DateAcquired = pcPerk.AcquiredDate, DateRefunded = DateTime.UtcNow, Level = pcPerk.PerkLevel, PerkID = pcPerk.PerkID }; // Bypass caching for perk refunds. DataService.DataQueue.Enqueue(new DatabaseAction(refundAudit, DatabaseActionType.Insert)); DataService.SubmitDataChange(pcPerk, DatabaseActionType.Delete); DataService.SubmitDataChange(dbPlayer, DatabaseActionType.Update); // If perk refunded was one granted by a background bonus, we need to reapply it. ReapplyBackgroundBonus((PerkType)pcPerk.PerkID); GetPC().FloatingText("Perk refunded! You reclaimed " + refundAmount + " SP."); model.TomeItem.Destroy(); var handler = PerkService.GetPerkHandler(perk.ID); handler.OnRemoved(player); MessageHub.Instance.Publish(new OnPerkRefunded(player, pcPerk.PerkID)); }
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 void OnImpact(NWCreature creature, NWObject target, int perkLevel, int spellTier) { 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; } if (creature.IsPlayer) { var effectiveStats = PlayerStatService.GetPlayerItemEffectiveStats(creature.Object); int luck = PerkService.GetCreaturePerkLevel(creature, PerkType.Lucky) + effectiveStats.Luck; chance += luck; } if (RandomService.Random(100) + 1 <= chance) { _.ApplyEffectToObject(_.DURATION_TYPE_TEMPORARY, _.EffectAttackIncrease(ab), creature.Object, length); creature.SendMessage(ColorTokenService.Combat("You perform a defensive maneuver.")); } }
public static void grenadeAoe(NWObject oTarget, string grenadeType) { if (oTarget.ObjectType != ObjectType.Creature) { return; } NWCreature user = GetAreaOfEffectCreator(_.OBJECT_SELF); int perkLevel = PerkService.GetCreaturePerkLevel(user, PerkType.GrenadeProficiency); int duration = 1; Effect impactEffect = null; Effect durationEffect = null; //Console.WriteLine("In grenadeAoe for grenade type " + grenadeType + " on " + GetName(oTarget)); switch (grenadeType) { case "SMOKE": durationEffect = EffectInvisibility(InvisibilityType.Normal); break; case "BACTABOMB": durationEffect = EffectRegenerate(perkLevel * 2 + 1, 6.0f); break; case "INCENDIARY": impactEffect = EffectDamage(perkLevel + 1 + RandomService.D6(perkLevel), DamageType.Fire); duration = RandomService.D6(1); break; case "GAS": impactEffect = EffectDamage(perkLevel + 1 + RandomService.D6(perkLevel), DamageType.Acid); duration = RandomService.D6(1); break; default: throw new ArgumentOutOfRangeException(nameof(grenadeType)); } if (GetIsObjectValid(oTarget) == true) { if (impactEffect != null) { ApplyEffectToObject(DurationType.Instant, impactEffect, oTarget); } if (durationEffect != null) { ApplyEffectToObject(DurationType.Temporary, durationEffect, oTarget, duration * 6.0f); } if (!oTarget.IsPlayer) { SkillService.RegisterPCToNPCForSkill(user.Object, oTarget, SkillType.Throwing); } } }
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 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)); }
private string GetMainPageHeader() { Player pcEntity = PlayerService.GetPlayerEntity(GetPC().GlobalID); int totalSP = SkillService.GetPCTotalSkillCount(GetPC()); int totalPerks = PerkService.GetPCTotalPerkCount(GetPC().GlobalID); return(ColorTokenService.Green("Total SP: ") + totalSP + " / " + SkillService.SkillCap + "\n" + ColorTokenService.Green("Available SP: ") + pcEntity.UnallocatedSP + "\n" + ColorTokenService.Green("Total Perks: ") + totalPerks + "\n"); }
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 IHttpActionResult GetByGameId(int gameId) { PerkService perkService = CreatePerkService(); var perks = perkService.GetPerksByGameId(gameId); foreach (PerkListItem h in perks) { h.GameURL = "https://" + HttpContext.Current.Request.Url.Authority + "/api/Game?GameId=" + h.GameId; } return(Ok(perks)); }
public float Seconds(NWCreature user, NWItem item, NWObject target, Location targetLocation, CustomData customData) { const float BaseHarvestingTime = 16.0f; float harvestingTime = BaseHarvestingTime; if (user.IsPlayer) { var player = (user.Object); harvestingTime = BaseHarvestingTime - BaseHarvestingTime * (PerkService.GetCreaturePerkLevel(player, PerkType.SpeedyHarvester) * 0.1f); } return(harvestingTime); }
private void BuildPerkList() { Model vm = GetDialogCustomData <Model>(); var perksAvailable = PerkService.GetPerksAvailableToPC(GetPC()); List <Data.Entity.Perk> perks = perksAvailable.Where(x => x.PerkCategoryID == vm.SelectedCategoryID).ToList(); ClearPageResponses("PerkListPage"); foreach (Data.Entity.Perk perk in perks) { AddResponseToPage("PerkListPage", perk.Name, true, perk.ID); } }
private void BuildCategoryList() { var perksAvailable = PerkService.GetPerksAvailableToPC(GetPC()); var categoryIDs = perksAvailable.Select(x => x.PerkCategoryID).Distinct(); List <PerkCategory> categories = DataService.Where <PerkCategory>(x => categoryIDs.Contains(x.ID)).ToList(); ClearPageResponses("CategoryPage"); foreach (PerkCategory category in categories) { AddResponseToPage("CategoryPage", category.Name, true, category.ID); } }
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 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.GetCreaturePerkLevel(player, PerkType.Lucky); int perkDurationBonus = PerkService.GetCreaturePerkLevel(player, PerkType.HealingKitExpert) * 6 + (luck * 2); float duration = 30.0f + (rank * 0.4f) + perkDurationBonus + effectiveStats.Medicine; int restoreAmount = 1 + item.GetLocalInt("HEALING_BONUS") + (rank / 10); int delta = item.RecommendedLevel - rank; float effectivenessPercent = 1.0f; if (delta > 0) { effectivenessPercent = effectivenessPercent - (delta * 0.1f); } restoreAmount = (int)(restoreAmount * effectivenessPercent) + item.MedicineBonus; int perkBlastBonus = PerkService.GetCreaturePerkLevel(player, PerkType.ImmediateForcePack); if (perkBlastBonus > 0) { int blastHeal = restoreAmount * perkBlastBonus; if (RandomService.Random(100) + 1 <= luck / 2) { blastHeal *= 2; } AbilityService.RestorePlayerFP(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.GetCreaturePerkLevel(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(NWCreature creature, NWObject target, int perkLevel, int spellTier) { // Mark the player as performing a recovery blast. // This is later picked up in the OnApplyDamage event to reduce all damage to 0. creature.SetLocalInt("RECOVERY_BLAST_ACTIVE", 1); var members = creature.PartyMembers.Where(x => _.GetDistanceBetween(x, target) <= 10.0f); int luck = PerkService.GetCreaturePerkLevel(creature, PerkType.Lucky); foreach (var member in members) { HealTarget(member, perkLevel, luck); } }