From 421f27d63c108f2caab9d0cfef492854baf77cf3 Mon Sep 17 00:00:00 2001 From: Martin Michelsen Date: Sat, 3 Dec 2022 11:03:30 -0800 Subject: [PATCH] document 6xB4x4B command --- src/CommandFormats.hh | 28 +++++++++++++++++++++------- src/Episode3/DeckState.cc | 4 ++-- src/Episode3/DeckState.hh | 4 ++-- 3 files changed, 25 insertions(+), 11 deletions(-) diff --git a/src/CommandFormats.hh b/src/CommandFormats.hh index 553fbfe0..2e18efc6 100644 --- a/src/CommandFormats.hh +++ b/src/CommandFormats.hh @@ -5399,14 +5399,28 @@ struct G_Unknown_GC_Ep3_6xB4x4A { parray card_refs; } __packed__; -// 6xB4x4B: Unknown -// TODO: Document this from Episode 3 client/server disassembly +// 6xB4x4B: Set EX result values +// This command specifies how much EX the player should get based on the +// difference between their level and the levels of the players they defeated or +// were defeated by. (For multi-player opponent teams, the average of the +// opponents' levels is used.) The game scans the appropriate list for the entry +// whose threshold is less than or equal to than the level difference, and +// returns the corresponding value. For example, if the first two entries in the +// win list are [20, 40] and [10, 30], and the player defeats an opponent who is +// 15 levels above the player's level, the player will get 30 EX when they win +// the battle. If all thresholds are greater than the level difference, the last +// entry's value is used. -struct G_Unknown_GC_Ep3_6xB4x4B { - G_CardBattleCommandHeader header = {0xB4, sizeof(G_Unknown_GC_Ep3_6xB4x4B) / 4, 0, 0x4B, 0, 0, 0}; - // If any of the entries [0][1] through [0][10] or [1][1] through [1][10] are - // < -99 or > 99, the entire command is ignored. - parray, 2> unknown_a1; +struct G_SetEXResultValues_GC_Ep3_6xB4x4B { + G_CardBattleCommandHeader header = {0xB4, sizeof(G_SetEXResultValues_GC_Ep3_6xB4x4B) / 4, 0, 0x4B, 0, 0, 0}; + struct Entry { + le_int16_t threshold; + le_int16_t value; + } __packed__; + // If any of the entries in either list has .value outside the range [-100, + // 100], the entire command is ignored and default values are used instead. + parray win_entries; + parray lose_entries; } __packed__; // 6xB4x4C: Update action chain diff --git a/src/Episode3/DeckState.cc b/src/Episode3/DeckState.cc index 2ccd4471..8ae0ab71 100644 --- a/src/Episode3/DeckState.cc +++ b/src/Episode3/DeckState.cc @@ -27,8 +27,8 @@ void DeckEntry::clear() { this->team_id = 0xFFFFFFFF; this->god_whim_flag = 3; this->unused1 = 0; - this->unused2 = 0; - this->unused3 = 0; + this->player_level = 0; + this->unused2.clear(0); this->card_ids.clear(0xFFFF); } diff --git a/src/Episode3/DeckState.hh b/src/Episode3/DeckState.hh index acd69909..1bffa389 100644 --- a/src/Episode3/DeckState.hh +++ b/src/Episode3/DeckState.hh @@ -31,8 +31,8 @@ struct DeckEntry { // always sets this to 3, and it's not clear why this even exists. uint8_t god_whim_flag; uint8_t unused1; - le_uint16_t unused2; - be_uint16_t unused3; + le_uint16_t player_level; + parray unused2; DeckEntry(); void clear();