Commit 1c2896a6 authored by Chunchi Che's avatar Chunchi Che

fix ygo card

parent 84b388d9
Pipeline #28746 passed with stages
in 11 minutes and 21 seconds
......@@ -32,28 +32,28 @@ export default async (container: Container, updateData: MsgUpdateData) => {
await callCardMove(target.uuid);
}
}
if (action.type_ >= 0) {
if (action?.type_ >= 0) {
meta.data.type = action.type_;
if (action.type_ & TYPE_TOKEN) {
target.isToken = true;
}
}
if (action.level >= 0) {
if (action?.level >= 0) {
meta.data.level = action.level;
}
if (action.attribute >= 0) {
if (action?.attribute >= 0) {
meta.data.attribute = action.attribute;
}
if (action.race >= 0) {
if (action?.race >= 0) {
meta.data.race = action.race;
}
if (action.attack >= 0) {
if (action?.attack >= 0) {
meta.data.atk = action.attack;
}
if (action.defense >= 0) {
if (action?.defense >= 0) {
meta.data.def = action.defense;
}
if (action.status >= 0) {
if (action?.status >= 0) {
target.status = action.status;
}
// TODO: counters
......
......@@ -99,7 +99,7 @@ export class CardStore implements NeosStore {
// TODO: provided in class
export function isCardDisabled(card: CardType): boolean {
return card.status === STATUS_DISABLED || card.status === STATUS_FORBIDDEN;
return (card.status & (STATUS_DISABLED | STATUS_FORBIDDEN)) > 0;
}
export const cardStore = proxy(new CardStore());
......@@ -34,6 +34,7 @@ export const YgoCard: React.FC<Props> = (props) => {
onClick,
onLoad,
} = props;
return useMemo(
() => (
<div
......@@ -55,7 +56,10 @@ export const YgoCard: React.FC<Props> = (props) => {
<div className={styles.targeted}>
<img src={`${assetsPath}/targeted.svg`} />
</div>
) : disabled ? (
) : (
<></>
)}
{disabled ? (
<div className={styles.disabled}>
<img src={`${assetsPath}/disabled.png`} />
</div>
......@@ -64,6 +68,6 @@ export const YgoCard: React.FC<Props> = (props) => {
)}
</div>
),
[code],
[code, targeted, disabled],
);
};
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