generated from Jaysyn/ModuleTemplate
Initial Commit
Initial Commit.
This commit is contained in:
135
_module/nss/jw_combsubs_inc.nss
Normal file
135
_module/nss/jw_combsubs_inc.nss
Normal file
@@ -0,0 +1,135 @@
|
||||
#include "jw_privates_inc"
|
||||
|
||||
//DETERMINE COMBAT ROUND SUB FUNCTIONS
|
||||
|
||||
int BashDoorCheck(object oIntruder = OBJECT_INVALID);
|
||||
int DetermineClassToUse();
|
||||
|
||||
|
||||
int GetAttackCompatibility(talent tUse, int nClass);
|
||||
int MatchReflexAttacks(talent tUse);
|
||||
int MatchFortAttacks(talent tUse);
|
||||
object GetRangedAttackGroup(int bAllowFriendlyFire = FALSE);
|
||||
object GetToughestMeleeAttacker();
|
||||
object GetToughestAttacker();
|
||||
struct sSpellSelect AnalyzeCombatSituation();
|
||||
int GetAlliedHD();
|
||||
int GetEnemyHD();
|
||||
talent StartAttackLoop();
|
||||
|
||||
int UniversalSpellMatch(talent tUse);
|
||||
|
||||
|
||||
//::///////////////////////////////////////////////
|
||||
//:: Bash Doors
|
||||
//:: Copyright (c) 2002 Bioware Corp.
|
||||
//:://////////////////////////////////////////////
|
||||
/*
|
||||
Used in DetermineCombatRound to keep a
|
||||
henchmen bashing doors.
|
||||
*/
|
||||
//:://////////////////////////////////////////////
|
||||
//:: Created By: Preston Watamaniuk
|
||||
//:: Created On: April 4, 2002
|
||||
//:://////////////////////////////////////////////
|
||||
|
||||
int BashDoorCheck(object oIntruder = OBJECT_INVALID)
|
||||
{
|
||||
int bDoor = FALSE;
|
||||
//This code is here to make sure that henchmen keep bashing doors and placables.
|
||||
object oDoor = GetLocalObject(OBJECT_SELF, "NW_GENERIC_DOOR_TO_BASH");
|
||||
if(GetIsObjectValid(oDoor)&&!GetPlotFlag(oDoor))
|
||||
{
|
||||
int nDoorMax = GetMaxHitPoints(oDoor);
|
||||
int nDoorNow = GetCurrentHitPoints(oDoor);
|
||||
int nCnt = GetLocalInt(OBJECT_SELF,"NW_GENERIC_DOOR_TO_BASH_HP");
|
||||
if(!GetIsObjectValid(GetNearestCreature(CREATURE_TYPE_REPUTATION, REPUTATION_TYPE_ENEMY, OBJECT_SELF, 1, CREATURE_TYPE_PERCEPTION, PERCEPTION_SEEN))
|
||||
|| (!GetIsObjectValid(oIntruder) && !GetIsObjectValid(GetMaster())))
|
||||
{
|
||||
if(GetLocked(oDoor))
|
||||
{
|
||||
if(nDoorMax == nDoorNow)
|
||||
{
|
||||
nCnt++;
|
||||
SetLocalInt(OBJECT_SELF,"NW_GENERIC_DOOR_TO_BASH_HP", nCnt);
|
||||
}
|
||||
if(nCnt <= 0)
|
||||
{
|
||||
bDoor = TRUE;
|
||||
if(GetHasFeat(FEAT_IMPROVED_POWER_ATTACK))
|
||||
{
|
||||
ActionUseFeat(FEAT_IMPROVED_POWER_ATTACK, oDoor);
|
||||
}
|
||||
else if(GetHasFeat(FEAT_POWER_ATTACK))
|
||||
{
|
||||
ActionUseFeat(FEAT_POWER_ATTACK, oDoor);
|
||||
}
|
||||
else
|
||||
{
|
||||
ActionAttack(oDoor);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(bDoor == FALSE)
|
||||
{
|
||||
PlayVoiceChat(VOICE_CHAT_CUSS);
|
||||
DeleteLocalObject(OBJECT_SELF, "NW_GENERIC_DOOR_TO_BASH");
|
||||
DeleteLocalInt(OBJECT_SELF, "NW_GENERIC_DOOR_TO_BASH_HP");
|
||||
}
|
||||
}
|
||||
return bDoor;
|
||||
}
|
||||
|
||||
//::///////////////////////////////////////////////
|
||||
//:: Determine Class to Use
|
||||
//:: Copyright (c) 2002 Bioware Corp.
|
||||
//:://////////////////////////////////////////////
|
||||
/*
|
||||
Determines which of a NPCs three classes to
|
||||
use in DetermineCombatRound
|
||||
*/
|
||||
//:://////////////////////////////////////////////
|
||||
//:: Created By: Preston Watamaniuk
|
||||
//:: Created On: April 4, 2002
|
||||
//:://////////////////////////////////////////////
|
||||
|
||||
int DetermineClassToUse()
|
||||
{
|
||||
int nClass;
|
||||
int nTotal = GetCharacterLevel(OBJECT_SELF);
|
||||
float fTotal = IntToFloat(nTotal);
|
||||
|
||||
int nState1 = FloatToInt((IntToFloat(GetLevelByClass(GetClassByPosition(1))) / fTotal) * 100);
|
||||
MyPrintString("GENERIC SCRIPT DEBUG STRING ********** " + GetTag(OBJECT_SELF) + "Class: " + IntToString(GetClassByPosition(1)) + " %" + IntToString(nState1));
|
||||
|
||||
int nState2 = FloatToInt((IntToFloat(GetLevelByClass(GetClassByPosition(2))) / fTotal) * 100) + nState1;
|
||||
MyPrintString("GENERIC SCRIPT DEBUG STRING ********** " + GetTag(OBJECT_SELF) + "Class: " + IntToString(GetClassByPosition(2)) + " %" + IntToString(nState2));
|
||||
|
||||
int nState3 = FloatToInt((IntToFloat(GetLevelByClass(GetClassByPosition(3))) / fTotal) * 100) + nState2;
|
||||
MyPrintString("GENERIC SCRIPT DEBUG STRING ********** " + GetTag(OBJECT_SELF) + "Class: " + IntToString(GetClassByPosition(3)) + " %" + IntToString(nState3));
|
||||
|
||||
int nUseClass = d100();
|
||||
MyPrintString("GENERIC SCRIPT DEBUG STRING ********** " + "D100 Roll " + IntToString(nUseClass));
|
||||
|
||||
if(nUseClass <= nState1)
|
||||
{
|
||||
nClass = GetClassByPosition(1);
|
||||
}
|
||||
else if(nUseClass > nState1 && nUseClass <= nState2)
|
||||
{
|
||||
nClass = GetClassByPosition(2);
|
||||
}
|
||||
else
|
||||
{
|
||||
nClass = GetClassByPosition(3);
|
||||
}
|
||||
MyPrintString("GENERIC SCRIPT DEBUG STRING ********** " + GetName(OBJECT_SELF) + " Return Class = " + IntToString(nClass));
|
||||
|
||||
return nClass;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user