UW2_PRC8/_module/nss/x2_s2_mghtyrage.nss
Jaysyn904 5197ad9a4d Initial upload
Initial upload
2023-09-25 20:24:01 -04:00

201 lines
8.2 KiB
Plaintext

//::///////////////////////////////////////////////
//:: Mighty Rage
//:: X2_S2_MghtyRage
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
+ 12 Str
+ 12 Con
+ 3 Will Save
- 2 Ac
if maximum str is already reached before or during rage the barbarian gets the following:
+ slashing bonus damage
+ attack bonus
or if maximum con is reached:
+ temporary hp
*/
//:://////////////////////////////////////////////
//:: Created By: Andrew Nobbs
//:: Created On: May 16, 2003
//:://////////////////////////////////////////////
//:://////////////////////////////////////////////
//:: Rewritten By: Mizzajl
//:: Created On: Oct 24, 2004
//:://////////////////////////////////////////////
//:: Edited By: Bogo Rath
//:://////////////////////////////////////////////
#include "x2_inc_itemprop"
#include "prc_class_const"
int GetInnateAbility(object oCreature, int nAbility)
{
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, EffectAbilityIncrease(nAbility, 12), oCreature, 0.01);
return GetAbilityScore(oCreature, nAbility) - 12;
}
//------------------------------------------------------------------------------
// GZ, 2003-07-09
// If the character calling this function from a spellscript has the thundering
// rage feat, his weapons are upgraded to deafen and cause 2d6 points of massive
// criticals
//------------------------------------------------------------------------------
void CheckAndApplyThunderingRage(int nRounds)
{
if (GetHasFeat(988, OBJECT_SELF))
{
object oWeapon = GetItemInSlot(INVENTORY_SLOT_RIGHTHAND);
if (GetIsObjectValid(oWeapon))
{
IPSafeAddItemProperty(oWeapon, ItemPropertyDamageBonus(IP_CONST_DAMAGETYPE_SONIC, IP_CONST_DAMAGEBONUS_2d12), RoundsToSeconds(nRounds), X2_IP_ADDPROP_POLICY_REPLACE_EXISTING,FALSE,TRUE);
IPSafeAddItemProperty(oWeapon, ItemPropertyVisualEffect(ITEM_VISUAL_SONIC), RoundsToSeconds(nRounds), X2_IP_ADDPROP_POLICY_REPLACE_EXISTING,FALSE,TRUE);
IPSafeAddItemProperty(oWeapon, ItemPropertyOnHitProps(IP_CONST_ONHIT_DEAFNESS,IP_CONST_ONHIT_SAVEDC_26,IP_CONST_ONHIT_DURATION_50_PERCENT_2_ROUNDS), RoundsToSeconds(nRounds), X2_IP_ADDPROP_POLICY_REPLACE_EXISTING,FALSE,TRUE);
}
oWeapon = GetItemInSlot(INVENTORY_SLOT_LEFTHAND);
if (GetIsObjectValid(oWeapon) )
{
IPSafeAddItemProperty(oWeapon, ItemPropertyDamageBonus(IP_CONST_DAMAGETYPE_SONIC, IP_CONST_DAMAGEBONUS_2d12), RoundsToSeconds(nRounds), X2_IP_ADDPROP_POLICY_REPLACE_EXISTING,FALSE,TRUE);
IPSafeAddItemProperty(oWeapon,ItemPropertyVisualEffect(ITEM_VISUAL_SONIC), RoundsToSeconds(nRounds), X2_IP_ADDPROP_POLICY_REPLACE_EXISTING,FALSE,TRUE);
IPSafeAddItemProperty(oWeapon, ItemPropertyOnHitProps(IP_CONST_ONHIT_DEAFNESS,IP_CONST_ONHIT_SAVEDC_26,IP_CONST_ONHIT_DURATION_50_PERCENT_2_ROUNDS), RoundsToSeconds(nRounds), X2_IP_ADDPROP_POLICY_REPLACE_EXISTING,FALSE,TRUE);
}
}
}
//------------------------------------------------------------------------------
// GZ, 2003-07-09
// If the character calling this function from a spellscript has the terrifying
// rage feat, he gets an aura of fear for the specified duration
// The saving throw against this fear is a check opposed to the character's
// intimidation skill
//------------------------------------------------------------------------------
void CheckAndApplyTerrifyingRage(int nRounds)
{
if (GetHasFeat(989, OBJECT_SELF))
{
effect eAOE = EffectAreaOfEffect(AOE_MOB_FEAR,"x2_s2_terrage_A", "","");
ApplyEffectToObject(DURATION_TYPE_TEMPORARY,eAOE,OBJECT_SELF,RoundsToSeconds(nRounds));
}
}
//------------------------------------------------------------------------------
// GZ, 2003-07-09
// Hub function for the epic barbarian feats that upgrade rage. Call from
// the end of the barbarian rage spellscript
//------------------------------------------------------------------------------
void CheckAndApplyEpicRageFeats(int nRounds)
{
CheckAndApplyThunderingRage(nRounds);
CheckAndApplyTerrifyingRage(nRounds);
}
void main()
{
if(!GetHasFeatEffect(FEAT_BARBARIAN_RAGE))
{
//Declare major variables
int nLevel = GetLevelByClass(CLASS_TYPE_BARBARIAN)
+ GetLevelByClass(CLASS_TYPE_FRE_BERSERKER)
+ GetLevelByClass(CLASS_TYPE_BATTLERAGER)
+ GetLevelByClass(CLASS_TYPE_CELEBRANT_SHARESS)
+ GetLevelByClass(CLASS_TYPE_BLACK_BLOOD_CULTIST)
+ GetLevelByClass(CLASS_TYPE_RUNESCARRED)
+ GetLevelByClass(CLASS_TYPE_TOTEM_RAGER)
+ GetLevelByClass(CLASS_TYPE_FRE_BERSERKER)
+ GetLevelByClass(CLASS_TYPE_FROSTRAGER);
int nHD = GetHitDice(OBJECT_SELF);
int nSave = 3;
int nStrIncrease = 12;
int nConIncrease = 12;
// Stacks str and con so that none is lost if you reach the +12 limit
int nStrenght = GetAbilityScore(OBJECT_SELF, ABILITY_STRENGTH);
int nDexterity = GetAbilityScore(OBJECT_SELF, ABILITY_DEXTERITY);
int nConstitution = GetAbilityScore(OBJECT_SELF, ABILITY_CONSTITUTION);
int nDur = 3 + GetAbilityModifier(ABILITY_CONSTITUTION) + nConIncrease;
int nBaseStr = GetInnateAbility(OBJECT_SELF, ABILITY_STRENGTH);
int nBaseCon = GetInnateAbility(OBJECT_SELF, ABILITY_CONSTITUTION);
int nOverCapStr = nStrenght - nBaseStr - 0 + nStrIncrease;
int nOverCapCon = nConstitution - nBaseCon - 0 + nConIncrease;
if(nOverCapStr > 12)
{
nStrIncrease = nStrIncrease - nOverCapStr;
}
if(nOverCapCon > 12)
{
nConIncrease = nConIncrease - nOverCapCon;
}
//end of calculation :)
PlayVoiceChat(VOICE_CHAT_BATTLECRY2);
//Determine the duration by getting the con modifier after being modified
effect eStr = EffectAbilityIncrease(ABILITY_STRENGTH, nStrIncrease);
effect eCon = EffectAbilityIncrease(ABILITY_CONSTITUTION, nConIncrease);
effect eSave = EffectSavingThrowIncrease(SAVING_THROW_WILL, nSave);
effect eAC = EffectACDecrease(4, AC_DODGE_BONUS);
effect eDur = EffectVisualEffect(VFX_DUR_CESSATE_POSITIVE);
// adds Damage, AB and HP
effect eAB = EffectAttackIncrease(nOverCapStr/2);
effect eBonusDamage = EffectDamageIncrease(nOverCapStr/2, DAMAGE_TYPE_SLASHING);
effect eHP = EffectTemporaryHitpoints((nOverCapCon/2) * nHD);
effect eLink = EffectLinkEffects(eCon, eStr);
eLink = EffectLinkEffects(eLink, eSave);
eLink = EffectLinkEffects(eLink, eAC);
eLink = EffectLinkEffects(eLink, eDur);
//checks if any str is lost because of the +12 limit
if(nOverCapStr > 12)
{
//check if the char is NOT a dexer
if(GetHasFeat(FEAT_WEAPON_FINESSE, OBJECT_SELF) == TRUE)
{
if(nStrenght > nDexterity)
{
//only aply if str is higher than dex
eLink = EffectLinkEffects(eLink, eAB);
}
}
else // if you dont have weapon finesse you get the AB even if dex is higher
{
eLink = EffectLinkEffects(eLink, eAB);
}
// dexers always gets more damage even if dex is higher
eLink = EffectLinkEffects(eLink, eBonusDamage);
}
SignalEvent(OBJECT_SELF, EventSpellCastAt(OBJECT_SELF, SPELLABILITY_BARBARIAN_RAGE, FALSE));
//Make effect extraordinary
eLink = ExtraordinaryEffect(eLink);
effect eVis = EffectVisualEffect(VFX_IMP_IMPROVE_ABILITY_SCORE); //Change to the Rage VFX
if (nDur > 12)
{
//Apply the VFX impact and effects
DelayCommand(0.02, ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eLink, OBJECT_SELF, RoundsToSeconds(nDur)));
//checks if any con is lost because of the +12 limit
//hp could not be linked, losing hp whould result in lose of all bonuses
if(nOverCapCon > 12)
{
DelayCommand(0.02, ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eHP, OBJECT_SELF, RoundsToSeconds(nDur)));
}
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, OBJECT_SELF) ;
// 2003-07-08, Georg: Rage Epic Feat Handling
CheckAndApplyEpicRageFeats(nDur);
}
}
}