Commit fcb1fe34 authored by Chunchi Che's avatar Chunchi Che

fix

parent e2e42df3
Pipeline #20602 passed with stages
in 9 minutes and 10 seconds
......@@ -126,3 +126,35 @@ export const Meta2StringCodeMap: Map<number, number> = new Map([
[RACE_WYRM, 1043],
[RACE_CYBERSE, 1044],
]);
/*
* ygopro将卡牌类型按位运算进行了编码,这里将编码信息提出出来*/
export function extraCardTypes(typeCode: number): number[] {
return [
TYPE_MONSTER,
TYPE_SPELL,
TYPE_TRAP,
TYPE_NORMAL,
TYPE_EFFECT,
TYPE_FUSION,
TYPE_RITUAL,
TYPE_TRAPMONSTER,
TYPE_SPIRIT,
TYPE_UNION,
TYPE_DUAL,
TYPE_TUNER,
TYPE_SYNCHRO,
TYPE_TOKEN,
TYPE_QUICKPLAY,
TYPE_CONTINUOUS,
TYPE_EQUIP,
TYPE_FIELD,
TYPE_COUNTER,
TYPE_FLIP,
TYPE_TOON,
TYPE_XYZ,
TYPE_PENDULUM,
TYPE_SPSUMMON,
TYPE_LINK,
].filter((target) => (target & typeCode) > 0);
}
......@@ -16,7 +16,7 @@ import Icon, { StarOutlined } from "@ant-design/icons";
import NeosConfig from "../../../neos.config.json";
import { ReactComponent as BattleSvg } from "../../../neos-assets/battle-axe.svg";
import { ReactComponent as DefenceSvg } from "../../../neos-assets/checked-shield.svg";
import { Meta2StringCodeMap } from "../../common";
import { extraCardTypes, Meta2StringCodeMap } from "../../common";
import { fetchStrings } from "../../api/strings";
const { Meta } = Card;
......@@ -27,7 +27,7 @@ const CardModal = () => {
const isOpen = useAppSelector(selectCardModalIsOpen);
const meta = useAppSelector(selectCardModalMeta);
const name = meta?.text.name;
const types = meta?.text.types;
const types = meta?.data.type;
const race = meta?.data.race;
const attribute = meta?.data.attribute;
const level = meta?.data.level;
......@@ -52,7 +52,11 @@ const CardModal = () => {
>
<Meta title={name} />
<p>
<AttLine types={types} race={race} attribute={attribute} />
<AttLine
types={extraCardTypes(types || 0)}
race={race}
attribute={attribute}
/>
</p>
<p>
<AtkLine level={level} atk={atk} def={def} />
......@@ -109,7 +113,7 @@ const AtkLine = (props: { level?: number; atk?: number; def?: number }) => (
);
const AttLine = (props: {
types?: string;
types: number[];
race?: number;
attribute?: number;
}) => {
......@@ -119,9 +123,12 @@ const AttLine = (props: {
const attribute = props.attribute
? fetchStrings("!system", Meta2StringCodeMap.get(props.attribute) || 0)
: undefined;
const types = props.types
.map((t) => fetchStrings("!system", Meta2StringCodeMap.get(t) || 0))
.join("|");
return (
<Row gutter={8}>
{props.types ? <Col>{`[${props.types}]`}</Col> : <></>}
<Col>{`[${types}]`}</Col>
{race ? <Col>{race}</Col> : <></>}
<Col>/</Col>
{attribute ? <Col>{attribute}</Col> : <></>}
......
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