AOC_PRC8/_module/nss/ondamage_aoc.nss
Jaysyn904 5e558169a0 Initial Commit
Initial Commit
2025-04-03 11:24:16 -04:00

141 lines
4.2 KiB
Plaintext

//::///////////////////////////////////////////////
//:: Name x2_def_ondamage
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
Default OnDamaged script
*/
//:://////////////////////////////////////////////
//:: Created By: Keith Warner
//:: Created On: June 11/03
//:://////////////////////////////////////////////
void main()
{
object oMod = GetModule();
object oPC = GetLastDamager();
int oDam = GetTotalDamageDealt();
string oAtt;
string oSelf;
string oMon;
object oDest;
int oHit;
int oMhit;
int oPCdam;
int oSDTaken;
int oUDTaken;
int oSDDealt;
int oUDDealt;
int iSFhit;
int iSFdam;
int iFBhit;
int iFBdam;
int oHWdam;
int oHWhit;
int iCHdam;
int iCHhit;
int iHwar = GetLocalInt(oMod, "hwar_on");
int iArenaChall = GetLocalInt(oMod, "challenge");
int iSFDuel = GetLocalInt(oMod, "duel_on");
int iFinalBattle = GetLocalInt(oPC, "final_on");
//FloatingTextStringOnCreature("duel on: "+IntToString(GetLocalInt(oMod, "duel_on")), oPC);
int oSwing = GetLocalInt(oPC, "pc_swing");
int iCHswing = GetLocalInt(oPC, "pc_CHswing");
int iSFswing = GetLocalInt(oPC, "pc_SFswing");
int iFBswing = GetLocalInt(oPC, "pc_FBswing");
int iHWswing = GetLocalInt(oPC, "pc_HWswing");
if (GetIsPC(oPC))
{
oHit = GetLocalInt(oPC, "pc_hit");
oPCdam = GetLocalInt(oPC, "player_dd");
++oHit;
oPCdam+=oDam;
if (oHit>oSwing){oHit=oSwing;}
SetLocalInt(oPC, "pc_hit", oHit);
SetLocalInt(oPC, "player_dd", oPCdam);
if (iHwar==1)
{
oHWdam = GetLocalInt(oPC, "pc_HWdam");
oHWhit = GetLocalInt(oPC, "pc_HWhit");
++oHWhit;
oHWdam+=oDam;
if (oHWhit>iHWswing){oHWhit=iHWswing;}
SetLocalInt(oPC, "pc_HWhit", oHWhit);
SetLocalInt(oPC, "pc_HWdam", oHWdam);
}
if (iArenaChall==1)
{
iCHdam = GetLocalInt(oPC, "pc_CHdam");
iCHhit = GetLocalInt(oPC, "pc_CHhit");
iCHdam+=oDam;
++iCHhit;
if (iCHhit>iCHswing){iCHhit=iCHswing;}
SetLocalInt(oPC, "pc_CHhit", iCHhit);
SetLocalInt(oPC, "pc_CHdam", iCHdam);
}
if (iSFDuel==1)
{
iSFdam = GetLocalInt(oPC, "pc_SFdam");
iSFhit = GetLocalInt(oPC, "pc_SFhit");
iSFdam+=oDam;
++iSFhit;
if (iSFhit>iSFswing){iSFhit=iSFswing;}
SetLocalInt(oPC, "pc_SFhit", iSFhit);
SetLocalInt(oPC, "pc_SFdam", iSFdam);
//FloatingTextStringOnCreature("dam "+IntToString(GetLocalInt(oPC, "pc_SFdam")), oPC);
//FloatingTextStringOnCreature("hit "+IntToString(GetLocalInt(oPC, "pc_SFhit")), oPC);
}
if (iFinalBattle==1)
{
iFBdam = GetLocalInt(oPC, "pc_FBdam");
iFBhit = GetLocalInt(oPC, "pc_FBhit");
iFBdam+=oDam;
++iFBhit;
if (iFBhit>iFBswing){iFBhit=iFBswing;}
SetLocalInt(oPC, "pc_FBhit", iFBhit);
SetLocalInt(oPC, "pc_FBdam", iFBdam);
}
//FloatingTextStringOnCreature("hit"+IntToString(iCHhit), oPC);
}
else
{
if ((iArenaChall==1)||(iSFDuel==1)){return;}
oAtt = GetResRef(oPC);
oSelf = GetResRef(OBJECT_SELF);
oAtt+="_dd";
oSelf+="_dt";
oSDTaken = GetLocalInt(oMod, oSelf);
oUDTaken = oSDTaken+oDam;
oSDDealt = GetLocalInt(oMod, oAtt);
oUDDealt = oSDDealt+oDam;
SetLocalInt(oMod, oSelf, oUDTaken);
SetLocalInt(oMod, oAtt, oUDDealt);
}
//--------------------------------------------------------------------------
// GZ: 2003-10-16
// Make Plot Creatures Ignore Attacks
//--------------------------------------------------------------------------
if (GetPlotFlag(OBJECT_SELF))
{
return;
}
//--------------------------------------------------------------------------
// Execute old NWN default AI code
//--------------------------------------------------------------------------
ExecuteScript("nw_c2_default6", OBJECT_SELF);
}