Commit 4eda5276 authored by Chunchi Che's avatar Chunchi Che

rename location to zone

parent 3249270c
Pipeline #22067 failed with stages
in 14 minutes and 29 seconds
......@@ -36,15 +36,17 @@ export class BufferReaderExt {
// 超量素材
return new ygopro.CardLocation({
controler,
location: ygopro.CardZone.OVERLAY,
zone: numberToCardZone(location),
sequence,
is_overlay: true,
overlay_sequence: ss,
});
} else {
return new ygopro.CardLocation({
controler,
location: numberToCardZone(location),
zone: numberToCardZone(location),
sequence,
is_overlay: false,
position: numberToCardPosition(ss),
});
}
......@@ -57,7 +59,7 @@ export class BufferReaderExt {
return new ygopro.CardLocation({
controler,
location: numberToCardZone(location),
zone: numberToCardZone(location),
sequence,
});
}
......
......@@ -18,7 +18,7 @@ export default (data: Uint8Array) => {
if (
target_location.controler == 0 &&
target_location.location == 0 &&
target_location.zone == 0 &&
target_location.sequence == 0
) {
// 全零表示直接攻击玩家
......
......@@ -99,9 +99,6 @@ export function cardZoneToNumber(zone: ygopro.CardZone): number {
case ygopro.CardZone.EXTRA: {
return 0x40;
}
case ygopro.CardZone.OVERLAY: {
return 0x80;
}
case ygopro.CardZone.ONFIELD: {
return 0x0c;
}
......@@ -142,9 +139,6 @@ export function numberToCardZone(
case 0x40: {
return ygopro.CardZone.EXTRA;
}
case 0x80: {
return ygopro.CardZone.OVERLAY;
}
case 0x0c: {
return ygopro.CardZone.ONFIELD;
}
......
......@@ -9,7 +9,7 @@ export default async (attack: ygopro.StocGameMessage.MsgAttack) => {
});
const attacker = cardStore.at(
attack.attacker_location.location,
attack.attacker_location.zone,
attack.attacker_location.controler,
attack.attacker_location.sequence
);
......@@ -22,7 +22,7 @@ export default async (attack: ygopro.StocGameMessage.MsgAttack) => {
attacker.directAttack = false;
} else {
const target = cardStore.at(
attack.target_location.location,
attack.target_location.zone,
attack.target_location.controler,
attack.target_location.sequence
);
......
......@@ -5,8 +5,7 @@ import { cardStore, CardType } from "@/stores";
import { REASON_MATERIAL } from "../../common";
type MsgMove = ygopro.StocGameMessage.MsgMove;
const { HAND, GRAVE, REMOVED, DECK, EXTRA, MZONE, TZONE, OVERLAY } =
ygopro.CardZone;
const { HAND, GRAVE, REMOVED, DECK, EXTRA, MZONE, TZONE } = ygopro.CardZone;
const overlayStack: CardType[] = [];
......@@ -18,16 +17,14 @@ export default async (move: MsgMove) => {
// FIXME: 考虑超量素材的情况
const fromCards = cardStore.at(from.location, from.controler);
const toCards = cardStore.at(to.location, to.controler);
const fromCards = cardStore.at(from.zone, from.controler);
const toCards = cardStore.at(to.zone, to.controler);
// TODO: 这段逻辑有点迷惑,后面问问作者
const fromZone =
move.from.toArray().at(1) === undefined
? ygopro.CardZone.TZONE
: from.location;
move.from.toArray().at(1) === undefined ? ygopro.CardZone.TZONE : from.zone;
const toZone =
move.to.toArray().at(1) === undefined ? ygopro.CardZone.TZONE : to.location;
move.to.toArray().at(1) === undefined ? ygopro.CardZone.TZONE : to.zone;
// log出来看看,后期删掉即可
await (async () => {
......@@ -44,7 +41,7 @@ export default async (move: MsgMove) => {
if (fromZone === TZONE) {
// 召唤 token
target = cardStore.at(TZONE, from.controler)[0]; // 必有,随便取一个没用到的token
} else if (fromZone === OVERLAY) {
} else if (from.is_overlay) {
// 超量素材的去除
const xyzMonster = cardStore.at(MZONE, from.controler, from.sequence);
if (xyzMonster) {
......@@ -80,7 +77,7 @@ export default async (move: MsgMove) => {
}
// 超量
if (toZone === OVERLAY) {
if (to.is_overlay) {
// 准备超量召唤,超量素材入栈
if (reason == REASON_MATERIAL) overlayStack.push(target);
// 超量素材的添加
......
......@@ -19,7 +19,7 @@ export default async (selectEffectYn: MsgSelectEffectYn) => {
) => {
const desc1 = desc.replace(
`[%ls]`,
fetchStrings("!system", cardLocation.location + 1000)
fetchStrings("!system", cardLocation.zone + 1000)
);
const desc2 = desc1.replace(`[%ls]`, cardMeta.text.name || "[?]");
return desc2;
......
......@@ -61,7 +61,7 @@ class CardStore {
}
}
find(location: ygopro.CardLocation): CardType | undefined {
return this.at(location.location, location.controler, location.sequence);
return this.at(location.zone, location.controler, location.sequence);
}
async setChaining(
location: ygopro.CardLocation,
......
......@@ -65,7 +65,7 @@ export const fetchEsHintMeta = async ({
if (location) {
const fieldMeta = cardStore.at(
location.location,
location.zone,
location.controler,
location.sequence
);
......
......@@ -25,8 +25,7 @@ export const fetchCheckCardMeta = async (
const newID =
code != 0
? code
: cardStore.at(location.location, controller, location.sequence)?.code ||
0;
: cardStore.at(location.zone, controller, location.sequence)?.code || 0;
const meta = await fetchCard(newID);
const effectDesc = effectDescCode
......
......@@ -10,7 +10,6 @@ import {
fetchStrings,
sendSelectMultiResponse,
sendSelectSingleResponse,
ygopro,
} from "@/api";
import { useConfig } from "@/config";
import { clearSelectActions, matStore, messageStore } from "@/stores";
......@@ -60,7 +59,7 @@ export const SelectActionsModal = () => {
? response.length == 1
: response.length >= min && response.length <= max && levelMatched;
const grouped = groupBy(selectables, (option) => option.location?.location!);
const grouped = groupBy(selectables, (option) => option.location?.zone!);
return (
<>
......
......@@ -21,7 +21,7 @@ import {
const NeosConfig = useConfig();
const { HAND, GRAVE, REMOVED, DECK, EXTRA, MZONE, SZONE, TZONE, OVERLAY } =
const { HAND, GRAVE, REMOVED, DECK, EXTRA, MZONE, SZONE, TZONE } =
ygopro.CardZone;
export const Card: FC<{ idx: number }> = React.memo(({ idx }) => {
......@@ -43,7 +43,6 @@ export const Card: FC<{ idx: number }> = React.memo(({ idx }) => {
switch (zone) {
case MZONE:
case SZONE:
case OVERLAY:
await moveToGround({ card: state, api });
break;
case HAND:
......
......@@ -24,7 +24,7 @@ const {
DECK_CARD_HEIGHT,
} = matConfig;
const { HAND, GRAVE, REMOVED, DECK, EXTRA, MZONE, SZONE, TZONE, OVERLAY } =
const { HAND, GRAVE, REMOVED, DECK, EXTRA, MZONE, SZONE, TZONE } =
ygopro.CardZone;
export const moveToDeck = async (props: { card: CardType; api: SpringApi }) => {
......
......@@ -23,7 +23,7 @@ const {
DECK_ROTATE_Z,
} = matConfig;
const { HAND, GRAVE, REMOVED, DECK, EXTRA, MZONE, SZONE, TZONE, OVERLAY } =
const { HAND, GRAVE, REMOVED, DECK, EXTRA, MZONE, SZONE, TZONE } =
ygopro.CardZone;
export const moveToGround = async (props: {
......@@ -67,7 +67,6 @@ export const moveToGround = async (props: {
}
break;
}
case OVERLAY:
case MZONE: {
if (sequence > 4) {
// 额外怪兽区
......
......@@ -23,7 +23,7 @@ const {
DECK_ROTATE_Z,
} = matConfig;
const { HAND, GRAVE, REMOVED, DECK, EXTRA, MZONE, SZONE, TZONE, OVERLAY } =
const { HAND, GRAVE, REMOVED, DECK, EXTRA, MZONE, SZONE, TZONE } =
ygopro.CardZone;
export const moveToHand = async (props: { card: CardType; api: SpringApi }) => {
......
......@@ -23,7 +23,7 @@ const {
DECK_ROTATE_Z,
} = matConfig;
const { HAND, GRAVE, REMOVED, DECK, EXTRA, MZONE, SZONE, TZONE, OVERLAY } =
const { HAND, GRAVE, REMOVED, DECK, EXTRA, MZONE, SZONE, TZONE } =
ygopro.CardZone;
export const moveToOutside = async (props: {
......
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