diff --git a/otoca@asphyxia/README.md b/otoca@asphyxia/README.md index d1a3a2d..7ae78f8 100644 --- a/otoca@asphyxia/README.md +++ b/otoca@asphyxia/README.md @@ -23,7 +23,8 @@ How it works status 1, and the game then plays offline. - The key card (`game.bindKeyUser`) is a second printed card tied to the player. Once a key is bound, scanning a card asks for the key card (`game.checkKeyUser`) and the closet holds 999 items instead of 50. - - `game.getVersion` and getCardInfo both send episode 5 / phase 11, the newest the game knows. + - `game.getVersion` and getCardInfo both send episode 5 and a phase from 7 to 11. Those phases unlock the + same content and differ only in the rival card pack (and its icon on the title screen). - Without a camera, printed card images can be scanned with a hook that feeds an image to the game's camera library (libcamera.dll) in place of the camera frame. @@ -39,6 +40,9 @@ Settings - Limited-time enemy: shows the one limited-time enemy the data has (episode 3). - Double stamps: two stamps per play. - Free star kira: star kira cards need no star powder. + - Rival card pack: the pack the rival cards offered after a play come from, one of the five packs or + Random (a new draw for each play). The game takes the pack from the version it got when the card + was scanned; plays without a scan (new players) use the one from the attract loop. Server-side rules (from the arcade as documented by the fan wiki and the official site) - Kira cards give +1 to 1-3 random stats. diff --git a/otoca@asphyxia/data.ts b/otoca@asphyxia/data.ts index aa37d43..2cbfdd4 100644 --- a/otoca@asphyxia/data.ts +++ b/otoca@asphyxia/data.ts @@ -1,8 +1,16 @@ // Values taken from the game's data (data_ncg/paramdb) and the arcade's rules. -// versiondata.csv: base 5-2, newest 5-11. getCardInfo's version is applied the same way, so both send this. +// versiondata.csv: base 5-2, newest 5-11. 5-6 to 5-11 unlock the same content; only the rival card pack +// (rivalcard_packdata.csv: the last row at or below the version) and its title-screen icon differ, +// so the phase picks the pack. export const EPISODE = 5; -export const PHASE = 11; +export const RIVAL_PACKS = [ + { name: 'ジュエル・ソング', phase: 7 }, + { name: 'ミッドサマーナイト・ドリーム', phase: 8 }, + { name: 'スターズ・シャイニング', phase: 9 }, + { name: 'ファイアリー・エンジェル', phase: 10 }, + { name: 'レ・フェニーチ', phase: 11 }, +]; // Alphabet of the ids the game packs into its QR codes (5 bits per char). export const ID_CHARS = '0123456789ABCDEFGHJKLMNPRSTUWXYZ'; // equipdata.csv rows with kind 4 (accessories): they carry an accessory_seq. diff --git a/otoca@asphyxia/handlers/card.ts b/otoca@asphyxia/handlers/card.ts index 470e8b4..0fe1b6f 100644 --- a/otoca@asphyxia/handlers/card.ts +++ b/otoca@asphyxia/handlers/card.ts @@ -1,9 +1,10 @@ // New players and dolls, and scanning a printed card. import { accessoryNode, equipWithAccessories, gradeList } from '../closet'; -import { EPISODE, PHASE } from '../data'; +import { EPISODE } from '../data'; import { getCard, getDoll, getUser, nextSeq, saveUser } from '../db'; import { greeting, newDoll, newUser } from '../player'; import { bool, log, now, u8, u32 } from '../utils'; +import { phase } from './version'; export const addUser: EPR = async (info, data, send) => { const u = newUser(await nextSeq('user'), $(data).str('user_name', '')); @@ -70,7 +71,7 @@ export const getCardInfo: EPR = async (info, data, send) => { // the bonus printed on this card; the game applies it to one battle offset: { kira_hp: u8(card.kira[0]), kira_atk: u8(card.kira[1]), kira_mat: u8(card.kira[2]), kira_spd: u8(card.kira[3]) }, active_key: bool(!!u.keycard_id), - version: { episode: u8(EPISODE), phase: u8(PHASE) }, + version: { episode: u8(EPISODE), phase: u8(phase()) }, makeup: { hair_color: u8(d.makeup[0]), eye_color: u8(d.makeup[1]) }, closet: { powder_num: u32(u.powder_num), diff --git a/otoca@asphyxia/handlers/version.ts b/otoca@asphyxia/handlers/version.ts index 4b63f9b..52434a1 100644 --- a/otoca@asphyxia/handlers/version.ts +++ b/otoca@asphyxia/handlers/version.ts @@ -1,5 +1,13 @@ -import { EPISODE, PHASE } from '../data'; -import { bool, u8, u32 } from '../utils'; +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) => { @@ -7,7 +15,7 @@ export const getVersion: EPR = async (info, data, send) => { send.object({ expire: u32(600), episode: u8(EPISODE), - phase: u8(PHASE), + phase: u8(phase()), marker: u8(U.GetConfig('marker')), campaign: { trial_play: bool(false), diff --git a/otoca@asphyxia/index.ts b/otoca@asphyxia/index.ts index 766e851..2a24697 100644 --- a/otoca@asphyxia/index.ts +++ b/otoca@asphyxia/index.ts @@ -1,6 +1,7 @@ // otoca d'or (NCG). The XRPC module "game" (service "local") is implemented by the game's ealocal.dll; // field names, types and limits follow its psmap tables, and every value follows how game.dll uses it // (see README). Values marked "guess" are server policy the game code does not decide. +import { RIVAL_PACKS } from './data'; import { addDoll, addUser, getCardInfo } from './handlers/card'; import { receiveGift, receiveItem } from './handlers/gift'; import { addItem, composition, delItem, sellItem, setMakeup } from './handlers/item'; @@ -38,6 +39,13 @@ export function register() { type: 'boolean', default: true, }); + R.Config('rival_pack', { + name: 'Rival card pack', + desc: 'The pack the rival cards offered after a play come from. Random draws one for each play.', + type: 'string', + options: ['Random', ...RIVAL_PACKS.map(p => p.name)], + default: 'Random', + }); R.Config('starkira_free', { name: 'Free star kira', desc: 'Star kira cards need no star powder.',