Commit 16155b29 authored by Chunchi Che's avatar Chunchi Che

rename controler to controller

parent 1c27f135
neos-protobuf @ 44727f71
Subproject commit 75fb3c4b20d9909da5aa0ac4a4cbb512a602cf4a Subproject commit 44727f7136ec5708c86d6ed09d5bec8b48f13efc
...@@ -41,7 +41,7 @@ export namespace ygopro { ...@@ -41,7 +41,7 @@ export namespace ygopro {
| any[] | any[]
| { | {
code?: number; code?: number;
controler?: number; controller?: number;
location?: CardZone; location?: CardZone;
sequence?: number; sequence?: number;
} }
...@@ -59,8 +59,8 @@ export namespace ygopro { ...@@ -59,8 +59,8 @@ export namespace ygopro {
if ("code" in data && data.code != undefined) { if ("code" in data && data.code != undefined) {
this.code = data.code; this.code = data.code;
} }
if ("controler" in data && data.controler != undefined) { if ("controller" in data && data.controller != undefined) {
this.controler = data.controler; this.controller = data.controller;
} }
if ("location" in data && data.location != undefined) { if ("location" in data && data.location != undefined) {
this.location = data.location; this.location = data.location;
...@@ -76,10 +76,10 @@ export namespace ygopro { ...@@ -76,10 +76,10 @@ export namespace ygopro {
set code(value: number) { set code(value: number) {
pb_1.Message.setField(this, 1, value); pb_1.Message.setField(this, 1, value);
} }
get controler() { get controller() {
return pb_1.Message.getFieldWithDefault(this, 2, 0) as number; return pb_1.Message.getFieldWithDefault(this, 2, 0) as number;
} }
set controler(value: number) { set controller(value: number) {
pb_1.Message.setField(this, 2, value); pb_1.Message.setField(this, 2, value);
} }
get location() { get location() {
...@@ -100,7 +100,7 @@ export namespace ygopro { ...@@ -100,7 +100,7 @@ export namespace ygopro {
} }
static fromObject(data: { static fromObject(data: {
code?: number; code?: number;
controler?: number; controller?: number;
location?: CardZone; location?: CardZone;
sequence?: number; sequence?: number;
}): CardInfo { }): CardInfo {
...@@ -108,8 +108,8 @@ export namespace ygopro { ...@@ -108,8 +108,8 @@ export namespace ygopro {
if (data.code != null) { if (data.code != null) {
message.code = data.code; message.code = data.code;
} }
if (data.controler != null) { if (data.controller != null) {
message.controler = data.controler; message.controller = data.controller;
} }
if (data.location != null) { if (data.location != null) {
message.location = data.location; message.location = data.location;
...@@ -122,15 +122,15 @@ export namespace ygopro { ...@@ -122,15 +122,15 @@ export namespace ygopro {
toObject() { toObject() {
const data: { const data: {
code?: number; code?: number;
controler?: number; controller?: number;
location?: CardZone; location?: CardZone;
sequence?: number; sequence?: number;
} = {}; } = {};
if (this.code != null) { if (this.code != null) {
data.code = this.code; data.code = this.code;
} }
if (this.controler != null) { if (this.controller != null) {
data.controler = this.controler; data.controller = this.controller;
} }
if (this.location != null) { if (this.location != null) {
data.location = this.location; data.location = this.location;
...@@ -145,7 +145,7 @@ export namespace ygopro { ...@@ -145,7 +145,7 @@ export namespace ygopro {
serialize(w?: pb_1.BinaryWriter): Uint8Array | void { serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
const writer = w || new pb_1.BinaryWriter(); const writer = w || new pb_1.BinaryWriter();
if (this.code != 0) writer.writeInt32(1, this.code); if (this.code != 0) writer.writeInt32(1, this.code);
if (this.controler != 0) writer.writeInt32(2, this.controler); if (this.controller != 0) writer.writeInt32(2, this.controller);
if (this.location != CardZone.DECK) writer.writeEnum(3, this.location); if (this.location != CardZone.DECK) writer.writeEnum(3, this.location);
if (this.sequence != 0) writer.writeInt32(4, this.sequence); if (this.sequence != 0) writer.writeInt32(4, this.sequence);
if (!w) return writer.getResultBuffer(); if (!w) return writer.getResultBuffer();
...@@ -163,7 +163,7 @@ export namespace ygopro { ...@@ -163,7 +163,7 @@ export namespace ygopro {
message.code = reader.readInt32(); message.code = reader.readInt32();
break; break;
case 2: case 2:
message.controler = reader.readInt32(); message.controller = reader.readInt32();
break; break;
case 3: case 3:
message.location = reader.readEnum(); message.location = reader.readEnum();
...@@ -190,7 +190,7 @@ export namespace ygopro { ...@@ -190,7 +190,7 @@ export namespace ygopro {
data?: data?:
| any[] | any[]
| { | {
controler?: number; controller?: number;
zone?: CardZone; zone?: CardZone;
sequence?: number; sequence?: number;
position?: CardPosition; position?: CardPosition;
...@@ -208,8 +208,8 @@ export namespace ygopro { ...@@ -208,8 +208,8 @@ export namespace ygopro {
this.#one_of_decls this.#one_of_decls
); );
if (!Array.isArray(data) && typeof data == "object") { if (!Array.isArray(data) && typeof data == "object") {
if ("controler" in data && data.controler != undefined) { if ("controller" in data && data.controller != undefined) {
this.controler = data.controler; this.controller = data.controller;
} }
if ("zone" in data && data.zone != undefined) { if ("zone" in data && data.zone != undefined) {
this.zone = data.zone; this.zone = data.zone;
...@@ -228,10 +228,10 @@ export namespace ygopro { ...@@ -228,10 +228,10 @@ export namespace ygopro {
} }
} }
} }
get controler() { get controller() {
return pb_1.Message.getFieldWithDefault(this, 1, 0) as number; return pb_1.Message.getFieldWithDefault(this, 1, 0) as number;
} }
set controler(value: number) { set controller(value: number) {
pb_1.Message.setField(this, 1, value); pb_1.Message.setField(this, 1, value);
} }
get zone() { get zone() {
...@@ -273,7 +273,7 @@ export namespace ygopro { ...@@ -273,7 +273,7 @@ export namespace ygopro {
pb_1.Message.setField(this, 6, value); pb_1.Message.setField(this, 6, value);
} }
static fromObject(data: { static fromObject(data: {
controler?: number; controller?: number;
zone?: CardZone; zone?: CardZone;
sequence?: number; sequence?: number;
position?: CardPosition; position?: CardPosition;
...@@ -281,8 +281,8 @@ export namespace ygopro { ...@@ -281,8 +281,8 @@ export namespace ygopro {
overlay_sequence?: number; overlay_sequence?: number;
}): CardLocation { }): CardLocation {
const message = new CardLocation({}); const message = new CardLocation({});
if (data.controler != null) { if (data.controller != null) {
message.controler = data.controler; message.controller = data.controller;
} }
if (data.zone != null) { if (data.zone != null) {
message.zone = data.zone; message.zone = data.zone;
...@@ -303,15 +303,15 @@ export namespace ygopro { ...@@ -303,15 +303,15 @@ export namespace ygopro {
} }
toObject() { toObject() {
const data: { const data: {
controler?: number; controller?: number;
zone?: CardZone; zone?: CardZone;
sequence?: number; sequence?: number;
position?: CardPosition; position?: CardPosition;
is_overlay?: boolean; is_overlay?: boolean;
overlay_sequence?: number; overlay_sequence?: number;
} = {}; } = {};
if (this.controler != null) { if (this.controller != null) {
data.controler = this.controler; data.controller = this.controller;
} }
if (this.zone != null) { if (this.zone != null) {
data.zone = this.zone; data.zone = this.zone;
...@@ -334,7 +334,7 @@ export namespace ygopro { ...@@ -334,7 +334,7 @@ export namespace ygopro {
serialize(w: pb_1.BinaryWriter): void; serialize(w: pb_1.BinaryWriter): void;
serialize(w?: pb_1.BinaryWriter): Uint8Array | void { serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
const writer = w || new pb_1.BinaryWriter(); const writer = w || new pb_1.BinaryWriter();
if (this.controler != 0) writer.writeInt32(1, this.controler); if (this.controller != 0) writer.writeInt32(1, this.controller);
if (this.zone != CardZone.DECK) writer.writeEnum(2, this.zone); if (this.zone != CardZone.DECK) writer.writeEnum(2, this.zone);
if (this.sequence != 0) writer.writeInt32(3, this.sequence); if (this.sequence != 0) writer.writeInt32(3, this.sequence);
if (this.position != CardPosition.FACEUP_ATTACK) if (this.position != CardPosition.FACEUP_ATTACK)
...@@ -354,7 +354,7 @@ export namespace ygopro { ...@@ -354,7 +354,7 @@ export namespace ygopro {
if (reader.isEndGroup()) break; if (reader.isEndGroup()) break;
switch (reader.getFieldNumber()) { switch (reader.getFieldNumber()) {
case 1: case 1:
message.controler = reader.readInt32(); message.controller = reader.readInt32();
break; break;
case 2: case 2:
message.zone = reader.readEnum(); message.zone = reader.readEnum();
...@@ -11006,7 +11006,7 @@ export namespace ygopro { ...@@ -11006,7 +11006,7 @@ export namespace ygopro {
data?: data?:
| any[] | any[]
| { | {
controler?: number; controller?: number;
zone?: CardZone; zone?: CardZone;
sequence?: number; sequence?: number;
} }
...@@ -11021,8 +11021,8 @@ export namespace ygopro { ...@@ -11021,8 +11021,8 @@ export namespace ygopro {
this.#one_of_decls this.#one_of_decls
); );
if (!Array.isArray(data) && typeof data == "object") { if (!Array.isArray(data) && typeof data == "object") {
if ("controler" in data && data.controler != undefined) { if ("controller" in data && data.controller != undefined) {
this.controler = data.controler; this.controller = data.controller;
} }
if ("zone" in data && data.zone != undefined) { if ("zone" in data && data.zone != undefined) {
this.zone = data.zone; this.zone = data.zone;
...@@ -11032,10 +11032,10 @@ export namespace ygopro { ...@@ -11032,10 +11032,10 @@ export namespace ygopro {
} }
} }
} }
get controler() { get controller() {
return pb_1.Message.getFieldWithDefault(this, 1, 0) as number; return pb_1.Message.getFieldWithDefault(this, 1, 0) as number;
} }
set controler(value: number) { set controller(value: number) {
pb_1.Message.setField(this, 1, value); pb_1.Message.setField(this, 1, value);
} }
get zone() { get zone() {
...@@ -11055,13 +11055,13 @@ export namespace ygopro { ...@@ -11055,13 +11055,13 @@ export namespace ygopro {
pb_1.Message.setField(this, 3, value); pb_1.Message.setField(this, 3, value);
} }
static fromObject(data: { static fromObject(data: {
controler?: number; controller?: number;
zone?: CardZone; zone?: CardZone;
sequence?: number; sequence?: number;
}): SelectAblePlace { }): SelectAblePlace {
const message = new SelectAblePlace({}); const message = new SelectAblePlace({});
if (data.controler != null) { if (data.controller != null) {
message.controler = data.controler; message.controller = data.controller;
} }
if (data.zone != null) { if (data.zone != null) {
message.zone = data.zone; message.zone = data.zone;
...@@ -11073,12 +11073,12 @@ export namespace ygopro { ...@@ -11073,12 +11073,12 @@ export namespace ygopro {
} }
toObject() { toObject() {
const data: { const data: {
controler?: number; controller?: number;
zone?: CardZone; zone?: CardZone;
sequence?: number; sequence?: number;
} = {}; } = {};
if (this.controler != null) { if (this.controller != null) {
data.controler = this.controler; data.controller = this.controller;
} }
if (this.zone != null) { if (this.zone != null) {
data.zone = this.zone; data.zone = this.zone;
...@@ -11092,7 +11092,7 @@ export namespace ygopro { ...@@ -11092,7 +11092,7 @@ export namespace ygopro {
serialize(w: pb_1.BinaryWriter): void; serialize(w: pb_1.BinaryWriter): void;
serialize(w?: pb_1.BinaryWriter): Uint8Array | void { serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
const writer = w || new pb_1.BinaryWriter(); const writer = w || new pb_1.BinaryWriter();
if (this.controler != 0) writer.writeInt32(1, this.controler); if (this.controller != 0) writer.writeInt32(1, this.controller);
if (this.zone != CardZone.DECK) writer.writeEnum(2, this.zone); if (this.zone != CardZone.DECK) writer.writeEnum(2, this.zone);
if (this.sequence != 0) writer.writeInt32(3, this.sequence); if (this.sequence != 0) writer.writeInt32(3, this.sequence);
if (!w) return writer.getResultBuffer(); if (!w) return writer.getResultBuffer();
...@@ -11109,7 +11109,7 @@ export namespace ygopro { ...@@ -11109,7 +11109,7 @@ export namespace ygopro {
if (reader.isEndGroup()) break; if (reader.isEndGroup()) break;
switch (reader.getFieldNumber()) { switch (reader.getFieldNumber()) {
case 1: case 1:
message.controler = reader.readInt32(); message.controller = reader.readInt32();
break; break;
case 2: case 2:
message.zone = reader.readEnum(); message.zone = reader.readEnum();
......
...@@ -14,20 +14,20 @@ export class BufferReaderExt { ...@@ -14,20 +14,20 @@ export class BufferReaderExt {
readCardInfo(): ygopro.CardInfo { readCardInfo(): ygopro.CardInfo {
const code = this.inner.readUint32(); const code = this.inner.readUint32();
const controler = this.inner.readUint8(); const controller = this.inner.readUint8();
const location = numberToCardZone(this.inner.readUint8()); const location = numberToCardZone(this.inner.readUint8());
const sequence = this.inner.readUint8(); const sequence = this.inner.readUint8();
return new ygopro.CardInfo({ return new ygopro.CardInfo({
code, code,
controler, controller,
location, location,
sequence, sequence,
}); });
} }
readCardLocation(): ygopro.CardLocation { readCardLocation(): ygopro.CardLocation {
const controler = this.inner.readUint8(); const controller = this.inner.readUint8();
const location = this.inner.readUint8(); const location = this.inner.readUint8();
const sequence = this.inner.readUint8(); const sequence = this.inner.readUint8();
const ss = this.inner.readUint8(); const ss = this.inner.readUint8();
...@@ -35,7 +35,7 @@ export class BufferReaderExt { ...@@ -35,7 +35,7 @@ export class BufferReaderExt {
if (location & LOCATION_OVERLAY) { if (location & LOCATION_OVERLAY) {
// 超量素材 // 超量素材
return new ygopro.CardLocation({ return new ygopro.CardLocation({
controler, controller,
zone: numberToCardZone(location & ~LOCATION_OVERLAY), zone: numberToCardZone(location & ~LOCATION_OVERLAY),
sequence, sequence,
is_overlay: true, is_overlay: true,
...@@ -43,7 +43,7 @@ export class BufferReaderExt { ...@@ -43,7 +43,7 @@ export class BufferReaderExt {
}); });
} else { } else {
return new ygopro.CardLocation({ return new ygopro.CardLocation({
controler, controller,
zone: numberToCardZone(location), zone: numberToCardZone(location),
sequence, sequence,
is_overlay: false, is_overlay: false,
...@@ -53,12 +53,12 @@ export class BufferReaderExt { ...@@ -53,12 +53,12 @@ export class BufferReaderExt {
} }
readCardShortLocation(): ygopro.CardLocation { readCardShortLocation(): ygopro.CardLocation {
const controler = this.inner.readUint8(); const controller = this.inner.readUint8();
const location = this.inner.readUint8(); const location = this.inner.readUint8();
const sequence = this.inner.readUint8(); const sequence = this.inner.readUint8();
return new ygopro.CardLocation({ return new ygopro.CardLocation({
controler, controller,
zone: numberToCardZone(location), zone: numberToCardZone(location),
sequence, sequence,
}); });
......
...@@ -17,7 +17,7 @@ export default (data: Uint8Array) => { ...@@ -17,7 +17,7 @@ export default (data: Uint8Array) => {
const target_location = reader.readCardLocation(); const target_location = reader.readCardLocation();
if ( if (
target_location.controler == 0 && target_location.controller == 0 &&
target_location.zone == 0 && target_location.zone == 0 &&
target_location.sequence == 0 target_location.sequence == 0
) { ) {
......
...@@ -30,7 +30,7 @@ export default (data: Uint8Array) => { ...@@ -30,7 +30,7 @@ export default (data: Uint8Array) => {
}); });
for (let i = 0; i < 2; i++) { for (let i = 0; i < 2; i++) {
const controler = i == 0 ? player : 1 - player; const controller = i == 0 ? player : 1 - player;
const field = i == 0 ? _field & 0xffff : _field >> 16; const field = i == 0 ? _field & 0xffff : _field >> 16;
if ((field & 0x7f) != 0) { if ((field & 0x7f) != 0) {
...@@ -42,7 +42,7 @@ export default (data: Uint8Array) => { ...@@ -42,7 +42,7 @@ export default (data: Uint8Array) => {
if ((filter & (1 << sequence)) != 0) { if ((filter & (1 << sequence)) != 0) {
msg.places.push( msg.places.push(
new MsgSelectPlace.SelectAblePlace({ new MsgSelectPlace.SelectAblePlace({
controler, controller,
zone, zone,
sequence: sequence, sequence: sequence,
}) })
...@@ -60,7 +60,7 @@ export default (data: Uint8Array) => { ...@@ -60,7 +60,7 @@ export default (data: Uint8Array) => {
if ((filter & (1 << sequence)) != 0) { if ((filter & (1 << sequence)) != 0) {
msg.places.push( msg.places.push(
new MsgSelectPlace.SelectAblePlace({ new MsgSelectPlace.SelectAblePlace({
controler, controller,
zone, zone,
sequence, sequence,
}) })
...@@ -77,7 +77,7 @@ export default (data: Uint8Array) => { ...@@ -77,7 +77,7 @@ export default (data: Uint8Array) => {
if ((filter & 0x1) != 0) { if ((filter & 0x1) != 0) {
msg.places.push( msg.places.push(
new MsgSelectPlace.SelectAblePlace({ new MsgSelectPlace.SelectAblePlace({
controler, controller,
zone, zone,
sequence: 6, sequence: 6,
}) })
...@@ -87,7 +87,7 @@ export default (data: Uint8Array) => { ...@@ -87,7 +87,7 @@ export default (data: Uint8Array) => {
if ((filter & 0x2) != 0) { if ((filter & 0x2) != 0) {
msg.places.push( msg.places.push(
new MsgSelectPlace.SelectAblePlace({ new MsgSelectPlace.SelectAblePlace({
controler, controller,
zone, zone,
sequence: 7, sequence: 7,
}) })
......
...@@ -154,14 +154,14 @@ export function sendSelectIdleCmdResponse(value: number) { ...@@ -154,14 +154,14 @@ export function sendSelectIdleCmdResponse(value: number) {
} }
export function sendSelectPlaceResponse(value: { export function sendSelectPlaceResponse(value: {
controler: number; controller: number;
zone: ygopro.CardZone; zone: ygopro.CardZone;
sequence: number; sequence: number;
}) { }) {
const response = new ygopro.YgoCtosMsg({ const response = new ygopro.YgoCtosMsg({
ctos_response: new ygopro.CtosGameMsgResponse({ ctos_response: new ygopro.CtosGameMsgResponse({
select_place: new ygopro.CtosGameMsgResponse.SelectPlaceResponse({ select_place: new ygopro.CtosGameMsgResponse.SelectPlaceResponse({
player: value.controler, player: value.controller,
zone: value.zone, zone: value.zone,
sequence: value.sequence, sequence: value.sequence,
}), }),
......
...@@ -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.zone, attack.attacker_location.zone,
attack.attacker_location.controler, attack.attacker_location.controller,
attack.attacker_location.sequence attack.attacker_location.sequence
); );
...@@ -22,13 +22,13 @@ export default async (attack: ygopro.StocGameMessage.MsgAttack) => { ...@@ -22,13 +22,13 @@ export default async (attack: ygopro.StocGameMessage.MsgAttack) => {
} else { } else {
const target = cardStore.at( const target = cardStore.at(
attack.target_location.zone, attack.target_location.zone,
attack.target_location.controler, attack.target_location.controller,
attack.target_location.sequence attack.target_location.sequence
); );
if (target) { if (target) {
attacker.attackTarget = { attacker.attackTarget = {
opponent: !matStore.isMe(attack.target_location.controler), opponent: !matStore.isMe(attack.target_location.controller),
...target, ...target,
}; };
......
...@@ -6,7 +6,7 @@ export default async (confirmCards: ygopro.StocGameMessage.MsgConfirmCards) => { ...@@ -6,7 +6,7 @@ export default async (confirmCards: ygopro.StocGameMessage.MsgConfirmCards) => {
console.color("pink")(`confirmCards: ${cards}`); console.color("pink")(`confirmCards: ${cards}`);
for (const card of cards) { for (const card of cards) {
const target = cardStore.at(card.location, card.controler, card.sequence); const target = cardStore.at(card.location, card.controller, card.sequence);
if (target) { if (target) {
// 设置`occupant` // 设置`occupant`
......
...@@ -64,7 +64,7 @@ export default async (move: MsgMove) => { ...@@ -64,7 +64,7 @@ export default async (move: MsgMove) => {
// 超量素材的去除 // 超量素材的去除
const overlayMaterial = cardStore.at( const overlayMaterial = cardStore.at(
from.zone, from.zone,
from.controler, from.controller,
from.sequence, from.sequence,
from.overlay_sequence from.overlay_sequence
); );
...@@ -72,20 +72,20 @@ export default async (move: MsgMove) => { ...@@ -72,20 +72,20 @@ export default async (move: MsgMove) => {
target = overlayMaterial; target = overlayMaterial;
} else { } else {
console.warn( console.warn(
`<Move>overlayMaterial from zone=${from.zone}, controller=${from.controler}, `<Move>overlayMaterial from zone=${from.zone}, controller=${from.controller},
sequence=${from.sequence}, overlay_sequence=${from.overlay_sequence} is null` sequence=${from.sequence}, overlay_sequence=${from.overlay_sequence} is null`
); );
return; return;
} }
} else { } else {
const card = cardStore.at(from.zone, from.controler, from.sequence); const card = cardStore.at(from.zone, from.controller, from.sequence);
if (card) { if (card) {
target = card; target = card;
} else { } else {
console.warn( console.warn(
`<Move>card from zone=${from.zone}, controller=${from.controler} sequence=${from.sequence} is null` `<Move>card from zone=${from.zone}, controller=${from.controller} sequence=${from.sequence} is null`
); );
console.info(cardStore.at(from.zone, from.controler)); console.info(cardStore.at(from.zone, from.controller));
return; return;
} }
} }
...@@ -106,28 +106,28 @@ export default async (move: MsgMove) => { ...@@ -106,28 +106,28 @@ export default async (move: MsgMove) => {
for (const location of xyzLocations) { for (const location of xyzLocations) {
const overlayMaterial = cardStore.at( const overlayMaterial = cardStore.at(
location.zone, location.zone,
location.controler, location.controller,
location.sequence, location.sequence,
location.overlay_sequence location.overlay_sequence
); );
if (overlayMaterial) { if (overlayMaterial) {
// 超量素材的位置应该和超量怪兽保持一致 // 超量素材的位置应该和超量怪兽保持一致
overlayMaterial.location.controler = to.controler; overlayMaterial.location.controller = to.controller;
overlayMaterial.location.zone = to.zone; overlayMaterial.location.zone = to.zone;
overlayMaterial.location.sequence = to.sequence; overlayMaterial.location.sequence = to.sequence;
await eventbus.call(Task.Move, overlayMaterial.uuid); await eventbus.call(Task.Move, overlayMaterial.uuid);
} else { } else {
console.warn( console.warn(
`<Move>overlayMaterial from zone=${location.zone}, controller=${location.controler}, sequence=${location.sequence}, overlay_sequence=${location.overlay_sequence} is null` `<Move>overlayMaterial from zone=${location.zone}, controller=${location.controller}, sequence=${location.sequence}, overlay_sequence=${location.overlay_sequence} is null`
); );
} }
} }
} }
// 维护sequence // 维护sequence
const fromCards = cardStore.at(from.zone, from.controler); const fromCards = cardStore.at(from.zone, from.controller);
const toCards = cardStore.at(to.zone, to.controler); const toCards = cardStore.at(to.zone, to.controller);
if ([HAND, GRAVE, REMOVED, DECK, EXTRA, TZONE].includes(from.zone)) if ([HAND, GRAVE, REMOVED, DECK, EXTRA, TZONE].includes(from.zone))
fromCards.forEach( fromCards.forEach(
...@@ -142,7 +142,7 @@ export default async (move: MsgMove) => { ...@@ -142,7 +142,7 @@ export default async (move: MsgMove) => {
const overlay_sequence = from.overlay_sequence; const overlay_sequence = from.overlay_sequence;
for (const overlay of cardStore.findOverlay( for (const overlay of cardStore.findOverlay(
from.zone, from.zone,
from.controler, from.controller,
from.sequence from.sequence
)) { )) {
if (overlay.location.overlay_sequence > overlay_sequence) { if (overlay.location.overlay_sequence > overlay_sequence) {
...@@ -160,7 +160,7 @@ export default async (move: MsgMove) => { ...@@ -160,7 +160,7 @@ export default async (move: MsgMove) => {
promises.push(eventbus.call(Task.Move, target.uuid)); promises.push(eventbus.call(Task.Move, target.uuid));
// 如果from或者to是手卡,那么需要刷新除了这张卡之外,这个玩家的所有手卡 // 如果from或者to是手卡,那么需要刷新除了这张卡之外,这个玩家的所有手卡
if ([from.zone, to.zone].includes(HAND)) { if ([from.zone, to.zone].includes(HAND)) {
cardStore.at(HAND, target.location.controler).forEach((card) => { cardStore.at(HAND, target.location.controller).forEach((card) => {
if (card.uuid !== target.uuid) if (card.uuid !== target.uuid)
promises.push(eventbus.call(Task.Move, card.uuid)); promises.push(eventbus.call(Task.Move, card.uuid));
}); });
...@@ -172,11 +172,11 @@ export default async (move: MsgMove) => { ...@@ -172,11 +172,11 @@ export default async (move: MsgMove) => {
if (from.zone == MZONE && !from.is_overlay) { if (from.zone == MZONE && !from.is_overlay) {
for (const overlay of cardStore.findOverlay( for (const overlay of cardStore.findOverlay(
from.zone, from.zone,
from.controler, from.controller,
from.sequence from.sequence
)) { )) {
overlay.location.zone = to.zone; overlay.location.zone = to.zone;
overlay.location.controler = to.controler; overlay.location.controller = to.controller;
overlay.location.sequence = to.sequence; overlay.location.sequence = to.sequence;
await eventbus.call(Task.Move, overlay.uuid); await eventbus.call(Task.Move, overlay.uuid);
......
...@@ -3,9 +3,9 @@ import MsgPosChange = ygopro.StocGameMessage.MsgPosChange; ...@@ -3,9 +3,9 @@ import MsgPosChange = ygopro.StocGameMessage.MsgPosChange;
import { eventbus, Task } from "@/infra"; import { eventbus, Task } from "@/infra";
import { cardStore, fetchEsHintMeta } from "@/stores"; import { cardStore, fetchEsHintMeta } from "@/stores";
export default async (posChange: MsgPosChange) => { export default async (posChange: MsgPosChange) => {
const { location, controler, sequence } = posChange.card_info; const { location, controller, sequence } = posChange.card_info;
const target = cardStore.at(location, controler, sequence); const target = cardStore.at(location, controller, sequence);
if (target) { if (target) {
target.location.position = posChange.cur_position; target.location.position = posChange.cur_position;
......
...@@ -13,10 +13,10 @@ export default (selectPlace: MsgSelectPlace) => { ...@@ -13,10 +13,10 @@ export default (selectPlace: MsgSelectPlace) => {
switch (place.zone) { switch (place.zone) {
case ygopro.CardZone.MZONE: case ygopro.CardZone.MZONE:
case ygopro.CardZone.SZONE: case ygopro.CardZone.SZONE:
placeStore.set(place.zone, place.controler, place.sequence, { placeStore.set(place.zone, place.controller, place.sequence, {
interactType: InteractType.PLACE_SELECTABLE, interactType: InteractType.PLACE_SELECTABLE,
response: { response: {
controler: place.controler, controller: place.controller,
zone: place.zone, zone: place.zone,
sequence: place.sequence, sequence: place.sequence,
}, },
......
...@@ -43,7 +43,7 @@ export default (start: ygopro.StocGameMessage.MsgStart) => { ...@@ -43,7 +43,7 @@ export default (start: ygopro.StocGameMessage.MsgStart) => {
uuid: v4uuid(), uuid: v4uuid(),
code: 0, code: 0,
location: new ygopro.CardLocation({ location: new ygopro.CardLocation({
controler: i < 3 ? 0 : 1, controller: i < 3 ? 0 : 1,
zone: [ zone: [
ygopro.CardZone.DECK, ygopro.CardZone.DECK,
ygopro.CardZone.EXTRA, ygopro.CardZone.EXTRA,
......
...@@ -15,7 +15,7 @@ export interface CardType { ...@@ -15,7 +15,7 @@ export interface CardType {
originController: number; // 在卡组构建之中持有这张卡的玩家,方便reloadField的使用 originController: number; // 在卡组构建之中持有这张卡的玩家,方便reloadField的使用
idleInteractivities: Interactivity<number>[]; // IDLE状态下的互动信息 idleInteractivities: Interactivity<number>[]; // IDLE状态下的互动信息
placeInteractivity?: Interactivity<{ placeInteractivity?: Interactivity<{
controler: number; controller: number;
zone: ygopro.CardZone; zone: ygopro.CardZone;
sequence: number; sequence: number;
}>; // 选择位置状态下的互动信息 }>; // 选择位置状态下的互动信息
...@@ -52,7 +52,7 @@ class CardStore { ...@@ -52,7 +52,7 @@ class CardStore {
.filter( .filter(
(card) => (card) =>
card.location.zone === zone && card.location.zone === zone &&
card.location.controler === controller && card.location.controller === controller &&
card.location.sequence === sequence && card.location.sequence === sequence &&
card.location.is_overlay == true && card.location.is_overlay == true &&
card.location.overlay_sequence == overlay_sequence card.location.overlay_sequence == overlay_sequence
...@@ -63,7 +63,7 @@ class CardStore { ...@@ -63,7 +63,7 @@ class CardStore {
.filter( .filter(
(card) => (card) =>
card.location.zone === zone && card.location.zone === zone &&
card.location.controler === controller && card.location.controller === controller &&
card.location.sequence === sequence && card.location.sequence === sequence &&
card.location.is_overlay == false card.location.is_overlay == false
) )
...@@ -73,13 +73,13 @@ class CardStore { ...@@ -73,13 +73,13 @@ class CardStore {
return this.inner.filter( return this.inner.filter(
(card) => (card) =>
card.location.zone === zone && card.location.zone === zone &&
card.location.controler === controller && card.location.controller === controller &&
card.location.is_overlay == false card.location.is_overlay == false
); );
} }
} }
find(location: ygopro.CardLocation): CardType | undefined { find(location: ygopro.CardLocation): CardType | undefined {
return this.at(location.zone, location.controler, location.sequence); return this.at(location.zone, location.controller, location.sequence);
} }
// 获取特定位置下的所有超量素材 // 获取特定位置下的所有超量素材
findOverlay( findOverlay(
...@@ -90,7 +90,7 @@ class CardStore { ...@@ -90,7 +90,7 @@ class CardStore {
return this.inner.filter( return this.inner.filter(
(card) => (card) =>
card.location.zone == zone && card.location.zone == zone &&
card.location.controler == controller && card.location.controller == controller &&
card.location.sequence == sequence && card.location.sequence == sequence &&
card.location.is_overlay card.location.is_overlay
); );
......
...@@ -66,7 +66,7 @@ export const fetchEsHintMeta = async ({ ...@@ -66,7 +66,7 @@ export const fetchEsHintMeta = async ({
if (location) { if (location) {
const fieldMeta = cardStore.at( const fieldMeta = cardStore.at(
location.zone, location.zone,
location.controler, location.controller,
location.sequence location.sequence
); );
if (fieldMeta?.meta.text.name) { if (fieldMeta?.meta.text.name) {
......
...@@ -21,7 +21,7 @@ export const fetchCheckCardMeta = async ( ...@@ -21,7 +21,7 @@ export const fetchCheckCardMeta = async (
selected?: boolean, selected?: boolean,
mustSelect?: boolean mustSelect?: boolean
) => { ) => {
const controller = location.controler; const controller = location.controller;
const newID = const newID =
code != 0 code != 0
? code ? code
......
...@@ -7,7 +7,7 @@ import type { Interactivity } from "./matStore/types"; ...@@ -7,7 +7,7 @@ import type { Interactivity } from "./matStore/types";
export type PlaceInteractivity = export type PlaceInteractivity =
| Interactivity<{ | Interactivity<{
controler: number; controller: number;
zone: ygopro.CardZone; zone: ygopro.CardZone;
sequence: number; sequence: number;
}> }>
......
...@@ -151,7 +151,7 @@ export const SelectActionsModal = () => { ...@@ -151,7 +151,7 @@ export const SelectActionsModal = () => {
style={{ style={{
width: 120, width: 120,
backgroundColor: backgroundColor:
option.location?.controler === 0 option.location?.controller === 0
? "white" ? "white"
: "grey", : "grey",
}} }}
......
...@@ -164,7 +164,7 @@ const onCardClick = (card: CardType) => { ...@@ -164,7 +164,7 @@ const onCardClick = (card: CardType) => {
// 侧边栏展示超量素材信息 // 侧边栏展示超量素材信息
const overlayMaterials = cardStore.findOverlay( const overlayMaterials = cardStore.findOverlay(
card.location.zone, card.location.zone,
card.location.controler, card.location.controller,
card.location.sequence card.location.sequence
); );
if (overlayMaterials.length > 0) { if (overlayMaterials.length > 0) {
...@@ -184,7 +184,7 @@ const onCardClick = (card: CardType) => { ...@@ -184,7 +184,7 @@ const onCardClick = (card: CardType) => {
const onFieldClick = (card: CardType) => { const onFieldClick = (card: CardType) => {
const displayStates = cardStore.at( const displayStates = cardStore.at(
card.location.zone, card.location.zone,
card.location.controler card.location.controller
); );
messageStore.cardListModal.list = displayStates.map((item) => ({ messageStore.cardListModal.list = displayStates.map((item) => ({
meta: { meta: {
......
...@@ -13,7 +13,7 @@ export const focus = async (props: { card: CardType; api: SpringApi }) => { ...@@ -13,7 +13,7 @@ export const focus = async (props: { card: CardType; api: SpringApi }) => {
const current = api.current[0].get(); const current = api.current[0].get();
if (card.location.zone === ygopro.CardZone.HAND) { if (card.location.zone === ygopro.CardZone.HAND) {
await asyncStart(api)({ await asyncStart(api)({
y: current.y + (matStore.isMe(card.location.controler) ? -1 : 1) * 200, // TODO: 放到config之中 y: current.y + (matStore.isMe(card.location.controller) ? -1 : 1) * 200, // TODO: 放到config之中
rz: 0, rz: 0,
}); });
await asyncStart(api)({ y: current.y, rz: current.rz }); await asyncStart(api)({ y: current.y, rz: current.rz });
......
...@@ -31,7 +31,7 @@ export const moveToDeck = async (props: { card: CardType; api: SpringApi }) => { ...@@ -31,7 +31,7 @@ export const moveToDeck = async (props: { card: CardType; api: SpringApi }) => {
const { card, api } = props; const { card, api } = props;
// report // report
const { location } = card; const { location } = card;
const { controler, zone, sequence, position } = location; const { controller, zone, sequence, position } = location;
const rightX = DECK_OFFSET_X.value + 2 * (BLOCK_WIDTH.value + COL_GAP.value); const rightX = DECK_OFFSET_X.value + 2 * (BLOCK_WIDTH.value + COL_GAP.value);
const leftX = -rightX; const leftX = -rightX;
...@@ -42,20 +42,20 @@ export const moveToDeck = async (props: { card: CardType; api: SpringApi }) => { ...@@ -42,20 +42,20 @@ export const moveToDeck = async (props: { card: CardType; api: SpringApi }) => {
2 * ROW_GAP.value - 2 * ROW_GAP.value -
BLOCK_HEIGHT_S.value; BLOCK_HEIGHT_S.value;
const topY = -bottomY; const topY = -bottomY;
let x = isMe(controler) ? rightX : leftX; let x = isMe(controller) ? rightX : leftX;
let y = isMe(controler) ? bottomY : topY; let y = isMe(controller) ? bottomY : topY;
if (zone === EXTRA) { if (zone === EXTRA) {
x = isMe(controler) ? leftX : rightX; x = isMe(controller) ? leftX : rightX;
} }
let rz = zone === EXTRA ? DECK_ROTATE_Z.value : -DECK_ROTATE_Z.value; let rz = zone === EXTRA ? DECK_ROTATE_Z.value : -DECK_ROTATE_Z.value;
rz += isMe(controler) ? 0 : 180; rz += isMe(controller) ? 0 : 180;
const z = sequence; const z = sequence;
api.start({ api.start({
x, x,
y, y,
z, z,
rz, rz,
ry: isMe(controler) ? (zone === DECK ? 180 : 0) : 180, ry: isMe(controller) ? (zone === DECK ? 180 : 0) : 180,
zIndex: z, zIndex: z,
height: DECK_CARD_HEIGHT.value, height: DECK_CARD_HEIGHT.value,
}); });
......
...@@ -34,7 +34,7 @@ export const moveToGround = async (props: { ...@@ -34,7 +34,7 @@ export const moveToGround = async (props: {
const { location } = card; const { location } = card;
const { controler, zone, sequence, position, is_overlay } = location; const { controller, zone, sequence, position, is_overlay } = location;
// 根据zone计算卡片的宽度 // 根据zone计算卡片的宽度
const cardWidth = const cardWidth =
...@@ -77,7 +77,7 @@ export const moveToGround = async (props: { ...@@ -77,7 +77,7 @@ export const moveToGround = async (props: {
} }
} }
if (!isMe(controler)) { if (!isMe(controller)) {
x = -x; x = -x;
y = -y; y = -y;
} }
...@@ -89,7 +89,7 @@ export const moveToGround = async (props: { ...@@ -89,7 +89,7 @@ export const moveToGround = async (props: {
ygopro.CardPosition.FACEUP_DEFENSE, ygopro.CardPosition.FACEUP_DEFENSE,
].includes(position ?? 5); ].includes(position ?? 5);
height = defence ? BLOCK_WIDTH.value : height; height = defence ? BLOCK_WIDTH.value : height;
let rz = isMe(controler) ? 0 : 180; let rz = isMe(controller) ? 0 : 180;
rz += defence ? 90 : 0; rz += defence ? 90 : 0;
// 动画 // 动画
......
...@@ -28,7 +28,7 @@ const { HAND, GRAVE, REMOVED, DECK, EXTRA, MZONE, SZONE, TZONE } = ...@@ -28,7 +28,7 @@ const { HAND, GRAVE, REMOVED, DECK, EXTRA, MZONE, SZONE, TZONE } =
export const moveToHand = async (props: { card: CardType; api: SpringApi }) => { export const moveToHand = async (props: { card: CardType; api: SpringApi }) => {
const { card, api } = props; const { card, api } = props;
const { zone, sequence, controler } = card.location; const { zone, sequence, controller } = card.location;
// 手卡会有很复杂的计算... // 手卡会有很复杂的计算...
const hand_circle_center_x = 0; const hand_circle_center_x = 0;
const hand_circle_center_y = const hand_circle_center_y =
...@@ -48,22 +48,22 @@ export const moveToHand = async (props: { card: CardType; api: SpringApi }) => { ...@@ -48,22 +48,22 @@ export const moveToHand = async (props: { card: CardType; api: SpringApi }) => {
) * ) *
0.9; 0.9;
// 接下来计算每一张手卡 // 接下来计算每一张手卡
const hands_length = cardStore.at(HAND, controler).length; const hands_length = cardStore.at(HAND, controller).length;
const angle = (sequence - (hands_length - 1) / 2) * THETA; const angle = (sequence - (hands_length - 1) / 2) * THETA;
const r = HAND_CIRCLE_CENTER_OFFSET_Y.value + HAND_CARD_HEIGHT.value / 2; const r = HAND_CIRCLE_CENTER_OFFSET_Y.value + HAND_CARD_HEIGHT.value / 2;
const negativeX = Math.sin(angle) * r; const negativeX = Math.sin(angle) * r;
const negativeY = Math.cos(angle) * r + HAND_CARD_HEIGHT.value / 2; const negativeY = Math.cos(angle) * r + HAND_CARD_HEIGHT.value / 2;
const x = hand_circle_center_x + negativeX * (isMe(controler) ? 1 : -1); const x = hand_circle_center_x + negativeX * (isMe(controller) ? 1 : -1);
const y = hand_circle_center_y - negativeY + 130; // 常量 是手动调的 这里肯定有问题 有空来修 const y = hand_circle_center_y - negativeY + 130; // 常量 是手动调的 这里肯定有问题 有空来修
const _rz = (angle * 180) / Math.PI; const _rz = (angle * 180) / Math.PI;
api.start({ api.start({
x: isMe(controler) ? x : -x, x: isMe(controller) ? x : -x,
y: isMe(controler) ? y : -y, y: isMe(controller) ? y : -y,
z: 0, z: 0,
rz: isMe(controler) ? _rz : 180 - _rz, rz: isMe(controller) ? _rz : 180 - _rz,
ry: isMe(controler) ? 0 : 180, ry: isMe(controller) ? 0 : 180,
height: HAND_CARD_HEIGHT.value, height: HAND_CARD_HEIGHT.value,
zIndex: sequence, zIndex: sequence,
// rx: -PLANE_ROTATE_X.value, // rx: -PLANE_ROTATE_X.value,
......
...@@ -32,11 +32,11 @@ export const moveToOutside = async (props: { ...@@ -32,11 +32,11 @@ export const moveToOutside = async (props: {
}) => { }) => {
const { card, api } = props; const { card, api } = props;
// report // report
const { zone, sequence, controler, position } = card.location; const { zone, sequence, controller, position } = card.location;
let x = (BLOCK_WIDTH.value + COL_GAP.value) * 3, let x = (BLOCK_WIDTH.value + COL_GAP.value) * 3,
y = zone === GRAVE ? BLOCK_HEIGHT_M.value + ROW_GAP.value : 0; y = zone === GRAVE ? BLOCK_HEIGHT_M.value + ROW_GAP.value : 0;
if (!isMe(controler)) { if (!isMe(controller)) {
x = -x; x = -x;
y = -y; y = -y;
} }
...@@ -45,7 +45,7 @@ export const moveToOutside = async (props: { ...@@ -45,7 +45,7 @@ export const moveToOutside = async (props: {
y, y,
z: 0, z: 0,
height: BLOCK_HEIGHT_S.value, height: BLOCK_HEIGHT_S.value,
rz: isMe(controler) ? 0 : 180, rz: isMe(controller) ? 0 : 180,
ry: [ygopro.CardPosition.FACEDOWN].includes(position) ? 180 : 0, ry: [ygopro.CardPosition.FACEDOWN].includes(position) ? 180 : 0,
}); });
}; };
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