Skip to content

Commit

Permalink
Add custom "Replace starting knight by dragon" mode
Browse files Browse the repository at this point in the history
  • Loading branch information
gereon77 committed Jun 11, 2024
1 parent 1bb5c5d commit 69ad599
Show file tree
Hide file tree
Showing 21 changed files with 170 additions and 57 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 15 additions & 3 deletions agot-bg-game-server/src/client/GameLogListComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import orders from "../common/ingame-game-state/game-data-structure/orders";
import CombatInfoComponent from "./CombatInfoComponent";
import { OverlayTrigger, Tooltip } from "react-bootstrap";
import User from "../server/User";
import { baseHouseCardsData, adwdHouseCardsData, ffcHouseCardsData, modBHouseCardsData , HouseCardData, asosHouseCardsData } from "../common/ingame-game-state/game-data-structure/createGame";
import { baseHouseCardsData, adwdHouseCardsData, ffcHouseCardsData, modBHouseCardsData , HouseCardData, asosHouseCardsData, createHouseCard } from "../common/ingame-game-state/game-data-structure/createGame";
import HouseCard from "../common/ingame-game-state/game-data-structure/house-card/HouseCard";
import houseCardAbilities from "../common/ingame-game-state/game-data-structure/house-card/houseCardAbilities";
import BetterMap from "../utils/BetterMap";
Expand Down Expand Up @@ -97,14 +97,25 @@ export default class GameLogListComponent extends Component<GameLogListComponent
});
}

createNervedHouseCards(): [string, HouseCard][] {
const balonNerved = createHouseCard("balon-greyjoy-nerved", { name: "Balon Greyjoy", combatStrength: 2, ability: "jaqen-h-ghar" }, "greyjoy");
const aeronDwdNerved = createHouseCard("aeron-damphair-dwd-nerved", { name: "Aeron Damphair", ability: "aeron-damphair" }, "greyjoy");

return [
[balonNerved.id, balonNerved],
[aeronDwdNerved.id, aeronDwdNerved]
];
}

getAllHouseCards(): [string, HouseCard][] {
return _.concat(
this.createHouseCards(baseHouseCardsData),
this.createHouseCards(adwdHouseCardsData),
this.createHouseCards(ffcHouseCardsData),
this.createHouseCards(modBHouseCardsData),
this.createHouseCards(asosHouseCardsData),
this.game.vassalHouseCards.entries);
this.game.vassalHouseCards.entries,
this.createNervedHouseCards());
}

render(): ReactNode {
Expand Down Expand Up @@ -1432,9 +1443,10 @@ export default class GameLogListComponent extends Component<GameLogListComponent
const house = this.game.houses.get(data.house);
const affectedHouse = this.game.houses.get(data.affectedHouse);
const newHouseCard = this.allHouseCards.get(data.newHouseCard);
const usedByHouseCard = this.allHouseCards.get(data.usedById);

return <p>
<b>Jaqen H&apos;ghar</b>: House <b>{house.name}</b> randomly chose <b>{newHouseCard.name}</b> as <b>
<b>{usedByHouseCard.name}</b>: House <b>{house.name}</b> randomly chose <b>{newHouseCard.name}</b> as <b>
{affectedHouse.name}&apos;s</b> new House card.
</p>;
}
Expand Down
15 changes: 15 additions & 0 deletions agot-bg-game-server/src/client/GameSettingsComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -698,6 +698,21 @@ export default class GameSettingsComponent extends Component<GameSettingsCompone
onChange={() => this.changeGameSettings(() => this.gameSettings.useVassalPositions = !this.gameSettings.useVassalPositions)}
/>
</Col>
<Col xs="12">
<FormCheck
id="replace-knights-by-dragon-setting"
type="switch"
label={
<OverlayTrigger overlay={
<Tooltip id="replace-knights-by-dragon-tooltip">
All houses, except Targaryen, will replace their starting knight by a dragon.
</Tooltip>}>
<label htmlFor="replace-knights-by-dragon-setting">Replace knight by dragon</label>
</OverlayTrigger>}
checked={this.gameSettings.replaceKnightByDragon}
onChange={() => this.changeGameSettings(() => this.gameSettings.replaceKnightByDragon = !this.gameSettings.replaceKnightByDragon)}
/>
</Col>
<Col xs="12">
<FormCheck
id="hold-vps-setting"
Expand Down
2 changes: 1 addition & 1 deletion agot-bg-game-server/src/client/IngameComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -978,7 +978,7 @@ export default class IngameComponent extends Component<IngameComponentProps> {
</div>
</div>
</Row>
{this.gameSettings.playerCount >= 8 && <Row className="mx-0 mt-3">
{(this.gameSettings.playerCount >= 8 || this.gameSettings.replaceKnightByDragon) && <Row className="mx-0 mt-3">
<OverlayTrigger overlay={this.renderDragonStrengthTooltip()}
placement="auto">
<div>
Expand Down
11 changes: 5 additions & 6 deletions agot-bg-game-server/src/client/houseCardImages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import aeroImage from "../../public/images/house-cards/Areo.png";
import arianneImage from "../../public/images/house-cards/Arianne.png";
import ashaImage from "../../public/images/house-cards/Asha.png";
import balonImage from "../../public/images/house-cards/Balon.png";
import balonNervedImage from "../../public/images/house-cards/Balon-nerved.png";
import blackfishImage from "../../public/images/house-cards/Blackfish.png";
import brienneImage from "../../public/images/house-cards/Brienne.png";
import catelynImage from "../../public/images/house-cards/Catelyn.png";
Expand Down Expand Up @@ -41,11 +42,13 @@ import theonImage from "../../public/images/house-cards/Theon.png";
import tyrionImage from "../../public/images/house-cards/Tyrion.png";
import tywinImage from "../../public/images/house-cards/Tywin.png";
import victarionImage from "../../public/images/house-cards/Victarion.png";

import rayderImage from "../../public/images/house-cards/Rayder.png";
import melisandreDwDImage from "../../public/images/house-cards/Melisandre_DwD.png";
import jonSnow from "../../public/images/house-cards/JonSnow.png";
import stannisDwDImage from "../../public/images/house-cards/StannisBaratheonDwD.png";
import aeronDwDImage from "../../public/images/house-cards/AeronDamphairDwD.png";
import aeronDwDNervedImage from "../../public/images/house-cards/AeronDamphairDwD-nerved.png";
import qarlTheMaidImage from "../../public/images/house-cards/QarlTheMaid.png";
import rodrikTheReaderImage from "../../public/images/house-cards/RodrikTheReader.png";
import euronDwDImage from "../../public/images/house-cards/EuronCrowsEye.png";
Expand All @@ -61,30 +64,24 @@ import ramsayBoltonImage from "../../public/images/house-cards/RamsayBolton.png"
import queenOfThornsDwDImage from "../../public/images/house-cards/QueenOfThorns.png";
import paxterRedwyneImage from "../../public/images/house-cards/PaxterRedwyne.png";
import margaeryTyrellDwDImage from "../../public/images/house-cards/MargaeryTyrell.png";

import maceTyrellDwDImage from "../../public/images/house-cards/MaceTyrell.png";
import randyllTarlyDwDImage from "../../public/images/house-cards/RandyllTarly.png";
import willasTyrellImage from "../../public/images/house-cards/WillasTyrell.png";
import serJonFossowayImage from "../../public/images/house-cards/SerJonFossoway.png";

import nymeriaSandDwDImage from "../../public/images/house-cards/NymeriaSand.png";
import areoHotahDwDImage from "../../public/images/house-cards/AreoHotah.png";
import bastardOfGodsgraceImage from "../../public/images/house-cards/BastardOfGodsgrace.png";
import bigManImage from "../../public/images/house-cards/BigMan.png";

import serHarrasHarlawImage from "../../public/images/house-cards/SerHarrasHarlaw.png";
import victarionGreyjoyDwDImage from "../../public/images/house-cards/VictarionGreyjoy.png";
import ashaGreyjoyDwDImage from "../../public/images/house-cards/AshaGreyjoy.png";

import bastardOfNightsongImage from "../../public/images/house-cards/BastardOfNightsong.png";
import serDavosSeaworthDwDImage from "../../public/images/house-cards/SerDavosSeaworth.png";
import serAxellFlorentImage from "../../public/images/house-cards/SerAxellFlorent.png";

import blackWalderImage from "../../public/images/house-cards/BlackWalder.png";
import steelshanksWaltonImage from "../../public/images/house-cards/SteelshanksWalton.png";
import damonDanceForMeImage from "../../public/images/house-cards/DamonDanceForMe.png";
import rooseBoltonDwDImage from "../../public/images/house-cards/RooseBolton.png";

import cerseiLannisterDwDImage from "../../public/images/house-cards/CerseiLannister.png";
import serJaimeLannisterDwDImage from "../../public/images/house-cards/SerJaimeLannister.png";
import serKevanLannisterDwDImage from "../../public/images/house-cards/SerKevanLannister.png";
Expand Down Expand Up @@ -178,6 +175,7 @@ const houseCardImages = new BetterMap([
["areo-hotah", aeroImage],
["asha-greyjoy", ashaImage],
["balon-greyjoy", balonImage],
["balon-greyjoy-nerved", balonNervedImage],
["the-blackfish", blackfishImage],
["brienne-of-tarth", brienneImage],
["catelyn-stark", catelynImage],
Expand Down Expand Up @@ -219,6 +217,7 @@ const houseCardImages = new BetterMap([
["jon-snow", jonSnow],
["stannis-baratheon-dwd", stannisDwDImage],
["aeron-damphair-dwd", aeronDwDImage],
["aeron-damphair-dwd-nerved", aeronDwDNervedImage],
["qarl-the-maid", qarlTheMaidImage],
["rodrik-the-reader", rodrikTheReaderImage],
["euron-crows-eye-dwd", euronDwDImage],
Expand Down
96 changes: 56 additions & 40 deletions agot-bg-game-server/src/client/unitImages.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import BetterMap from "../utils/BetterMap";
import {dragon, footman, knight, ship, siegeEngine} from "../common/ingame-game-state/game-data-structure/unitTypes";
import barathFoot from "../../public/images/units/BarathFoot.png";
import barathKnight from "../../public/images/units/BarathKnight.png";
import barathSiege from "../../public/images/units/BarathSeige.png";
import barathShip from "../../public/images/units/BarathShip.png";
import boltonFoot from "../../public/images/units/BoltonFoot.png";
import boltonKnight from "../../public/images/units/BoltonKnight.png";
import boltonSiege from "../../public/images/units/BoltonSiege.png";
import boltonShip from "../../public/images/units/BoltonShip.png";
import lanFoot from "../../public/images/units/LanFoot.png";
import lanKnight from "../../public/images/units/LanKnight.png";
import lanSiege from "../../public/images/units/LanSeige.png";
import lanShip from "../../public/images/units/LanShip.png";
import baraFoot from "../../public/images/units/BarathFoot.png";
import baraKnight from "../../public/images/units/BarathKnight.png";
import baraSiege from "../../public/images/units/BarathSeige.png";
import baraShip from "../../public/images/units/BarathShip.png";
import boltFoot from "../../public/images/units/BoltonFoot.png";
import boltKnight from "../../public/images/units/BoltonKnight.png";
import boltSiege from "../../public/images/units/BoltonSiege.png";
import boltShip from "../../public/images/units/BoltonShip.png";
import lannFoot from "../../public/images/units/LanFoot.png";
import lannKnight from "../../public/images/units/LanKnight.png";
import lannSiege from "../../public/images/units/LanSeige.png";
import lannShip from "../../public/images/units/LanShip.png";
import starFoot from "../../public/images/units/StarFoot.png";
import starKnight from "../../public/images/units/StarKnight.png";
import starSiege from "../../public/images/units/StarSeige.png";
Expand All @@ -28,70 +28,86 @@ import tyrFoot from "../../public/images/units/TyrFoot.png";
import tyrKnight from "../../public/images/units/TyrKnight.png";
import tyrSiege from "../../public/images/units/TyrSeige.png";
import tyrShip from "../../public/images/units/TyrShip.png";
import arrynFoot from "../../public/images/units/ArrynFoot.png"
import arrynKnight from "../../public/images/units/ArrynKnight.png";
import arrynSiege from "../../public/images/units/ArrynSiege.png";
import arrynShip from "../../public/images/units/ArrynShip.png";
import targaryenShip from "../../public/images/units/TargShip.png";
import targaryenFoot from "../../public/images/units/TargFoot.png";
import arrFoot from "../../public/images/units/ArrynFoot.png"
import arrKnight from "../../public/images/units/ArrynKnight.png";
import arrSiege from "../../public/images/units/ArrynSiege.png";
import arrShip from "../../public/images/units/ArrynShip.png";
import targShip from "../../public/images/units/TargShip.png";
import targFoot from "../../public/images/units/TargFoot.png";
import targKnight from "../../public/images/units/TargKnight.png";
import targDragon from "../../public/images/units/TargDragon.png";
import baraDragon from "../../public/images/units/BaraDragon.png";
import lannDragon from "../../public/images/units/LannDragon.png";
import starDragon from "../../public/images/units/StarDragon.png";
import boltDragon from "../../public/images/units/BoltDragon.png";
import greyDragon from "../../public/images/units/GreyDragon.png";
import martDragon from "../../public/images/units/MartDragon.png";
import tyrDragon from "../../public/images/units/TyrDragon.png";
import arrDragon from "../../public/images/units/ArrDragon.png";


const unitImages = new BetterMap([
["baratheon", new BetterMap([
[footman.id, barathFoot],
[knight.id, barathKnight],
[siegeEngine.id, barathSiege],
[ship.id, barathShip]
[footman.id, baraFoot],
[knight.id, baraKnight],
[siegeEngine.id, baraSiege],
[ship.id, baraShip],
[dragon.id, baraDragon]
])],
["lannister", new BetterMap([
[footman.id, lanFoot],
[knight.id, lanKnight],
[siegeEngine.id, lanSiege],
[ship.id, lanShip]
[footman.id, lannFoot],
[knight.id, lannKnight],
[siegeEngine.id, lannSiege],
[ship.id, lannShip],
[dragon.id, lannDragon]
])],
["stark", new BetterMap([
[footman.id, starFoot],
[knight.id, starKnight],
[siegeEngine.id, starSiege],
[ship.id, starShip]
[ship.id, starShip],
[dragon.id, starDragon]
])],
["greyjoy", new BetterMap([
[footman.id, greyFoot],
[knight.id, greyKnight],
[siegeEngine.id, greySiege],
[ship.id, greyShip]
[ship.id, greyShip],
[dragon.id, greyDragon]
])],
["martell", new BetterMap([
[footman.id, martFoot],
[knight.id, martKnight],
[siegeEngine.id, martSiege],
[ship.id, martShip]
[ship.id, martShip],
[dragon.id, martDragon]
])],
["tyrell", new BetterMap([
[footman.id, tyrFoot],
[knight.id, tyrKnight],
[siegeEngine.id, tyrSiege],
[ship.id, tyrShip]
[ship.id, tyrShip],
[dragon.id, tyrDragon]
])],
["arryn", new BetterMap([
[footman.id, arrynFoot],
[knight.id, arrynKnight],
[siegeEngine.id, arrynSiege],
[ship.id, arrynShip]
[footman.id, arrFoot],
[knight.id, arrKnight],
[siegeEngine.id, arrSiege],
[ship.id, arrShip],
[dragon.id, arrDragon]
])],
["bolton", new BetterMap([
[footman.id, boltonFoot],
[knight.id, boltonKnight],
[siegeEngine.id, boltonSiege],
[ship.id, boltonShip]
[footman.id, boltFoot],
[knight.id, boltKnight],
[siegeEngine.id, boltSiege],
[ship.id, boltShip],
[dragon.id, boltDragon]
])],
["targaryen", new BetterMap([
[footman.id, targaryenFoot],
[footman.id, targFoot],
[knight.id, targKnight],
[dragon.id, targDragon],
[ship.id, targaryenShip]
[ship.id, targShip]
])]
]);

Expand Down
3 changes: 2 additions & 1 deletion agot-bg-game-server/src/common/EntireGame.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export default class EntireGame extends GameState<null, LobbyGameState | IngameG
draftHouseCards: false, thematicDraft: false, limitedDraft: false, randomDraft: false, blindDraft: false, selectedDraftDecks: HouseCardDecks.All,
mixedWesterosDeck1: false, cokWesterosPhase: false, fogOfWar: false, victoryPointsCountNeededToWin: 7, loyaltyTokenCountNeededToWin: 7, endless: false, faceless: false,
useVassalPositions: false, precedingMustering: false, randomStartPositions: false, initialLiveClock: 60,
noPrivateChats: false, tournamentMode: false, fixedClock: false, holdVictoryPointsUntilEndOfRound: false
noPrivateChats: false, tournamentMode: false, fixedClock: false, holdVictoryPointsUntilEndOfRound: false, replaceKnightByDragon: false
};

onSendClientMessage?: (message: ClientMessage) => void;
Expand Down Expand Up @@ -820,4 +820,5 @@ export interface GameSettings {
fixedClock: boolean;
holdVictoryPointsUntilEndOfRound: boolean;
fogOfWar: boolean;
replaceKnightByDragon: boolean;
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import ActionGameState, {SerializedActionGameState} from "./action-game-state/Ac
import Order from "./game-data-structure/Order";
import Game, {SerializedGame} from "./game-data-structure/Game";
import WesterosGameState, {SerializedWesterosGameState} from "./westeros-game-state/WesterosGameState";
import createGame, { applyChangesForDanceWithMotherOfDragons } from "./game-data-structure/createGame";
import createGame, { applyChangesForDanceWithMotherOfDragons, replaceKnightsByDragons } from "./game-data-structure/createGame";
import BetterMap from "../../utils/BetterMap";
import House from "./game-data-structure/House";
import Unit from "./game-data-structure/Unit";
Expand Down Expand Up @@ -146,6 +146,10 @@ export default class IngameGameState extends GameState<
applyChangesForDanceWithMotherOfDragons(this);
}

if (this.entireGame.gameSettings.replaceKnightByDragon) {
replaceKnightsByDragons(this);
}

if (this.entireGame.gameSettings.onlyLive) {
this.players.values.forEach(p => p.liveClockData = {
remainingSeconds: this.entireGame.gameSettings.initialLiveClock * 60,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -716,6 +716,7 @@ interface JaqenHGharUsed {
affectedHouse: string;
oldHouseCard: string;
newHouseCard: string;
usedById: string;
}

interface JonConningtonUsed {
Expand Down
Loading

0 comments on commit 69ad599

Please sign in to comment.