mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-21 09:30:45 +00:00
add traitor icon, bots don't ally traitors
This commit is contained in:
@@ -116,8 +116,9 @@
|
||||
* UI: basic win condition & popup DONE 9/16/2024
|
||||
* right click popup alliance option DONE 9/17/2024
|
||||
* BUG: can't ally same person twice DONE 9/18/2024
|
||||
* break alliance makes you a traitor
|
||||
* add traitor icon
|
||||
* break alliance makes you a traitor DONE 9/18/2024
|
||||
* add traitor icon DONE 9/18/2024
|
||||
* make alliance icon
|
||||
* alert play when they become traitor
|
||||
* make fake humans easier
|
||||
* click alliance sends alliance request
|
||||
@@ -146,5 +147,5 @@
|
||||
* add offline mode
|
||||
* REFACTOR: give terranullius an ID, game.player() returns terranullius
|
||||
* REFACTOR: ocean is considered TerraNullius ?
|
||||
|
||||
* Make icons svgs
|
||||
testing webhook
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 14 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 4.9 KiB |
@@ -6,6 +6,8 @@ import {Layer} from "./Layer"
|
||||
import {placeName} from "../NameBoxCalculator"
|
||||
import {TransformHandler} from "../TransformHandler"
|
||||
import {renderTroops} from "../Utils"
|
||||
import traitorIcon from '../../../../resources/images/TraitorIcon.png';
|
||||
|
||||
|
||||
class RenderInfo {
|
||||
public isVisible = true
|
||||
@@ -27,10 +29,14 @@ export class NameLayer implements Layer {
|
||||
private rand = new PseudoRandom(10)
|
||||
private renders: RenderInfo[] = []
|
||||
private seenPlayers: Set<Player> = new Set()
|
||||
private traitorIconImage: HTMLImageElement;
|
||||
|
||||
|
||||
constructor(private game: Game, private theme: Theme, private transformHandler: TransformHandler) {
|
||||
|
||||
this.traitorIconImage = new Image();
|
||||
this.traitorIconImage.src = traitorIcon;
|
||||
}
|
||||
|
||||
shouldTransform(): boolean {
|
||||
return true
|
||||
}
|
||||
@@ -112,6 +118,20 @@ export class NameLayer implements Layer {
|
||||
const nameCenterX = Math.floor(render.location.x - this.game.width() / 2)
|
||||
const nameCenterY = Math.floor(render.location.y - this.game.height() / 2)
|
||||
|
||||
const iconSize = render.fontSize * 2; // Adjust size as needed
|
||||
// const iconX = nameCenterX + render.fontSize * 2; // Position to the right of the name
|
||||
// const iconY = nameCenterY - render.fontSize / 2;
|
||||
|
||||
if (render.player.isTraitor() && this.traitorIconImage.complete) {
|
||||
context.drawImage(
|
||||
this.traitorIconImage,
|
||||
nameCenterX - iconSize / 2,
|
||||
nameCenterY - iconSize / 2,
|
||||
iconSize,
|
||||
iconSize
|
||||
);
|
||||
}
|
||||
|
||||
context.textRendering = "optimizeSpeed";
|
||||
|
||||
context.font = `${render.fontSize}px ${this.theme.font()}`;
|
||||
|
||||
@@ -111,7 +111,6 @@ export class AttackExecution implements Execution {
|
||||
}
|
||||
if (this.breakAlliance) {
|
||||
this.breakAlliance = false
|
||||
alert('set player traitor')
|
||||
this._owner.breakAllianceWith(this.target as Player)
|
||||
}
|
||||
|
||||
|
||||
@@ -41,7 +41,11 @@ export class BotExecution implements Execution {
|
||||
}
|
||||
|
||||
this.bot.incomingAllianceRequests().forEach(ar => {
|
||||
ar.accept()
|
||||
if (ar.requestor().isTraitor()) {
|
||||
ar.reject()
|
||||
} else {
|
||||
ar.accept()
|
||||
}
|
||||
})
|
||||
|
||||
if (this.neighborsTerraNullius) {
|
||||
|
||||
Reference in New Issue
Block a user