2025/08/22 Update

Reverted to 4.56 to track down a bug that started in 4.57.  Bugfixed back to 4.61.
It's amazing the damage that one skipped case statement can do.
This commit is contained in:
Jaysyn904
2025-08-22 17:54:55 -04:00
parent 59b2630adf
commit 246f8d56aa
3624 changed files with 101489 additions and 93263 deletions

View File

@@ -20,6 +20,11 @@
/* Function prototypes */
//////////////////////////////////////////////////
//:: Calculates total Shield AC bonuses from all sources
int GetTotalShieldACBonus(object oCreature);
//:: Handles psuedo-Foritifcation
void DoFortification(object oPC = OBJECT_SELF, int nFortification = 25);
@@ -376,6 +381,36 @@ const int TYPE_DIVINE = -2;
/* Function definitions */
//////////////////////////////////////////////////
// Returns TRUE if nSpellID is a subradial spell, FALSE otherwise
int GetIsSubradialSpell(int nSpellID)
{
string sMaster = Get2DAString("spells", "Master", nSpellID);
// A subradial will have a numeric master ID here, not ****
if (sMaster != "****")
{
return TRUE;
}
return FALSE;
}
// Returns the masterspell SpellID for a subradial spell.
int GetMasterSpellFromSubradial(int nSpellID)
{
string sMaster = Get2DAString("spells", "Master", nSpellID);
if (sMaster != "****")
{
return StringToInt(sMaster);
}
return -1; // No master
}
int GetPrCAdjustedClassLevel(int nClass, object oCaster = OBJECT_SELF)
{
int iTemp;
@@ -412,7 +447,9 @@ int GetPrCAdjustedCasterLevelByType(int nClassType, object oCaster = OBJECT_SELF
{
int nClassLvl;
int nClass1, nClass2, nClass3, nClass4, nClass5, nClass6, nClass7, nClass8;
int nClass1Lvl, nClass2Lvl, nClass3Lvl, nClass4Lvl, nClass5Lvl, nClass6Lvl, nClass7Lvl, nClass8Lvl;
int nClass1Lvl = 0, nClass2Lvl = 0, nClass3Lvl = 0, nClass4Lvl = 0,
nClass5Lvl = 0, nClass6Lvl = 0, nClass7Lvl = 0, nClass8Lvl = 0;
nClass1 = GetClassByPosition(1, oCaster);
nClass2 = GetClassByPosition(2, oCaster);
@@ -2223,6 +2260,78 @@ int GetControlledCelestialTotalHD(object oPC = OBJECT_SELF)
return nTotalHD;
}
//:: Calculates total Shield AC bonuses from all sources
int GetTotalShieldACBonus(object oCreature)
{
int nShieldBonus = 0;
object oItem;
// Check left hand for shield
oItem = GetItemInSlot(INVENTORY_SLOT_LEFTHAND, oCreature);
if (GetIsObjectValid(oItem))
{
int nBaseItem = GetBaseItemType(oItem);
if (nBaseItem == BASE_ITEM_SMALLSHIELD ||
nBaseItem == BASE_ITEM_LARGESHIELD ||
nBaseItem == BASE_ITEM_TOWERSHIELD)
{
nShieldBonus += GetItemACValue(oItem);
if(DEBUG) DoDebug("prc_inc_spells >> GetTotalShieldACBonus: Found Shield AC, bonus = " + IntToString(nShieldBonus)+".");
}
}
// Check creature weapon slots for shield AC bonus
oItem = GetItemInSlot(INVENTORY_SLOT_CWEAPON_L, oCreature);
if (GetIsObjectValid(oItem))
nShieldBonus += GetItemACValue(oItem);
oItem = GetItemInSlot(INVENTORY_SLOT_CWEAPON_R, oCreature);
if (GetIsObjectValid(oItem))
nShieldBonus += GetItemACValue(oItem);
oItem = GetItemInSlot(INVENTORY_SLOT_CWEAPON_B, oCreature);
if (GetIsObjectValid(oItem))
nShieldBonus += GetItemACValue(oItem);
// Add shield AC bonuses from magical effects
effect eEffect = GetFirstEffect(oCreature);
while (GetIsEffectValid(eEffect))
{
int nACType = GetEffectInteger(eEffect, 0);
int nACAmount = GetEffectInteger(eEffect, 1);
if(GetEffectType(eEffect) == EFFECT_TYPE_AC_INCREASE && nACType == AC_SHIELD_ENCHANTMENT_BONUS)
{
if(DEBUG) DoDebug("prc_inc_spells >> GetTotalShieldACBonus: Found Shield AC effect, bonus = " + IntToString(nACAmount)+".");
nShieldBonus += nACAmount;
}
eEffect = GetNextEffect(oCreature);
}
return nShieldBonus;
}
// Add shield AC bonuses from magical effects
/* effect eEffect = GetFirstEffect(oCreature);
while (GetIsEffectValid(eEffect))
{
if (GetEffectType(eEffect) == EFFECT_TYPE_AC_INCREASE &&
GetEffectInteger(eEffect, 1) == AC_SHIELD_ENCHANTMENT_BONUS)
{
int nMod = GetEffectInteger(eEffect, 0);
int nType = GetEffectInteger(eEffect, 1);
nShieldBonus += GetEffectInteger(eEffect, 0);
string s = "Found AC effect: bonus = " + IntToString(nMod) + ", type = " + IntToString(nType);
SendMessageToPC(GetFirstPC(), s);
}
eEffect = GetNextEffect(oCreature);
}
return nShieldBonus;
}*/
//
//:: Handles psuedo-Foritifcation
void DoFortification(object oPC = OBJECT_SELF, int nFortification = 25)
{
@@ -2275,7 +2384,7 @@ void DoFortification(object oPC = OBJECT_SELF, int nFortification = 25)
IPSafeAddItemProperty(oHide, ItemPropertyImmunityMisc(IP_CONST_IMMUNITYMISC_BACKSTAB));
}
}
//
// wrapper for DecrementRemainingSpellUses, works for newspellbook 'fake' spells too
// should also find and decrement metamagics for newspellbooks