180 lines
		
	
	
		
			6.4 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			180 lines
		
	
	
		
			6.4 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
| 
 | |
| 
 | |
| //::///////////////////////////////////////////////
 | |
| //:: Darkfire
 | |
| //:: X2_S0_Darkfire
 | |
| //:: Copyright (c) 2001 Bioware Corp.
 | |
| //:://////////////////////////////////////////////
 | |
| /*
 | |
|  Gives a melee weapon 1d6 fire damage +1 per two caster
 | |
|  levels to a maximum of +10.
 | |
| */
 | |
| //:://////////////////////////////////////////////
 | |
| //:: Created By: Andrew Nobbs
 | |
| //:: Created On: Dec 04, 2002
 | |
| //:://////////////////////////////////////////////
 | |
| //:: Updated by Rose Dec. 6, 2015
 | |
| 
 | |
| 
 | |
| #include "nw_i0_spells"
 | |
| //#include "x2_i0_spells" #include "prc_inc_spells"
 | |
| 
 | |
| #include "x2_inc_spellhook"
 | |
| 
 | |
| /* This function has been replaced for optimization reasons
 | |
| void AddFlamingEffectToWeapon(object oTarget, float fDuration, int nCasterLvl)
 | |
| {
 | |
|  // If the spell is cast again, any previous itemproperties matching are removed.
 | |
|  IPSafeAddItemProperty(oTarget, ItemPropertyOnHitCastSpell(127,nCasterLvl), fDuration, X2_IP_ADDPROP_POLICY_REPLACE_EXISTING);
 | |
| 
 | |
|  IPSafeAddItemProperty(oTarget, ItemPropertyVisualEffect(ITEM_VISUAL_FIRE), fDuration,X2_IP_ADDPROP_POLICY_REPLACE_EXISTING,FALSE,TRUE);
 | |
|  return;
 | |
| }
 | |
| */
 | |
| 
 | |
| void AddFlamingEffectToWeapon( object oTarget, float fDuration, int nCasterLvl)
 | |
| {
 | |
|     IPSafeAddItemProperty(oTarget, ItemPropertyDamageBonus(IP_CONST_DAMAGETYPE_COLD, IP_CONST_DAMAGEBONUS_2d8), fDuration, X2_IP_ADDPROP_POLICY_REPLACE_EXISTING);
 | |
| 
 | |
|     IPSafeAddItemProperty(oTarget, ItemPropertyVisualEffect(ITEM_VISUAL_COLD), fDuration,X2_IP_ADDPROP_POLICY_REPLACE_EXISTING,FALSE,TRUE);
 | |
|  return;
 | |
| }
 | |
| 
 | |
| void main()
 | |
| {
 | |
| 
 | |
|  /*
 | |
|  Spellcast Hook Code
 | |
|  Added 2003-07-07 by Georg Zoeller
 | |
|  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
 | |
|  effect eVis = EffectVisualEffect(VFX_IMP_PULSE_COLD);
 | |
|  eVis = EffectLinkEffects(EffectVisualEffect(VFX_IMP_FLAME_M),eVis);
 | |
|  effect eDur = EffectVisualEffect(VFX_DUR_CESSATE_POSITIVE);
 | |
|  int nDuration = 2 * GetCasterLevel(OBJECT_SELF);
 | |
|  int nMetaMagic = GetMetaMagicFeat();
 | |
|  int nCasterLvl = GetCasterLevel(OBJECT_SELF);
 | |
| 
 | |
|  //Limit nCasterLvl to 10, so it max out at +10 to the damage.
 | |
|  //Bugfix: Limiting nCasterLvl to *20* - the damage calculation
 | |
|  // divides it by 2.
 | |
|  if(nCasterLvl > 20)
 | |
|  {
 | |
|      nCasterLvl = 20;
 | |
|  }
 | |
| 
 | |
|  if (nMetaMagic == METAMAGIC_EXTEND)
 | |
|  {
 | |
|      nDuration = nDuration * 2; //Duration is +100%
 | |
|  }
 | |
| 
 | |
|  object oTarget = GetSpellTargetObject();
 | |
|  if(GetIsObjectValid(oTarget) && GetObjectType(oTarget) == OBJECT_TYPE_CREATURE)
 | |
|  {
 | |
|     // Alter the right hand weapon equipped by the creature.
 | |
|     object oWeapon1 = GetItemInSlot(INVENTORY_SLOT_RIGHTHAND, oTarget);
 | |
|     if(GetIsObjectValid(oWeapon1))
 | |
|     {
 | |
|         // If the PC has a melee weapon equipped.
 | |
|         if ( IPGetIsMeleeWeapon(oWeapon1))
 | |
|         {
 | |
|             SignalEvent(oWeapon1, EventSpellCastAt(OBJECT_SELF, GetSpellId(), FALSE));
 | |
| 
 | |
|             if (nDuration>0)
 | |
|             {
 | |
|                 // haaaack: store caster level on item for the on hit spell to work properly
 | |
|                 ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, GetItemPossessor(oWeapon1));
 | |
|                 ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eDur, GetItemPossessor(oWeapon1), TurnsToSeconds(nDuration));
 | |
|                 AddFlamingEffectToWeapon(oWeapon1, TurnsToSeconds(nDuration),nCasterLvl);
 | |
|             }
 | |
|         }
 | |
|         else
 | |
|         {
 | |
|             FloatingTextStrRefOnCreature(83615, OBJECT_SELF);
 | |
|         }
 | |
|     }
 | |
|     // Alter the left hand weapon equipped by the creature.
 | |
|     object oWeapon2 = GetItemInSlot(INVENTORY_SLOT_LEFTHAND, oTarget);
 | |
|     if(GetIsObjectValid(oWeapon2))
 | |
|     {
 | |
|         // If the PC has a melee weapon equipped.
 | |
|         if ( IPGetIsMeleeWeapon(oWeapon2))
 | |
|         {
 | |
|             SignalEvent(oWeapon2, EventSpellCastAt(OBJECT_SELF, GetSpellId(), FALSE));
 | |
| 
 | |
|             if (nDuration>0)
 | |
|             {
 | |
|                 // haaaack: store caster level on item for the on hit spell to work properly
 | |
|                 ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, GetItemPossessor(oWeapon2));
 | |
|                 ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eDur, GetItemPossessor(oWeapon2), TurnsToSeconds(nDuration));
 | |
|                 AddFlamingEffectToWeapon(oWeapon2, TurnsToSeconds(nDuration),nCasterLvl);
 | |
|             }
 | |
|         }
 | |
|         else
 | |
|         {
 | |
|             FloatingTextStrRefOnCreature(83615, OBJECT_SELF);
 | |
|         }
 | |
|     }
 | |
|     // Alter the right claw equipped by the creature.
 | |
|     object oWeapon3 = GetItemInSlot(INVENTORY_SLOT_CWEAPON_R, oTarget);
 | |
|     if(GetIsObjectValid(oWeapon3))
 | |
|     {
 | |
|         SignalEvent(oWeapon3, EventSpellCastAt(OBJECT_SELF, GetSpellId(), FALSE));
 | |
| 
 | |
|         if (nDuration>0)
 | |
|         {
 | |
|             // haaaack: store caster level on item for the on hit spell to work properly
 | |
|             ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, GetItemPossessor(oWeapon3));
 | |
|             ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eDur, GetItemPossessor(oWeapon3), TurnsToSeconds(nDuration));
 | |
|             AddFlamingEffectToWeapon(oWeapon3, TurnsToSeconds(nDuration),nCasterLvl);
 | |
|         }
 | |
|     }
 | |
|     // Alter the left claw equipped by the creature.
 | |
|     object oWeapon4 = GetItemInSlot(INVENTORY_SLOT_CWEAPON_L, oTarget);
 | |
|     if(GetIsObjectValid(oWeapon4))
 | |
|     {
 | |
|         SignalEvent(oWeapon4, EventSpellCastAt(OBJECT_SELF, GetSpellId(), FALSE));
 | |
| 
 | |
|         if (nDuration>0)
 | |
|         {
 | |
|             // haaaack: store caster level on item for the on hit spell to work properly
 | |
|             ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, GetItemPossessor(oWeapon4));
 | |
|             ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eDur, GetItemPossessor(oWeapon4), TurnsToSeconds(nDuration));
 | |
|             AddFlamingEffectToWeapon(oWeapon4, TurnsToSeconds(nDuration),nCasterLvl);
 | |
|         }
 | |
|     }
 | |
|     // Alter the bite equipped by the creature.
 | |
|     object oWeapon5 = GetItemInSlot(INVENTORY_SLOT_CWEAPON_B, oTarget);
 | |
|     if(GetIsObjectValid(oWeapon5))
 | |
|     {
 | |
|         SignalEvent(oWeapon5, EventSpellCastAt(OBJECT_SELF, GetSpellId(), FALSE));
 | |
| 
 | |
|         if (nDuration>0)
 | |
|         {
 | |
|             // haaaack: store caster level on item for the on hit spell to work properly
 | |
|             ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, GetItemPossessor(oWeapon5));
 | |
|             ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eDur, GetItemPossessor(oWeapon5), TurnsToSeconds(nDuration));
 | |
|             AddFlamingEffectToWeapon(oWeapon5, TurnsToSeconds(nDuration),nCasterLvl);
 | |
|         }
 | |
|     }
 | |
|     }
 | |
|     else
 | |
|     {
 | |
|         SendMessageToPC(OBJECT_SELF, "You must target a creature!");
 | |
|         return;
 | |
|     }
 | |
| }
 | |
| 
 | |
| 
 |