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