Skip to content

Commit

Permalink
Improve nerfed DwD Aeron Damphair
Browse files Browse the repository at this point in the history
  • Loading branch information
gereon77 committed Jun 24, 2024
1 parent f17e40d commit 6d514df
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 9 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,17 @@ export default class AeronDamphairAbilityComponent extends Component<GameStateCo
return (
<>
<Col xs={12} className="text-center">
<b>Aeron Damphair:</b> House <b>{this.props.gameState.house.name}</b> may discard any number of available Power token to increase the combat strength of his card by the number of Power tokens discarded.
{!this.props.gameState.nerfed
? <>
<b>Aeron Damphair:</b> House <b>{this.props.gameState.house.name}</b> may discard any number of available Power tokens
to increase the combat strength of their card by the number of Power tokens discarded.
</>
: <>
<b>Aeron Damphair:</b> House <b>{this.props.gameState.house.name}</b> may discard one Power token for each House card
in their discard pile to increase the combat strength of their card by the number of Power tokens discarded.
</>
}

</Col>
{this.authenticatedPlayer && this.props.gameClient.doesControlHouse(this.props.gameState.house) && (
<>
Expand All @@ -31,7 +41,7 @@ export default class AeronDamphairAbilityComponent extends Component<GameStateCo
type="range"
className="custom-range"
min={0}
max={this.authenticatedPlayer.house.powerTokens}
max={this.props.gameState.maxAllowedPowerTokens}
value={this.powerTokens}
onChange={e => {
this.powerTokens = parseInt(e.target.value);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@ import BeforeCombatHouseCardAbilitiesGameState from "../BeforeCombatHouseCardAbi
import User from "../../../../../../../server/User";
import { aeronDamphairDwD } from "../../../../../game-data-structure/house-card/houseCardAbilities";
import HouseCardModifier from "../../../../../game-data-structure/house-card/HouseCardModifier";
import { HouseCardState } from "../../../../../../../common/ingame-game-state/game-data-structure/house-card/HouseCard";

export default class AeronDamphairDwDAbilityGameState extends GameState<
BeforeCombatHouseCardAbilitiesGameState["childGameState"]> {
house: House;
nerfed: boolean;

get game(): Game {
return this.parentGameState.game;
Expand All @@ -27,9 +29,16 @@ export default class AeronDamphairDwDAbilityGameState extends GameState<
return this.parentGameState.parentGameState.parentGameState.ingameGameState;
}

firstStart(house: House): void {
get maxAllowedPowerTokens(): number {
return this.nerfed
? this.house.houseCards.values.filter(hc => hc.state == HouseCardState.USED).length
: this.house.powerTokens;
}

firstStart(house: House, nerfed: boolean): void {
this.house = house;
if (house.powerTokens == 0) {
this.nerfed = nerfed;
if (house.powerTokens == 0 || this.maxAllowedPowerTokens == 0) {
this.ingame.log({
type: "house-card-ability-not-used",
house: house.id,
Expand All @@ -46,7 +55,7 @@ export default class AeronDamphairDwDAbilityGameState extends GameState<
return;
}

const pt = Math.max(0, Math.min(message.powerTokens, this.house.powerTokens));
const pt = Math.max(0, Math.min(message.powerTokens, this.maxAllowedPowerTokens));
this.ingame.changePowerTokens(this.house, -pt);

const houseCardModifier = new HouseCardModifier();
Expand Down Expand Up @@ -86,14 +95,16 @@ export default class AeronDamphairDwDAbilityGameState extends GameState<
serializeToClient(_admin: boolean, _player: Player | null): SerializedAeronDamphairDwDAbilityGameState {
return {
type: "aeron-damphair-dwd-ability",
house: this.house.id
house: this.house.id,
nerfed: this.nerfed
};
}

static deserializeFromServer(houseCardResolution: BeforeCombatHouseCardAbilitiesGameState["childGameState"], data: SerializedAeronDamphairDwDAbilityGameState): AeronDamphairDwDAbilityGameState {
const aeronDamphairDwDAbilityGameState = new AeronDamphairDwDAbilityGameState(houseCardResolution);

aeronDamphairDwDAbilityGameState.house = houseCardResolution.game.houses.get(data.house);
aeronDamphairDwDAbilityGameState.nerfed = data.nerfed;

return aeronDamphairDwDAbilityGameState;
}
Expand All @@ -102,4 +113,5 @@ export default class AeronDamphairDwDAbilityGameState extends GameState<
export interface SerializedAeronDamphairDwDAbilityGameState {
type: "aeron-damphair-dwd-ability";
house: string;
nerfed: boolean;
}
Original file line number Diff line number Diff line change
Expand Up @@ -699,7 +699,7 @@ function applyChangesForDragonWar(ingame: IngameGameState): void {
ensureDragonStrengthTokensArePresent(ingame);

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

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 Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import AeronDamphairDwDAbilityGameState from "../../action-game-state/resolve-ma
import CombatGameState from "../../action-game-state/resolve-march-order-game-state/combat-game-state/CombatGameState";

export default class AeronDamphairDwDHouseCardAbility extends HouseCardAbility {
beforeCombatResolution(beforeCombat: BeforeCombatHouseCardAbilitiesGameState, house: House, _houseCard: HouseCard): void {
beforeCombat.childGameState.setChildGameState(new AeronDamphairDwDAbilityGameState(beforeCombat.childGameState)).firstStart(house);
beforeCombatResolution(beforeCombat: BeforeCombatHouseCardAbilitiesGameState, house: House, houseCard: HouseCard): void {
beforeCombat.childGameState.setChildGameState(new AeronDamphairDwDAbilityGameState(beforeCombat.childGameState)).firstStart(house, houseCard.id.endsWith("-nerfed"));
}

modifyCombatStrength(combat: CombatGameState, _house: House, houseCard: HouseCard, affectedHouseCard: HouseCard, _baseValue: number): number {
Expand Down

0 comments on commit 6d514df

Please sign in to comment.