File tree Expand file tree Collapse file tree 1 file changed +12
-12
lines changed Expand file tree Collapse file tree 1 file changed +12
-12
lines changed Original file line number Diff line number Diff line change @@ -269,20 +269,20 @@ export class BotBehavior {
269269 }
270270
271271 selectNearestIslandEnemy ( ) {
272- const allPlayers = this . game . players ( ) ;
273- const filteredPlayers = allPlayers . filter (
274- ( p ) =>
275- // Don't spam boats into players that are more than twice as large as us
276- p . troops ( ) <= this . player . troops ( ) * 2 &&
277- ! this . player . isFriendly ( p ) &&
278- p !== this . player ,
279- ) ;
272+ const myBorder = this . player . borderTiles ( ) ;
273+ if ( myBorder . size === 0 ) return ;
274+
275+ const filteredPlayers = this . game . players ( ) . filter ( ( p ) => {
276+ if ( p === this . player ) return false ;
277+ if ( ! p . isAlive ( ) ) return false ;
278+ if ( p . borderTiles ( ) . size === 0 ) return false ;
279+ if ( this . player . isFriendly ( p ) ) return false ;
280+ // Don't spam boats into players more than 2x our troops
281+ return p . troops ( ) <= this . player . troops ( ) * 2 ;
282+ } ) ;
280283
281284 if ( filteredPlayers . length > 0 ) {
282- const playerCenter = calculateBoundingBoxCenter (
283- this . game ,
284- this . player . borderTiles ( ) ,
285- ) ;
285+ const playerCenter = calculateBoundingBoxCenter ( this . game , myBorder ) ;
286286
287287 const sortedPlayers = filteredPlayers
288288 . map ( ( filteredPlayer ) => {
You can’t perform that action at this time.
0 commit comments