|
|
|
@ -54,6 +54,7 @@ void Monster::STRATEGY::BOAR(Monster&m,float fElapsedTime,std::string strategy){ |
|
|
|
|
MOVE, |
|
|
|
|
SCRATCH, |
|
|
|
|
CHARGE, |
|
|
|
|
RECOVERY, |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
switch(m.phase){ |
|
|
|
@ -61,25 +62,50 @@ void Monster::STRATEGY::BOAR(Monster&m,float fElapsedTime,std::string strategy){ |
|
|
|
|
float distToPlayer=geom2d::line<float>(m.GetPos(),game->GetPlayer()->GetPos()).length(); |
|
|
|
|
if(distToPlayer>=ConfigInt("Closein Range")/100.f*24){ |
|
|
|
|
m.RemoveBuff(BuffType::SLOWDOWN); |
|
|
|
|
m.targetAcquireTimer=0.f; |
|
|
|
|
RUN_TOWARDS(m,fElapsedTime,"Run Towards"); |
|
|
|
|
}else |
|
|
|
|
if(distToPlayer<=ConfigInt("Backpedal Range")/100.f*24){ |
|
|
|
|
Key prevFacingDirection=m.GetFacingDirection(); |
|
|
|
|
m.AddBuff(BuffType::SLOWDOWN,INFINITE,(100-ConfigInt("Backpedal Movespeed"))/100.f); |
|
|
|
|
m.targetAcquireTimer=0.f; |
|
|
|
|
RUN_AWAY(m,fElapsedTime,"Run Away"); |
|
|
|
|
m.UpdateFacingDirection(game->GetPlayer()->GetPos()); |
|
|
|
|
}else{ |
|
|
|
|
m.PerformOtherAnimation(0); |
|
|
|
|
m.F(A::CASTING_TIMER)=m.GetCurrentAnimation().GetTotalAnimationDuration(); |
|
|
|
|
m.F(A::CASTING_TIMER)=ConfigInt("Ground Scratch Count")*m.GetCurrentAnimation().GetTotalAnimationDuration(); |
|
|
|
|
m.phase=PhaseName::SCRATCH; |
|
|
|
|
} |
|
|
|
|
}break; |
|
|
|
|
case PhaseName::SCRATCH:{ |
|
|
|
|
m.RemoveBuff(BuffType::SLOWDOWN); |
|
|
|
|
|
|
|
|
|
m.F(A::CASTING_TIMER)-=fElapsedTime; |
|
|
|
|
if(m.F(A::CASTING_TIMER)<=0.f){ |
|
|
|
|
m.PerformShootAnimation(); |
|
|
|
|
m.phase=PhaseName::CHARGE; |
|
|
|
|
|
|
|
|
|
vf2d chargeTargetPoint=geom2d::line<float>(m.GetPos(),game->GetPlayer()->GetPos()).rpoint(ConfigFloat("Charge Distance")/100.f*24); |
|
|
|
|
|
|
|
|
|
m.target=chargeTargetPoint; |
|
|
|
|
m.AddBuff(BuffType::SPEEDBOOST,INFINITE,ConfigFloat("Charge Movespeed")/100.f-1); |
|
|
|
|
} |
|
|
|
|
}break; |
|
|
|
|
case PhaseName::CHARGE:{ |
|
|
|
|
|
|
|
|
|
float distToTarget=geom2d::line<float>(m.GetPos(),m.target).length(); |
|
|
|
|
if(m.bumpedIntoTerrain||distToTarget<4.f){ |
|
|
|
|
m.phase=PhaseName::RECOVERY; |
|
|
|
|
m.F(A::CHARGE_COOLDOWN)=ConfigFloat("Charge Recovery Time"); |
|
|
|
|
m.PerformIdleAnimation(); |
|
|
|
|
}else{ |
|
|
|
|
m.targetAcquireTimer=INFINITY; //Don't acquire a new target.
|
|
|
|
|
RUN_TOWARDS(m,fElapsedTime,"Run Towards"); |
|
|
|
|
} |
|
|
|
|
}break; |
|
|
|
|
case PhaseName::RECOVERY:{ |
|
|
|
|
m.F(A::CHARGE_COOLDOWN)-=fElapsedTime; |
|
|
|
|
m.targetAcquireTimer=0.f; |
|
|
|
|
m.RemoveBuff(BuffType::SPEEDBOOST); |
|
|
|
|
if(m.F(A::CHARGE_COOLDOWN)<=0)m.phase=PhaseName::MOVE; |
|
|
|
|
}break; |
|
|
|
|
} |
|
|
|
|
} |