mirror of
https://github.com/asphyxia-core/plugins.git
synced 2026-12-05 11:40:31 -06:00
The pack of the rival cards offered after a play comes from the game's version: rivalcard_packdata picks the last row at or below it, and 5-6 to 5-11 unlock the same content otherwise (only the title-screen pack icon differs). Always sending phase 11 fixed the pack to Le Fenice. The new setting "Rival card pack" (one of the five packs, or Random) picks the phase sent by getVersion and getCardInfo. getCardInfo's version is applied when the card is scanned, so Random draws a pack for each play; plays without a scan use getVersion's.
30 lines
1.4 KiB
TypeScript
30 lines
1.4 KiB
TypeScript
import { EPISODE, RIVAL_PACKS } from '../data';
|
|
import { bool, rand, u8, u32 } from '../utils';
|
|
|
|
// The phase of the configured rival card pack ("Random" draws one on every call). The game picks the pack
|
|
// from the version it holds when the card choice opens: getCardInfo's sets it for that play, getVersion's
|
|
// for plays without a card scan (new players) and for the pack icon on the title screen.
|
|
export function phase() {
|
|
const pack = RIVAL_PACKS.find(p => p.name === U.GetConfig('rival_pack'));
|
|
return (pack || RIVAL_PACKS[rand(RIVAL_PACKS.length)]).phase;
|
|
}
|
|
|
|
// Sent by ealocal every `expire` seconds from the attract loop; the game waits for the first one at boot.
|
|
export const getVersion: EPR = async (info, data, send) => {
|
|
const limited = U.GetConfig('limited_enemy') ? 1 : 0;
|
|
send.object({
|
|
expire: u32(600),
|
|
episode: u8(EPISODE),
|
|
phase: u8(phase()),
|
|
marker: u8(U.GetConfig('marker')),
|
|
campaign: {
|
|
trial_play: bool(false),
|
|
trial_shop: bool(U.GetConfig('trial_shop')), // one free salon try per player; the game keeps the flag
|
|
starkira_free: bool(U.GetConfig('starkira_free')),
|
|
stamp_double: bool(U.GetConfig('stamp_double')),
|
|
limited_enemy: K.ARRAY('bool', [0, 0, limited, 0, 0, 0, 0, 0]), // only slot 2 has an enemy (team 63)
|
|
},
|
|
question: { id: u8(0), reward: { type: u8(0), id: u32(0), grade: u8(0) } },
|
|
});
|
|
};
|