Commit c5e0535e authored by nanahira's avatar nanahira

bump & add tosscoin test

parent 9fe98a3b
......@@ -10,7 +10,7 @@
"license": "MIT",
"dependencies": {
"js-yaml": "^4.1.1",
"koishipro-core.js": "^1.3.8",
"koishipro-core.js": "^1.3.9",
"sql.js": "^1.13.0",
"ygopro-cdb-encode": "^1.0.5",
"ygopro-jstest": "^1.1.3",
......@@ -4492,9 +4492,9 @@
}
},
"node_modules/koishipro-core.js": {
"version": "1.3.8",
"resolved": "https://registry.npmjs.org/koishipro-core.js/-/koishipro-core.js-1.3.8.tgz",
"integrity": "sha512-qVqhhK+VyrpD04E2TnTJEzZhqHaPytWt253h6PyU3e0VdM/wk60AVHYIGMDQ1rP5wbt0qo4WVafJKfjd+YbuyA==",
"version": "1.3.9",
"resolved": "https://registry.npmjs.org/koishipro-core.js/-/koishipro-core.js-1.3.9.tgz",
"integrity": "sha512-3LnNqkcbGNtDOK6SBc/EtLRP1bDiYbYo7nvcQFkaTqpkP62jOFTMbrGZ9J1XHWgayM2CAWjow00PsYeJ/wvZUg==",
"license": "MIT",
"dependencies": {
"@types/emscripten": "^1.41.5",
......
......@@ -54,7 +54,7 @@
},
"dependencies": {
"js-yaml": "^4.1.1",
"koishipro-core.js": "^1.3.8",
"koishipro-core.js": "^1.3.9",
"sql.js": "^1.13.0",
"ygopro-cdb-encode": "^1.0.5",
"ygopro-jstest": "^1.1.3",
......
import {
SlientAdvancor,
SummonPlaceAdvancor,
NoEffectAdvancor,
} from "koishipro-core.js";
import {
OcgcoreScriptConstants,
YGOProMsgSelectCard,
YGOProMsgSelectEffectYn,
YGOProMsgSelectIdleCmd,
} from "ygopro-msg-encode";
import { createTest } from "../utility/create-test";
describe("Tosscoin Search", () => {
it("Should be able to search proper cards", async () => {
await createTest({}, (ctx) =>
ctx
.addCard([
{
code: 10000,
location: OcgcoreScriptConstants.LOCATION_DECK, // not searchable
},
{
code: 71625222,
location: OcgcoreScriptConstants.LOCATION_DECK, // searchable
},
{
code: 83764718,
location: OcgcoreScriptConstants.LOCATION_DECK, // even not a monster
},
{
code: 50915474,
location: OcgcoreScriptConstants.LOCATION_HAND,
},
])
.state(() => {
expect(ctx.evaluate(`return EFFECT_FLAG_COIN`)).toBe(
OcgcoreScriptConstants.EFFECT_FLAG_COIN,
); // caused by lua int64 problem, just check if the constant is correctly passed
expect(
ctx.evaluate(`
local dg = Duel.GetFieldGroup(0, LOCATION_DECK, 0)
local notSearchable = dg:Filter(Card.IsCode, nil, 10000):GetFirst()
local searchable = dg:Filter(Card.IsCode, nil, 71625222):GetFirst()
return {c50915474.thfilter(notSearchable), c50915474.thfilter(searchable)}
`),
).toEqual([false, true]);
})
.advance(SlientAdvancor())
.state(YGOProMsgSelectIdleCmd, (msg) => {
const hand = ctx.getFieldCard(
0,
OcgcoreScriptConstants.LOCATION_HAND,
);
expect(hand).toHaveLength(1);
const hc = hand[0];
expect(hc.code).toBe(50915474);
expect(hc.canSummon()).toBeTruthy();
return hc.summon();
})
.advance(SummonPlaceAdvancor(), NoEffectAdvancor())
.state(YGOProMsgSelectEffectYn, (msg) => {
expect(msg.code).toBe(50915474); // check if it's the correct card effect
return msg.prepareResponse(true);
})
.advance(SlientAdvancor())
.state(YGOProMsgSelectCard, (msg) => {
expect(msg.cards).toHaveLength(1);
const c = msg.cards[0];
expect(c.code).toBe(71625222);
return msg.prepareResponse([c]);
})
.state(() => {
const hand = ctx.getFieldCard(
0,
OcgcoreScriptConstants.LOCATION_HAND,
);
expect(hand).toHaveLength(1);
const hc = hand[0];
expect(hc.code).toBe(71625222);
}),
);
});
});
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