mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-07-01 20:02:08 +00:00
created PlayerType enum add FakeHuman type
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import {Executor} from "../core/execution/ExecutionManager";
|
||||
import {Cell, MutableGame, PlayerEvent, PlayerID, MutablePlayer, TileEvent, Player, Game, BoatEvent, Tile} from "../core/Game";
|
||||
import {Cell, MutableGame, PlayerEvent, PlayerID, MutablePlayer, TileEvent, Player, Game, BoatEvent, Tile, PlayerType} from "../core/Game";
|
||||
import {createGame} from "../core/GameImpl";
|
||||
import {EventBus} from "../core/EventBus";
|
||||
import {Config} from "../core/configuration/Config";
|
||||
@@ -248,7 +248,7 @@ export class ClientGame {
|
||||
if (enemyShoreDists.length > 0 && bordersOcean) {
|
||||
enemyShoreClosest = enemyShoreDists[0].dist
|
||||
}
|
||||
if (enemyShoreClosest < borderTileClosest / 4) {
|
||||
if (enemyShoreClosest < borderTileClosest / 6) {
|
||||
this.sendBoatAttackIntent(targetID, enemyShoreDists[0].tile.cell(), this.gs.config().boatAttackAmount(this.myPlayer, owner))
|
||||
} else {
|
||||
this.sendAttackIntent(targetID, cell, this.gs.config().attackAmount(this.myPlayer, owner))
|
||||
@@ -275,7 +275,7 @@ export class ClientGame {
|
||||
type: "spawn",
|
||||
clientID: this.id,
|
||||
name: this.playerName,
|
||||
isBot: false,
|
||||
playerType: PlayerType.Human,
|
||||
x: cell.x,
|
||||
y: cell.y
|
||||
})
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {Cell, Game, Player} from "../../core/Game"
|
||||
import {Cell, Game, Player, PlayerType} from "../../core/Game"
|
||||
import {PseudoRandom} from "../../core/PseudoRandom"
|
||||
import {calculateBoundingBox} from "../../core/Util"
|
||||
import {Theme} from "../../core/configuration/Config"
|
||||
@@ -85,7 +85,7 @@ export class NameRenderer {
|
||||
|
||||
isVisible(render: RenderInfo, min: Cell, max: Cell): boolean {
|
||||
const ratio = (max.x - min.x) / Math.max(20, (render.boundingBox.max.x - render.boundingBox.min.x))
|
||||
if (render.player.isBot()) {
|
||||
if (render.player.type() == PlayerType.Bot) {
|
||||
if (ratio > 35) {
|
||||
return false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user