Skip to content

Commit b33e945

Browse files
committed
Some fixes
1 parent 31b597f commit b33e945

File tree

4 files changed

+33
-15
lines changed

4 files changed

+33
-15
lines changed

agot-bg-game-server/src/client/EntireGameComponent.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -274,13 +274,13 @@ export default class EntireGameComponent extends Component<EntireGameComponentPr
274274
<div className="text-center">
275275
{this.settings.dragonWar && <>
276276
<p>
277-
<h6>Dragon war</h6>
277+
<h6>Dragon War</h6>
278278
<small>Balon Greyjoy and Aeron Damphair (DwD) have been nerfed!</small>
279279
</p>
280280
</>}
281281
{this.settings.dragonRevenge && <>
282282
<p>
283-
<h6>Dragon revenge</h6>
283+
<h6>Dragon Revenge</h6>
284284
<small>The last remaining non-dragon land unit will transform into a dragon!</small>
285285
</p>
286286
</>}

agot-bg-game-server/src/client/MapComponent.tsx

+18-3
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import _ from "lodash";
2929
import PartialRecursive from "../utils/PartialRecursive";
3030
import { land, sea } from "../common/ingame-game-state/game-data-structure/regionTypes";
3131
import PlaceOrdersGameState from "../common/ingame-game-state/planning-game-state/place-orders-game-state/PlaceOrdersGameState";
32+
import PlaceOrdersForVassalsGameState from "../common/ingame-game-state/planning-game-state/place-orders-for-vassals-game-state/PlaceOrdersForVassalsGameState";
3233
import UseRavenGameState from "../common/ingame-game-state/action-game-state/use-raven-game-state/UseRavenGameState";
3334
import { renderRegionTooltip } from "./regionTooltip";
3435
import getGarrisonToken from "./garrisonTokens";
@@ -377,10 +378,24 @@ export default class MapComponent extends Component<MapComponentProps> {
377378
}
378379

379380
const clickable = property.onClick != undefined;
381+
const dragonStrength = this.ingame.game.currentDragonStrength;
382+
383+
const dragonPrefix = u.type.id == "dragon"
384+
? dragonStrength <= -1
385+
? <></>
386+
: dragonStrength <= 1
387+
? <>Baby </>
388+
: dragonStrength <= 3
389+
? <></>
390+
: dragonStrength <= 5
391+
? <>Monster </>
392+
: <></>
393+
: <>
394+
</>;
380395

381396
return <OverlayTrigger
382397
overlay={<Tooltip id={"unit-tooltip-" + u.id} className="tooltip-w-100">
383-
<div className="text-center"><b>{u.type.name}</b><small> of <b>{controller?.name ?? "Unknown"}</b><br /><b>{r.name}</b></small></div>
398+
<div className="text-center"><b>{dragonPrefix}{u.type.name}</b><small> of <b>{controller?.name ?? "Unknown"}</b><br /><b>{r.name}</b></small></div>
384399
</Tooltip>}
385400
key={`map-unit-_${controller?.id ?? "must-be-controlled"}_${u.id}`}
386401
delay={{ show: 500, hide: 100 }}
@@ -405,7 +420,7 @@ export default class MapComponent extends Component<MapComponentProps> {
405420
"pulsate-bck_fade-in": property.animateFadeIn,
406421
"pulsate-bck_fade-out": property.animateFadeOut,
407422
},
408-
getClassNameForDragonStrength(u.type.id, this.ingame.game.currentDragonStrength)
423+
getClassNameForDragonStrength(u.type.id, dragonStrength)
409424
)}
410425
style={{
411426
backgroundImage: `url(${unitImages.get(u.allegiance.id).get(u.upgradedType ? u.upgradedType.id : u.type.id)})`,
@@ -597,7 +612,7 @@ export default class MapComponent extends Component<MapComponentProps> {
597612
}
598613

599614
const drawBorder = order?.type.restrictedTo == sea.kind;
600-
const hasPlaceOrders = this.ingame.hasChildGameState(PlaceOrdersGameState);
615+
const hasPlaceOrders = this.ingame.hasChildGameState(PlaceOrdersGameState) || this.ingame.hasChildGameState(PlaceOrdersForVassalsGameState);
601616
const controller = drawBorder || hasPlaceOrders ? region.getController() : null;
602617
const color = drawBorder && controller
603618
? controller.id != "greyjoy"

agot-bg-game-server/src/common/ingame-game-state/vote-system/Vote.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import CombatGameState from "../action-game-state/resolve-march-order-game-state
99
import ClaimVassalsGameState from "../planning-game-state/claim-vassals-game-state/ClaimVassalsGameState";
1010
import { getTimeDeltaInSeconds } from "../../../utils/getElapsedSeconds";
1111
import BiddingGameState from "../westeros-game-state/bidding-game-state/BiddingGameState";
12-
import PlaceOrdersGameState from "../planning-game-state/place-orders-game-state/PlaceOrdersGameState";
12+
import PlanningGameState from "../planning-game-state/PlanningGameState";
1313

1414
export enum VoteState {
1515
ONGOING,
@@ -79,9 +79,9 @@ export default class Vote {
7979
}
8080

8181
const swapHousesVoteType = this.type;
82-
if (this.ingame.hasChildGameState(PlaceOrdersGameState)) {
83-
const placeOrders = this.ingame.getChildGameState(PlaceOrdersGameState) as PlaceOrdersGameState;
84-
if (placeOrders.placedOrders.keys.some(r => {
82+
if (this.ingame.hasChildGameState(PlanningGameState)) {
83+
const planning = this.ingame.getChildGameState(PlanningGameState) as PlanningGameState;
84+
if (planning.placedOrders.keys.some(r => {
8585
const controller = r.getController();
8686
return controller == swapHousesVoteType.initiatorHouse || controller == swapHousesVoteType.swappingHouse})
8787
) {

agot-bg-game-server/src/common/ingame-game-state/vote-system/VoteType.ts

+9-6
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ import Order from "../game-data-structure/Order";
1111
import _ from "lodash";
1212
import GameEndedGameState from "../game-ended-game-state/GameEndedGameState";
1313
import ChooseInitialObjectivesGameState from "../choose-initial-objectives-game-state/ChooseInitialObjectivesGameState";
14+
import PlanningGameState from "../planning-game-state/PlanningGameState";
15+
import PlaceOrdersForVassalsGameState from "../planning-game-state/place-orders-for-vassals-game-state/PlaceOrdersForVassalsGameState";
1416

1517
export type SerializedVoteType = SerializedCancelGame | SerializedEndGame
1618
| SerializedReplacePlayer | SerializedReplacePlayerByVassal | SerializedReplaceVassalByPlayer
@@ -266,9 +268,9 @@ export class CancelGame extends VoteType {
266268
ingame.resumeGame(true);
267269
}
268270

269-
if (ingame.hasChildGameState(PlaceOrdersGameState)) {
270-
const placeOrders = vote.ingame.getChildGameState(PlaceOrdersGameState) as PlaceOrdersGameState;
271-
ingame.ordersOnBoard = placeOrders.placedOrders as BetterMap<Region, Order>;
271+
if (ingame.hasChildGameState(PlanningGameState)) {
272+
const planning = vote.ingame.getChildGameState(PlanningGameState) as PlanningGameState;
273+
ingame.ordersOnBoard = planning.placedOrders as BetterMap<Region, Order>;
272274
ingame.entireGame.broadcastToClients({
273275
type: "reveal-orders",
274276
orders: vote.ingame.ordersOnBoard.mapOver(r => r.id, o => o.id)
@@ -595,9 +597,10 @@ export class ReplaceVassalByPlayer extends VoteType {
595597
houseCards: vote.ingame.game.oldPlayerHouseCards.entries.map(([h, hcs]) => [h.id, hcs.values.map(hc => hc.id)])
596598
});
597599

598-
const placeOrders = vote.ingame.leafState instanceof PlaceOrdersGameState ? vote.ingame.leafState : null;
599-
if (placeOrders) {
600-
const planning = placeOrders.parentGameState;
600+
const hasPlaceOrders = vote.ingame.hasChildGameState(PlanningGameState)
601+
&& (vote.ingame.hasChildGameState(PlaceOrdersGameState) || vote.ingame.hasChildGameState(PlaceOrdersForVassalsGameState));
602+
if (hasPlaceOrders) {
603+
const planning = vote.ingame.getChildGameState(PlanningGameState) as PlanningGameState;
601604

602605
// Reset waitedFor data, to properly call ingame.setWaitedForPlayers() by the game-state-change
603606
vote.ingame.resetAllWaitedForData();

0 commit comments

Comments
 (0)