Skip to content

Commit

Permalink
Show units you haven't unlocked yet in the damage chart.
Browse files Browse the repository at this point in the history
GitOrigin-RevId: 013fb1963f7e6fd521295224af40d56aa2216062
  • Loading branch information
cpojer committed Oct 29, 2024
1 parent ef8e674 commit edd9ed3
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 10 deletions.
8 changes: 4 additions & 4 deletions athena/info/Building.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ export const PowerStation = new BuildingInfo(
export const Barracks = new BuildingInfo(
12,
'Barracks',
`Barracks function as training centers, facilitating the recruitment and deployment of various types of infantry units.`,
`Barracks function as training centers, facilitating the recruitment and deployment of various types of soldiers.`,
{
cost: 150,
defense: 20,
Expand All @@ -486,7 +486,7 @@ export const Barracks = new BuildingInfo(
export const Shelter = new BuildingInfo(
BuildingID.Shelter,
'Shelter',
`Shelters automatically heal and resupply infantry units at the beginning of each turn.`,
`Shelters automatically heal and resupply soldiers at the beginning of each turn.`,
{
behaviors: new BuildingBehaviors({ heal: true }),
cost: 200,
Expand Down Expand Up @@ -552,7 +552,7 @@ export const RepairShop = new BuildingInfo(
export const Medbay = new BuildingInfo(
18,
'Medbay',
`Medbays automatically heal and resupply infantry units at the beginning of each turn.`,
`Medbays automatically heal and resupply soldiers at the beginning of each turn.`,
{
behaviors: new BuildingBehaviors({ heal: true }),
cost: 200,
Expand All @@ -567,7 +567,7 @@ export const Medbay = new BuildingInfo(
export const SpawnPlatform = new BuildingInfo(
19,
'Spawn Platform',
`Spawn Platforms can be used to spawn infantry units.`,
`Spawn Platforms can be used to spawn soldiers.`,
{
cost: 150,
defense: 20,
Expand Down
2 changes: 2 additions & 0 deletions hera/GameMap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1737,6 +1737,7 @@ export default class GameMap extends Component<Props, State> {
disablePerformanceMetrics,
editor,
fogStyle,
gameId,
margin,
playerAchievement,
scale,
Expand Down Expand Up @@ -2008,6 +2009,7 @@ export default class GameMap extends Component<Props, State> {
{gameInfoState && (
<GameDialog
endGame={this.props.endGame ? this._endGame : undefined}
gameId={gameId}
onClose={this._hideGameInfo}
playerAchievement={playerAchievement}
spectatorCodes={this.props.spectatorCodes}
Expand Down
1 change: 1 addition & 0 deletions hera/Types.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ export type Props = Readonly<{
endGame?: (type: 'Lose') => void;
events?: EventTarget;
fogStyle: 'soft' | 'hard';
gameId?: string;
gameInfoPanels?: GameInfoPanels;
inset?: number;
lastActionResponse?: ActionResponse | null;
Expand Down
22 changes: 16 additions & 6 deletions hera/card/UnitCard.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Route } from '@deities/apollo/Routes.tsx';
import { House, VerticalBarrier } from '@deities/athena/info/Building.tsx';
import { MovementType } from '@deities/athena/info/MovementType.tsx';
import { Skill } from '@deities/athena/info/Skill.tsx';
Expand Down Expand Up @@ -125,18 +126,25 @@ const supplyRange = getAttributeRange(
);

export default memo(function UnitCard({
gameId,
map,
playerDetails,
unit,
vector,
viewer,
}: {
gameId?: string;
map: MapData;
playerDetails: PlayerDetails;
unit: Unit;
vector: Vector;
viewer?: PlayerID | null;
}) {
const { pathname: backURL } = useLocation();
const damageChartRoute: Route = gameId?.length
? `/damage-chart/${gameId}?back=${backURL}`
: `/damage-chart?back=${backURL}`;

const { biome } = map.config;
const { info, player } = unit;
const {
Expand Down Expand Up @@ -318,6 +326,7 @@ export default memo(function UnitCard({
<UnitTransports biome={biome} player={player} unit={unit} />
<UnitAttack
biome={biome}
damageChartRoute={damageChartRoute}
map={map}
player={player}
unit={unit}
Expand Down Expand Up @@ -366,6 +375,7 @@ const getAllAvailableUnits = (

const Weapon = memo(function WeaponAttack({
biome,
damageChartRoute,
map,
player,
supply,
Expand All @@ -374,14 +384,14 @@ const Weapon = memo(function WeaponAttack({
weapon,
}: {
biome: Biome;
damageChartRoute: Route;
map: MapData;
player: PlayerID;
supply?: number;
unit: Unit;
vector: Vector;
weapon: WeaponT;
}) {
const { pathname: backURL } = useLocation();
const tile = map.getTileInfo(vector);
const opponent = resolveDynamicPlayerID(map, 'opponent', player);
const allSkills = useMemo(
Expand Down Expand Up @@ -512,14 +522,11 @@ const Weapon = memo(function WeaponAttack({
damage. See the{' '}
<fbt:param name="link">
{App.canQuit ? (
<InlineLink to={`/damage-chart?back=${backURL}`}>
<InlineLink to={damageChartRoute}>
<fbt desc="Damage chart link name">Damage Chart</fbt>
</InlineLink>
) : (
<InlineLink
href={`/damage-chart?back=${backURL}`}
target="blank"
>
<InlineLink href={damageChartRoute} target="blank">
<fbt desc="Damage chart link name">Damage Chart</fbt>
</InlineLink>
)}
Expand All @@ -535,12 +542,14 @@ const Weapon = memo(function WeaponAttack({

const UnitAttack = ({
biome,
damageChartRoute,
map,
player,
unit,
vector,
}: {
biome: Biome;
damageChartRoute: Route;
map: MapData;
player: PlayerID;
unit: Unit;
Expand All @@ -562,6 +571,7 @@ const UnitAttack = ({
{[...weapons].map(([id, weapon]) => (
<Weapon
biome={biome}
damageChartRoute={damageChartRoute}
key={id}
map={map}
player={player}
Expand Down
9 changes: 9 additions & 0 deletions hera/ui/GameDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,13 @@ type MapInfoPanelState = Readonly<

const MapInfoPanel = memo(function MapInfoPanel({
currentViewer,
gameId,
info,
map,
playerDetails,
}: {
currentViewer: PlayerID | null;
gameId?: string;
info: MapInfoState | LeaderInfoState;
map: MapData;
playerDetails: PlayerDetails;
Expand Down Expand Up @@ -170,6 +172,7 @@ const MapInfoPanel = memo(function MapInfoPanel({
<Stack gap={16} vertical>
{panel.type === 'unit' ? (
<UnitCard
gameId={gameId}
map={map}
playerDetails={playerDetails}
{...info}
Expand Down Expand Up @@ -625,12 +628,14 @@ const GameInfoPanel = memo(function GameInfoPanel({

const GameDialogPanel = memo(function GameDialogPanel({
endGame,
gameId,
gameInfoState,
playerAchievement,
spectatorCodes,
state: { currentViewer, lastActionResponse, map, playerDetails },
}: {
endGame?: () => void;
gameId?: string;
gameInfoState: CurrentGameInfoState | LeaderInfoState | MapInfoState;
playerAchievement: PlayerAchievementT | null;
spectatorCodes?: ReadonlyArray<string>;
Expand Down Expand Up @@ -658,6 +663,7 @@ const GameDialogPanel = memo(function GameDialogPanel({
return (
<MapInfoPanel
currentViewer={currentViewer}
gameId={gameId}
info={gameInfoState}
map={map}
playerDetails={playerDetails}
Expand Down Expand Up @@ -970,12 +976,14 @@ const crystalSelectedBoxStyle = css`

export default memo(function GameDialog({
endGame,
gameId,
onClose,
playerAchievement,
spectatorCodes,
state,
}: {
endGame?: (type: 'Lose') => void;
gameId?: string;
onClose: () => void | Promise<void>;
playerAchievement: PlayerAchievementT | null;
spectatorCodes?: ReadonlyArray<string>;
Expand All @@ -1001,6 +1009,7 @@ export default memo(function GameDialog({
}
: undefined
}
gameId={gameId}
gameInfoState={
create
? {
Expand Down

0 comments on commit edd9ed3

Please sign in to comment.