void AIEnemyJunkbotTrack::Attack() { int pyt = aio->player_input->GetYTilePos(); int th = abs((pyt+aio->player_input->GetTileHeight()) - (ytile + aiinput->GetTileHeight())); if( ((pyt > ytile) && (th < 1)) || ((pyt <= ytile) && (th <= 2)) ) { FacePlayer(); if(fabs(aio->player_input->GetXLoc()-xpos) > attack_range) { ChangeState(AIS_CHASE); } else { if(!aiinput->GetStateFlags()->S_DAMAGED) { aioutput->SetAttack(0); aioutput->moveButton4(); } } } else ChangeState(AIS_PATROL); }
void AIEnemyJunkbotTrack::Chase() { int pyt = aio->player_input->GetYTilePos(); int th = abs((pyt+aio->player_input->GetTileHeight()) - (ytile + aiinput->GetTileHeight())); FacePlayer(); if( (((pyt > ytile) && (th < 1)) || ((pyt <= ytile) && (th <= 2))) && (abs(aio->player_input->GetXTilePos()-xtile) <= chase_range)) { if(xpos < (aio->player_input->GetXLoc()-attack_range)) { if(!IsStopBlock()) aioutput->moveRight(); else aioutput->moveStop(); } else if(xpos > (aio->player_input->GetXLoc()+attack_range)) { if(!IsStopBlock()) aioutput->moveLeft(); else aioutput->moveStop(); } else { aioutput->moveStop(); ChangeState(AIS_ATTACK); } } else ChangeState(AIS_PATROL); }
void AIEnemyElitePistolGaurd::Attack() { /*#ifdef _DEBUG char temp[512]; sprintf(temp, "{AI}[ElitePistol] (fire:%f) (fire_time:%f) (time:%f)", fire, fire_time, time); OutputDebugString(temp); #endif*/ int pyt = aio->player_input->GetYTilePos(); int th = abs(ytile - pyt); if(aiinput->GetStateFlags()->S_DAMAGED || aiinput->GetStateFlags()->S_INVULNERABLE) fire = fire_time; FacePlayer(); if( (fabs(aio->player_input->GetXLoc() - xpos) <= attack_range ) && (th <= tileheight)) { if(fire <= 0) { if(!aiinput->GetStateFlags()->S_DAMAGED) { fire = fire_time; aioutput->moveButton4(); } } else fire -= time; } else ChangeState(AIS_PATROL); }
void AIEnemyDocRope::Wait() { FacePlayer(); aioutput->moveStop(); if(fabs(aio->player_input->GetXLoc()-xpos) < (attack_range)) { ChangeState(AIS_ATTACK); } }
void AIEnemyGMonster::Attack() { /*#ifdef _DEBUG char temp[512]; sprintf(temp, "{AI}[GM] (state:%d)", current_state); OutputDebugString(temp); #endif*/ /*if(aiinput->GetDirection()) { if(GetAIMapCord(xtile, ytile) == BLK_STOPRIGHT ) { aioutput->moveStop(); ChangeAttackState((attackstate++)%2); } } else { if(GetAIMapCord(xtile, ytile) == BLK_STOPLEFT) { aioutput->moveStop(); ChangeAttackState((attackstate++)%2); } }*/ int pxt = aio->player_input->GetXTilePos(); int pyt = aio->player_input->GetYTilePos(); float pxl = aio->player_input->GetXLoc(); if( (abs(pyt - ytile) <=1) && (fabs(pxl - xpos) >= attack_range) ) { aioutput->moveStop(); ChangeState(AIS_CHASE); return; } if(!aiinput->GetStateFlags()->S_ATTACK && !aiinput->GetStateFlags()->S_DAMAGED) { switch(attackstate) { case 0: FacePlayer(); aioutput->SetAttack(0); aioutput->moveButton4(); ChangeAttackState(1); break; case 1: aioutput->SetDirection(!aiinput->GetDirection()); aioutput->SetAttack(0); aioutput->moveButton4(); ChangeAttackState(0); break; } } }
void AIEnemyEliteBatonGaurd::Wait() { FacePlayer(); if(abs(aio->player_input->GetXTilePos()-xtile) < chase_range) { aioutput->moveStop(); ChangeState(AIS_CHASE); // throw_star=0; swing_sword=0; } }
void AIEnemyGreenNinja::Wait() { FacePlayer(); if( (abs(aio->player_input->GetXTilePos()-xtile) < chase_range) || ( wait_timer <= 0) ) { wait_timer = wait_time; ChangeState(AIS_CHASE); // throw_star=0; swing_sword=0; } else wait_timer -= time; }
void AIEnemyEliteBatonGaurd::Chase() { int pyt = aio->player_input->GetYTilePos(); int th = abs(ytile - pyt); /*#ifdef _DEBUG char temp[256]; sprintf(temp, "[EBG](xt:%d)(yt:%d)(stop:%d)(state:chase)", xtile, ytile, IsStopBlock()); OutputDebugString(temp); #endif*/ if(FacePlayer()) { swing_sword=0; } if(IsStopBlock()) { ignore_player = true; aioutput->moveStop(); ChangeState(AIS_PATROL); } if((th <= tileheight) && (abs(aio->player_input->GetXTilePos()-xtile) <= chase_range)) { if(xpos < (aio->player_input->GetXLoc()-attack_range)) { if(!IsStopBlock()) aioutput->moveRight(); else aioutput->moveStop(); } else if(xpos > (aio->player_input->GetXLoc()+attack_range)) { if(!IsStopBlock()) aioutput->moveLeft(); else aioutput->moveStop(); } else { aioutput->moveStop(); ChangeState(AIS_ATTACK); } } else { aioutput->moveStop(); ChangeState(AIS_PATROL); } }
void AIEnemyPunk::Attack() { int pyt = aio->player_input->GetYTilePos(); int th = abs(ytile - pyt); if(th <= tileheight ) { if(FacePlayer()) { punch = 0; // throw_star=0; } if(fabs(aio->player_input->GetXLoc()-xpos) > attack_range) { ChangeState(AIS_CHASE); } else { if(punch <=0) { if(!aiinput->GetStateFlags()->S_DAMAGED) { punch = punch_time; aioutput->SetAttack(0); aioutput->moveButton4(); } } else punch-=time; } } else ChangeState(AIS_PATROL); }
void AIEnemyDocRope::Attack() { int pyt = aio->player_input->GetYTilePos(); int th = ytile - pyt; // int temp; FacePlayer(); if((th >= 0 ) && (th <= tileheight) && (fabs(aio->player_input->GetXLoc()-xpos) < (attack_range))) { if(throw_star <= 0) { if(!aiinput->GetStateFlags()->S_DAMAGED) { aioutput->SetAttack(2); aioutput->moveButton4(); } } else throw_star -= time; } else ChangeState(AIS_WAIT); }
void AIEnemyGMonster::Chase() { int pxt = aio->player_input->GetXTilePos(); int pyt = aio->player_input->GetYTilePos(); float pxl = aio->player_input->GetXLoc(); /*#ifdef _DEBUG char temp[512]; sprintf(temp, "{AI}[GM] (state:%d)(tileheight:%d)", current_state, aiinput->GetTileHeight()); OutputDebugString(temp); #endif*/ if(abs(pxt - xtile) > chase_range ) { aioutput->moveStop(); ChangeState(AIS_PATROL); } if(IsStopBlock()) { // was_stop_block = true; // xstoploc = xtile; ignore_player = true; aioutput->moveStop(); ChangeState(AIS_PATROL); } else if( (abs(pyt - ytile) <=1) && (fabs(pxl - xpos) <= attack_range) ) { aioutput->moveStop(); ChangeAttackState(0); aioutput->moveStop(); ChangeState(AIS_ATTACK); } else { FacePlayer(); if(aiinput->GetDirection()) aioutput->moveRight(); else aioutput->moveLeft(); } }
void AIEnemyPunk::Chase() { int pyt = aio->player_input->GetYTilePos(); int th = abs(ytile - pyt); if(FacePlayer()) { punch=0; } if(IsStopBlock()) { ignore_player = true; aioutput->moveStop(); ChangeState(AIS_PATROL); } if((th <= tileheight) && (abs(aio->player_input->GetXTilePos()-xtile) <= chase_range)) { if(xpos < (aio->player_input->GetXLoc()-attack_range)) { if(!IsStopBlock()) aioutput->moveRight(); else aioutput->moveStop(); } else if(xpos > (aio->player_input->GetXLoc()+attack_range)) { if(!IsStopBlock()) aioutput->moveLeft(); else aioutput->moveStop(); } else { aioutput->moveStop(); ChangeState(AIS_ATTACK); } } else ChangeState(AIS_PATROL); }
void AIEnemyGreenNinja::Chase() { int pyt = aio->player_input->GetYTilePos(); int th = abs((pyt+aio->player_input->GetTileHeight()) - (ytile + aiinput->GetTileHeight())); if(FacePlayer()) { swing_sword=0; } if(IsStopBlock()) { ignore_player = true; aioutput->moveStop(); ChangeState(AIS_PATROL); } if( (((pyt > ytile) && (th < 1)) || ((pyt <= ytile) && (th <= 4))) && (abs(aio->player_input->GetXTilePos()-xtile) <= chase_range)) { if(xpos < (aio->player_input->GetXLoc()-attack_range)) { if(!IsStopBlock()) aioutput->moveRight(); else aioutput->moveStop(); } else if(xpos > (aio->player_input->GetXLoc()+attack_range)) { if(!IsStopBlock()) aioutput->moveLeft(); else aioutput->moveStop(); } else { aioutput->moveStop(); ChangeState(AIS_ATTACK); } } else ChangeState(AIS_PATROL); }
void BaseEnemy::Wait() { aioutput->moveStop(); FacePlayer(); }
void AIEnemyEliteBatonGaurd::Attack() { int pyt = aio->player_input->GetYTilePos(); int th = abs(ytile - pyt); /*#ifdef _DEBUG char temp[256]; sprintf(temp, "[EBG](xt:%d)(yt:%d)(stop:%d)(state:attack)", xtile, ytile, IsStopBlock()); OutputDebugString(temp); #endif*/ switch(attackstate) { case AIS_ATTACK_ATTACK: if(th <= tileheight ) { if(FacePlayer()) { swing_sword = 0; // throw_star=0; } if(fabs(aio->player_input->GetXLoc()-xpos) > attack_range) { aioutput->moveStop(); ChangeState(AIS_CHASE); } else { if(swing_sword <=0) { if(!aiinput->GetStateFlags()->S_DAMAGED) { swing_sword = time_sword; aioutput->SetAttack(0); aioutput->moveButton4(); } } else swing_sword-=time; } } else { aioutput->moveStop(); ChangeState(AIS_PATROL); } break; case AIS_ATTACK_WAIT: //attackstate = AIS_ATTACK_ATTACK; if(th <= tileheight ) { if(fabs(aio->player_input->GetXLoc()-xpos) > attack_range) { aioutput->moveStop(); ChangeState(AIS_CHASE); } else { if(!aiinput->GetStateFlags()->S_DAMAGED) { aioutput->SetAttack(0); aioutput->moveButton4(); movetoxtile = aio->player_input->GetXTilePos() + (int)pow(-1, (rand()%2)+1)*5; aioutput->moveStop(); ChangeState(AIS_MOVE); } } } else { aioutput->moveStop(); ChangeState(AIS_PATROL); } break; } }
void AIEnemyGreenNinja::Attack() { int pyt = aio->player_input->GetYTilePos(); int th = abs((pyt+aio->player_input->GetTileHeight()) - (ytile + aiinput->GetTileHeight())); /*#ifdef _DEBUG char temp[256]; sprintf(temp, "{AI}[GreenNinja] (th:%d)", th); OutputDebugString(temp); #endif*/ switch(attackstate) { case AIS_ATTACK_ATTACK: if( ((pyt > ytile) && (th < 1)) || ((pyt <= ytile) && (th <= 4)) ) { if(FacePlayer()) { swing_sword = 0; // throw_star=0; } if(fabs(aio->player_input->GetXLoc()-xpos) > attack_range) { ChangeState(AIS_CHASE); } else { if(swing_sword <=0) { if(!aiinput->GetStateFlags()->S_DAMAGED) { swing_sword = time_sword; aioutput->SetAttack(0); aioutput->moveButton4(); } } else swing_sword-=time; } } else ChangeState(AIS_PATROL); break; case AIS_ATTACK_WAIT: //attackstate = AIS_ATTACK_ATTACK; if( ((pyt > ytile) && (th < 1)) || ((pyt <= ytile) && (th <= 4)) ) { if(fabs(aio->player_input->GetXLoc()-xpos) > attack_range) { ChangeState(AIS_CHASE); } else { if(!aiinput->GetStateFlags()->S_DAMAGED) { aioutput->SetAttack(0); aioutput->moveButton4(); movetoxtile = aio->player_input->GetXTilePos() + (int)pow(-1, (rand()%2)+1)*5; ChangeState(AIS_MOVE); } } } else ChangeState(AIS_PATROL); break; } }
void AIEnemyAdvancedGeneticMonster2::Attack() { /*#ifdef _DEBUG char temp[256]; sprintf(temp, "[AGM] attackstate (xtile:%d)(ytile:%d)(stop:%d)(direction:%d)", xtile, ytile, IsStopBlock(), aiinput->GetDirection()); OutputDebugString(temp); #endif*/ int pyt = aio->player_input->GetYTilePos(); int th = abs(ytile - pyt); //if(th > attack_height) ChangeState(AIS_PATROL); if(IsStopBlock()) { ignore_player = true; ChangeState(AIS_PATROL); return; } switch(attackstate) { /* case AIS_AGM_INTRO: if(!aiinput->GetStateFlags()->S_ATTACK && !aiinput->GetStateFlags()->S_DAMAGED) { FacePlayer(); aioutput->SetAttack(1); aioutput->moveButton4(); ChangeAttackState(AIS_AGM_SLASH); } break;*/ case AIS_AGM_SLASH: if(aiinput->GetStateFlags()->S_ON_GROUND && !aiinput->GetStateFlags()->S_ATTACK && !aiinput->GetStateFlags()->S_DAMAGED) { if(fabs(aio->player_input->GetXLoc()-xpos) <= attack_range) { FacePlayer(); aioutput->SetAttack(0); aioutput->moveButton4(); ChangeAttackState(AIS_AGM_JUMP); } else ChangeState(AIS_CHASE); } break; case AIS_AGM_JUMP: if(!aiinput->GetStateFlags()->S_ATTACK && !aiinput->GetStateFlags()->S_DAMAGED) { FacePlayer(); aioutput->moveButton3(); ChangeAttackState(AIS_AGM_SLASH2); } break; case AIS_AGM_SLASH2: if(aiinput->GetStateFlags()->S_ON_GROUND && !aiinput->GetStateFlags()->S_ATTACK && !aiinput->GetStateFlags()->S_DAMAGED) { if(fabs(aio->player_input->GetXLoc()-xpos) <= attack_range) { FacePlayer(); aioutput->SetAttack(0); aioutput->moveButton4(); ChangeAttackState(AIS_AGM_RUN); } else ChangeState(AIS_CHASE); } break; /*case AIS_AGM_SPIKE: if(aiinput->GetStateFlags()->S_ON_GROUND && !aiinput->GetStateFlags()->S_ATTACK && !aiinput->GetStateFlags()->S_DAMAGED) { FacePlayer(); aioutput->SetAttack(2); aioutput->moveButton4(); ChangeAttackState(AIS_AGM_RUN); run_direction = aiinput->GetDirection(); } break;*/ case AIS_AGM_RUN: if(!aiinput->GetStateFlags()->S_ATTACK) { if(!IsStopBlock()) { if(run_direction) aioutput->moveRight(); else aioutput->moveLeft(); } else { aioutput->moveStop(); ChangeAttackState(AIS_AGM_SLASH); } } default: break; } /* switch(attackstate) { case AIS_AGM_INTRO: if(!aiinput->GetStateFlags()->S_ATTACK && !aiinput->GetStateFlags()->S_DAMAGED) { FacePlayer(); aioutput->SetAttack(1); aioutput->moveButton4(); ChangeAttackState(AIS_AGM_SLASH); } break; case AIS_AGM_SLASH: if((th < attack_height) && (fabs(aio->player_input->GetXLoc()-xpos) <= attack_range)) { if(!aiinput->GetStateFlags()->S_ATTACK && !aiinput->GetStateFlags()->S_JUMP && !aiinput->GetStateFlags()->S_DAMAGED) { FacePlayer(); aioutput->SetAttack(0); aioutput->moveButton4(); } if(damaged) { damaged = false; if(damage_count == 2) { ChangeAttackState(AIS_AGM_SPIKE); } else { damage_count++; ChangeAttackState(AIS_AGM_JUMP); } } } else if(th > attack_height) ChangeState(AIS_PATROL); else ChangeState(AIS_CHASE); break; case AIS_AGM_JUMP: if(!aiinput->GetStateFlags()->S_ATTACK && !aiinput->GetStateFlags()->S_DAMAGED) { aioutput->moveButton3(); ChangeAttackState(AIS_AGM_SLASH); } break; case AIS_AGM_SPIKE: if(!aiinput->GetStateFlags()->S_ATTACK && !aiinput->GetStateFlags()->S_DAMAGED) { aioutput->SetAttack(2); aioutput->moveButton4(); ChangeAttackState(AIS_AGM_SLASH); damage_count = 0; } break; default: break; }*/ }