//:://///////////////////////////////////////////// //:: Associate: On Damaged //:: NW_CH_AC6 //:: Copyright (c) 2001 Bioware Corp. //::////////////////////////////////////////////// /* If already fighting then ignore, else determine combat round */ //::////////////////////////////////////////////// //:: Created By: Preston Watamaniuk //:: Created On: Nov 19, 2001 //::////////////////////////////////////////////// //::////////////////////////////////////////////// //:: Modified By: Deva Winblood //:: Modified On: Jan 17th, 2008 //:: Added Support for Mounted Combat Feat Support //::////////////////////////////////////////////// #include "X0_INC_HENAI" #include "x3_inc_horse" // Determine whether to switch to new attacker int SwitchTargets(object oCurTarget, object oNewEnemy); void main() { // Don't do anything if we have have been recently commanded QWE if (GetLocalInt(OBJECT_SELF, "commandstatus")) { return; } object oAttacker = GetLastDamager(); object oTarget = GetAttackTarget(); object oDamager = oAttacker; 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) GetHitDice(oCurTarget) || // or we just received more than 25% of our hp in damage GetTotalDamageDealt() > (GetMaxHitPoints(OBJECT_SELF) / 4) ) ); }