void UndeadGideon::AI_STATE_AttackFar() { DFLOAT fHeight = (DFLOAT)fabs(m_vTargetPos.y - m_MoveObj.GetPos().y); //SCHLEGZ 4/22/98 4:51:21 PM: sanity check if(m_hTarget == DNULL && m_nCurMetacmd != MC_FIRE_STAND && m_nCurMetacmd != MC_JUMP) { if(fHeight <= m_vDims.y) SetNewState(STATE_SearchVisualTarget); else ComputeState(); return; } m_fStimuli[SIGHT] = VEC_DIST(m_MoveObj.GetPos(),m_vTargetPos); DBOOL bAbove = (m_vTargetPos.y - m_MoveObj.GetPos().y) > 0; MC_FaceTarget(); Metacmd--; switch(Metacmd) { case 1: if(m_fStimuli[SIGHT] <= (m_fSeeingDist * 0.75) || m_nCurMetacmd == MC_FIRE_STAND || (bAbove && fHeight > m_vDims.y)) { MC_Fire_Stand(); } else { if(m_fStimuli[SIGHT] < (m_fSeeingDist * 0.20)) ComputeState(); else MC_Walk(); } break; case 2: if((m_fStimuli[SIGHT] < (m_fSeeingDist * 0.20)) && m_nCurMetacmd != MC_JUMP || (bAbove && fHeight > m_vDims.y)) { ComputeState(); } else if(m_fStimuli[SIGHT] < (m_fSeeingDist * 0.30) || m_nCurMetacmd == MC_JUMP || IsLedge(m_MoveObj.GetForwardVector())) { MC_Jump(); } else MC_Walk(); break; case 3: ComputeState(); break; } return; }
void CultistAI::AI_STATE_AttackFar() { DFLOAT fHeight = (DFLOAT)fabs(m_vTargetPos.y - m_MoveObj.GetPos().y); //SCHLEGZ 4/22/98 4:51:21 PM: sanity check if(m_hTarget == DNULL) { if(fHeight <= m_vDims.y) SetNewState(STATE_SearchVisualTarget); else ComputeState(); return; } m_fStimuli[SIGHT] = VEC_DIST(m_MoveObj.GetPos(),m_vTargetPos); DBOOL bAbove = (m_vTargetPos.y - m_MoveObj.GetPos().y) > 0; switch(Metacmd) { case 1: MC_FaceTarget(); break; case 2: MC_BestWeapon(); break; case 3: if(m_fStimuli[SIGHT] <= (m_fSeeingDist * 0.75) || m_nCurMetacmd == MC_FIRE_STAND || fHeight > m_vDims.y) { MC_Fire_Stand(); } else Metacmd++; break; case 4: if(m_fStimuli[SIGHT] > (m_fSeeingDist * 0.75)) { MC_FaceTarget(); Metacmd--; if(!IsLedge(m_MoveObj.GetForwardVector()) && fHeight <= m_vDims.y && m_nCurMetacmd != MC_FIRE_STAND ) { if(m_nInjuredLeg) MC_Walk(); else MC_Fire_Run(); } else { MC_Fire_Stand(); } } else Metacmd++; break; case 5: ComputeState(); break; } return; }
void DeathShroud::AI_STATE_AttackFar() { DFLOAT fHeight = (DFLOAT)fabs(m_vTargetPos.y - m_MoveObj.GetPos().y); //SCHLEGZ 4/22/98 4:51:21 PM: sanity check if(m_hTarget == DNULL && m_nCurMetacmd != MC_FIRE_STAND) { if(fHeight <= m_vDims.y) SetNewState(STATE_SearchVisualTarget); else ComputeState(); return; } m_fStimuli[SIGHT] = VEC_DIST(m_MoveObj.GetPos(),m_vTargetPos); MC_FaceTarget(); Metacmd--; switch(Metacmd) { case 1: MC_Fade(DFALSE); break; case 2: if(m_fStimuli[SIGHT] <= (m_fSeeingDist * 0.66) || m_nCurMetacmd == MC_FIRE_STAND || fHeight > m_vDims.y) { MC_Fire_Stand(); } else { Metacmd++; } break; case 3: MC_Fade(DTRUE); break; case 4: if(m_fStimuli[SIGHT] <= (m_fSeeingDist * 0.33) || fHeight > m_vDims.y) Metacmd++; else MC_Walk(); break; case 5: ComputeState(); break; } return; }
void OpheliaREV::AI_STATE_AttackFar() { DFLOAT fHeight = (DFLOAT)fabs(m_vTargetPos.y - m_MoveObj.GetPos().y); //SCHLEGZ 4/22/98 4:51:21 PM: sanity check if(m_hTarget == DNULL) { if(fHeight <= m_vDims.y) SetNewState(STATE_SearchVisualTarget); else ComputeState(); return; } m_fStimuli[SIGHT] = VEC_DIST(m_MoveObj.GetPos(),m_vTargetPos); DBOOL bAbove = (m_vTargetPos.y - m_MoveObj.GetPos().y) > 0; CWeapon* pW = m_InventoryMgr.GetCurrentWeapon(); if(pW == DNULL) { SetNewState(STATE_Idle); return; } switch(Metacmd) { case 1: MC_FaceTarget(); break; case 2: MC_BestWeapon(); break; case 3: if(m_fStimuli[SIGHT] <= (m_fSeeingDist * 0.75) || m_nCurMetacmd == MC_FIRE_STAND || m_nCurMetacmd == MC_FIRE_CROUCH || fHeight > m_vDims.y) { if((fHeight > m_vDims.y && !bAbove) || m_nCurMetacmd == MC_FIRE_CROUCH || m_fStimuli[HEALTH] < 0.5f || pW->GetType() == WEAP_SNIPERRIFLE) { MC_Fire_Crouch(); } else { MC_Fire_Stand(); } } else Metacmd++; break; case 4: if(m_fStimuli[SIGHT] > (m_fSeeingDist * 0.75)) { MC_FaceTarget(); Metacmd--; if(!IsLedge(m_MoveObj.GetForwardVector()) && fHeight <= m_vDims.y && m_nCurMetacmd != MC_FIRE_CROUCH && pW->GetType() != WEAP_SNIPERRIFLE) { if(m_nInjuredLeg) MC_Walk(); else MC_Fire_Run(); } else { MC_Fire_Crouch(); } } else Metacmd++; break; case 5: ComputeState(); break; } return; }
void Prophet::AI_STATE_AttackClose() { DFLOAT fHeight = (DFLOAT)fabs(m_vTargetPos.y - m_MoveObj.GetPos().y); //SCHLEGZ 4/22/98 4:51:21 PM: sanity check if(m_hTarget == DNULL) { if(fHeight <= m_vDims.y) SetNewState(STATE_SearchVisualTarget); else ComputeState(); return; } m_fStimuli[SIGHT] = VEC_DIST(m_MoveObj.GetPos(),m_vTargetPos); DBOOL bAbove = (m_vTargetPos.y - m_MoveObj.GetPos().y) > 0; switch(Metacmd) { case 1: MC_FaceTarget(); break; case 2: MC_BestWeapon(); break; case 3: if(m_fStimuli[SIGHT] <= (m_fSeeingDist * 0.33) || m_nCurMetacmd == MC_FIRE_STAND || m_nCurMetacmd == MC_FIRE_CROUCH) { if(m_nDodgeFlags & FORWARD || m_nDodgeFlags & BACKWARD || m_fStimuli[HEALTH] < 0.5f || m_nCurMetacmd == MC_FIRE_CROUCH || (fHeight > m_vDims.y && !bAbove)) { MC_Fire_Crouch(); } else { MC_Fire_Stand(); } } else Metacmd++; break; case 4: if(m_fStimuli[SIGHT] > (m_fSeeingDist * 0.33) && m_fStimuli[SIGHT] < (m_fSeeingDist * 0.5)) { MC_FaceTarget(); Metacmd--; if(!IsLedge(m_MoveObj.GetForwardVector()) && fHeight <= m_vDims.y && m_nCurMetacmd != MC_FIRE_CROUCH) { if(m_nInjuredLeg) MC_Walk(); else { if(m_nDodgeFlags & FORWARD || m_nDodgeFlags & BACKWARD || m_fStimuli[HEALTH] < 0.5f) MC_Fire_Crawl(); else MC_Fire_Run(); } } else { MC_Fire_Crouch(); } } else Metacmd++; break; case 5: ComputeState(); break; } return; }
void GremlinAI::AI_STATE_AttackFar() { //SCHLEGZ 4/22/98 4:51:21 PM: sanity check if(m_hTarget == DNULL) { ComputeState(); return; } DFLOAT fHeight = (DFLOAT)fabs(m_vTargetPos.y - m_MoveObj.GetPos().y); m_fStimuli[SIGHT] = VEC_DIST(m_MoveObj.GetPos(),m_vTargetPos); DBOOL bAbove = (m_vTargetPos.y - m_MoveObj.GetPos().y) > 0; MC_FaceTarget(); Metacmd--; switch(Metacmd) { case 1: { if (m_nCurMetacmd != MC_TAUNT_BOLD) { if (IsRandomChance(40)) { MC_Taunt_Bold(); Metacmd--; } else Metacmd++; } else { if(m_pServerDE->GetModelPlaybackState(m_hObject) & MS_PLAYDONE) Metacmd++; } break; } case 2: if(m_fStimuli[SIGHT] <= (m_fSeeingDist * 0.75) || m_nCurMetacmd == MC_FIRE_STAND || (bAbove && fHeight > m_vDims.y)) { MC_Fire_Stand(); } else { if(m_fStimuli[SIGHT] < (m_fSeeingDist * 0.33)) ComputeState(); else MC_Walk(); } break; case 3: if((m_fStimuli[SIGHT] < (m_fSeeingDist * 0.33)) && m_nCurMetacmd != MC_JUMP) { ComputeState(); } else if(m_fStimuli[SIGHT] < (m_fSeeingDist * 0.4) || m_nCurMetacmd == MC_JUMP || IsLedge(m_MoveObj.GetForwardVector())) { MC_Jump(); } else Metacmd++; break; default: ComputeState(); break; } return; }