Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change nerfed Dwd Aerons ability to Quenty Martells ability #1842

Merged
merged 2 commits into from
Jun 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
12 changes: 6 additions & 6 deletions agot-bg-game-server/src/client/GameLogListComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,13 @@ 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");
createNerfedHouseCards(): [string, HouseCard][] {
const balonNerfed = createHouseCard("balon-greyjoy-nerfed", { name: "Balon Greyjoy", combatStrength: 2, ability: "jaqen-h-ghar" }, "greyjoy");
const aeronDwdNerfed = createHouseCard("aeron-damphair-dwd-nerfed", { name: "Aeron Damphair", ability: "quentyn-martell" }, "greyjoy");

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

Expand All @@ -116,7 +116,7 @@ export default class GameLogListComponent extends Component<GameLogListComponent
this.createHouseCards(modBHouseCardsData),
this.createHouseCards(asosHouseCardsData),
this.game.vassalHouseCards.entries,
this.createNervedHouseCards());
this.createNerfedHouseCards());
}

render(): ReactNode {
Expand Down
8 changes: 4 additions & 4 deletions agot-bg-game-server/src/client/houseCardImages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +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 balonNerfedImage from "../../public/images/house-cards/Balon-nerfed.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 @@ -48,7 +48,7 @@ import melisandreDwDImage from "../../public/images/house-cards/Melisandre_DwD.p
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 aeronDwDNerfedImage from "../../public/images/house-cards/AeronDamphairDwD-nerfed.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 Down Expand Up @@ -175,7 +175,7 @@ const houseCardImages = new BetterMap([
["areo-hotah", aeroImage],
["asha-greyjoy", ashaImage],
["balon-greyjoy", balonImage],
["balon-greyjoy-nerved", balonNervedImage],
["balon-greyjoy-nerfed", balonNerfedImage],
["the-blackfish", blackfishImage],
["brienne-of-tarth", brienneImage],
["catelyn-stark", catelynImage],
Expand Down Expand Up @@ -217,7 +217,7 @@ const houseCardImages = new BetterMap([
["jon-snow", jonSnow],
["stannis-baratheon-dwd", stannisDwDImage],
["aeron-damphair-dwd", aeronDwDImage],
["aeron-damphair-dwd-nerved", aeronDwDNervedImage],
["aeron-damphair-dwd-nerfed", aeronDwDNerfedImage],
["qarl-the-maid", qarlTheMaidImage],
["rodrik-the-reader", rodrikTheReaderImage],
["euron-crows-eye-dwd", euronDwDImage],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -621,8 +621,8 @@ export function applyChangesForDragonWar(ingame: IngameGameState): void {

ensureDragonStrengthTokensArePresent(ingame);

nervHouseCard(game, "balon-greyjoy", "jaqen-h-ghar");
nervHouseCard(game, "aeron-damphair-dwd", "aeron-damphair");
nerfHouseCard(game, "balon-greyjoy", "jaqen-h-ghar");
nerfHouseCard(game, "aeron-damphair-dwd", "quentyn-martell");

game.world.regions.values.filter(r => r.superControlPowerToken != null && r.garrison == 4).forEach(r => r.garrison = 6);
game.world.regions.values.filter(r => r.superControlPowerToken != null && r.garrison == 2).forEach(r => r.garrison = 4);
Expand All @@ -647,25 +647,24 @@ function findUnitToReplace(ingame: IngameGameState, house: House, unitType: stri
: pickRandom(ingame.world.getUnitsOfHouse(house).filter(u => u.type.id == unitType));
}

function nervHouseCard(game: Game, hcId: string, newAbilityId: string): void {
function nerfHouseCard(game: Game, hcId: string, newAbilityId: string): void {
const houseCard = game.draftableHouseCards.has(hcId)
? game.draftableHouseCards.get(hcId)
: _.flatMap(game.houses.values.map(h => h.houseCards.values)).find(hc => hc.id == hcId);

if (houseCard) {
const originalId = houseCard.id;
houseCard.id = hcId + "-nerved";
houseCard.id = hcId + "-nerfed";
houseCard.ability = houseCardAbilities.get(newAbilityId);

const house = game.houses.values.find(h => h.houseCards.has(originalId));
const house = game.houses.values.find(h => h.houseCards.has(hcId));
if (house) {
house.houseCards.delete(originalId);
house.houseCards.delete(hcId);
house.houseCards.set(houseCard.id, houseCard);
}

if (game.draftableHouseCards.has(hcId)) {
game.draftableHouseCards.delete(hcId);
game.draftableHouseCards.set(hcId + "-nerved", houseCard);
game.draftableHouseCards.set(houseCard.id, houseCard);
}
}
}
25 changes: 24 additions & 1 deletion agot-bg-game-server/src/server/serializedGameMigrations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2239,7 +2239,7 @@ const serializedGameMigrations: {version: string; migrate: (serializeGamed: any)
ingame.game.removedDragonStrengthTokens.push(10);
}

// Fix wrong id for players house cards map with nerved cards
// Fix wrong id for players house cards map with nerfed cards
if (serializedGame.gameSettings.dragonWar) {
ingame.game.houses.forEach((h: any) => {
const balon = h.houseCards.find(([id, shc]: any) => id == "balon-greyjoy" && shc.id == "balon-greyjoy-nerved");
Expand All @@ -2257,6 +2257,29 @@ const serializedGameMigrations: {version: string; migrate: (serializeGamed: any)
}
return serializedGame;
}
},
{
version: "117",
migrate: (serializedGame: any) => {
if (serializedGame.childGameState.type == "ingame") {
const ingame = serializedGame.childGameState;

const houseCards = _.flatMap(ingame.game.houses.map((h: any) => h.houseCards));
houseCards.push(...ingame.game.draftableHouseCards);

const aeronDwdNerfed: any = houseCards.find(([id, _shc]: any) => id == "aeron-damphair-dwd-nerved");
if (aeronDwdNerfed) {
aeronDwdNerfed[1].abilityId = "quentyn-martell";
}

// Fix typo in nerfed:
houseCards.filter(([id, _shc]: any) => id.endsWith("-nerved")).forEach((item: any) => {
item[0] = item[0].replace("-nerved", "-nerfed");
item[1].id = item[0];
});
}
return serializedGame;
}
}
];

Expand Down