221 lines
		
	
	
		
			8.6 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			221 lines
		
	
	
		
			8.6 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
//::///////////////////////////////////////////////
 | 
						|
//:: Tensor's Transformation
 | 
						|
//:: NW_S0_TensTrans.nss
 | 
						|
//:: Copyright (c) 2001 Bioware Corp.
 | 
						|
//:://////////////////////////////////////////////
 | 
						|
/*
 | 
						|
    Gives the caster the following bonuses:
 | 
						|
        +1 Attack per 2 levels
 | 
						|
        +4 Natural AC
 | 
						|
        20 STR and DEX and CON
 | 
						|
        1d6 Bonus HP per level
 | 
						|
        +5 on Fortitude Saves
 | 
						|
        -10 Intelligence
 | 
						|
*/
 | 
						|
//:://////////////////////////////////////////////
 | 
						|
//:: Created By: Preston Watamaniuk
 | 
						|
//:: Created On: Oct 26, 2001
 | 
						|
//:://////////////////////////////////////////////
 | 
						|
//: Sep2002: losing hit-points won't get rid of the rest of the bonuses
 | 
						|
 | 
						|
//:://///////////////////////////////////////////
 | 
						|
//:: Modified by C.R. Hain (AKA Lord Niah)
 | 
						|
//:: on: Feb 3, 2003
 | 
						|
/////////////////////////////////////////////////
 | 
						|
/*
 | 
						|
        Spell no longer applies polymorph effect so that
 | 
						|
        player can now use their own equipment
 | 
						|
 | 
						|
        Also increases discipline skill
 | 
						|
*/
 | 
						|
 | 
						|
#include "x2_inc_spellhook"
 | 
						|
//#include "x2_inc_itemprop"
 | 
						|
//#include "x2_inc_shifter"
 | 
						|
 | 
						|
void main()
 | 
						|
{
 | 
						|
 | 
						|
 | 
						|
  //----------------------------------------------------------------------------
 | 
						|
  // GZ, Nov 3, 2003
 | 
						|
  // There is a serious problems with creatures turning into unstoppable killer
 | 
						|
  // machines when affected by tensors transformation. NPC AI can't handle that
 | 
						|
  // spell anyway, so I added this code to disable the use of Tensors by any
 | 
						|
  // NPC.
 | 
						|
  //----------------------------------------------------------------------------
 | 
						|
  if (!GetIsPC(OBJECT_SELF))
 | 
						|
  {
 | 
						|
      WriteTimestampedLogEntry(GetName(OBJECT_SELF) + "[" + GetTag (OBJECT_SELF) +"] tried to cast Tensors Transformation. Bad! Remove that spell from the creature");
 | 
						|
      return;
 | 
						|
  }
 | 
						|
 | 
						|
  /*
 | 
						|
    Spellcast Hook Code
 | 
						|
      Added 2003-06-23 by GeorgZ
 | 
						|
      If you want to make changes to all spells,
 | 
						|
      check x2_inc_spellhook.nss to find out more
 | 
						|
    */
 | 
						|
 | 
						|
    if (!X2PreSpellCastCode())
 | 
						|
    {
 | 
						|
        return;
 | 
						|
    }
 | 
						|
 | 
						|
    // End of Spell Cast Hook
 | 
						|
 | 
						|
 | 
						|
    //Declare major variables
 | 
						|
    int nLevel = GetCasterLevel(OBJECT_SELF);
 | 
						|
    int nHP, nCnt, nDuration;
 | 
						|
    nDuration = GetCasterLevel(OBJECT_SELF);
 | 
						|
    //Determine bonus HP
 | 
						|
    for(nCnt; nCnt <= nLevel; nCnt++)
 | 
						|
    {
 | 
						|
        nHP += d6();
 | 
						|
    }
 | 
						|
 | 
						|
    int nMeta = GetMetaMagicFeat();
 | 
						|
    //Metamagic
 | 
						|
    if(nMeta == METAMAGIC_MAXIMIZE)
 | 
						|
    {
 | 
						|
        nHP = nLevel * 6;
 | 
						|
    }
 | 
						|
    else if(nMeta == METAMAGIC_EMPOWER)
 | 
						|
    {
 | 
						|
        nHP = nHP + (nHP/2);
 | 
						|
    }
 | 
						|
    else if(nMeta == METAMAGIC_EXTEND)
 | 
						|
    {
 | 
						|
        nDuration *= 2;
 | 
						|
    }
 | 
						|
 | 
						|
 | 
						|
    //Set Discipline skill if lower than what it would be for a fighter of the
 | 
						|
    //same level -- CRH
 | 
						|
    int nDisc = GetSkillRank(SKILL_DISCIPLINE, OBJECT_SELF);
 | 
						|
 | 
						|
    if(nDisc < (nLevel + 3))
 | 
						|
        nDisc = (nLevel + 3) - nDisc;
 | 
						|
 | 
						|
    //Declare effects
 | 
						|
    effect eAttack = EffectAttackIncrease(nLevel/2);
 | 
						|
    effect eSave = EffectSavingThrowIncrease(SAVING_THROW_FORT, 5);
 | 
						|
    effect eAC = EffectACIncrease(4, AC_NATURAL_BONUS);
 | 
						|
    effect eStrength = EffectAbilityIncrease(ABILITY_STRENGTH, d4(2));
 | 
						|
    effect eDexterity = EffectAbilityIncrease(ABILITY_DEXTERITY, d4(2));
 | 
						|
    effect eSkill = EffectSkillIncrease(SKILL_DISCIPLINE, nDisc);
 | 
						|
    effect eSpellFail = EffectSpellFailure(200);
 | 
						|
    effect eDur = EffectVisualEffect(VFX_DUR_PROT_STONESKIN);
 | 
						|
    effect eGlow = EffectVisualEffect(VFX_DUR_GLOW_LIGHT_RED);
 | 
						|
    //effect ePoly = EffectPolymorph(28);
 | 
						|
    effect eSwing = EffectModifyAttacks(3);
 | 
						|
 | 
						|
    //Link effects
 | 
						|
    //effect eLink = EffectLinkEffects(eAttack, ePoly);
 | 
						|
    effect eLink = EffectLinkEffects(eAttack, eSave);
 | 
						|
    eLink = EffectLinkEffects(eLink, eAC);
 | 
						|
    eLink = EffectLinkEffects(eLink, eStrength);
 | 
						|
    eLink = EffectLinkEffects(eLink, eDexterity);
 | 
						|
    eLink = EffectLinkEffects(eLink, eSkill);
 | 
						|
    eLink = EffectLinkEffects(eLink, eSpellFail);
 | 
						|
    eLink = EffectLinkEffects(eLink, eSwing);
 | 
						|
    eLink = EffectLinkEffects(eLink, eDur);
 | 
						|
    eLink = EffectLinkEffects(eLink, eGlow);
 | 
						|
 | 
						|
    effect eHP = EffectTemporaryHitpoints(nHP);
 | 
						|
 | 
						|
    effect eVis = EffectVisualEffect(VFX_IMP_SUPER_HEROISM);
 | 
						|
 | 
						|
    //int nAppearance = GetAppearanceType(OBJECT_SELF);
 | 
						|
 | 
						|
    /*
 | 
						|
    //--------------------------------------------------------------------------
 | 
						|
    // 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_SMALLSHIELD)
 | 
						|
        {
 | 
						|
            oShield = OBJECT_INVALID;
 | 
						|
        }
 | 
						|
    }
 | 
						|
 | 
						|
    */
 | 
						|
    //--------------------------------------------------------------------------
 | 
						|
    // Here the actual polymorphing is done and effects applied
 | 
						|
    //--------------------------------------------------------------------------
 | 
						|
    SignalEvent(OBJECT_SELF, EventSpellCastAt(OBJECT_SELF, SPELL_TENSERS_TRANSFORMATION, FALSE));
 | 
						|
 | 
						|
    ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, OBJECT_SELF);
 | 
						|
    ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eHP, OBJECT_SELF, RoundsToSeconds(nDuration));
 | 
						|
    ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eLink, OBJECT_SELF, RoundsToSeconds(nDuration));
 | 
						|
    //SetCreatureAppearanceType(OBJECT_SELF, APPEARANCE_TYPE_DOOM_KNIGHT);
 | 
						|
    //DelayCommand(RoundsToSeconds(nDuration), SetCreatureAppearanceType(OBJECT_SELF, nAppearance));
 | 
						|
    //DelayCommand(RoundsToSeconds(nDuration), ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_IMP_POLYMORPH), OBJECT_SELF));
 | 
						|
    /*
 | 
						|
    //--------------------------------------------------------------------------
 | 
						|
    // This code handles the merging of item properties
 | 
						|
    //--------------------------------------------------------------------------
 | 
						|
    object oWeaponNew = GetItemInSlot(INVENTORY_SLOT_RIGHTHAND,OBJECT_SELF);
 | 
						|
    object oArmorNew = GetItemInSlot(INVENTORY_SLOT_CARMOUR,OBJECT_SELF);
 | 
						|
 | 
						|
    //--------------------------------------------------------------------------
 | 
						|
    // ...Weapons
 | 
						|
    //--------------------------------------------------------------------------
 | 
						|
 | 
						|
        //----------------------------------------------------------------------
 | 
						|
        // 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.
 | 
						|
        //----------------------------------------------------------------------
 | 
						|
 | 
						|
 | 
						|
            //------------------------------------------------------------------
 | 
						|
            // Merge item properties...
 | 
						|
            //------------------------------------------------------------------
 | 
						|
    IPWildShapeCopyItemProperties(oWeaponOld,oWeaponNew, TRUE);
 | 
						|
 | 
						|
 | 
						|
 | 
						|
    //--------------------------------------------------------------------------
 | 
						|
    // ...Armor
 | 
						|
    //--------------------------------------------------------------------------
 | 
						|
 | 
						|
    //----------------------------------------------------------------------
 | 
						|
    // Merge item properties from armor and helmet...
 | 
						|
    //----------------------------------------------------------------------
 | 
						|
    IPWildShapeCopyItemProperties(oArmorOld,oArmorNew);
 | 
						|
    IPWildShapeCopyItemProperties(oHelmetOld,oArmorNew);
 | 
						|
    IPWildShapeCopyItemProperties(oShield,oArmorNew);
 | 
						|
 | 
						|
    //--------------------------------------------------------------------------
 | 
						|
    // ...Magic Items
 | 
						|
    //--------------------------------------------------------------------------
 | 
						|
 | 
						|
    //----------------------------------------------------------------------
 | 
						|
    // 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);
 | 
						|
    */
 | 
						|
}
 |