PRC8/nwn/nwnprc/trunk/spells/sp_mass_regen.nss
Jaysyn904 9c7b452b9a 2025/08/15 Update
Added Verdant Lord PrC.
Added Create Infusion feat & crafting system.
Added Magical Artisan: Create Infusion feat.
Added Plant Defiance feat.
Added Plant Control feat.
Added Control Plants spell.
Added Forestfold spell.
Added Immunity from Elements spell.
Added Creeping Cold & Greater Creeping Cold spells.
Added Adrenaline Surge spell.
Added Mundane & Infused Herb baseitem types.
Added Mundane & Enchanted Scepter baseitem types.
Added EffectGazeImmunity() effect.
Added Botanical material type.
Created json library for summoning support.
Updated Plant Domain spells.
Fixed bug w/ Regen Circle.
Fixed weapon size bug with Enlarge & Reduce Person.
Fixed TMI bug in Swarm of Arrows (hopefully)
Fixed Blood in the Water.
Fixed Iron Soul / Master of Nine prereq bug.
Fixed Happo Zanshin to work more like PnP.
Fixed targeting bug w/ Ultrablast.
Fixed Ubiquitous Vision.
Fixed Magic Staves for small creatures.
Gave the summoned "treant" from Treebrother a Barkskin vfx.
Radial spells can now be scribed w/ Scribe Scroll.
Fixed Martial Stances not counting bug w/ levelup NUI (@Rakiov)
2025-08-15 13:42:37 -04:00

102 lines
3.3 KiB
Plaintext

//::///////////////////////////////////////////////
//:: Regenerate Ring / Circle
//:: sp_regen_ring_circle.nss
//:: Jaysyn - PRC8 2025-08-01
//::
//:: Group fast healing aura spells
//::///////////////////////////////////////////////
#include "prc_inc_spells"
void main()
{
if (!X2PreSpellCastCode()) return;
PRCSetSchool(GetSpellSchool(PRCGetSpellId()));
object oCaster = OBJECT_SELF;
int nSpellId = PRCGetSpellId();
int nMetamagic = PRCGetMetaMagicFeat();
int nCasterLevel = PRCGetCasterLevel(oCaster);
int nDuration = 10 + (nCasterLevel / 2);
int nMaxTargets = nCasterLevel / 2;
float fMaxDistance = 30.0;
int nRegenRate = 1;
if (nSpellId == SPELL_REGEN_CIRCLE)
{
nRegenRate = 3;
}
if (nMetamagic == METAMAGIC_EXTEND)
{
nDuration *= 2;
}
location lCaster = GetLocation(oCaster);
object oTarget = MyFirstObjectInShape(SHAPE_SPHERE, fMaxDistance, lCaster, FALSE, OBJECT_TYPE_CREATURE);
int nCount = 0;
while (GetIsObjectValid(oTarget) && nCount < nMaxTargets)
{
if (!GetIsEnemy(oCaster, oTarget) &&
GetRacialType(oTarget) != RACIAL_TYPE_UNDEAD &&
GetRacialType(oTarget) != RACIAL_TYPE_CONSTRUCT)
{
int nCurrentHP = GetCurrentHitPoints(oTarget);
int nInitialHP = GetLocalInt(oTarget, "INITIAL_HIT_POINTS");
if (nCurrentHP > nInitialHP)
{
nInitialHP = nCurrentHP;
SetLocalInt(oTarget, "INITIAL_HIT_POINTS", nInitialHP);
}
int nCurrentRegen = GetLocalInt(oTarget, "REGEN_RATE");
int nExistingDuration = 0;
int bSameSpell = FALSE;
effect e = GetFirstEffect(oTarget);
while (GetIsEffectValid(e))
{
if (GetEffectTag(e) == "REGEN_WOUNDS")
{
if (nCurrentRegen == nRegenRate)
{
bSameSpell = TRUE;
nExistingDuration = GetEffectDurationRemaining(e) / 6;
if (nRegenRate >= nCurrentRegen) RemoveEffect(oTarget, e);
else return;
}
else if (nRegenRate >= nCurrentRegen)
{
RemoveEffect(oTarget, e);
}
}
e = GetNextEffect(oTarget);
}
if (bSameSpell)
{
nDuration += nExistingDuration;
}
SetLocalInt(oTarget, "REGEN_RATE", nRegenRate);
SetLocalInt(oTarget, "REGEN_WOUNDS_REMAINING", nDuration);
effect eVis = EffectVisualEffect(1330/* VFX_DUR_BF_IOUN_STONE_GREEN */);
effect eRegen = EffectRunScript("rs_regen_wounds", "rs_regen_wounds", "rs_regen_wounds", 6.0f, IntToString(nRegenRate));
eRegen = SetEffectSpellId(eRegen, nSpellId);
eRegen = EffectLinkEffects(eVis, eRegen);
eRegen = TagEffect(eRegen, "REGEN_WOUNDS");
PRCRemoveEffectsFromSpell(oTarget, nSpellId);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eRegen, oTarget, RoundsToSeconds(nDuration));
nCount++;
}
oTarget = MyNextObjectInShape(SHAPE_SPHERE, fMaxDistance, lCaster, FALSE, OBJECT_TYPE_CREATURE);
}
PRCSetSchool();
}