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