Commit 3459e7b8 authored by Chunchi Che's avatar Chunchi Che

fix readCardLocation

parent 414cfd54
Pipeline #20046 passed with stages
in 4 minutes and 50 seconds
......@@ -6,6 +6,7 @@ const OFFSET_INT8 = 1;
const OFFSET_UINT16 = 2;
const OFFSET_UINT32 = 4;
const OFFSET_INT32 = 4;
const LOCATION_OVERLAY = 0x80;
export class BufferReader {
dataView: DataView;
......@@ -67,28 +68,28 @@ export class BufferReader {
});
}
readCardLocation(overlay?: boolean): ygopro.CardLocation {
readCardLocation(): ygopro.CardLocation {
const controler = this.readUint8();
const location = this.readUint8();
const sequence = this.readUint8();
const ss = this.readUint8();
const cardLocation = new ygopro.CardLocation({
controler,
location: numberToCardZone(location),
sequence,
});
if (overlay && overlay) {
cardLocation.overlay_sequence = ss;
if (location & LOCATION_OVERLAY) {
// 超量素材
return new ygopro.CardLocation({
controler,
location: ygopro.CardZone.OVERLAY,
sequence,
overlay_sequence: ss,
});
} else {
const position = numberToCardPosition(ss);
if (position) {
cardLocation.position = position;
}
return new ygopro.CardLocation({
controler,
location: numberToCardZone(location),
sequence,
position: numberToCardPosition(ss),
});
}
return cardLocation;
}
}
......
......@@ -20,6 +20,7 @@ export default (move: MsgMove, dispatch: AppDispatch) => {
const code = move.code;
const from = move.from;
const to = move.to;
console.log(to);
// TODO: reason
switch (from.location) {
......
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