Commit bfee7219 authored by timel's avatar timel Committed by Chunchi Che

fix: change double equal sign to triple equal sign

parent b12eaa4c
Pipeline #22361 failed with stages
in 11 minutes and 55 seconds
......@@ -47,7 +47,7 @@ export class WebSocketStream {
reader.read().then(async function process({ done, value }): Promise<void> {
if (done) {
if (ws.readyState == WebSocket.CLOSED) {
if (ws.readyState === WebSocket.CLOSED) {
// websocket connection has been closed
console.info("WebSocket closed, stream complete.");
......
......@@ -8,8 +8,8 @@ export default async (announce: MsgAnnounce) => {
const type_ = announce.announce_type;
let min = announce.min;
if (
type_ == MsgAnnounce.AnnounceType.Card ||
type_ == MsgAnnounce.AnnounceType.Number
type_ === MsgAnnounce.AnnounceType.Card ||
type_ === MsgAnnounce.AnnounceType.Number
) {
min = 1;
}
......
......@@ -37,11 +37,11 @@ export default async (move: MsgMove) => {
const meta = await fetchCard(code);
if (meta.data.type !== undefined && (meta.data.type & TYPE_TOKEN) > 0) {
// 衍生物
if (from.zone == DECK) {
if (from.zone === DECK) {
// 衍生物出场的场景,设置`from.zone`为`TZONE`
from.zone = TZONE;
}
if (to.zone == DECK) {
if (to.zone === DECK) {
// 衍生物离开场上的场合,设置`to.zone`为`TZONE`
to.zone = TZONE;
}
......@@ -89,9 +89,9 @@ export default async (move: MsgMove) => {
}
// 超量
if (to.is_overlay && from.zone == MZONE) {
if (to.is_overlay && from.zone === MZONE) {
// 准备超量召唤,超量素材入栈
if (reason == REASON_MATERIAL) {
if (reason === REASON_MATERIAL) {
to.zone = MZONE;
overlayStack.push(to);
}
......@@ -168,7 +168,7 @@ 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(
from.zone,
from.controller,
......
......@@ -18,9 +18,9 @@ export default async (selectChain: MsgSelectChain) => {
let handle_flag = 0;
if (!forced) {
// 无强制发动的卡
if (spCount == 0) {
if (spCount === 0) {
// 无关键卡
if (chains.length == 0) {
if (chains.length === 0) {
// 直接回答
handle_flag = 0;
} else {
......@@ -34,7 +34,7 @@ export default async (selectChain: MsgSelectChain) => {
}
} else {
// 有关键卡
if (chains.length == 0) {
if (chains.length === 0) {
// 根本没卡,直接回答
handle_flag = 0;
} else {
......@@ -44,7 +44,7 @@ export default async (selectChain: MsgSelectChain) => {
}
} else {
// 有强制发动的卡
if (chains.length == 1) {
if (chains.length === 1) {
// 只有一个强制发动的连锁项,直接回应
handle_flag = 4;
} else {
......
......@@ -11,7 +11,7 @@ export default async (selectEffectYn: MsgSelectEffectYn) => {
const effect_description = selectEffectYn.effect_description;
const textGenerator =
effect_description == 0 || effect_description == 221
effect_description === 0 || effect_description === 221
? (
desc: string,
cardMeta: CardMeta,
......
......@@ -13,7 +13,7 @@ export default async (start: ygopro.StocGameMessage.MsgStart) => {
// 先初始化`matStore`
matStore.selfType = start.playerType;
const opponent =
start.playerType == ygopro.StocGameMessage.MsgStart.PlayerType.FirstStrike
start.playerType === ygopro.StocGameMessage.MsgStart.PlayerType.FirstStrike
? 1
: 0;
......
......@@ -10,9 +10,9 @@ export default async (toss: MsgToss) => {
const prefix = fetchStrings("!system", matStore.isMe(player) ? 102 : 103);
for (const x of toss.res) {
if (tossType == MsgToss.TossType.DICE) {
if (tossType === MsgToss.TossType.DICE) {
matStore.tossResult = prefix + fetchStrings("!system", 1624) + x;
} else if (tossType == MsgToss.TossType.COIN) {
} else if (tossType === MsgToss.TossType.COIN) {
matStore.tossResult =
prefix +
fetchStrings("!system", 1623) +
......
......@@ -12,7 +12,7 @@ export default async (updateData: MsgUpdateData) => {
const sequence = action.location?.sequence;
if (typeof sequence !== "undefined") {
const target = field
.filter((card) => card.location.sequence == sequence)
.filter((card) => card.location.sequence === sequence)
.at(0);
if (target) {
// 目前只更新以下字段
......
......@@ -4,10 +4,10 @@ import { fetchEsHintMeta, matStore } from "@/stores";
import MsgUpdateHp = ygopro.StocGameMessage.MsgUpdateHp;
export default (msgUpdateHp: MsgUpdateHp) => {
if (msgUpdateHp.type_ == MsgUpdateHp.ActionType.DAMAGE) {
if (msgUpdateHp.type_ === MsgUpdateHp.ActionType.DAMAGE) {
fetchEsHintMeta({ originMsg: "玩家收到伤害时" }); // TODO: i18n
matStore.initInfo.of(msgUpdateHp.player).life -= msgUpdateHp.value;
} else if (msgUpdateHp.type_ == MsgUpdateHp.ActionType.RECOVER) {
} else if (msgUpdateHp.type_ === MsgUpdateHp.ActionType.RECOVER) {
fetchEsHintMeta({ originMsg: "玩家生命值回复时" }); // TODO: i18n
matStore.initInfo.of(msgUpdateHp.player).life += msgUpdateHp.value;
}
......
......@@ -19,7 +19,7 @@ export default function handleSocketOpen(
) {
console.log("WebSocket opened.");
if (ws && ws.readyState == 1) {
if (ws && ws.readyState === 1) {
ws.binaryType = "arraybuffer";
sendPlayerInfo(ws, player);
......
......@@ -29,23 +29,23 @@ export default function handleHsPlayerChange(pb: ygopro.YgoStocMsg) {
break;
}
case ygopro.StocHsPlayerChange.State.READY: {
playerStore[change.pos == 0 ? "player0" : "player1"].state =
playerStore[change.pos === 0 ? "player0" : "player1"].state =
READY_STATE;
break;
}
case ygopro.StocHsPlayerChange.State.NO_READY: {
playerStore[change.pos == 0 ? "player0" : "player1"].state =
playerStore[change.pos === 0 ? "player0" : "player1"].state =
NO_READY_STATE;
break;
}
case ygopro.StocHsPlayerChange.State.LEAVE: {
playerStore[change.pos == 0 ? "player0" : "player1"] = {};
playerStore[change.pos === 0 ? "player0" : "player1"] = {};
break;
}
case ygopro.StocHsPlayerChange.State.TO_OBSERVER: {
playerStore[change.pos == 0 ? "player0" : "player1"] = {}; // todo: 有没有必要?
playerStore[change.pos === 0 ? "player0" : "player1"] = {}; // TODO: 有没有必要?
playerStore.observerCount += 1;
break;
}
......
......@@ -8,6 +8,6 @@ export default function handleHsPlayerEnter(pb: ygopro.YgoStocMsg) {
if (pos > 1) {
console.log("Currently only supported 2v2 mode.");
} else {
playerStore[pos == 0 ? "player0" : "player1"].name = name;
playerStore[pos === 0 ? "player0" : "player1"].name = name;
}
}
......@@ -34,11 +34,11 @@ export const playerStore = proxy<PlayerState>({
isHost: false,
selfType: SelfType.UNKNOWN,
getMePlayer() {
if (this.selfType == SelfType.PLAYER1) return this.player0;
if (this.selfType === SelfType.PLAYER1) return this.player0;
return this.player1;
},
getOpPlayer() {
if (this.selfType == SelfType.PLAYER1) return this.player1;
if (this.selfType === SelfType.PLAYER1) return this.player1;
return this.player0;
},
});
......@@ -24,7 +24,7 @@ export const CheckCounterModal = () => {
const [selected, setSelected] = useState(new Array(options.length));
const sum = selected.reduce((sum, current) => sum + current, 0);
const finishable = sum == min;
const finishable = sum === min;
const onFinish = () => {
sendSelectCounterResponse(selected);
......
......@@ -89,7 +89,7 @@ export const SelectActionsModal: FC = () => {
: sumLevel1 === totalLevels || sumLevel2 === totalLevels;
setSubmitable(
single
? response.length == 1
? response.length === 1
: response.length >= min && response.length <= max && levelMatched
);
}, [response.length]);
......
......@@ -50,7 +50,7 @@ export const SortCardModal = () => {
if (active.id !== over?.id) {
setItems((items) => {
const oldIndex = items.findIndex((item) => item.response == active.id);
const oldIndex = items.findIndex((item) => item.response === active.id);
const newIndex = items.findIndex((item) => item.response === over?.id);
// @ts-ignore
return arrayMove(items, oldIndex, newIndex);
......
......@@ -50,7 +50,7 @@ const NeosConfig = useConfig();
function getCardImgUrl(code: number, back = false) {
const ASSETS_BASE =
import.meta.env.BASE_URL == "/"
import.meta.env.BASE_URL === "/"
? NeosConfig.assetsPath
: `${import.meta.env.BASE_URL}${NeosConfig.assetsPath}`;
if (back) {
......
......@@ -80,7 +80,7 @@ const WaitRoom = () => {
// 初始化wasm
const url =
import.meta.env.BASE_URL == "/"
import.meta.env.BASE_URL === "/"
? undefined
: new URL("rust_src_bg.wasm", `${import.meta.env.BASE_URL}assets/`);
await rustInit(url);
......@@ -122,9 +122,9 @@ const WaitRoom = () => {
if (
!(
deck.main.length == 0 &&
deck.extra.length == 0 &&
deck.side.length == 0
deck.main.length === 0 &&
deck.extra.length === 0 &&
deck.side.length === 0
)
) {
// YDK解析成功
......
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