|
|
|
@ -64,8 +64,6 @@ void Monster::STRATEGY::GOBLIN_BOW(Monster&m,float fElapsedTime,std::string stra |
|
|
|
|
WINDUP, |
|
|
|
|
}; |
|
|
|
|
#pragma endregion |
|
|
|
|
|
|
|
|
|
m.F(A::ATTACK_COOLDOWN)+=fElapsedTime; |
|
|
|
|
|
|
|
|
|
switch(m.phase){ |
|
|
|
|
case INITIALIZE_PERCEPTION:{ |
|
|
|
@ -73,6 +71,8 @@ void Monster::STRATEGY::GOBLIN_BOW(Monster&m,float fElapsedTime,std::string stra |
|
|
|
|
m.phase=MOVE; |
|
|
|
|
}break; |
|
|
|
|
case MOVE:{ |
|
|
|
|
m.F(A::ATTACK_COOLDOWN)+=fElapsedTime; |
|
|
|
|
|
|
|
|
|
float distToPlayer=m.GetDistanceFrom(game->GetPlayer()->GetPos()); |
|
|
|
|
|
|
|
|
|
const bool outsideMaxShootingRange=distToPlayer>=ConfigPixelsArr("Stand Still and Shoot Range",1); |
|
|
|
@ -103,12 +103,14 @@ void Monster::STRATEGY::GOBLIN_BOW(Monster&m,float fElapsedTime,std::string stra |
|
|
|
|
float targetDir=m.B(A::RANDOM_DIRECTION)==CW?dirFromPlayer+PI/4:dirFromPlayer-PI/4; |
|
|
|
|
m.target=game->GetPlayer()->GetPos()+vf2d{m.F(A::RANDOM_RANGE),targetDir}.cart(); |
|
|
|
|
RUN_TOWARDS(m,fElapsedTime,"Run Towards"); |
|
|
|
|
}else{ //Only the stand still and shoot range remains...
|
|
|
|
|
}else |
|
|
|
|
if(m.F(A::ATTACK_COOLDOWN)>=ConfigFloat("Attack Reload Time")/2.f){ //Only the stand still and shoot range remains, which is twice as fast...
|
|
|
|
|
PrepareToShoot(); |
|
|
|
|
} |
|
|
|
|
}break; |
|
|
|
|
case WINDUP:{ |
|
|
|
|
m.F(A::SHOOT_TIMER)-=fElapsedTime; |
|
|
|
|
m.UpdateFacingDirection(game->GetPlayer()->GetPos()); |
|
|
|
|
if(m.F(A::SHOOT_TIMER)<=0){
|
|
|
|
|
geom2d::line pointTowardsPlayer(m.GetPos(),game->GetPlayer()->GetPos()); |
|
|
|
|
vf2d extendedLine=pointTowardsPlayer.upoint(1.1f); |
|
|
|
@ -116,7 +118,9 @@ void Monster::STRATEGY::GOBLIN_BOW(Monster&m,float fElapsedTime,std::string stra |
|
|
|
|
Arrow&arrow=static_cast<Arrow&>(*BULLET_LIST.back()); |
|
|
|
|
arrow.PointToBestTargetPath(m.F(A::PERCEPTION_LEVEL)); |
|
|
|
|
|
|
|
|
|
m.F(A::ATTACK_COOLDOWN)=0.f; |
|
|
|
|
m.F(A::PERCEPTION_LEVEL)=std::min(ConfigFloat("Maximum Perception Level"),m.F(A::PERCEPTION_LEVEL)+ConfigFloat("Perception Level Increase")); |
|
|
|
|
m.PerformAnimation("IDLE",m.GetFacingDirectionToTarget(game->GetPlayer()->GetPos())); |
|
|
|
|
m.phase=MOVE; |
|
|
|
|
} |
|
|
|
|
m.B(A::RANDOM_DIRECTION)=util::random()%2; |
|
|
|
|