public int FPCost(NWPlayer oPC, int baseFPCost, int spellFeatID) { CustomFeatType feat = (CustomFeatType)spellFeatID; switch (feat) { case CustomFeatType.ForceHeal: return(8); case CustomFeatType.ForceHeal2: return(24); case CustomFeatType.ForceHeal3: return(46); case CustomFeatType.ForceHeal4: return(88); default: throw new ArgumentOutOfRangeException(); } }
public int?CooldownCategoryID(NWPlayer oPC, int?baseCooldownCategoryID, int spellFeatID) { CustomFeatType feat = (CustomFeatType)spellFeatID; switch (feat) { case CustomFeatType.ForceHeal: return(6); case CustomFeatType.ForceHeal2: return(34); case CustomFeatType.ForceHeal3: return(35); case CustomFeatType.ForceHeal4: return(36); default: throw new ArgumentOutOfRangeException(); } }
public float CooldownTime(NWPlayer oPC, float baseCooldownTime, int spellFeatID) { CustomFeatType feat = (CustomFeatType)spellFeatID; switch (feat) { case CustomFeatType.ForceHeal: return(5f); case CustomFeatType.ForceHeal2: return(5.5f); case CustomFeatType.ForceHeal3: return(6f); case CustomFeatType.ForceHeal4: return(8f); default: throw new ArgumentOutOfRangeException(); } }
// Heal Formula: // Power = floor(WIS÷2) + floor(CHA÷4) + ((Force Support Skill+Item Potency)÷2) // Base = floor((Power - Power Floor) ÷ Rate ) + Base Potency // Completely stolen from: https://www.bg-wiki.com/index.php?title=Cure_Formula&oldid=537717 and tweaked. private void HealTarget(NWPlayer oPC, NWObject oTarget, int perkLevel, int skillRank, CustomFeatType spellFeat) { var effectiveStats = PlayerStatService.GetPlayerItemEffectiveStats(oPC); int itemPotency = effectiveStats.ForcePotency + effectiveStats.LightPotency; int power = (oPC.Wisdom / 2) + (oPC.Charisma / 4) + ((skillRank + itemPotency) / 2); ForceHealPotency potencyStats = null; // The same rules are used for each Force Heal tier. // However, using a lower tier ability will cap out regardless of your perk level. // I.E: If you are on perk level 8 and you use Force Heal I, the recovery amount will cap as if you were level 3. // Ranks 1-3: Force Heal I if (spellFeat == CustomFeatType.ForceHeal) { if (perkLevel > 3) { perkLevel = 3; } switch (perkLevel) { case 1: // Rank 1, Tier 1: if (power < 20) { potencyStats = _potencyLookup[1]; } // Rank 1, Tier 2: else { potencyStats = _potencyLookup[2]; } break; case 2: // Rank 2, Tier 1: if (power < 125) { potencyStats = _potencyLookup[3]; } // Rank 2, Tier 2: else { potencyStats = _potencyLookup[4]; } break; case 3: // Rank 3, Tier 1: if (power < 600) { potencyStats = _potencyLookup[5]; } // Rank 3, Tier 2: else { potencyStats = _potencyLookup[6]; } break; } } // Ranks 4-6: Force Heal II else if (spellFeat == CustomFeatType.ForceHeal2) { if (perkLevel > 6) { perkLevel = 6; } switch (perkLevel) { case 4: // Rank 4, Tier 1: if (power < 70) { potencyStats = _potencyLookup[7]; } // Rank 4, Tier 2: else { potencyStats = _potencyLookup[8]; } break; case 5: // Rank 5, Tier 1: if (power < 200) { potencyStats = _potencyLookup[9]; } // Rank 5, Tier 2: else { potencyStats = _potencyLookup[10]; } break; case 6: // Rank 6, Tier 1: if (power < 700) { potencyStats = _potencyLookup[11]; } // Rank 6, Tier 2: else { potencyStats = _potencyLookup[12]; } break; } } // Ranks 7-8: Force Heal III else if (spellFeat == CustomFeatType.ForceHeal3) { if (perkLevel > 8) { perkLevel = 8; } switch (perkLevel) { case 7: // Rank 7, Tier 1: if (power < 125) { potencyStats = _potencyLookup[13]; } // Rank 7, Tier 2: else { potencyStats = _potencyLookup[14]; } break; case 8: // Rank 8, Tier 1: if (power < 300) { potencyStats = _potencyLookup[15]; } // Rank 8, Tier 2: else if (power < 700) { potencyStats = _potencyLookup[16]; } // Rank 8, Tier 3: else { potencyStats = _potencyLookup[17]; } break; } } // Ranks 9-10: Force Heal IV else if (spellFeat == CustomFeatType.ForceHeal4) { if (perkLevel > 10) { perkLevel = 10; } switch (perkLevel) { case 9: // Rank 9, Tier 1: if (power < 200) { potencyStats = _potencyLookup[18]; } // Rank 9, Tier 2: else { potencyStats = _potencyLookup[19]; } break; case 10: // Rank 10, Tier 1: if (power < 400) { potencyStats = _potencyLookup[20]; } // Rank 10, Tier 2: else { potencyStats = _potencyLookup[21]; } break; } } if (potencyStats == null) { throw new Exception("Unable to identify Force Heal rules."); } // Calculate the amount based on the level and tier values int amount = (int)((power - potencyStats.PowerFloor) / potencyStats.Rate) + potencyStats.BasePotency; // Don't go over the hard cap, if there is one. if (potencyStats.HardCap > 0 && amount > potencyStats.HardCap) { amount = potencyStats.HardCap; } // Do a lucky check. Increases damage by 50% if successful. int luck = PerkService.GetPCPerkLevel(oPC, PerkType.Lucky) + effectiveStats.Luck; if (RandomService.Random(100) + 1 <= luck) { amount = (int)(amount * 1.5f); oPC.SendMessage("Lucky heal!"); } // Apply the heal. oPC.AssignCommand(() => { Effect heal = _.EffectHeal(amount); _.ApplyEffectToObject(DURATION_TYPE_INSTANT, heal, oTarget); Effect vfx = _.EffectVisualEffect(VFX_IMP_HEALING_M); _.ApplyEffectToObject(DURATION_TYPE_INSTANT, vfx, oTarget.Object); }); SkillService.RegisterPCToAllCombatTargetsForSkill(oPC, SkillType.ForceSupport, null); }