Initial upload
Initial upload
This commit is contained in:
83
_module/nss/sha_disallo_devc.nss
Normal file
83
_module/nss/sha_disallo_devc.nss
Normal file
@@ -0,0 +1,83 @@
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::://
|
||||
//:::::::::::::::::::: Shayan's Disallow Dev. Crit Script :::::::::::::::::::://
|
||||
//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::://
|
||||
//:: Written By: Shayan
|
||||
//:: Contact: mail_shayan@yahoo.com
|
||||
|
||||
//:: Use this to check whether the PC has Devestating critical, and if so
|
||||
//:: de-level them (until they have no devesating scritical feats, and then
|
||||
//:: re-level them.
|
||||
void CheckForDevestatingCritical(object oPC);
|
||||
|
||||
//:: Give the player levels. (Can be negative)
|
||||
void GiveLevel(object oPC, int Levels);
|
||||
|
||||
void GiveLevel(object oPC, int Levels)
|
||||
{
|
||||
int i = 1;
|
||||
int XP = 0;
|
||||
Levels += GetHitDice(oPC);
|
||||
|
||||
while(i <= Levels)
|
||||
{
|
||||
XP += 1000*(i - 1);
|
||||
i++;
|
||||
}
|
||||
SetXP(oPC, XP);
|
||||
}
|
||||
|
||||
int CheckIfPCHasDevestatingCriticalFeat(object oPC)
|
||||
{
|
||||
int i = 495;
|
||||
int HasDFeat = FALSE;
|
||||
//495-532 Are constants for devestating criticals
|
||||
while(i <= 532)
|
||||
{
|
||||
if(GetHasFeat(i, oPC))
|
||||
{
|
||||
//The PC has one of those feats... so delevel 1 level.
|
||||
GiveLevel(oPC, -1);
|
||||
HasDFeat = TRUE;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
//Dev crit on Dwarven Waraxe.
|
||||
if(GetHasFeat(955, oPC))
|
||||
{
|
||||
GiveLevel(oPC, -1);
|
||||
HasDFeat = TRUE;
|
||||
}
|
||||
|
||||
return HasDFeat;
|
||||
}
|
||||
|
||||
void CheckForDevestatingCritical(object oPC)
|
||||
{
|
||||
if(GetIsPC(oPC))
|
||||
{
|
||||
int i = 0;
|
||||
//Idiot proofing: What if the player was level 40, was deleveled to 32 to remove Dev. Crit..
|
||||
// but then say took Dev Crit again at 36, which would mean the OnPLayerLevelUp script
|
||||
// would cause him to delevel to 35, and give him xp only enough to level up to 36...
|
||||
// This would mean the player will end up at level 36.. but was level 40 to start with >.<
|
||||
// This method 'idiot' proofs this script.
|
||||
int LevelBefore = GetLocalInt(oPC, "Level_Before");
|
||||
if(LevelBefore == 0 || GetHitDice(oPC) > LevelBefore)
|
||||
{
|
||||
LevelBefore = GetHitDice(oPC);
|
||||
SetLocalInt(oPC, "Level_Before", LevelBefore);
|
||||
}
|
||||
while(CheckIfPCHasDevestatingCriticalFeat(oPC))
|
||||
{
|
||||
i++;
|
||||
}
|
||||
if(i > 0)
|
||||
{
|
||||
SendMessageToPC(oPC, "Devestating Critical has been dissabled, please re-level without the feat.");
|
||||
SendMessageToPC(oPC, "This was done to preserve caster classes and allow more damage from critical hits.");
|
||||
DelayCommand(1.0, GiveLevel(oPC, LevelBefore - GetHitDice(oPC)));
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user