mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-21 07:50:45 +00:00
make fake humans harder
This commit is contained in:
@@ -151,8 +151,6 @@
|
||||
* BUG: alliance cooldown request
|
||||
* add request attack
|
||||
* add emoji button
|
||||
* buttons greyed out when not active
|
||||
* make alliance request mobile friendly
|
||||
* request to attack other players
|
||||
* make year clock
|
||||
* block user inputs if too far behind server
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import {EventBus} from "../../../core/EventBus";
|
||||
import {Cell, Game, Player, PlayerID} from "../../../core/game/Game";
|
||||
import {ClientID} from "../../../core/Schemas";
|
||||
import {manhattanDist, sourceDstOceanShore} from "../../../core/Util";
|
||||
import {manhattanDist, manhattanDistWrapped, sourceDstOceanShore} from "../../../core/Util";
|
||||
import {ContextMenuEvent, MouseUpEvent} from "../../InputHandler";
|
||||
import {SendAllianceRequestIntentEvent, SendAttackIntentEvent, SendBoatAttackIntentEvent, SendBreakAllianceIntentEvent, SendSpawnIntentEvent} from "../../Transport";
|
||||
import {TransformHandler} from "../TransformHandler";
|
||||
@@ -284,7 +284,7 @@ export class RadialMenu implements Layer {
|
||||
if (myPlayerBordersOcean && otherPlayerBordersOcean) {
|
||||
const [src, dst] = sourceDstOceanShore(this.game, myPlayer, other, this.clickedCell)
|
||||
if (src != null && dst != null) {
|
||||
if (manhattanDist(src.cell(), dst.cell()) < this.game.config().boatMaxDistance()) {
|
||||
if (manhattanDistWrapped(src.cell(), dst.cell(), this.game.width()) < this.game.config().boatMaxDistance()) {
|
||||
this.activateMenuElement(RadialElement.BoatAttack, () => {
|
||||
this.eventBus.emit(
|
||||
new SendBoatAttackIntentEvent(other.id(), this.clickedCell, null)
|
||||
|
||||
@@ -26,7 +26,7 @@ export class DefaultConfig implements Config {
|
||||
return 400
|
||||
}
|
||||
numFakeHumans(gameID: GameID): number {
|
||||
return simpleHash(gameID) % 20
|
||||
return simpleHash(gameID) % 40
|
||||
}
|
||||
turnIntervalMs(): number {
|
||||
return 100
|
||||
@@ -59,12 +59,20 @@ export class DefaultConfig implements Config {
|
||||
// speed = mag
|
||||
|
||||
if (attacker.isPlayer() && defender.isPlayer()) {
|
||||
if (attacker.type() == PlayerType.Bot && (defender.type() == PlayerType.FakeHuman || defender.type() == PlayerType.Human)) {
|
||||
if (attacker.type() == PlayerType.Bot && defender.type() == PlayerType.Human) {
|
||||
mag *= 1.2
|
||||
}
|
||||
if ((attacker.type() == PlayerType.FakeHuman || attacker.type() == PlayerType.Human) && defender.type() == PlayerType.Bot) {
|
||||
if (attacker.type() == PlayerType.Bot && defender.type() == PlayerType.FakeHuman) {
|
||||
mag *= 1.5
|
||||
}
|
||||
|
||||
|
||||
if (attacker.type() == PlayerType.Human && defender.type() == PlayerType.Bot) {
|
||||
mag *= .8
|
||||
}
|
||||
if (attacker.type() == PlayerType.FakeHuman && defender.type() == PlayerType.Bot) {
|
||||
mag *= .6
|
||||
}
|
||||
}
|
||||
|
||||
if (defender.isPlayer()) {
|
||||
@@ -124,7 +132,7 @@ export class DefaultConfig implements Config {
|
||||
// console.log(`to add ${toAdd}`)
|
||||
|
||||
if (player.type() == PlayerType.FakeHuman) {
|
||||
toAdd *= 1.0
|
||||
toAdd *= 1.1
|
||||
}
|
||||
if (player.type() == PlayerType.Bot) {
|
||||
toAdd *= .7
|
||||
|
||||
@@ -27,9 +27,9 @@ export const devConfig = new class extends DefaultConfig {
|
||||
// return 10 * 10
|
||||
// }
|
||||
|
||||
numFakeHumans(gameID: GameID): number {
|
||||
return 0
|
||||
}
|
||||
// numFakeHumans(gameID: GameID): number {
|
||||
// return 0
|
||||
// }
|
||||
|
||||
// startTroops(playerInfo: PlayerInfo): number {
|
||||
// if (playerInfo.isBot) {
|
||||
|
||||
@@ -18,6 +18,7 @@ export class FakeHumanExecution implements Execution {
|
||||
private enemy: Player | null = null
|
||||
|
||||
private rejected: Set<Player> = new Set<Player>
|
||||
private isTraitor = false
|
||||
|
||||
|
||||
constructor(private playerInfo: PlayerInfo) {
|
||||
@@ -26,6 +27,9 @@ export class FakeHumanExecution implements Execution {
|
||||
|
||||
init(mg: MutableGame, ticks: number) {
|
||||
this.mg = mg
|
||||
if (this.random.chance(2)) {
|
||||
this.isTraitor = true
|
||||
}
|
||||
}
|
||||
|
||||
tick(ticks: number) {
|
||||
@@ -106,11 +110,11 @@ export class FakeHumanExecution implements Execution {
|
||||
}
|
||||
|
||||
if (this.random.chance(2)) {
|
||||
if (!this.player.isAlliedWith(enemies[0]) || this.random.chance(30)) {
|
||||
if (!this.player.isAlliedWith(enemies[0]) || (this.random.chance(90) && this.isTraitor)) {
|
||||
this.sendAttack(enemies[0])
|
||||
}
|
||||
} else {
|
||||
if (!this.player.isAlliedWith(enemies[0]) || this.random.chance(60)) {
|
||||
if (!this.player.isAlliedWith(enemies[0]) || (this.random.chance(180) && this.isTraitor)) {
|
||||
this.sendAttack(this.random.randElement(enemies))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user