diff --git a/agot-bg-game-server/public/images/house-cards/Balon-nerved.png b/agot-bg-game-server/public/images/house-cards/Balon-nerved.png new file mode 100644 index 000000000..791916d68 Binary files /dev/null and b/agot-bg-game-server/public/images/house-cards/Balon-nerved.png differ diff --git a/agot-bg-game-server/public/images/units/ArrDragon.png b/agot-bg-game-server/public/images/units/ArrDragon.png new file mode 100644 index 000000000..f0251f0c6 Binary files /dev/null and b/agot-bg-game-server/public/images/units/ArrDragon.png differ diff --git a/agot-bg-game-server/public/images/units/BaraDragon.png b/agot-bg-game-server/public/images/units/BaraDragon.png new file mode 100644 index 000000000..cb341f0c0 Binary files /dev/null and b/agot-bg-game-server/public/images/units/BaraDragon.png differ diff --git a/agot-bg-game-server/public/images/units/BoltDragon.png b/agot-bg-game-server/public/images/units/BoltDragon.png new file mode 100644 index 000000000..79a641909 Binary files /dev/null and b/agot-bg-game-server/public/images/units/BoltDragon.png differ diff --git a/agot-bg-game-server/public/images/units/GreyDragon.png b/agot-bg-game-server/public/images/units/GreyDragon.png new file mode 100644 index 000000000..2bb0d06c6 Binary files /dev/null and b/agot-bg-game-server/public/images/units/GreyDragon.png differ diff --git a/agot-bg-game-server/public/images/units/LannDragon.png b/agot-bg-game-server/public/images/units/LannDragon.png new file mode 100644 index 000000000..b8a16aab5 Binary files /dev/null and b/agot-bg-game-server/public/images/units/LannDragon.png differ diff --git a/agot-bg-game-server/public/images/units/MartDragon.png b/agot-bg-game-server/public/images/units/MartDragon.png new file mode 100644 index 000000000..ed25608e0 Binary files /dev/null and b/agot-bg-game-server/public/images/units/MartDragon.png differ diff --git a/agot-bg-game-server/public/images/units/StarDragon.png b/agot-bg-game-server/public/images/units/StarDragon.png new file mode 100644 index 000000000..a3c0799b7 Binary files /dev/null and b/agot-bg-game-server/public/images/units/StarDragon.png differ diff --git a/agot-bg-game-server/public/images/units/TyrDragon.png b/agot-bg-game-server/public/images/units/TyrDragon.png new file mode 100644 index 000000000..2976f62c0 Binary files /dev/null and b/agot-bg-game-server/public/images/units/TyrDragon.png differ diff --git a/agot-bg-game-server/src/client/GameSettingsComponent.tsx b/agot-bg-game-server/src/client/GameSettingsComponent.tsx index 9f1922080..d2cac1fd5 100644 --- a/agot-bg-game-server/src/client/GameSettingsComponent.tsx +++ b/agot-bg-game-server/src/client/GameSettingsComponent.tsx @@ -698,6 +698,21 @@ export default class GameSettingsComponent extends Component this.changeGameSettings(() => this.gameSettings.useVassalPositions = !this.gameSettings.useVassalPositions)} /> + + + All houses, except Targaryen, will replace their starting knight by a dragon. + }> + + } + checked={this.gameSettings.replaceKnightByDragon} + onChange={() => this.changeGameSettings(() => this.gameSettings.replaceKnightByDragon = !this.gameSettings.replaceKnightByDragon)} + /> + { - {this.gameSettings.playerCount >= 8 && + {(this.gameSettings.playerCount >= 8 || this.gameSettings.replaceKnightByDragon) &&
diff --git a/agot-bg-game-server/src/client/houseCardImages.ts b/agot-bg-game-server/src/client/houseCardImages.ts index b2dcfabaf..8dab8c5c1 100644 --- a/agot-bg-game-server/src/client/houseCardImages.ts +++ b/agot-bg-game-server/src/client/houseCardImages.ts @@ -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"; @@ -178,6 +179,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], diff --git a/agot-bg-game-server/src/client/unitImages.ts b/agot-bg-game-server/src/client/unitImages.ts index 3a4a0e49d..3142369df 100644 --- a/agot-bg-game-server/src/client/unitImages.ts +++ b/agot-bg-game-server/src/client/unitImages.ts @@ -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"; @@ -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] ])] ]); diff --git a/agot-bg-game-server/src/common/EntireGame.ts b/agot-bg-game-server/src/common/EntireGame.ts index 3f77b275d..9852516a0 100644 --- a/agot-bg-game-server/src/common/EntireGame.ts +++ b/agot-bg-game-server/src/common/EntireGame.ts @@ -54,7 +54,7 @@ export default class EntireGame extends GameState void; @@ -820,4 +820,5 @@ export interface GameSettings { fixedClock: boolean; holdVictoryPointsUntilEndOfRound: boolean; fogOfWar: boolean; + replaceKnightByDragon: boolean; } diff --git a/agot-bg-game-server/src/common/ingame-game-state/IngameGameState.ts b/agot-bg-game-server/src/common/ingame-game-state/IngameGameState.ts index 794c5ed17..5b5690b97 100644 --- a/agot-bg-game-server/src/common/ingame-game-state/IngameGameState.ts +++ b/agot-bg-game-server/src/common/ingame-game-state/IngameGameState.ts @@ -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"; @@ -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, diff --git a/agot-bg-game-server/src/common/ingame-game-state/game-data-structure/createGame.ts b/agot-bg-game-server/src/common/ingame-game-state/game-data-structure/createGame.ts index 07f50e884..0c3e99530 100644 --- a/agot-bg-game-server/src/common/ingame-game-state/game-data-structure/createGame.ts +++ b/agot-bg-game-server/src/common/ingame-game-state/game-data-structure/createGame.ts @@ -5,7 +5,7 @@ import Region from "./Region"; import World from "./World"; import WesterosCard from "./westeros-card/WesterosCard"; import {fireMadeFlesh, westerosCardTypes} from "./westeros-card/westerosCardTypes"; -import unitTypes, { ship } from "./unitTypes"; +import unitTypes, { dragon, knight, ship } from "./unitTypes"; import Game from "./Game"; import WildlingCard from "./wildling-card/WildlingCard"; import wildlingCardTypes from "./wildling-card/wildlingCardTypes"; @@ -20,8 +20,9 @@ import IronBank from "./IronBank"; import loanCardTypes from "./loan-card/loanCardTypes"; import LoanCard from "./loan-card/LoanCard"; import { specialObjectiveCards } from "./static-data-structure/objectiveCards"; -import popRandom from "../../../utils/popRandom"; +import popRandom, { pickRandom } from "../../../utils/popRandom"; import { HouseCardDecks } from "../../../common/EntireGame"; +import Unit from "./Unit"; interface HouseCardContainer { houseCards: {[key: string]: HouseCardData}; @@ -591,4 +592,45 @@ export function applyChangesForDanceWithMotherOfDragons(ingame: IngameGameState) while (_.some(_.take(game.westerosDecks[3], 2), wc => wc.type == fireMadeFlesh)) { shuffleInPlace(game.westerosDecks[3]); } +} + +export function replaceKnightsByDragons(ingame: IngameGameState): void { + const game = ingame.game; + const houses = _.without(game.houses.values, game.targaryen) as House[]; + + for (const house of houses) { + let knightToReplace: Unit; + const capital = ingame.world.getCapitalOfHouse(house) as Region; + const knightInCapital = _.first(capital.units.values.filter(u => u.type == knight)); + + if (knightInCapital) { + knightToReplace = knightInCapital; + } else { + const knights = ingame.world.getUnitsOfHouse(house).filter(u => u.type == knight); + if (knights.length == 0) { + throw new Error("Each house starts with at least one knight!"); + } + knightToReplace = pickRandom(knights) as Unit; + } + + const region = knightToReplace.region; + region.units.delete(knightToReplace.id); + const newDragon = game.createUnit(region, dragon, house); + region.units.set(newDragon.id, newDragon); + } + + if (game.dragonStrengthTokens.length == 0) { + game.dragonStrengthTokens = [2, 4, 6, 8, 10]; + } + + const balon = game.draftableHouseCards.has("balon-greyjoy") + ? game.draftableHouseCards.get("balon-greyjoy") + : _.flatMap(game.houses.values.map(h => h.houseCards.values)).find(hc => hc.id == "balon-greyjoy"); + + if (balon) { + balon.id = "balon-greyjoy-nerved"; + balon.ability = houseCardAbilities.get("jaqen-h-ghar"); + } + + game.world.regions.values.filter(r => r.superControlPowerToken != null && r.garrison == 2).forEach(r => r.garrison = 3); } \ No newline at end of file