Commit bbe1136b authored by timel's avatar timel

refactor: rename to official names(gy & banished)

parent 2c33125b
Pipeline #21243 failed with stages
in 11 minutes and 45 seconds
...@@ -20,28 +20,30 @@ import { ...@@ -20,28 +20,30 @@ import {
import { DuelState } from "./mod"; import { DuelState } from "./mod";
import { judgeSelf } from "./util"; import { judgeSelf } from "./util";
export interface ExclusionState extends DuelFieldState {} export interface BanishedZoneState extends DuelFieldState {}
// 初始化除外区状态 // 初始化除外区状态
export const initExclusionImpl: CaseReducer< export const initBanishedZoneImpl: CaseReducer<
DuelState, DuelState,
PayloadAction<number> PayloadAction<number>
> = (state, action) => { > = (state, action) => {
const player = action.payload; const player = action.payload;
if (judgeSelf(player, state)) { if (judgeSelf(player, state)) {
state.meExclusion = { inner: [] }; state.meBanishedZone = { inner: [] };
} else { } else {
state.opExclusion = { inner: [] }; state.opBanishedZone = { inner: [] };
} }
}; };
// 增加除外区 // 增加除外区
export const fetchExclusionMeta = createAsyncMetaThunk( export const fetchBanishedZoneMeta = createAsyncMetaThunk(
"duel/fetchExclusionMeta" "duel/fetchBanishedZoneMeta"
); );
export const exclusionCase = (builder: ActionReducerMapBuilder<DuelState>) => { export const banishedZoneCase = (
builder.addCase(fetchExclusionMeta.pending, (state, action) => { builder: ActionReducerMapBuilder<DuelState>
) => {
builder.addCase(fetchBanishedZoneMeta.pending, (state, action) => {
// Meta结果没返回之前先更新`ID` // Meta结果没返回之前先更新`ID`
const controler = action.meta.arg.controler; const controler = action.meta.arg.controler;
const sequence = action.meta.arg.sequence; const sequence = action.meta.arg.sequence;
...@@ -58,51 +60,51 @@ export const exclusionCase = (builder: ActionReducerMapBuilder<DuelState>) => { ...@@ -58,51 +60,51 @@ export const exclusionCase = (builder: ActionReducerMapBuilder<DuelState>) => {
counters: {}, counters: {},
}; };
if (judgeSelf(controler, state)) { if (judgeSelf(controler, state)) {
extendState(state.meExclusion, newExclusion); extendState(state.meBanishedZone, newExclusion);
} else { } else {
extendState(state.opExclusion, newExclusion); extendState(state.opBanishedZone, newExclusion);
} }
}); });
builder.addCase(fetchExclusionMeta.fulfilled, (state, action) => { builder.addCase(fetchBanishedZoneMeta.fulfilled, (state, action) => {
const controler = action.payload.controler; const controler = action.payload.controler;
const sequence = action.payload.sequence; const sequence = action.payload.sequence;
const meta = action.payload.meta; const meta = action.payload.meta;
if (judgeSelf(controler, state)) { if (judgeSelf(controler, state)) {
extendMeta(state.meExclusion, meta, sequence); extendMeta(state.meBanishedZone, meta, sequence);
} else { } else {
extendMeta(state.opExclusion, meta, sequence); extendMeta(state.opBanishedZone, meta, sequence);
} }
}); });
}; };
// 删除除外区 // 删除除外区
export const removeExclusionImpl: CaseReducer< export const removeBanishedZoneImpl: CaseReducer<
DuelState, DuelState,
PayloadAction<{ controler: number; sequence: number }> PayloadAction<{ controler: number; sequence: number }>
> = (state, action) => { > = (state, action) => {
const exclusion = judgeSelf(action.payload.controler, state) const banishedZone = judgeSelf(action.payload.controler, state)
? state.meExclusion ? state.meBanishedZone
: state.opExclusion; : state.opBanishedZone;
removeCard(exclusion, action.payload.sequence); removeCard(banishedZone, action.payload.sequence);
}; };
export const addExclusionIdleInteractivitiesImpl: DuelReducer<{ export const addBanishedZoneIdleInteractivitiesImpl: DuelReducer<{
player: number; player: number;
sequence: number; sequence: number;
interactivity: Interactivity<number>; interactivity: Interactivity<number>;
}> = (state, action) => { }> = (state, action) => {
const exclusion = judgeSelf(action.payload.player, state) const banishedZone = judgeSelf(action.payload.player, state)
? state.meExclusion ? state.meBanishedZone
: state.opExclusion; : state.opBanishedZone;
extendIdleInteractivities( extendIdleInteractivities(
exclusion, banishedZone,
action.payload.sequence, action.payload.sequence,
action.payload.interactivity action.payload.interactivity
); );
}; };
export const selectMeExclusion = (state: RootState) => export const selectMeBanishedZone = (state: RootState) =>
state.duel.meExclusion || { inner: [] }; state.duel.meBanishedZone || { inner: [] };
export const selectopExclusion = (state: RootState) => export const selectOpBanishedZone = (state: RootState) =>
state.duel.opExclusion || { inner: [] }; state.duel.opBanishedZone || { inner: [] };
...@@ -20,32 +20,34 @@ import { ...@@ -20,32 +20,34 @@ import {
import { DuelState } from "./mod"; import { DuelState } from "./mod";
import { judgeSelf } from "./util"; import { judgeSelf } from "./util";
export interface CemeteryState extends DuelFieldState {} export interface GraveyardState extends DuelFieldState {}
// 初始化墓地状态 // 初始化墓地状态
export const initCemeteryImpl: CaseReducer<DuelState, PayloadAction<number>> = ( export const initGraveyardImpl: CaseReducer<
state, DuelState,
action PayloadAction<number>
) => { > = (state, action) => {
const player = action.payload; const player = action.payload;
if (judgeSelf(player, state)) { if (judgeSelf(player, state)) {
state.meCemetery = { inner: [] }; state.meGraveyard = { inner: [] };
} else { } else {
state.opCemetery = { inner: [] }; state.opGraveyard = { inner: [] };
} }
}; };
// 增加墓地 // 增加墓地
export const fetchCemeteryMeta = createAsyncMetaThunk("duel/fetchCemeteryMeta"); export const fetchGraveyardMeta = createAsyncMetaThunk(
"duel/fetchGraveyardMeta"
);
export const cemeteryCase = (builder: ActionReducerMapBuilder<DuelState>) => { export const graveyardCase = (builder: ActionReducerMapBuilder<DuelState>) => {
builder.addCase(fetchCemeteryMeta.pending, (state, action) => { builder.addCase(fetchGraveyardMeta.pending, (state, action) => {
// Meta结果没返回之前先更新`ID` // Meta结果没返回之前先更新`ID`
const controler = action.meta.arg.controler; const controler = action.meta.arg.controler;
const sequence = action.meta.arg.sequence; const sequence = action.meta.arg.sequence;
const code = action.meta.arg.code; const code = action.meta.arg.code;
const newCemetery = { const newGraveyard = {
occupant: { id: code, data: {}, text: {} }, occupant: { id: code, data: {}, text: {} },
location: { location: {
controler, controler,
...@@ -56,51 +58,51 @@ export const cemeteryCase = (builder: ActionReducerMapBuilder<DuelState>) => { ...@@ -56,51 +58,51 @@ export const cemeteryCase = (builder: ActionReducerMapBuilder<DuelState>) => {
counters: {}, counters: {},
}; };
if (judgeSelf(controler, state)) { if (judgeSelf(controler, state)) {
extendState(state.meCemetery, newCemetery); extendState(state.meGraveyard, newGraveyard);
} else { } else {
extendState(state.opCemetery, newCemetery); extendState(state.opGraveyard, newGraveyard);
} }
}); });
builder.addCase(fetchCemeteryMeta.fulfilled, (state, action) => { builder.addCase(fetchGraveyardMeta.fulfilled, (state, action) => {
const controler = action.payload.controler; const controler = action.payload.controler;
const sequence = action.payload.sequence; const sequence = action.payload.sequence;
const meta = action.payload.meta; const meta = action.payload.meta;
if (judgeSelf(controler, state)) { if (judgeSelf(controler, state)) {
extendMeta(state.meCemetery, meta, sequence); extendMeta(state.meGraveyard, meta, sequence);
} else { } else {
extendMeta(state.opCemetery, meta, sequence); extendMeta(state.opGraveyard, meta, sequence);
} }
}); });
}; };
// 删除墓地 // 删除墓地
export const removeCemeteryImpl: CaseReducer< export const removeGraveyardImpl: CaseReducer<
DuelState, DuelState,
PayloadAction<{ controler: number; sequence: number }> PayloadAction<{ controler: number; sequence: number }>
> = (state, action) => { > = (state, action) => {
const cemetery = judgeSelf(action.payload.controler, state) const graveyard = judgeSelf(action.payload.controler, state)
? state.meCemetery ? state.meGraveyard
: state.opCemetery; : state.opGraveyard;
removeCard(cemetery, action.payload.sequence); removeCard(graveyard, action.payload.sequence);
}; };
export const addCemeteryIdleInteractivitiesImpl: DuelReducer<{ export const addGraveyardIdleInteractivitiesImpl: DuelReducer<{
player: number; player: number;
sequence: number; sequence: number;
interactivity: Interactivity<number>; interactivity: Interactivity<number>;
}> = (state, action) => { }> = (state, action) => {
const cemetery = judgeSelf(action.payload.player, state) const graveyard = judgeSelf(action.payload.player, state)
? state.meCemetery ? state.meGraveyard
: state.opCemetery; : state.opGraveyard;
extendIdleInteractivities( extendIdleInteractivities(
cemetery, graveyard,
action.payload.sequence, action.payload.sequence,
action.payload.interactivity action.payload.interactivity
); );
}; };
export const selectMeCemetery = (state: RootState) => export const selectMeGraveyard = (state: RootState) =>
state.duel.meCemetery || { inner: [] }; state.duel.meGraveyard || { inner: [] };
export const selectOpCemetery = (state: RootState) => export const selectOpGraveyard = (state: RootState) =>
state.duel.opCemetery || { inner: [] }; state.duel.opGraveyard || { inner: [] };
...@@ -24,16 +24,16 @@ export const clearAllIdleInteractivitiesImpl: DuelReducer<number> = ( ...@@ -24,16 +24,16 @@ export const clearAllIdleInteractivitiesImpl: DuelReducer<number> = (
state.meHands, state.meHands,
state.meMonsters, state.meMonsters,
state.meMagics, state.meMagics,
state.meCemetery, state.meGraveyard,
state.meExclusion, state.meBanishedZone,
state.meExtraDeck, state.meExtraDeck,
] ]
: [ : [
state.opHands, state.opHands,
state.opMonsters, state.opMonsters,
state.opMagics, state.opMagics,
state.opCemetery, state.opGraveyard,
state.opExclusion, state.opBanishedZone,
state.opExtraDeck, state.opExtraDeck,
]; ];
...@@ -51,15 +51,15 @@ export const clearAllPlaceInteractivitiesImpl: DuelReducer<number> = ( ...@@ -51,15 +51,15 @@ export const clearAllPlaceInteractivitiesImpl: DuelReducer<number> = (
state.meHands, state.meHands,
state.meMonsters, state.meMonsters,
state.meMagics, state.meMagics,
state.meCemetery, state.meGraveyard,
state.meExclusion, state.meBanishedZone,
] ]
: [ : [
state.opHands, state.opHands,
state.opMonsters, state.opMonsters,
state.opMagics, state.opMagics,
state.opCemetery, state.opGraveyard,
state.opExclusion, state.opBanishedZone,
]; ];
states.forEach((item) => clearPlaceInteractivities(item)); states.forEach((item) => clearPlaceInteractivities(item));
...@@ -106,18 +106,18 @@ export const updateFieldDataImpl: DuelReducer<MsgUpdateData> = ( ...@@ -106,18 +106,18 @@ export const updateFieldDataImpl: DuelReducer<MsgUpdateData> = (
break; break;
} }
case ygopro.CardZone.GRAVE: { case ygopro.CardZone.GRAVE: {
const cemetery = judgeSelf(player, state) const graveyard = judgeSelf(player, state)
? state.meCemetery ? state.meGraveyard
: state.opCemetery; : state.opGraveyard;
updateCardData(cemetery, actions); updateCardData(graveyard, actions);
break; break;
} }
case ygopro.CardZone.REMOVED: { case ygopro.CardZone.REMOVED: {
const exclusion = judgeSelf(player, state) const BanishedZone = judgeSelf(player, state)
? state.meExclusion ? state.meBanishedZone
: state.opExclusion; : state.opBanishedZone;
updateCardData(exclusion, actions); updateCardData(BanishedZone, actions);
break; break;
} }
...@@ -140,10 +140,10 @@ export const reloadFieldImpl: DuelReducer<MsgReloadField> = (state, action) => { ...@@ -140,10 +140,10 @@ export const reloadFieldImpl: DuelReducer<MsgReloadField> = (state, action) => {
state.opMonsters = { inner: [] }; state.opMonsters = { inner: [] };
state.meMagics = { inner: [] }; state.meMagics = { inner: [] };
state.opMagics = { inner: [] }; state.opMagics = { inner: [] };
state.meCemetery = { inner: [] }; state.meGraveyard = { inner: [] };
state.opCemetery = { inner: [] }; state.opGraveyard = { inner: [] };
state.meExclusion = { inner: [] }; state.meBanishedZone = { inner: [] };
state.opExclusion = { inner: [] }; state.opBanishedZone = { inner: [] };
state.meHands = { inner: [] }; state.meHands = { inner: [] };
state.opHands = { inner: [] }; state.opHands = { inner: [] };
...@@ -183,20 +183,20 @@ export const reloadFieldImpl: DuelReducer<MsgReloadField> = (state, action) => { ...@@ -183,20 +183,20 @@ export const reloadFieldImpl: DuelReducer<MsgReloadField> = (state, action) => {
player player
); );
// GRAVE // GRAVE
const cemetery = judgeSelf(player, state) const graveyard = judgeSelf(player, state)
? state.meCemetery ? state.meGraveyard
: state.opCemetery; : state.opGraveyard;
reloadFieldMeta( reloadFieldMeta(
cemetery, graveyard,
reload.zone_actions.filter((item) => item.zone == ygopro.CardZone.GRAVE), reload.zone_actions.filter((item) => item.zone == ygopro.CardZone.GRAVE),
player player
); );
// REMOVED // REMOVED
const exclusion = judgeSelf(player, state) const banishedZone = judgeSelf(player, state)
? state.meExclusion ? state.meBanishedZone
: state.opExclusion; : state.opBanishedZone;
reloadFieldMeta( reloadFieldMeta(
exclusion, banishedZone,
reload.zone_actions.filter( reload.zone_actions.filter(
(item) => item.zone == ygopro.CardZone.REMOVED (item) => item.zone == ygopro.CardZone.REMOVED
), ),
......
...@@ -9,11 +9,18 @@ import { ygopro } from "@/api/ocgcore/idl/ocgcore"; ...@@ -9,11 +9,18 @@ import { ygopro } from "@/api/ocgcore/idl/ocgcore";
import { RootState } from "@/store"; import { RootState } from "@/store";
import { import {
addCemeteryIdleInteractivitiesImpl, addBanishedZoneIdleInteractivitiesImpl,
cemeteryCase, banishedZoneCase,
CemeteryState, BanishedZoneState,
initCemeteryImpl, initBanishedZoneImpl,
removeCemeteryImpl, removeBanishedZoneImpl,
} from "./banishedZoneSlice";
import {
addGraveyardIdleInteractivitiesImpl,
graveyardCase,
GraveyardState,
initGraveyardImpl,
removeGraveyardImpl,
} from "./cemeretySlice"; } from "./cemeretySlice";
import { import {
clearAllIdleInteractivitiesImpl, clearAllIdleInteractivitiesImpl,
...@@ -22,13 +29,6 @@ import { ...@@ -22,13 +29,6 @@ import {
updateFieldDataImpl, updateFieldDataImpl,
} from "./commonSlice"; } from "./commonSlice";
import { DeckState, initDeckImpl } from "./deckSlice"; import { DeckState, initDeckImpl } from "./deckSlice";
import {
addExclusionIdleInteractivitiesImpl,
exclusionCase,
ExclusionState,
initExclusionImpl,
removeExclusionImpl,
} from "./exclusionSlice";
import { import {
addExtraDeckIdleInteractivitiesImpl, addExtraDeckIdleInteractivitiesImpl,
extraDeckCase, extraDeckCase,
...@@ -136,11 +136,11 @@ export interface DuelState { ...@@ -136,11 +136,11 @@ export interface DuelState {
meMagics?: MagicState; // 自己的魔法陷阱区状态 meMagics?: MagicState; // 自己的魔法陷阱区状态
opMagics?: MagicState; // 对手的魔法陷阱区状态 opMagics?: MagicState; // 对手的魔法陷阱区状态
meCemetery?: CemeteryState; // 自己的墓地状态 meGraveyard?: GraveyardState; // 自己的墓地状态
opCemetery?: CemeteryState; // 对手的墓地状态 opGraveyard?: GraveyardState; // 对手的墓地状态
meExclusion?: ExclusionState; // 自己的除外区状态 meBanishedZone?: BanishedZoneState; // 自己的除外区状态
opExclusion?: ExclusionState; // 对手的除外区状态 opBanishedZone?: BanishedZoneState; // 对手的除外区状态
meDeck?: DeckState; // 自己的卡组状态 meDeck?: DeckState; // 自己的卡组状态
opDeck?: DeckState; // 对手的卡组状态 opDeck?: DeckState; // 对手的卡组状态
...@@ -239,14 +239,14 @@ const duelSlice = createSlice({ ...@@ -239,14 +239,14 @@ const duelSlice = createSlice({
removeMagic: removeMagicImpl, removeMagic: removeMagicImpl,
// 墓地相关`Reducer` // 墓地相关`Reducer`
initCemetery: initCemeteryImpl, initGraveyard: initGraveyardImpl,
removeCemetery: removeCemeteryImpl, removeGraveyard: removeGraveyardImpl,
addCemeteryIdleInteractivities: addCemeteryIdleInteractivitiesImpl, addGraveyardIdleInteractivities: addGraveyardIdleInteractivitiesImpl,
// 除外区相关`Reducer` // 除外区相关`Reducer`
initExclusion: initExclusionImpl, initBanishedZone: initBanishedZoneImpl,
removeExclusion: removeExclusionImpl, removeBanishedZone: removeBanishedZoneImpl,
addExclusionIdleInteractivities: addExclusionIdleInteractivitiesImpl, addBanishedZoneIdleInteractivities: addBanishedZoneIdleInteractivitiesImpl,
// 卡组相关`Reducer` // 卡组相关`Reducer`
initDeck: initDeckImpl, initDeck: initDeckImpl,
...@@ -326,8 +326,8 @@ const duelSlice = createSlice({ ...@@ -326,8 +326,8 @@ const duelSlice = createSlice({
hintCase(builder); hintCase(builder);
monsterCase(builder); monsterCase(builder);
magicCase(builder); magicCase(builder);
cemeteryCase(builder); graveyardCase(builder);
exclusionCase(builder); banishedZoneCase(builder);
extraDeckCase(builder); extraDeckCase(builder);
checkCardModalCase(builder); checkCardModalCase(builder);
YesNoModalCase(builder); YesNoModalCase(builder);
...@@ -370,9 +370,9 @@ export const { ...@@ -370,9 +370,9 @@ export const {
setMagicPosition, setMagicPosition,
removeMagic, removeMagic,
removeHand, removeHand,
initCemetery, initGraveyard,
removeCemetery, removeGraveyard,
addCemeteryIdleInteractivities, addGraveyardIdleInteractivities,
setCardListModalIsOpen, setCardListModalIsOpen,
setCardListModalInfo, setCardListModalInfo,
setCheckCardModalIsOpen, setCheckCardModalIsOpen,
...@@ -390,9 +390,9 @@ export const { ...@@ -390,9 +390,9 @@ export const {
initDeck, initDeck,
removeExtraDeck, removeExtraDeck,
addExtraDeckIdleInteractivities, addExtraDeckIdleInteractivities,
initExclusion, initBanishedZone,
removeExclusion, removeBanishedZone,
addExclusionIdleInteractivities, addBanishedZoneIdleInteractivities,
setCheckCardModalV2IsOpen, setCheckCardModalV2IsOpen,
setCheckCardModalV2MinMax, setCheckCardModalV2MinMax,
setCheckCardModalV2CancelAble, setCheckCardModalV2CancelAble,
......
...@@ -61,15 +61,15 @@ export function findCardByLocation( ...@@ -61,15 +61,15 @@ export function findCardByLocation(
return magics?.inner.find(finder); return magics?.inner.find(finder);
} }
case ygopro.CardZone.REMOVED: { case ygopro.CardZone.REMOVED: {
const exclusions = judgeSelf(controler, state) const banishedZones = judgeSelf(controler, state)
? state.meExclusion ? state.meBanishedZone
: state.opExclusion; : state.opBanishedZone;
return exclusions?.inner.find(finder); return banishedZones?.inner.find(finder);
} }
case ygopro.CardZone.GRAVE: { case ygopro.CardZone.GRAVE: {
const cemerety = judgeSelf(controler, state) const cemerety = judgeSelf(controler, state)
? state.meCemetery ? state.meGraveyard
: state.opCemetery; : state.opGraveyard;
return cemerety?.inner.find(finder); return cemerety?.inner.find(finder);
} }
default: { default: {
......
import { ygopro } from "@/api/ocgcore/idl/ocgcore"; import { ygopro } from "@/api/ocgcore/idl/ocgcore";
import MsgMove = ygopro.StocGameMessage.MsgMove; import MsgMove = ygopro.StocGameMessage.MsgMove;
import { fetchCemeteryMeta } from "@/reducers/duel/cemeretySlice"; import { fetchBanishedZoneMeta } from "@/reducers/duel/banishedZoneSlice";
import { fetchExclusionMeta } from "@/reducers/duel/exclusionSlice"; import { fetchGraveyardMeta } from "@/reducers/duel/cemeretySlice";
import { fetchExtraDeckMeta } from "@/reducers/duel/extraDeckSlice"; import { fetchExtraDeckMeta } from "@/reducers/duel/extraDeckSlice";
import { insertHandMeta } from "@/reducers/duel/handsSlice"; import { insertHandMeta } from "@/reducers/duel/handsSlice";
import { fetchMagicMeta } from "@/reducers/duel/magicSlice"; import { fetchMagicMeta } from "@/reducers/duel/magicSlice";
import { import {
removeCemetery, removeBanishedZone,
removeExclusion,
removeExtraDeck, removeExtraDeck,
removeGraveyard,
removeHand, removeHand,
removeMagic, removeMagic,
removeMonster, removeMonster,
...@@ -52,14 +52,17 @@ export default (move: MsgMove, dispatch: AppDispatch) => { ...@@ -52,14 +52,17 @@ export default (move: MsgMove, dispatch: AppDispatch) => {
} }
case ygopro.CardZone.GRAVE: { case ygopro.CardZone.GRAVE: {
dispatch( dispatch(
removeCemetery({ controler: from.controler, sequence: from.sequence }) removeGraveyard({ controler: from.controler, sequence: from.sequence })
); );
break; break;
} }
case ygopro.CardZone.REMOVED: { case ygopro.CardZone.REMOVED: {
dispatch( dispatch(
removeExclusion({ controler: from.controler, sequence: from.sequence }) removeBanishedZone({
controler: from.controler,
sequence: from.sequence,
})
); );
break; break;
...@@ -128,7 +131,7 @@ export default (move: MsgMove, dispatch: AppDispatch) => { ...@@ -128,7 +131,7 @@ export default (move: MsgMove, dispatch: AppDispatch) => {
} }
case ygopro.CardZone.GRAVE: { case ygopro.CardZone.GRAVE: {
dispatch( dispatch(
fetchCemeteryMeta({ fetchGraveyardMeta({
controler: to.controler, controler: to.controler,
sequence: to.sequence, sequence: to.sequence,
code, code,
...@@ -146,7 +149,7 @@ export default (move: MsgMove, dispatch: AppDispatch) => { ...@@ -146,7 +149,7 @@ export default (move: MsgMove, dispatch: AppDispatch) => {
} }
case ygopro.CardZone.REMOVED: { case ygopro.CardZone.REMOVED: {
dispatch( dispatch(
fetchExclusionMeta({ fetchBanishedZoneMeta({
controler: to.controler, controler: to.controler,
sequence: to.sequence, sequence: to.sequence,
code, code,
......
import { ygopro } from "@/api/ocgcore/idl/ocgcore"; import { ygopro } from "@/api/ocgcore/idl/ocgcore";
import { Interactivity, InteractType } from "@/reducers/duel/generic"; import { Interactivity, InteractType } from "@/reducers/duel/generic";
import { import {
addCemeteryIdleInteractivities, addBanishedZoneIdleInteractivities,
addExclusionIdleInteractivities,
addExtraDeckIdleInteractivities, addExtraDeckIdleInteractivities,
addGraveyardIdleInteractivities,
addHandsIdleInteractivity, addHandsIdleInteractivity,
addMagicIdleInteractivities, addMagicIdleInteractivities,
addMonsterIdleInteractivities, addMonsterIdleInteractivities,
...@@ -83,12 +83,12 @@ export default (selectIdleCmd: MsgSelectIdleCmd, dispatch: AppDispatch) => { ...@@ -83,12 +83,12 @@ export default (selectIdleCmd: MsgSelectIdleCmd, dispatch: AppDispatch) => {
break; break;
} }
case ygopro.CardZone.GRAVE: { case ygopro.CardZone.GRAVE: {
dispatcher(data, interactType, addCemeteryIdleInteractivities); dispatcher(data, interactType, addGraveyardIdleInteractivities);
break; break;
} }
case ygopro.CardZone.REMOVED: { case ygopro.CardZone.REMOVED: {
dispatcher(data, interactType, addExclusionIdleInteractivities); dispatcher(data, interactType, addBanishedZoneIdleInteractivities);
break; break;
} }
......
import { ygopro } from "@/api/ocgcore/idl/ocgcore"; import { ygopro } from "@/api/ocgcore/idl/ocgcore";
import { import {
infoInit, infoInit,
initCemetery, initBanishedZone,
initDeck, initDeck,
initExclusion, initGraveyard,
initHint, initHint,
initMagics, initMagics,
initMonsters, initMonsters,
...@@ -40,11 +40,11 @@ export default ( ...@@ -40,11 +40,11 @@ export default (
dispatch(initMonsters(1)); dispatch(initMonsters(1));
dispatch(initMagics(0)); dispatch(initMagics(0));
dispatch(initMagics(1)); dispatch(initMagics(1));
dispatch(initCemetery(0)); dispatch(initGraveyard(0));
dispatch(initCemetery(1)); dispatch(initGraveyard(1));
dispatch(initDeck({ player: 0, deskSize: start.deckSize1 })); dispatch(initDeck({ player: 0, deskSize: start.deckSize1 }));
dispatch(initDeck({ player: 1, deskSize: start.deckSize2 })); dispatch(initDeck({ player: 1, deskSize: start.deckSize2 }));
dispatch(initExclusion(0)); dispatch(initBanishedZone(0));
dispatch(initExclusion(1)); dispatch(initBanishedZone(1));
dispatch(initHint()); dispatch(initHint());
}; };
...@@ -3,37 +3,37 @@ import * as BABYLON from "@babylonjs/core"; ...@@ -3,37 +3,37 @@ import * as BABYLON from "@babylonjs/core";
import { useConfig } from "@/config"; import { useConfig } from "@/config";
import { useAppSelector } from "@/hook"; import { useAppSelector } from "@/hook";
import { import {
selectMeExclusion, selectMeBanishedZone,
selectopExclusion, selectOpBanishedZone,
} from "@/reducers/duel/exclusionSlice"; } from "@/reducers/duel/banishedZoneSlice";
import { cardSlotRotation } from "../utils"; import { cardSlotRotation } from "../utils";
import { Depth, SingleSlot } from "./SingleSlot"; import { Depth, SingleSlot } from "./SingleSlot";
const NeosConfig = useConfig(); const NeosConfig = useConfig();
export const BanishedZone = () => { export const BanishedZone = () => {
const meExclusion = useAppSelector(selectMeExclusion).inner; const meBanishedZone = useAppSelector(selectMeBanishedZone).inner;
const opExclusion = useAppSelector(selectopExclusion).inner; const opBanishedZone = useAppSelector(selectOpBanishedZone).inner;
return ( return (
<> <>
<SingleSlot <SingleSlot
state={meExclusion} state={meBanishedZone}
position={banishedZonePosition(0, meExclusion.length)} position={banishedZonePosition(0, meBanishedZone.length)}
rotation={cardSlotRotation(false)} rotation={cardSlotRotation(false)}
/> />
<SingleSlot <SingleSlot
state={opExclusion} state={opBanishedZone}
position={banishedZonePosition(1, opExclusion.length)} position={banishedZonePosition(1, opBanishedZone.length)}
rotation={cardSlotRotation(true)} rotation={cardSlotRotation(true)}
/> />
</> </>
); );
}; };
const banishedZonePosition = (player: number, exclusionLength: number) => { const banishedZonePosition = (player: number, banishedZoneLength: number) => {
const x = player == 0 ? 3.2 : -3.2; const x = player == 0 ? 3.2 : -3.2;
const y = (Depth * exclusionLength) / 2 + NeosConfig.ui.card.floating; const y = (Depth * banishedZoneLength) / 2 + NeosConfig.ui.card.floating;
const z = player == 0 ? -0.7 : 0.7; const z = player == 0 ? -0.7 : 0.7;
return new BABYLON.Vector3(x, y, z); return new BABYLON.Vector3(x, y, z);
......
...@@ -3,8 +3,8 @@ import * as BABYLON from "@babylonjs/core"; ...@@ -3,8 +3,8 @@ import * as BABYLON from "@babylonjs/core";
import { useConfig } from "@/config"; import { useConfig } from "@/config";
import { useAppSelector } from "@/hook"; import { useAppSelector } from "@/hook";
import { import {
selectMeCemetery, selectMeGraveyard,
selectOpCemetery, selectOpGraveyard,
} from "@/reducers/duel/cemeretySlice"; } from "@/reducers/duel/cemeretySlice";
import { cardSlotRotation } from "../utils"; import { cardSlotRotation } from "../utils";
...@@ -12,28 +12,28 @@ import { Depth, SingleSlot } from "./SingleSlot"; ...@@ -12,28 +12,28 @@ import { Depth, SingleSlot } from "./SingleSlot";
const NeosConfig = useConfig(); const NeosConfig = useConfig();
export const Graveyard = () => { export const Graveyard = () => {
const meCemetery = useAppSelector(selectMeCemetery).inner; const meGraveyard = useAppSelector(selectMeGraveyard).inner;
const opCemetery = useAppSelector(selectOpCemetery).inner; const opGraveyard = useAppSelector(selectOpGraveyard).inner;
return ( return (
<> <>
<SingleSlot <SingleSlot
state={meCemetery} state={meGraveyard}
position={cemeteryPosition(0, meCemetery.length)} position={graveyardPosition(0, meGraveyard.length)}
rotation={cardSlotRotation(false)} rotation={cardSlotRotation(false)}
/> />
<SingleSlot <SingleSlot
state={opCemetery} state={opGraveyard}
position={cemeteryPosition(1, opCemetery.length)} position={graveyardPosition(1, opGraveyard.length)}
rotation={cardSlotRotation(true)} rotation={cardSlotRotation(true)}
/> />
</> </>
); );
}; };
const cemeteryPosition = (player: number, cemeteryLength: number) => { const graveyardPosition = (player: number, graveyardLength: number) => {
const x = player == 0 ? 3.2 : -3.2; const x = player == 0 ? 3.2 : -3.2;
const y = (Depth * cemeteryLength) / 2 + NeosConfig.ui.card.floating; const y = (Depth * graveyardLength) / 2 + NeosConfig.ui.card.floating;
const z = player == 0 ? -2.0 : 2.0; const z = player == 0 ? -2.0 : 2.0;
return new BABYLON.Vector3(x, y, z); return new BABYLON.Vector3(x, y, z);
......
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