Files
PRC8/nwn/nwnprc/trunk/spells/x2_s3_ruinarmor.nss
Jaysyn904 f7d00cf6f8 2025/12/04 Update
Added Intrinsic Armor builder's feat to prevent any Disarming.
Added Intrinsic Weapon builder's feat to prevent Ruin Armor.
GetEpicSorcerer() should allow racial hit dice casters.
Enlarge / Reduce Person now stores object's original scale.
Added prc_inc_size for the above changes.
Updated PRC8 version.
Reverted Vow of Poverty to use PRC event system.
Reverted Forsaker to use PRC event system.
Updated Spell Cancel NUI to not show "system" spells @Rakiov)
Added notes on instanced Maze system.
Organized notes.
2025-12-04 18:44:36 -05:00

141 lines
4.5 KiB
Plaintext

//::///////////////////////////////////////////////
//:: OnHit: Ruin Armor (Bebilith Ability)
//:: x2_s3_ruinarmor
//:: Copyright (c) 2003 Bioware Corp.
//:://////////////////////////////////////////////
/*
A bebilith claw can catch and tear an opponent's
armor. If there is both armor and shield,
it is randomly determined which item removed
By default, the armor and shield just get
unequipped, however by setting
MODULE_SWITCH_ENABLE_BEBILITH_RUIN_ARMOR
to true via x2_inc_switches::SetModuleSwitch,
the armor gets actually destroyed
Chance to destroy armor is Bebilith BAB + StrengthMod + 8
vs Disciple + Item AC value
*/
//:://////////////////////////////////////////////
//:: Created By: Georg Zoeller
//:: Created On: 2003-08-26
//:://////////////////////////////////////////////
//:: Updated By: Jaysyn
//:: Updated On: 2025-12-03 23:21:14
//::
//:: Checks for "Intrinsic Armor" that can't
//:: be ruined.
//:: Shields can actually be effected now.
//::
//:://////////////////////////////////////////////
#include "prc_feat_const"
#include "x2_inc_switches"
void main()
{
object oItem; // The item casting triggering this spellscript
object oSpellTarget; // On a weapon: The one being hit. On an armor: The one hitting the armor
object oSpellOrigin; // On a weapon: The one wielding the weapon. On an armor: The one wearing an armor
// fill the variables
oSpellOrigin = OBJECT_SELF;
oSpellTarget = GetSpellTargetObject();
oItem = GetSpellCastItem();
int bNoRend = GetHasFeat(FEAT_INTRINSIC_ARMOR, oSpellTarget);
//Note that there needs to be no signal event in that scirpt, because this is not a spell ...
if(bNoRend)
{
SendMessageToPC(oSpellOrigin, "This creatures armor cannot be ruined.");
return;
}
if (GetIsObjectValid(oItem))
{
object oArmor = GetItemInSlot(INVENTORY_SLOT_CHEST, oSpellTarget);
object oShield = GetItemInSlot(INVENTORY_SLOT_LEFTHAND, oSpellTarget);
object oDestroy;
int nType = GetBaseItemType(oShield);
// we actually have a shield here
if (nType == BASE_ITEM_LARGESHIELD || nType == BASE_ITEM_SMALLSHIELD || nType == BASE_ITEM_TOWERSHIELD)
{
//SpeakString("Shield")
}
else
{
oShield = OBJECT_INVALID;
}
int bShield = FALSE;
// Determine which item
if (oArmor != OBJECT_INVALID && oShield != OBJECT_INVALID)
{
if (d4()< 2)
{
oDestroy = oArmor;
}
else
{
oDestroy = oShield;
bShield = TRUE;
}
}
else if (oShield == OBJECT_INVALID)
{
oDestroy = oArmor;
}
else if (oArmor == OBJECT_INVALID)
{
oDestroy = oShield;
bShield = TRUE;
}
if (oDestroy != OBJECT_INVALID)
{
int nDC = GetBaseAttackBonus(oSpellOrigin) + GetAbilityModifier(ABILITY_STRENGTH,oSpellOrigin) + 8 - GetItemACValue(oItem);
if (nDC > 0)
{
if (!GetIsSkillSuccessful(oSpellTarget, SKILL_DISCIPLINE, nDC) )
{
if (GetModuleSwitchValue(MODULE_SWITCH_ENABLE_BEBILITH_RUIN_ARMOR))
{
DestroyObject(oDestroy);
if (!bShield)
{
FloatingTextStrRefOnCreature(84428, oSpellTarget,FALSE);
}
else
{
FloatingTextStrRefOnCreature(84430, oSpellTarget,FALSE);
}
}
else
{
if (GetLocalInt(oDestroy,"X2_L_BEB_RUINED") == 1)
{
return;
}
CopyItem(oDestroy, oSpellTarget,TRUE);
SetLocalInt(oDestroy,"X2_L_BEB_RUINED",1);
DestroyObject(oDestroy);
if (!bShield)
{
FloatingTextStrRefOnCreature(84426, oSpellTarget,FALSE);
}
else
{
FloatingTextStrRefOnCreature(84429, oSpellTarget,FALSE);
}
}
}
}
}
}
}