Skip to content

Commit

Permalink
Merge pull request #1813 from gereon77/minor-improvements
Browse files Browse the repository at this point in the history
Improve some wordings
  • Loading branch information
gereon77 authored Jan 31, 2024
2 parents 486f363 + 9630c2a commit 8e080f9
Show file tree
Hide file tree
Showing 6 changed files with 73 additions and 46 deletions.
7 changes: 4 additions & 3 deletions agot-bg-game-server/src/client/CombatInfoComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ export default class CombatInfoComponent extends Component<CombatInfoComponentPr
style={{
backgroundImage: `url(${houseCardsBackImages.get(this.attacker.houseCardBackId)})`
}}/>
: <div className="vertical-game-card game-card-slot small"/>}

: <div className="vertical-game-card game-card-slot small"/>
}
</div>

<div style={{gridRow: "3 / span 4", gridColumn: "5"}}>
Expand All @@ -139,7 +139,8 @@ export default class CombatInfoComponent extends Component<CombatInfoComponentPr
style={{
backgroundImage: `url(${houseCardsBackImages.get(this.defender.houseCardBackId)})`
}}/>
: <div className="vertical-game-card game-card-slot small"/>}
: <div className="vertical-game-card game-card-slot small"/>
}
</div>

<div style={{gridRow: "3", gridColumn: "2"}}>
Expand Down
4 changes: 2 additions & 2 deletions agot-bg-game-server/src/client/GameLogListComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -793,7 +793,7 @@ export default class GameLogListComponent extends Component<GameLogListComponent
const house = this.game.houses.get(data.house);
const houseCard = this.allHouseCards.get(data.houseCard);
return <p>
<b>Melisandre</b>: House <b>{house.name}</b> decided to return <b>
<b>Melisandre</b>: House <b>{house.name}</b> discarded <b>{houseCard.combatStrength}</b> Power token{houseCard.combatStrength != 1 ? "s" : ""} to return <b>
{houseCard.name}</b> to hand.
</p>;
}
Expand Down Expand Up @@ -1376,7 +1376,7 @@ export default class GameLogListComponent extends Component<GameLogListComponent

return <p>{vassals.length > 0
? (<>House <b>{house.name}</b> claimed {joinReactNodes(vassals.map(v => <b key={`vassals-claimed_${v.id}`}>{v.name}</b>), ", ")} as
vassal{vassals.length > 0 && "s"}.</>)
vassal{vassals.length > 1 && "s"}.</>)
: (<>House <b>{house.name}</b> has declined to command a vassal
and has handed their set of vassal order tokens to the next player on the Iron Throne track.</>)
}</p>;
Expand Down
90 changes: 53 additions & 37 deletions agot-bg-game-server/src/client/HouseRowComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ import HouseIconComponent from "./game-state-panel/utils/HouseIconComponent";
import ThematicDraftHouseCardsGameState from "../common/ingame-game-state/thematic-draft-house-cards-game-state/ThematicDraftHouseCardsGameState";
import { toast } from "react-toastify";
import getUserLinkOrLabel from "./utils/getIngameUserLinkOrLabel";
import CombatGameState from "../common/ingame-game-state/action-game-state/resolve-march-order-game-state/combat-game-state/CombatGameState";
import houseCardsBackImages from "./houseCardsBackImages";

interface HouseRowComponentProps {
house: House;
Expand Down Expand Up @@ -114,9 +116,7 @@ export default class HouseRowComponent extends Component<HouseRowComponentProps>
let player: Player | null = null;
let clock: number | null = null;

const showAllOtherPlayerHouseCards = !this.ingame.hasChildGameState(ThematicDraftHouseCardsGameState);

try {
try {
if (!isVassal) {
player = this.player;
isWaitedFor = this.ingame.getWaitedUsers().includes(player.user);
Expand Down Expand Up @@ -298,40 +298,7 @@ export default class HouseRowComponent extends Component<HouseRowComponentProps>
)}
<Col xs="auto">
<Row className="justify-content-center">
{!isVassal ?
(showAllOtherPlayerHouseCards || this.props.gameClient.doesControlHouse(this.house)) &&
_.sortBy(this.house.houseCards.values, hc => hc.combatStrength).map(hc => (
<Col xs="auto" key={`house-card_${this.house.id}_${hc.id}`}>
{hc.state == HouseCardState.AVAILABLE ? (
<HouseCardComponent
houseCard={hc}
size="tiny"
/>
) : (
<HouseCardBackComponent
house={this.house}
houseCard={hc}
size="tiny"
/>
)}
</Col>
))
: _.sortBy(this.game.vassalHouseCards.values, hc => hc.combatStrength).map(hc => (
<Col xs="auto" key={`vassal-cards_${this.house.id}_${hc.id}`}>
{hc.state == HouseCardState.AVAILABLE ? (
<HouseCardComponent
houseCard={hc}
size="tiny"
/>
) : (
<HouseCardBackComponent
house={null}
houseCard={hc}
size="tiny"
/>
)}
</Col>
))}
{this.renderHouseCards(isVassal)}
</Row>
{this.house.laterHouseCards != null && !isVassal &&
<Row className="justify-content-center">
Expand All @@ -358,6 +325,55 @@ export default class HouseRowComponent extends Component<HouseRowComponentProps>
</>;
}

private renderHouseCards(isVassal: boolean): ReactNode {
const showAllOtherPlayerHouseCards = !this.ingame.hasChildGameState(ThematicDraftHouseCardsGameState);

return !isVassal
? (showAllOtherPlayerHouseCards || this.props.gameClient.doesControlHouse(this.house))
? this.renderPlayerHouseCards()
: null
: _.sortBy(this.game.vassalHouseCards.values, hc => hc.combatStrength).map(hc => (
<Col xs="auto" key={`vassal-cards_${this.house.id}_${hc.id}`}>
{hc.state == HouseCardState.AVAILABLE ? (
<HouseCardComponent
houseCard={hc}
size="tiny" />
) : (
<HouseCardBackComponent
house={null}
houseCard={hc}
size="tiny" />
)}
</Col>
));
}

renderPlayerHouseCards(): ReactNode {
const combat = this.ingame.hasChildGameState(CombatGameState) ? this.ingame.getChildGameState(CombatGameState) as CombatGameState : null;
const isCommandingVassalInCombat = combat?.isCommandingVassalInCombat(this.house) ?? false;

return isCommandingVassalInCombat
? _.range(0, 3).map(i => <Col xs="auto" key={`vassal-combat_back_${this.house.id}_${i}`}>
<div className="vertical-game-card tiny" style={{
backgroundImage: `url(${houseCardsBackImages.get("vassal")})`
}}/>
</Col>)
: _.sortBy(this.house.houseCards.values, hc => hc.combatStrength).map(hc => (
<Col xs="auto" key={`house-card_${this.house.id}_${hc.id}`}>
{hc.state == HouseCardState.AVAILABLE ? (
<HouseCardComponent
houseCard={hc}
size="tiny" />
) : (
<HouseCardBackComponent
house={this.house}
houseCard={hc}
size="tiny" />
)}
</Col>
));
}

renderVassalDropDownItems(): ReactNode {
const ingame = this.props.ingame;
const {result, reason} = ingame.canLaunchReplaceVassalVote(this.props.gameClient.authenticatedUser, this.house);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,11 @@ export default class ChooseHouseCardComponent extends Component<GameStateCompone
checked={this.burnValyrianSteelBlade}
onChange={() => {
if (!this.burnValyrianSteelBlade && !window.confirm(
"Are you sure you want to use the VSB right now without knowing which House card the opponent has selected?\n\n"
+ "This could be useful, for example, if you think Doran Martell or Ser Gerris Drinkwater will take your blade soon. "
+ "Then it might make sense to burn the blade now in any case, because the game might not ask you later "
+ "if the blade can't be used usefully."
"Are you sure you want to pre-mark the Valyrian Steel Blade for use without knowing which House card the opponent has selected?\n\n"
+ "This could be useful if you anticipate effects like those of Doran Martell or Ser Gerris Drinkwater, "
+ "potentially causing you to lose your first-place position on the fiefdoms track.\n"
+ "However, exercise caution, as facing Doran in this battle would render it too late to hand over a used blade. "
+ "Doran's immediate effect takes precedence and transfers the blade before you have the chance to burn it."
)) {
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -572,6 +572,11 @@ export default class CombatGameState extends GameState<
}
}

isCommandingVassalInCombat(commanderHouse: House): boolean {
return (this.ingameGameState.isVassalHouse(this.attacker) && this.ingameGameState.getControllerOfHouse(this.attacker).house == commanderHouse)
|| (this.ingameGameState.isVassalHouse(this.defender) && this.ingameGameState.getControllerOfHouse(this.defender).house == commanderHouse);
}

isCommandingHouseInCombat(commanderHouse: House): boolean {
return this.ingameGameState.getControllerOfHouse(this.attacker).house == commanderHouse
|| this.ingameGameState.getControllerOfHouse(this.defender).house == commanderHouse;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,10 @@ export class ExtendPlayerClocks extends VoteType {
return "extend all player clocks by 15 minutes";
}

getPositiveCountToPass(vote: Vote): number {
return vote.participatingHouses.length;
}

executeAccepted(vote: Vote): void {
const ingame = vote.ingame;

Expand Down

0 comments on commit 8e080f9

Please sign in to comment.