max number of boats

This commit is contained in:
evanpelle
2024-08-30 11:27:10 -07:00
parent 906412e64a
commit a3156bd50c
4 changed files with 17 additions and 2 deletions
+1
View File
@@ -33,6 +33,7 @@ export interface Config {
attackAmount(attacker: Player, defender: Player | TerraNullius): number
boatAttackAmount(attacker: Player, defender: Player | TerraNullius): number
boatMaxDistance(): number
boatMaxNumber(): number
}
export interface Theme {
+3
View File
@@ -6,6 +6,9 @@ import {pastelTheme} from "./PastelTheme";
export class DefaultConfig implements Config {
boatMaxNumber(): number {
return 3
}
boatMaxDistance(): number {
return 500
}
+8 -1
View File
@@ -44,9 +44,16 @@ export class BoatAttackExecution implements Execution {
init(mg: MutableGame, ticks: number) {
this.lastMove = ticks
this.mg = mg
this.attacker = mg.player(this.attackerID)
if (this.attacker.boats().length >= mg.config().boatMaxNumber()) {
console.log('too many boats')
this.active = false
return
}
if (this.targetID == null) {
this.target = mg.terraNullius()
} else {