118 lines
		
	
	
		
			4.0 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			118 lines
		
	
	
		
			4.0 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
//::///////////////////////////////////////////////
 | 
						|
//:: Divine Power
 | 
						|
//:: NW_S0_DivPower.nss
 | 
						|
//:: Copyright (c) 2001 Bioware Corp.
 | 
						|
//:://////////////////////////////////////////////
 | 
						|
/*
 | 
						|
    Divine Power
 | 
						|
    Evocation
 | 
						|
    Level: Clr 4, War 4
 | 
						|
    Components: V, S, DF
 | 
						|
    Casting Time: 1 action
 | 
						|
    Range: Personal
 | 
						|
    Target: The character
 | 
						|
    Duration: 1 round/level
 | 
						|
    The character gains the base attack bonus of a fighter of the character's
 | 
						|
    total character level, an enhancement bonus to Strength sufficient to raise
 | 
						|
    the character's Strength score to 18 (if it is not already 18 or higher),
 | 
						|
    and 1 temporary hit point per level.
 | 
						|
*/
 | 
						|
//:://////////////////////////////////////////////
 | 
						|
//:: Created By: Preston Watamaniuk
 | 
						|
//:: Created On: Oct 21, 2001
 | 
						|
//:://////////////////////////////////////////////
 | 
						|
/*
 | 
						|
bugfix by Kovi 2002.07.22
 | 
						|
- temporary hp was stacked
 | 
						|
- loosing temporary hp resulted in loosing the other bonuses
 | 
						|
- number of attacks was not increased (should have been a BAB increase)
 | 
						|
still problem:
 | 
						|
~ attacks are better still approximation (the additional attack is at full BAB)
 | 
						|
~ attack/ability bonuses count against the limits
 | 
						|
*/
 | 
						|
/*
 | 
						|
Fixed by StoneDK 2003.12.19
 | 
						|
to work better for epic levels and give right number of attacks.
 | 
						|
Still give extra attack at full ab.
 | 
						|
*/
 | 
						|
 | 
						|
#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
 | 
						|
 | 
						|
    //Stop stacking
 | 
						|
    RemoveEffectsFromSpell(OBJECT_SELF, SPELL_DIVINE_POWER);
 | 
						|
    //Declare major variables
 | 
						|
    object oTarget = GetSpellTargetObject();
 | 
						|
    int nLevel = GetCasterLevel(OBJECT_SELF);
 | 
						|
    int nHP = nLevel;
 | 
						|
    int nAttack = nLevel - ((nLevel*3)/4);
 | 
						|
    int nExtraAttacks = 0;
 | 
						|
    int nBAB =GetBaseAttackBonus(OBJECT_SELF);
 | 
						|
    if(GetHitDice(OBJECT_SELF)>20)
 | 
						|
    {
 | 
						|
        //EAB = (lvl-21)/2+1; lvl 40 = 10, (40-21)/2+1= 10; lvl 21 = 1, (21-21)/2+1 = 1
 | 
						|
        nBAB = nBAB - ((GetHitDice(OBJECT_SELF)-21)/2+1);
 | 
						|
        if(nAttack>5)
 | 
						|
            nAttack =5;
 | 
						|
        if(nAttack> (20-nBAB))
 | 
						|
        //Problem if 10 rogue (7BAB)/10 fighter (10BAB)/20 cleric (10EAB),
 | 
						|
        //should get 0 AB bonus, gets 3
 | 
						|
            nAttack =20-nBAB;
 | 
						|
    }
 | 
						|
    //returns the number of attacks that a cleric should have extra were he a fighter
 | 
						|
    //Number of attacks = (BAB-1)/5+1
 | 
						|
    if(nBAB <16) // If not already have 4 attacks calculate new number of attacks.
 | 
						|
        nExtraAttacks = (nBAB+ nAttack -1 )/5 - (nBAB -1 )/5;
 | 
						|
    int nStr = GetAbilityScore(oTarget, ABILITY_STRENGTH);
 | 
						|
    int nStrength = (nStr - 18) * -1;
 | 
						|
    if(nStrength < 0)
 | 
						|
    {
 | 
						|
        nStrength = 0;
 | 
						|
    }
 | 
						|
    effect eAttackMod;
 | 
						|
    int nMetaMagic = GetMetaMagicFeat();
 | 
						|
    effect eVis = EffectVisualEffect(VFX_IMP_SUPER_HEROISM);
 | 
						|
    effect eStrength = EffectAbilityIncrease(ABILITY_STRENGTH, nStrength);
 | 
						|
    effect eHP = EffectTemporaryHitpoints(nHP);
 | 
						|
    effect eAttack = EffectAttackIncrease(nAttack);
 | 
						|
    effect eDur = EffectVisualEffect(VFX_DUR_CESSATE_POSITIVE);
 | 
						|
    effect eLink = EffectLinkEffects(eAttack, eDur);
 | 
						|
    if(nExtraAttacks >0)
 | 
						|
    {
 | 
						|
        eAttackMod = EffectModifyAttacks(nExtraAttacks);
 | 
						|
        eLink = EffectLinkEffects(eLink, eAttackMod);
 | 
						|
    }
 | 
						|
    //Make sure that the strength modifier is a bonus
 | 
						|
    if(nStrength > 0)
 | 
						|
    {
 | 
						|
        eLink = EffectLinkEffects(eLink, eStrength);
 | 
						|
    }
 | 
						|
    //Meta-Magic
 | 
						|
    if(nMetaMagic == METAMAGIC_EXTEND)
 | 
						|
    {
 | 
						|
        nLevel *= 2;
 | 
						|
    }
 | 
						|
    //RemoveTempHitPoints();
 | 
						|
    //Fire cast spell at event for the specified target
 | 
						|
    SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, SPELL_DIVINE_POWER, FALSE));
 | 
						|
    //Apply Link and VFX effects to the target
 | 
						|
    ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eLink, oTarget, RoundsToSeconds(nLevel));
 | 
						|
    ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eHP, oTarget, RoundsToSeconds(nLevel));
 | 
						|
    ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget);
 | 
						|
}
 | 
						|
 |