PRC8/nwn/nwnprc/trunk/spells/x2_s2_gwildshp.nss
Jaysyn904 6ec137a24e Updated AMS marker feats
Updated AMS marker feats.  Removed arcane & divine marker feats.  Updated Dread Necromancer for epic progression. Updated weapon baseitem models.  Updated new weapons for crafting & npc equip.
 Updated prefix.  Updated release archive.
2024-02-11 14:01:05 -05:00

400 lines
16 KiB
Plaintext

//::///////////////////////////////////////////////
//:: Greater Wild Shape, Humanoid Shape
//:: x2_s2_gwildshp
//:: Copyright (c) 2003 Bioware Corp.
//:://////////////////////////////////////////////
/*
Allows the character to shift into one of these
forms, gaining special abilities
Credits must be given to mr_bumpkin from the NWN
community who had the idea of merging item properties
from weapon and armor to the creatures new forms.
*/
//:://////////////////////////////////////////////
//:: Created By: Georg Zoeller
//:: Created On: 2003-07-02
//:://////////////////////////////////////////////
//:: Modified By: Deva Winblood
//:: Modified Date: January 26th, 2008
//:://////////////////////////////////////////////
/*
Modified to insure no shapeshifting spells are castable upon
mounted targets. This prevents problems that can occur due
to dismounting after shape shifting, or other issues that can
occur due to preserved appearances getting out of synch.
This can additional check can be disabled by setting the variable
X3_NO_SHAPESHIFT_SPELL_CHECK to 1 on the module object. If this
variable is set then this script will function as it did prior to
this modification.
*/
//#include "x2_inc_itemprop"
#include "x2_inc_shifter"
//#include "x3_inc_horse"
#include "prc_alterations"
#include "pnp_shft_poly"
void dragon_shape_shift(object oPC, int nShape)
{
string sResRef = Get2DACache("prc_polymorph", "ResRef", nShape);
StoreCurrentAppearanceAsTrueAppearance(oPC, TRUE);
ShiftIntoResRef(oPC, SHIFTER_TYPE_DRUID, sResRef, TRUE);
}
void main()
{
//--------------------------------------------------------------------------
// Declare major variables
//--------------------------------------------------------------------------
int nSpell = GetSpellId();
object oTarget = GetSpellTargetObject();
effect eVis = EffectVisualEffect(VFX_IMP_POLYMORPH);
int nShifter = GetLevelByClass(CLASS_TYPE_SHIFTER);
effect ePoly;
int nPoly;
if (!GetLocalInt(GetModule(),"X3_NO_SHAPESHIFT_SPELL_CHECK"))
{ // check to see if abort due to being mounted
if (PRCHorseGetIsMounted(oTarget))
{ // abort
if (GetIsPC(oTarget)) FloatingTextStrRefOnCreature(111982,oTarget,FALSE);
return;
} // abort
} // check to see if abort due to being mounted
//this command will make shore that polymorph plays nice with the shifter
ShifterCheck(OBJECT_SELF);
int nShape = GetPersistantLocalInt(OBJECT_SELF, PRC_PNP_SHIFTING + IntToString(nSpell));
if(nShape > 0)
{
dragon_shape_shift(OBJECT_SELF, nShape);
return;
}
// Feb 13, 2004, Jon: Added scripting to take care of case where it's an NPC
// using one of the feats. It will randomly pick one of the shapes associated
// with the feat.
switch(nSpell)
{
// Greater Wildshape I
case 646: nSpell = Random(5)+658; break;
// Greater Wildshape II
case 675: switch(Random(3))
{
case 0: nSpell = 672; break;
case 1: nSpell = 678; break;
case 2: nSpell = 680;
}
break;
// Greater Wildshape III
case 676: switch(Random(3))
{
case 0: nSpell = 670; break;
case 1: nSpell = 673; break;
case 2: nSpell = 674;
}
break;
// Greater Wildshape IV
case 677: switch(Random(3))
{
case 0: nSpell = 679; break;
case 1: nSpell = 691; break;
case 2: nSpell = 694;
}
break;
// Humanoid Shape
case 681: nSpell = Random(3)+682; break;
// Undead Shape
case 685: nSpell = Random(3)+704; break;
// Dragon Shape
case 725: nSpell = Random(3)+707; break;
// Outsider Shape
case 732: nSpell = Random(3)+733; break;
// Construct Shape
case 737: nSpell = Random(3)+738; break;
}
//--------------------------------------------------------------------------
// Determine which form to use based on spell id, gender and level
//--------------------------------------------------------------------------
switch (nSpell)
{
//-----------------------------------------------------------------------
// Greater Wildshape I - Wyrmling Shape
//-----------------------------------------------------------------------
case 658: nPoly = POLYMORPH_TYPE_WYRMLING_RED; break;
case 659: nPoly = POLYMORPH_TYPE_WYRMLING_BLUE; break;
case 660: nPoly = POLYMORPH_TYPE_WYRMLING_BLACK; break;
case 661: nPoly = POLYMORPH_TYPE_WYRMLING_WHITE; break;
case 662: nPoly = POLYMORPH_TYPE_WYRMLING_GREEN; break;
//-----------------------------------------------------------------------
// Greater Wildshape II - Minotaur, Gargoyle, Harpy
//-----------------------------------------------------------------------
case 672: if (nShifter < X2_GW2_EPIC_THRESHOLD)
nPoly = POLYMORPH_TYPE_HARPY;
else
nPoly = 97;
break;
case 678: if (nShifter < X2_GW2_EPIC_THRESHOLD)
nPoly = POLYMORPH_TYPE_GARGOYLE;
else
nPoly = 98;
break;
case 680: if (nShifter < X2_GW2_EPIC_THRESHOLD)
nPoly = POLYMORPH_TYPE_MINOTAUR;
else
nPoly = 96;
break;
//-----------------------------------------------------------------------
// Greater Wildshape III - Drider, Basilisk, Manticore
//-----------------------------------------------------------------------
case 670: if (nShifter < X2_GW3_EPIC_THRESHOLD)
nPoly = POLYMORPH_TYPE_BASILISK;
else
nPoly = 99;
break;
case 673: if (nShifter < X2_GW3_EPIC_THRESHOLD)
nPoly = POLYMORPH_TYPE_DRIDER;
else
nPoly = 100;
break;
case 674: if (nShifter < X2_GW3_EPIC_THRESHOLD)
nPoly = POLYMORPH_TYPE_MANTICORE;
else
nPoly = 101;
break;
//-----------------------------------------------------------------------
// Greater Wildshape IV - Dire Tiger, Medusa, MindFlayer
//-----------------------------------------------------------------------
case 679: nPoly = POLYMORPH_TYPE_MEDUSA; break;
case 691: nPoly = 68; break; // Mindflayer
case 694: nPoly = 69; break; // DireTiger
//-----------------------------------------------------------------------
// Humanoid Shape - Kobold Commando, Drow, Lizard Crossbow Specialist
//-----------------------------------------------------------------------
case 682:
if(nShifter< 17)
{
if (GetGender(OBJECT_SELF) == GENDER_MALE) //drow
nPoly = 59;
else
nPoly = 70;
}
else
{
if (GetGender(OBJECT_SELF) == GENDER_MALE) //drow
nPoly = 105;
else
nPoly = 106;
}
break;
case 683:
if(nShifter< 17)
{
nPoly = 82; break; // Lizard
}
else
{
nPoly =104; break; // Epic Lizard
}
case 684: if(nShifter< 17)
{
nPoly = 83; break; // Kobold Commando
}
else
{
nPoly = 103; break; // Kobold Commando
}
//-----------------------------------------------------------------------
// Undead Shape - Spectre, Risen Lord, Vampire
//-----------------------------------------------------------------------
case 704: nPoly = 75; break; // Risen lord
case 705: if (GetGender(OBJECT_SELF) == GENDER_MALE) // vampire
nPoly = 74;
else
nPoly = 77;
break;
case 706: nPoly = 76; break; /// spectre
//-----------------------------------------------------------------------
// Dragon Shape - Red Blue and Green Dragons
//-----------------------------------------------------------------------
case 707: nPoly = 72; break; // Ancient Red Dragon
case 708: nPoly = 71; break; // Ancient Blue Dragon
case 709: nPoly = 73; break; // Ancient Green Dragon
//-----------------------------------------------------------------------
// Outsider Shape - Rakshasa, Azer Chieftain, Black Slaad
//-----------------------------------------------------------------------
case 733: if (GetGender(OBJECT_SELF) == GENDER_MALE) //azer
nPoly = 85;
else // anything else is female
nPoly = 86;
break;
case 734: if (GetGender(OBJECT_SELF) == GENDER_MALE) //rakshasa
nPoly = 88;
else // anything else is female
nPoly = 89;
break;
case 735: nPoly =87; break; // slaad
//-----------------------------------------------------------------------
// Construct Shape - Stone Golem, Iron Golem, Demonflesh Golem
//-----------------------------------------------------------------------
case 738: nPoly =91; break; // stone golem
case 739: nPoly =92; break; // demonflesh golem
case 740: nPoly =90; break; // iron golem
}
//--------------------------------------------------------------------------
// Determine which items get their item properties merged onto the shifters
// new form.
//--------------------------------------------------------------------------
int bWeapon = ShifterMergeWeapon(nPoly);
int bArmor = ShifterMergeArmor(nPoly);
int bItems = ShifterMergeItems(nPoly);
//--------------------------------------------------------------------------
// Store the old objects so we can access them after the character has
// changed into his new form
//--------------------------------------------------------------------------
object oWeaponOld = GetItemInSlot(INVENTORY_SLOT_RIGHTHAND,OBJECT_SELF);
object oArmorOld = GetItemInSlot(INVENTORY_SLOT_CHEST,OBJECT_SELF);
object oRing1Old = GetItemInSlot(INVENTORY_SLOT_LEFTRING,OBJECT_SELF);
object oRing2Old = GetItemInSlot(INVENTORY_SLOT_RIGHTRING,OBJECT_SELF);
object oAmuletOld = GetItemInSlot(INVENTORY_SLOT_NECK,OBJECT_SELF);
object oCloakOld = GetItemInSlot(INVENTORY_SLOT_CLOAK,OBJECT_SELF);
object oBootsOld = GetItemInSlot(INVENTORY_SLOT_BOOTS,OBJECT_SELF);
object oBeltOld = GetItemInSlot(INVENTORY_SLOT_BELT,OBJECT_SELF);
object oHelmetOld = GetItemInSlot(INVENTORY_SLOT_HEAD,OBJECT_SELF);
object oShield = GetItemInSlot(INVENTORY_SLOT_LEFTHAND,OBJECT_SELF);
if (GetIsObjectValid(oShield))
{
if (GetBaseItemType(oShield) !=BASE_ITEM_LARGESHIELD &&
GetBaseItemType(oShield) !=BASE_ITEM_SMALLSHIELD &&
GetBaseItemType(oShield) !=BASE_ITEM_TOWERSHIELD)
{
oShield = OBJECT_INVALID;
}
}
//--------------------------------------------------------------------------
// Here the actual polymorphing is done
//--------------------------------------------------------------------------
ePoly = EffectPolymorph(nPoly);
ePoly = ExtraordinaryEffect(ePoly);
ClearAllActions(); // prevents an exploit
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, OBJECT_SELF);
ApplyEffectToObject(DURATION_TYPE_PERMANENT, ePoly, OBJECT_SELF);
SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, GetSpellId(), FALSE));
//--------------------------------------------------------------------------
// This code handles the merging of item properties
//--------------------------------------------------------------------------
object oWeaponNew = GetItemInSlot(INVENTORY_SLOT_RIGHTHAND,OBJECT_SELF);
object oArmorNew = GetItemInSlot(INVENTORY_SLOT_CARMOUR,OBJECT_SELF);
//identify weapon
SetIdentified(oWeaponNew, TRUE);
//--------------------------------------------------------------------------
// ...Weapons
//--------------------------------------------------------------------------
if (bWeapon)
{
//----------------------------------------------------------------------
// GZ: 2003-10-20
// Sorry, but I was forced to take that out, it was confusing people
// and there were problems with updating the stats sheet.
//----------------------------------------------------------------------
/* if (!GetIsObjectValid(oWeaponOld))
{
//------------------------------------------------------------------
// If we had no weapon equipped before, remove the old weapon
// to allow monks to change into unarmed forms by not equipping any
// weapon before polymorphing
//------------------------------------------------------------------
DestroyObject(oWeaponNew);
}
else*/
{
//------------------------------------------------------------------
// Merge item properties...
//------------------------------------------------------------------
IPWildShapeCopyItemProperties(oWeaponOld,oWeaponNew, TRUE);
}
}
//--------------------------------------------------------------------------
// ...Armor
//--------------------------------------------------------------------------
if (bArmor)
{
//----------------------------------------------------------------------
// Merge item properties from armor and helmet...
//----------------------------------------------------------------------
IPWildShapeCopyItemProperties(oArmorOld,oArmorNew);
IPWildShapeCopyItemProperties(oHelmetOld,oArmorNew);
IPWildShapeCopyItemProperties(oShield,oArmorNew);
}
//--------------------------------------------------------------------------
// ...Magic Items
//--------------------------------------------------------------------------
if (bItems)
{
//----------------------------------------------------------------------
// Merge item properties from from rings, amulets, cloak, boots, belt
//----------------------------------------------------------------------
IPWildShapeCopyItemProperties(oRing1Old,oArmorNew);
IPWildShapeCopyItemProperties(oRing2Old,oArmorNew);
IPWildShapeCopyItemProperties(oAmuletOld,oArmorNew);
IPWildShapeCopyItemProperties(oCloakOld,oArmorNew);
IPWildShapeCopyItemProperties(oBootsOld,oArmorNew);
IPWildShapeCopyItemProperties(oBeltOld,oArmorNew);
}
//--------------------------------------------------------------------------
// Set artificial usage limits for special ability spells to work around
// the engine limitation of not being able to set a number of uses for
// spells in the polymorph radial
//--------------------------------------------------------------------------
ShifterSetGWildshapeSpellLimits(nSpell);
}