Amon_PRC8/_removed/hench/x0_ch_hen_combat.nss

104 lines
3.6 KiB
Plaintext
Raw Permalink Normal View History

2025-04-03 19:00:46 -04:00
//::///////////////////////////////////////////////
//:: Associate: End of Combat End
//:: NW_CH_AC3
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
Calls the end of combat script every round
*/
//:://////////////////////////////////////////////
//:: Created By: Preston Watamaniuk
//:: Created On: Oct 16, 2001
//:://////////////////////////////////////////////
//:://////////////////////////////////////////////
//:: Modified By: Deva Winblood
//:: Modified On: Jan 16th, 2008
//:: Added Support for Mounted Combat Feat Support
//:://////////////////////////////////////////////
#include "x0_inc_henai"
void main()
{
// Fixes some Bioware bugs
object oBiowareBash = GetLocalObject(OBJECT_SELF, "NW_GENERIC_DOOR_TO_BASH");
if (GetIsObjectValid(oBiowareBash))
{
// This happens if we have a door transition that was destroyed
if (GetCurrentHitPoints(oBiowareBash) <= 0)
{
ResetHenchmenState();
}
else
{
// Just use feats as appropriate rather than having to damage the
// object first (default Bioware behavior)
if(GetHasFeat(FEAT_IMPROVED_POWER_ATTACK))
{
ActionUseFeat(FEAT_IMPROVED_POWER_ATTACK, oBiowareBash);
return;
}
else if(GetHasFeat(FEAT_POWER_ATTACK))
{
ActionUseFeat(FEAT_POWER_ATTACK, oBiowareBash);
return;
}
else
{
ActionAttack(oBiowareBash);
return;
}
}
}
// Don't do anything if we have have been recently commanded
if (GetLocalInt(OBJECT_SELF, "bmc_active"))
{
// See if we have a valid creature to attack
object oTarget = GetLocalObject(OBJECT_SELF, "bmc_attacktarget");
if (GetIsObjectValid(oTarget) && GetIsEnemy(oTarget) && !GetIsDead(oTarget))
{
DetermineCombatRound(oTarget);
return;
}
else
{
DeleteLocalObject(OBJECT_SELF, "bmc_attacktarget");
}
oTarget = GetAttackTarget();
if (GetIsObjectValid(oTarget) && GetIsEnemy(oTarget) && !GetIsDead(oTarget))
{
DetermineCombatRound(oTarget);
return;
}
oTarget = GetAttemptedAttackTarget();
if (GetIsObjectValid(oTarget) && GetIsEnemy(oTarget) && !GetIsDead(oTarget))
{
DetermineCombatRound(oTarget);
return;
}
return;
}
if (!GetLocalInt(GetModule(),"X3_NO_MOUNTED_COMBAT_FEAT"))
{ // set variables on target for mounted combat
DeleteLocalInt(OBJECT_SELF,"bX3_LAST_ATTACK_PHYSICAL");
DeleteLocalInt(OBJECT_SELF,"nX3_HP_BEFORE");
DeleteLocalInt(OBJECT_SELF,"bX3_ALREADY_MOUNTED_COMBAT");
} // set variables on target for mounted combat
if(!GetSpawnInCondition(NW_FLAG_SET_WARNINGS))
{
HenchmenCombatRound(OBJECT_INVALID);
}
if(GetSpawnInCondition(NW_FLAG_END_COMBAT_ROUND_EVENT))
{
SignalEvent(OBJECT_SELF, EventUserDefined(1003));
}
}