//::////////////////////////////////////////////////// //:: NW_C2_DEFAULT6 //:: Default OnDamaged handler /* If already fighting then ignore, else determine combat round */ //::////////////////////////////////////////////////// //:: Copyright (c) 2002 Floodgate Entertainment //:: Created By: Naomi Novik //:: Created On: 12/22/2002 //::////////////////////////////////////////////////// //::////////////////////////////////////////////////// //:: Modified By: Deva Winblood //:: Modified On: Jan 17th, 2008 //:: Added Support for Mounted Combat Feat Support //::////////////////////////////////////////////////// #include "nw_i0_generic" #include "x3_inc_horse" void main() { ExecuteScript("prc_npc_damaged", OBJECT_SELF); object oDamager = GetLastDamager(); object oMe=OBJECT_SELF; int nHPBefore; if (!GetLocalInt(GetModule(),"X3_NO_MOUNTED_COMBAT_FEAT")) if (GetHasFeat(FEAT_MOUNTED_COMBAT)&&HorseGetIsMounted(OBJECT_SELF)) { // see if can negate some damage if (GetLocalInt(OBJECT_SELF,"bX3_LAST_ATTACK_PHYSICAL")) { // last attack was physical nHPBefore=GetLocalInt(OBJECT_SELF,"nX3_HP_BEFORE"); if (!GetLocalInt(OBJECT_SELF,"bX3_ALREADY_MOUNTED_COMBAT")) { // haven't already had a chance to use this for the round SetLocalInt(OBJECT_SELF,"bX3_ALREADY_MOUNTED_COMBAT",TRUE); int nAttackRoll=GetBaseAttackBonus(oDamager)+d20(); int nRideCheck=GetSkillRank(SKILL_RIDE,OBJECT_SELF)+d20(); if (nRideCheck>=nAttackRoll&&!GetIsDead(OBJECT_SELF)) { // averted attack if (GetIsPC(oDamager)) SendMessageToPC(oDamager,GetName(OBJECT_SELF)+GetStringByStrRef(111991)); //if (GetIsPC(OBJECT_SELF)) SendMessageToPCByStrRef(OBJECT_SELF,111992"); if (GetCurrentHitPoints(OBJECT_SELF) (GetMaxHitPoints(OBJECT_SELF) / 4) || (GetHitDice(oDamager) - 2) > GetHitDice(oTarget) ) ) ) { // Switch targets DetermineCombatRound(oDamager); } } } // Send the user-defined event signal if(GetSpawnInCondition(NW_FLAG_DAMAGED_EVENT)) { SignalEvent(OBJECT_SELF, EventUserDefined(EVENT_DAMAGED)); } }