Commit ad8414d7 authored by Chunchi Che's avatar Chunchi Che

update Mat.tsx

parent 9eaab7d6
Pipeline #21436 passed with stages
in 14 minutes and 29 seconds
......@@ -10,6 +10,7 @@ import { BlockRow, ExtraBlockRow } from "./Block";
import { Card } from "./Card";
import { Menu } from "./Menu";
import YgoZone = ygopro.CardZone;
import YgoPosition = ygopro.CardPosition;
type RenderCard = CardState & {
sequence: number;
......@@ -92,6 +93,14 @@ export const Mat = () => {
row={cardStateToRow(card)}
col={cardStateToCol(card)}
hight={CardStateToHigh(card)}
defense={
card.location.position === YgoPosition.DEFENSE ||
card.location.position === YgoPosition.FACEDOWN_DEFENSE ||
card.location.position === YgoPosition.FACEUP_DEFENSE
}
facedown={CardStateToFaceDown(card)}
vertical={card.location.zone == YgoZone.HAND}
highlight={card.idleInteractivities.length > 0}
/>
))}
</div>
......@@ -201,3 +210,14 @@ function CardStateToHigh(state: RenderCard): number {
return 0;
}
}
function CardStateToFaceDown(state: RenderCard): boolean {
const position = state.location.position;
return (
position === YgoPosition.FACEDOWN ||
position === YgoPosition.FACEDOWN_ATTACK ||
position === YgoPosition.FACEDOWN_DEFENSE ||
state.occupant!.id == 0
);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment