NPCs only attack target when friendly, more bonus for larger attack vs defender troops

This commit is contained in:
Evan
2024-12-30 13:55:30 -08:00
parent ba67ac9507
commit c4061e8848
2 changed files with 5 additions and 5 deletions
+1 -1
View File
@@ -221,7 +221,7 @@ export class DefaultConfig implements Config {
if (defender.isPlayer()) {
return {
attackerTroopLoss: within(defender.troops() / (5 * attackTroops), .5, 2) * mag,
attackerTroopLoss: within(defender.troops() / (5 * attackTroops), .1, 10) * mag,
defenderTroopLoss: defender.troops() / defender.numTilesOwned(),
tilesPerTickUsed: within(defender.troops() / (5 * attackTroops), .2, 1.5) * speed
}
+4 -4
View File
@@ -160,13 +160,13 @@ export class FakeHumanExecution implements Execution {
}
const target = this.player.allies()
.filter(ally => this.player.relation(ally) >= Relation.Neutral)
.filter(ally => this.player.relation(ally) == Relation.Friendly)
.filter(ally => ally.targets().length > 0)
.map(ally => ({ ally: ally, t: ally.targets() }))[0] ?? null
.map(ally => ({ ally: ally, t: ally.targets()[0] }))[0] ?? null
if (target != null) {
if (target != null && !this.player.isAlliedWith(target.t)) {
this.player.updateRelation(target.ally, -20)
this.enemy = target.t[0]
this.enemy = target.t
this.lastEnemyUpdateTick = this.mg.ticks()
this.mg.addExecution(new EmojiExecution(this.player.id(), target.ally.id(), "👍"))
}