mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-21 14:30:44 +00:00
cleanup: Nations rarely launch nukes (#1948)
## Description: In #1860, some unused code was left behind. Remove the unused code. ## Please complete the following: - [x] I have added screenshots for all UI updates - [x] I process any text displayed to the user through translateText() and I've added it to the en.json file - [x] I have added relevant tests to the test directory - [x] I confirm I have thoroughly tested these changes and take full responsibility for any bugs introduced
This commit is contained in:
committed by
evanpelle
parent
d83a66196a
commit
e216b8a22b
@@ -1,6 +1,5 @@
|
||||
import {
|
||||
Cell,
|
||||
Difficulty,
|
||||
Execution,
|
||||
Game,
|
||||
Gold,
|
||||
@@ -239,53 +238,6 @@ export class FakeHumanExecution implements Execution {
|
||||
}
|
||||
}
|
||||
|
||||
private shouldAttack(other: Player): boolean {
|
||||
if (this.player === null) throw new Error("not initialized");
|
||||
|
||||
if (this.player.isOnSameTeam(other)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const shouldAttack = this.attackChance(other);
|
||||
|
||||
// Consider betrayal for allies
|
||||
if (shouldAttack && this.player.isAlliedWith(other)) {
|
||||
return this.maybeConsiderBetrayal(other);
|
||||
}
|
||||
|
||||
return shouldAttack;
|
||||
}
|
||||
|
||||
private attackChance(other: Player): boolean {
|
||||
if (this.player === null) throw new Error("not initialized");
|
||||
|
||||
if (this.player.isAlliedWith(other)) {
|
||||
return this.shouldDiscourageAttack(other)
|
||||
? this.random.chance(200)
|
||||
: this.random.chance(50);
|
||||
} else {
|
||||
return this.shouldDiscourageAttack(other) ? this.random.chance(4) : true;
|
||||
}
|
||||
}
|
||||
|
||||
private shouldDiscourageAttack(other: Player) {
|
||||
if (other.isTraitor()) {
|
||||
return false;
|
||||
}
|
||||
const difficulty = this.mg.config().gameConfig().difficulty;
|
||||
if (
|
||||
difficulty === Difficulty.Hard ||
|
||||
difficulty === Difficulty.Impossible
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
if (other.type() !== PlayerType.Human) {
|
||||
return false;
|
||||
}
|
||||
// Only discourage attacks on Humans who are not traitors on easy or medium difficulty.
|
||||
return true;
|
||||
}
|
||||
|
||||
private maybeSendEmoji(enemy: Player) {
|
||||
if (this.player === null) throw new Error("not initialized");
|
||||
if (enemy.type() !== PlayerType.Human) return;
|
||||
|
||||
Reference in New Issue
Block a user