77 lines
		
	
	
		
			2.3 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			77 lines
		
	
	
		
			2.3 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
| //::///////////////////////////////////////////////
 | |
| //:: Mage Armor
 | |
| //:: [NW_S0_MageArm.nss]
 | |
| //:: Copyright (c) 2001 Bioware Corp.
 | |
| //:://////////////////////////////////////////////
 | |
| /*
 | |
|     Gives the target +1 AC Bonus to Deflection,
 | |
|     Armor Enchantment, Natural Armor and Dodge.
 | |
| */
 | |
| //:://////////////////////////////////////////////
 | |
| //:: Created By: Preston Watamaniuk
 | |
| //:: Created On: Jan 12, 2001
 | |
| //:://////////////////////////////////////////////
 | |
| //:: Last Updated By: Preston Watamaniuk, On: April 10, 2001
 | |
| //:: VFX Pass By: Preston W, On: June 22, 2001
 | |
| 
 | |
| /*
 | |
| bugfix by Kovi 2002.07.23
 | |
| - dodge bonus was stacking
 | |
| */
 | |
| 
 | |
| #include "nw_i0_spells"
 | |
| 
 | |
| #include "x2_inc_spellhook"
 | |
| 
 | |
| void main()
 | |
| {
 | |
| 
 | |
| /*
 | |
|   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())
 | |
|     {
 | |
|     // If code within the PreSpellCastHook (i.e. UMD) reports FALSE, do not run this spell
 | |
|         return;
 | |
|     }
 | |
| 
 | |
| // End of Spell Cast Hook
 | |
| 
 | |
| 
 | |
|     //Declare major variables
 | |
|     object oTarget = GetSpellTargetObject();
 | |
|     int nDuration = GetCasterLevel(OBJECT_SELF);
 | |
|     int nMetaMagic = GetMetaMagicFeat();
 | |
|     effect eVis = EffectVisualEffect(VFX_IMP_AC_BONUS);
 | |
|     effect eAC1, eAC2, eAC3, eAC4;
 | |
|     //Fire cast spell at event for the specified target
 | |
|     SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, SPELL_MAGE_ARMOR, FALSE));
 | |
|     //Check for metamagic extend
 | |
|     if (nMetaMagic == METAMAGIC_EXTEND) //Duration is +100%
 | |
|     {
 | |
|          nDuration = nDuration * 2;
 | |
|     }
 | |
|     //Set the four unique armor bonuses
 | |
|     eAC1 = EffectACIncrease(1, AC_ARMOUR_ENCHANTMENT_BONUS);
 | |
|     eAC2 = EffectACIncrease(1, AC_DEFLECTION_BONUS);
 | |
|     eAC3 = EffectACIncrease(1, AC_DODGE_BONUS);
 | |
|     eAC4 = EffectACIncrease(1, AC_NATURAL_BONUS);
 | |
|     effect eDur = EffectVisualEffect(VFX_DUR_CESSATE_POSITIVE);
 | |
| 
 | |
|     effect eLink = EffectLinkEffects(eAC1, eAC2);
 | |
|     eLink = EffectLinkEffects(eLink, eAC3);
 | |
|     eLink = EffectLinkEffects(eLink, eAC4);
 | |
|     eLink = EffectLinkEffects(eLink, eDur);
 | |
| 
 | |
|     RemoveEffectsFromSpell(oTarget, SPELL_MAGE_ARMOR);
 | |
| 
 | |
|     //Apply the armor bonuses and the VFX impact
 | |
|     ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eLink, oTarget, HoursToSeconds(nDuration));
 | |
|     ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget);
 | |
| }
 |