From 4dc4be67f854217d1e1fa00ac45efa7200fe35d0 Mon Sep 17 00:00:00 2001 From: zyr17 Date: Mon, 25 Mar 2024 10:40:02 +0800 Subject: [PATCH] fix: #82 object trigger order --- src/lpsim/server/character/character_base.py | 6 +- src/lpsim/server/match.py | 48 +- src/lpsim/server/player_table.py | 14 +- .../server/status/team_status/event_cards.py | 4 +- tests/server/bugfix/jsons/test_issue_82.json | 1408 +++++++++++++++++ tests/server/bugfix/test_json_bugfix.py | 7 + 6 files changed, 1460 insertions(+), 27 deletions(-) create mode 100644 tests/server/bugfix/jsons/test_issue_82.json diff --git a/src/lpsim/server/character/character_base.py b/src/lpsim/server/character/character_base.py index ad18af00..a7b10db9 100644 --- a/src/lpsim/server/character/character_base.py +++ b/src/lpsim/server/character/character_base.py @@ -751,9 +751,9 @@ def damage_taken(self) -> int: def get_object_lists(self) -> List[ObjectBase]: """ - Get all objects of the character, order is passive skill, weapon, - artifact, talent, status. For status, order is their index in status - list, i.e. generated time. + Get all objects of the character, order is character itself, skills, and other + objects. Order of other objects, including equipment and status, are based on + when they are attached, regardless of their types. """ result: List[ObjectBase] = [self] for skill in self.skills: diff --git a/src/lpsim/server/match.py b/src/lpsim/server/match.py index fba27d37..b9c2be3e 100644 --- a/src/lpsim/server/match.py +++ b/src/lpsim/server/match.py @@ -1094,11 +1094,15 @@ def get_object_list(self) -> List[ObjectBase]: Get all objects in the match by `self.table.get_object_lists`. The order of objects should follow the game rule. The rules are: 1. objects of `self.current_player` goes first - 2. objects belongs to character goes first - 2.1. active character first, otherwise the default order. - 2.2. for one character, order is weapon, artifact, talent, status. - 2.3. for status, order is their index in status list, i.e. - generated time. + 2. objects belongs to character and team status goes first + 2.1. active character first, then next, next ... until all alive + characters are included. + 2.2. for one character, order is character self, its skills, other objects + attached to the character. + 2.3. status and equipment have no priority, just based on the time when they + are attached to the character. + 2.4. specifically, team status has lower priority of active character and + its attached objects, but higher priority of other characters. 3. for other objects, order is: summon, support, hand, dice, deck. 3.1. all other objects in same region are sorted by their index in the list. @@ -1491,20 +1495,28 @@ def _respond_switch_character(self, response: SwitchCharacterResponse): ) cost_value = self._modify_cost_value(cost_value, "REAL") actions.append(SwitchCharacterAction.from_response(response)) - actions.append( - ActionEndAction( - action_label=PlayerActionLabels.SWITCH.value, - position=ObjectPosition( - player_idx=response.player_idx, - character_idx=response.request.active_character_idx, - area=ObjectPositionType.CHARACTER, - id=self.player_tables[response.player_idx] - .characters[response.request.active_character_idx] - .id, - ), - do_combat_action=True, - ) + end_action = ActionEndAction( + action_label=PlayerActionLabels.SWITCH.value, + position=ObjectPosition( + player_idx=response.player_idx, + character_idx=response.request.active_character_idx, + area=ObjectPositionType.CHARACTER, + id=self.player_tables[response.player_idx] + .characters[response.request.active_character_idx] + .id, + ), + do_combat_action=True, ) + # as after switching character, the active character may change, so + # we need to update combat action value before switching. + combat_action_value = CombatActionValue( + position=end_action.position, + action_label=end_action.action_label, + do_combat_action=end_action.do_combat_action, + ) + self._modify_value(value=combat_action_value, mode="REAL") + end_action.do_combat_action = combat_action_value.do_combat_action + actions.append(end_action) self.event_controller.stack_actions(actions) self.requests = [ x for x in self.requests if x.player_idx != response.player_idx diff --git a/src/lpsim/server/player_table.py b/src/lpsim/server/player_table.py index 46ff04ac..499f21b6 100644 --- a/src/lpsim/server/player_table.py +++ b/src/lpsim/server/player_table.py @@ -197,12 +197,15 @@ def get_object_lists(self) -> List[ObjectBase]: Get all objects in the table. The order of objects should follow the game rule. The rules are: 1. objects of `self.current_player` goes first - 2. objects belongs to character goes first + 2. objects belongs to character and team status goes first 2.1. active character first, then next, next ... until all alive characters are included. - 2.2. for one character, order is weapon, artifact, talent, status. - 2.3. for status, order is their index in status list, i.e. - generated time. + 2.2. for one character, order is character self, its skills, other objects + attached to the character. + 2.3. status and equipment have no priority, just based on the time when they + are attached to the character. + 2.4. specifically, team status has lower priority of active character and + its attached objects, but higher priority of other characters. 3. for other objects, order is: summon, support, hand, dice, deck. 3.1. all other objects in same region are sorted by their index in the list. @@ -215,7 +218,8 @@ def get_object_lists(self) -> List[ObjectBase]: target = (start_character_idx + i) % len(self.characters) if self.characters[target].is_alive: result += self.characters[target].get_object_lists() - result += self.team_status + if i == 0: + result += self.team_status result += self.summons result += self.supports if self.using_hand is not None: diff --git a/src/lpsim/server/status/team_status/event_cards.py b/src/lpsim/server/status/team_status/event_cards.py index 61b51b02..9ec6500f 100644 --- a/src/lpsim/server/status/team_status/event_cards.py +++ b/src/lpsim/server/status/team_status/event_cards.py @@ -152,7 +152,9 @@ class LeaveItToMe_3_3(UsageTeamStatus): def value_modifier_COMBAT_ACTION( self, value: CombatActionValue, match: Any, mode: Literal["TEST", "REAL"] ) -> CombatActionValue: - assert self.usage > 0 + if self.usage <= 0: + # no usage, do nothing + return value if not self.position.check_position_valid( value.position, match, diff --git a/tests/server/bugfix/jsons/test_issue_82.json b/tests/server/bugfix/jsons/test_issue_82.json new file mode 100644 index 00000000..43358bc7 --- /dev/null +++ b/tests/server/bugfix/jsons/test_issue_82.json @@ -0,0 +1,1408 @@ +{ + "match_random_state": [ + "MT19937", + [ + 2147483648, + 852258933, + 3037751817, + 2843736348, + 2346345909, + 241038820, + 3630833971, + 322381140, + 1250305161, + 1459257731, + 3694471596, + 515911843, + 3937938455, + 2827679987, + 3950882980, + 3581943267, + 4151002148, + 1618076744, + 3274872619, + 2159583707, + 1559018499, + 1583145829, + 1179320338, + 3113356017, + 1931467408, + 2410284883, + 753436273, + 437428593, + 510572609, + 2706055346, + 879811753, + 825585750, + 2401349358, + 2490929089, + 3977100308, + 4231974237, + 3442070342, + 2600699322, + 3596477700, + 3408240710, + 3752939454, + 3842241914, + 2634979991, + 739520375, + 3739104881, + 2527561182, + 1297315978, + 1316945693, + 1727810483, + 3695100167, + 1453832382, + 979363388, + 3076017079, + 3732405838, + 1444648514, + 4151023880, + 2205533946, + 4261855231, + 4267702982, + 2647124900, + 1484461652, + 1998843354, + 4035414622, + 4156165081, + 322695412, + 2240084797, + 218965524, + 2620616784, + 2355246093, + 353075890, + 807460217, + 2080397923, + 2949113800, + 3746761770, + 4204485378, + 2925858822, + 940465313, + 2978225661, + 1552046939, + 3792670316, + 4122385657, + 3233513602, + 1380874839, + 984796113, + 886794804, + 4153798316, + 717328536, + 469185684, + 3765962743, + 4135056014, + 3479073223, + 3023129426, + 4222684062, + 3850877054, + 224467384, + 3087354214, + 1680195562, + 2193347842, + 2684173028, + 1880093036, + 3229242389, + 3049410427, + 1279447835, + 332094632, + 1579758630, + 3710374238, + 2337675471, + 115759493, + 4211910051, + 3915073058, + 1108976576, + 2071829022, + 3748361252, + 3666084797, + 3192128605, + 604670057, + 188878253, + 403907626, + 3217757074, + 1892194987, + 378411265, + 573022174, + 3720006947, + 254195013, + 1584935511, + 3553011007, + 1370455926, + 1537144829, + 2822387189, + 2441227067, + 1172427512, + 1810388875, + 597276150, + 3442654859, + 1319639025, + 1278428752, + 3109211997, + 3125310769, + 1778730908, + 2179046274, + 529756476, + 3028614397, + 390243483, + 2580809143, + 2253747482, + 645716549, + 4069787277, + 3392915288, + 1804927866, + 2998699909, + 3486738826, + 2249333105, + 2840926426, + 832811354, + 2642376678, + 2647298729, + 2972210951, + 3980432569, + 2414014267, + 3379616787, + 827881623, + 2006639651, + 2739098202, + 4142232454, + 1674001832, + 387416494, + 1242487127, + 3900036886, + 1084620969, + 4223529924, + 2384308612, + 2101645863, + 1707720038, + 3225537336, + 1571082365, + 4196493122, + 2164372558, + 3866850114, + 2805868839, + 675209309, + 4179066360, + 3625074731, + 3089956980, + 3293027876, + 3902965037, + 1224438018, + 1224895899, + 2575389666, + 3357949449, + 2384469209, + 3700336215, + 338019398, + 3289126851, + 2769703855, + 390722640, + 2704007496, + 2883292084, + 1965587089, + 1025300549, + 619699852, + 1043025444, + 3803785664, + 922193774, + 151167841, + 2126109206, + 3168147631, + 2865122591, + 3327041069, + 3373701209, + 9353399, + 473750565, + 3028380130, + 1467951504, + 4190922997, + 589795710, + 942553933, + 937635948, + 298315070, + 415821393, + 4041939848, + 372373022, + 3689582099, + 519737891, + 4233378103, + 1157474098, + 138790908, + 770838763, + 430623945, + 814484707, + 2853558444, + 3213795543, + 3845643860, + 2512330672, + 1336888278, + 572322181, + 1282342669, + 920514674, + 2038291972, + 3149365870, + 4102830575, + 3549173955, + 3684993693, + 1356278478, + 1775628726, + 213156443, + 2298969406, + 2717355438, + 1572856796, + 1513647543, + 2132855513, + 1986873076, + 3528225839, + 308723273, + 292601737, + 1277750001, + 1679680638, + 2785246156, + 3878540692, + 471870265, + 668186544, + 2580697021, + 2706131701, + 1695560777, + 2843565854, + 332232130, + 1424790421, + 2379530317, + 4168717850, + 974529721, + 2592398077, + 1897652930, + 1672473548, + 1312396662, + 1869749067, + 2084827226, + 73229630, + 1974021446, + 3205173810, + 874883708, + 2176709342, + 2290870532, + 2232221173, + 11665963, + 3617533180, + 2066756895, + 869614124, + 248729098, + 3168320955, + 2513792026, + 1546475412, + 3754194653, + 1731401296, + 669770116, + 1064448459, + 2396128651, + 1085107150, + 2799824622, + 1789749972, + 2034050724, + 2306132503, + 2368269703, + 338106206, + 3551116912, + 2236740658, + 3994225500, + 1393516086, + 814315152, + 4115786034, + 1931073526, + 3698510923, + 3264469706, + 1200777713, + 3605887842, + 537661941, + 99637609, + 739482224, + 4131737706, + 2971745240, + 1636938568, + 461809637, + 1293154012, + 2051347708, + 3415492749, + 309673494, + 1718449666, + 895136483, + 459169287, + 3758491237, + 1484777584, + 2985652876, + 3690529376, + 2814466466, + 3761286303, + 2906796347, + 1770927703, + 66989981, + 1227151467, + 740432923, + 1742669766, + 4108895627, + 1129792952, + 4217696861, + 1581599772, + 2822850338, + 1371889226, + 2928171633, + 337314434, + 1287812001, + 2566385880, + 1016557934, + 1521694314, + 1446569819, + 494280377, + 3605614928, + 1750373709, + 1917104935, + 1005209477, + 3290246820, + 2435278462, + 2392228341, + 1860566250, + 3604753061, + 1545385861, + 179541456, + 1095359, + 2235243074, + 3565546844, + 1848692563, + 3296532274, + 932183734, + 2678033798, + 2819310696, + 372402397, + 2849752546, + 3300638946, + 979341372, + 2027134812, + 3377292468, + 776160986, + 876596828, + 3411844979, + 3807986688, + 2828349004, + 2667246233, + 2887674321, + 3417530634, + 4192745201, + 1514743338, + 1486186234, + 3599480114, + 2220700932, + 877264426, + 3683620224, + 1791677875, + 1576589409, + 3371864729, + 239577320, + 664674279, + 97455638, + 671315040, + 4098637571, + 1233610174, + 2528631470, + 4181767203, + 4188289355, + 201010882, + 2613994903, + 3722085049, + 464425505, + 3872757292, + 1251239949, + 155862569, + 1690852071, + 958025955, + 3882516403, + 11720145, + 1377457109, + 611510219, + 4258313417, + 2145041081, + 230603729, + 108822725, + 2878554314, + 1764726348, + 2813464509, + 2430757019, + 1893470021, + 2345837745, + 3504885831, + 471263087, + 3448186974, + 91510807, + 1692101012, + 870758111, + 279967414, + 2975906051, + 831331682, + 714973860, + 895403271, + 1946906216, + 2175407141, + 294729832, + 663378707, + 4040948408, + 371079217, + 3849217943, + 3167620631, + 2106715634, + 4270851423, + 4180090782, + 2160180184, + 3446426895, + 3057856044, + 1623629695, + 1938845385, + 1992740005, + 2620458046, + 602642578, + 168172447, + 1859880120, + 3105244601, + 3397983984, + 4209231162, + 116203150, + 2166700138, + 679395399, + 1591101135, + 1511475060, + 3865776260, + 3861604114, + 2333630785, + 578347291, + 107805155, + 1281990800, + 2331362412, + 2805566554, + 1392433873, + 4113871053, + 1681686757, + 1317522404, + 263062625, + 3972207482, + 871540459, + 858793555, + 3378130229, + 1638925065, + 3644427872, + 425845250, + 4199381058, + 138738749, + 4064868817, + 641652061, + 3293641471, + 2781033146, + 2433876171, + 958379132, + 515825137, + 1920938822, + 508669000, + 1996074650, + 1132963176, + 112386699, + 4020276217, + 3307649861, + 712492536, + 752257327, + 703177072, + 655737206, + 1936095049, + 2870883815, + 750441059, + 531193802, + 3887354491, + 3768893981, + 758096438, + 763690471, + 1177380930, + 836758118, + 1370880236, + 2406562066, + 3117758426, + 38974763, + 729452259, + 563449846, + 2410187015, + 1585606395, + 4205777270, + 2173618669, + 3178196512, + 1074979883, + 4149809984, + 3286590086, + 2021554321, + 4088426121, + 3079684553, + 1917337899, + 2966649180, + 2899231799, + 1062888899, + 1306359486, + 876671599, + 3348080246, + 1542570792, + 3517583561, + 164390915, + 135607212, + 1392292837, + 1540942523, + 2587272281, + 974783651, + 3971944422, + 1315415300, + 1419043995, + 3194113563, + 495692306, + 3087088482, + 735847283, + 2418041689, + 2761711941, + 608441639, + 3606420410, + 2500421680, + 2129584375, + 4277314193, + 362285431, + 3829261316, + 3033449623, + 2726841579, + 2856071091, + 1282567563, + 1399900137, + 1288485551, + 1784276086, + 3203384342, + 2304811961, + 4188374470, + 2799600913, + 1668300233, + 3487044801, + 345405685, + 68861045, + 4149051636, + 630962370, + 3809297774, + 3497678965, + 2777356018, + 1131508456, + 3088811640, + 2916362619, + 3604683426, + 1367656029, + 3164360959, + 3464800203, + 2727920289, + 3993785877, + 410872094, + 933194096, + 1088600539, + 3511204625, + 818519978, + 4217773289, + 4016704403, + 2742865381, + 2118058332, + 2028824770, + 3585206344, + 3620279056, + 4291530408, + 748541778, + 1337473025, + 2734790168, + 2153414969, + 1554090190, + 4147260811, + 1053913480, + 4166858558, + 1486762641, + 34008703, + 2957308893, + 3461353779, + 3720643435, + 476418844, + 2092109162, + 1388524448 + ], + 623, + 0, + 0 + ], + "start_deck": [ + "default_version:4.4\ncharacter:Xiao@3.7\ncharacter:Venti@3.7\ncharacter:Kamisato Ayaka@3.3\nKanten Senmyou Blessing@3.3\nKanten Senmyou Blessing@3.3\nKanten Senmyou Blessing@3.3\nKanten Senmyou Blessing@3.3\nKanten Senmyou Blessing@3.3\nKanten Senmyou Blessing@3.3\nKanten Senmyou Blessing@3.3\nKanten Senmyou Blessing@3.3\nKanten Senmyou Blessing@3.3\nKanten Senmyou Blessing@3.3\nConqueror of Evil: Guardian Yaksha@3.7\nConqueror of Evil: Guardian Yaksha@3.7\nConqueror of Evil: Guardian Yaksha@3.7\nConqueror of Evil: Guardian Yaksha@3.7\nConqueror of Evil: Guardian Yaksha@3.7\nConqueror of Evil: Guardian Yaksha@3.7\nConqueror of Evil: Guardian Yaksha@3.7\nConqueror of Evil: Guardian Yaksha@3.7\nConqueror of Evil: Guardian Yaksha@3.7\nConqueror of Evil: Guardian Yaksha@3.7\n", + "default_version:4.4\ncharacter:Xiao@3.7\ncharacter:Venti@3.7\ncharacter:Kamisato Ayaka@3.3\nKanten Senmyou Blessing@3.3\nKanten Senmyou Blessing@3.3\nKanten Senmyou Blessing@3.3\nKanten Senmyou Blessing@3.3\nKanten Senmyou Blessing@3.3\nKanten Senmyou Blessing@3.3\nKanten Senmyou Blessing@3.3\nKanten Senmyou Blessing@3.3\nKanten Senmyou Blessing@3.3\nKanten Senmyou Blessing@3.3\nConqueror of Evil: Guardian Yaksha@3.7\nConqueror of Evil: Guardian Yaksha@3.7\nConqueror of Evil: Guardian Yaksha@3.7\nConqueror of Evil: Guardian Yaksha@3.7\nConqueror of Evil: Guardian Yaksha@3.7\nConqueror of Evil: Guardian Yaksha@3.7\nConqueror of Evil: Guardian Yaksha@3.7\nConqueror of Evil: Guardian Yaksha@3.7\nConqueror of Evil: Guardian Yaksha@3.7\nConqueror of Evil: Guardian Yaksha@3.7\n" + ], + "command_history": [ + [ + "TEST 1 10 10 10 10 10 10", + "TEST 4 p0", + "TEST 5 p0c0", + "TEST 12 p0c0", + "TEST 5 p0c1", + "TEST 12 p0c1", + "TEST 5 p0c2", + "TEST 12 p0c2", + "TEST 7 p0", + "TEST 4 p1", + "TEST 5 p1c0", + "TEST 12 p1c0", + "TEST 5 p1c1", + "TEST 12 p1c1", + "TEST 5 p1c2", + "TEST 12 p1c2", + "TEST 7 p1", + "sw_card", + "TEST 1 10 10 10 10 10 10", + "TEST 4 p0", + "TEST 5 p0c0", + "TEST 12 p0c0", + "TEST 5 p0c1", + "TEST 12 p0c1", + "TEST 5 p0c2", + "TEST 12 p0c2", + "TEST 7 p0", + "TEST 4 p1", + "TEST 5 p1c0", + "TEST 12 p1c0", + "TEST 5 p1c1", + "TEST 12 p1c1", + "TEST 5 p1c2", + "TEST 12 p1c2", + "TEST 7 p1", + "choose 0", + "TEST 1 10 10 10 10 10 10", + "TEST 4 p0", + "TEST 5 p0c0", + "TEST 12 p0c0", + "TEST 5 p0c1", + "TEST 12 p0c1", + "TEST 5 p0c2", + "TEST 12 p0c2", + "TEST 7 p0 OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI", + "TEST 4 p1", + "TEST 5 p1c0", + "TEST 12 p1c0", + "TEST 5 p1c1", + "TEST 12 p1c1", + "TEST 5 p1c2", + "TEST 12 p1c2", + "TEST 7 p1 OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI", + "card 1 0 15 14", + "TEST 1 10 10 10 10 10 10", + "TEST 4 p0", + "TEST 5 p0c0", + "TEST 12 p0c0", + "TEST 5 p0c1", + "TEST 12 p0c1", + "TEST 5 p0c2", + "TEST 12 p0c2", + "TEST 7 p0 OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI", + "TEST 4 p1", + "TEST 5 p1c0", + "TEST 12 p1c0", + "TEST 5 p1c1", + "TEST 12 p1c1", + "TEST 5 p1c2", + "TEST 12 p1c2", + "TEST 7 p1 OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI", + "skill 0 13 12 11", + "TEST 1 8 10 10 8 10 10", + "TEST 4 p0", + "TEST 5 p0c0", + "TEST 12 p0c0", + "TEST 5 p0c1", + "TEST 12 p0c1", + "TEST 5 p0c2", + "TEST 12 p0c2", + "TEST 7 p0 OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI", + "TEST 4 p1", + "TEST 5 p1c0", + "TEST 12 p1c0", + "TEST 5 p1c1", + "TEST 12 p1c1", + "TEST 5 p1c2", + "TEST 12 p1c2", + "TEST 7 p1 OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI", + "skill 0 10 9 8", + "TEST 1 6 10 10 6 10 10", + "TEST 4 p0", + "TEST 5 p0c0", + "TEST 12 p0c0", + "TEST 5 p0c1", + "TEST 12 p0c1", + "TEST 5 p0c2", + "TEST 12 p0c2", + "TEST 7 p0 OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI", + "TEST 4 p1", + "TEST 5 p1c0", + "TEST 12 p1c0", + "TEST 5 p1c1", + "TEST 12 p1c1", + "TEST 5 p1c2", + "TEST 12 p1c2", + "TEST 7 p1 OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI", + "card 1 0 7 6 5", + "TEST 1 6 10 10 2 10 10", + "TEST 4 p0", + "TEST 5 p0c0 2", + "TEST 12 p0c0", + "TEST 5 p0c1", + "TEST 12 p0c1", + "TEST 5 p0c2", + "TEST 12 p0c2", + "TEST 7 p0 OMNI OMNI OMNI OMNI OMNI", + "TEST 4 p1", + "TEST 5 p1c0", + "TEST 12 p1c0", + "TEST 5 p1c1", + "TEST 12 p1c1", + "TEST 5 p1c2", + "TEST 12 p1c2", + "TEST 7 p1 OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI", + "sw_char 2", + "TEST 1 6 10 8 2 10 10", + "TEST 4 p0", + "TEST 5 p0c0 2", + "TEST 12 p0c0", + "TEST 5 p0c1", + "TEST 12 p0c1", + "TEST 5 p0c2 1", + "TEST 12 p0c2", + "TEST 7 p0 OMNI OMNI OMNI OMNI OMNI", + "TEST 4 p1 2", + "TEST 5 p1c0", + "TEST 12 p1c0", + "TEST 5 p1c1", + "TEST 12 p1c1", + "TEST 5 p1c2", + "TEST 12 p1c2", + "TEST 7 p1 OMNI OMNI OMNI OMNI OMNI OMNI", + "sw_char 1 4", + "TEST 1 6 10 8 2 10 10", + "TEST 4 p0", + "TEST 5 p0c0 2", + "TEST 12 p0c0", + "TEST 5 p0c1", + "TEST 12 p0c1", + "TEST 5 p0c2 1", + "TEST 12 p0c2", + "TEST 7 p0 OMNI OMNI OMNI OMNI", + "TEST 4 p1 1", + "TEST 5 p1c0", + "TEST 12 p1c0", + "TEST 5 p1c1", + "TEST 12 p1c1", + "TEST 5 p1c2 1", + "TEST 12 p1c2", + "TEST 7 p1 OMNI OMNI OMNI OMNI", + "sw_char 2", + "TEST 1 6 10 8 2 10 10", + "TEST 4 p0", + "TEST 5 p0c0 2", + "TEST 12 p0c0", + "TEST 5 p0c1", + "TEST 12 p0c1", + "TEST 5 p0c2 1", + "TEST 12 p0c2", + "TEST 7 p0 OMNI OMNI OMNI OMNI", + "TEST 4 p1", + "TEST 5 p1c0", + "TEST 12 p1c0", + "TEST 5 p1c1", + "TEST 12 p1c1", + "TEST 5 p1c2 1", + "TEST 12 p1c2", + "TEST 7 p1 OMNI OMNI OMNI OMNI", + "end", + "TEST 1 6 10 6 2 10 10", + "TEST 4 p0", + "TEST 5 p0c0 1", + "TEST 12 p0c0", + "TEST 5 p0c1", + "TEST 12 p0c1", + "TEST 5 p0c2", + "TEST 12 p0c2", + "TEST 7 p0 OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI", + "TEST 4 p1 2", + "TEST 5 p1c0", + "TEST 12 p1c0", + "TEST 5 p1c1", + "TEST 12 p1c1", + "TEST 5 p1c2", + "TEST 12 p1c2", + "TEST 7 p1 OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI", + "sw_char 1 15", + "TEST 1 6 10 6 2 10 10", + "TEST 4 p0", + "TEST 5 p0c0 1", + "TEST 12 p0c0", + "TEST 5 p0c1", + "TEST 12 p0c1", + "TEST 5 p0c2", + "TEST 12 p0c2", + "TEST 7 p0 OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI", + "TEST 4 p1 1", + "TEST 5 p1c0", + "TEST 12 p1c0", + "TEST 5 p1c1", + "TEST 12 p1c1", + "TEST 5 p1c2", + "TEST 12 p1c2", + "TEST 7 p1 OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI", + "end" + ], + [ + "TEST 1 10 10 10 10 10 10", + "TEST 4 p0", + "TEST 5 p0c0", + "TEST 12 p0c0", + "TEST 5 p0c1", + "TEST 12 p0c1", + "TEST 5 p0c2", + "TEST 12 p0c2", + "TEST 7 p0", + "TEST 4 p1", + "TEST 5 p1c0", + "TEST 12 p1c0", + "TEST 5 p1c1", + "TEST 12 p1c1", + "TEST 5 p1c2", + "TEST 12 p1c2", + "TEST 7 p1", + "sw_card", + "TEST 1 10 10 10 10 10 10", + "TEST 4 p0", + "TEST 5 p0c0", + "TEST 12 p0c0", + "TEST 5 p0c1", + "TEST 12 p0c1", + "TEST 5 p0c2", + "TEST 12 p0c2", + "TEST 7 p0", + "TEST 4 p1", + "TEST 5 p1c0", + "TEST 12 p1c0", + "TEST 5 p1c1", + "TEST 12 p1c1", + "TEST 5 p1c2", + "TEST 12 p1c2", + "TEST 7 p1", + "choose 0", + "TEST 1 10 10 10 8 10 10", + "TEST 4 p0", + "TEST 5 p0c0", + "TEST 12 p0c0", + "TEST 5 p0c1", + "TEST 12 p0c1", + "TEST 5 p0c2", + "TEST 12 p0c2", + "TEST 7 p0 OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI", + "TEST 4 p1", + "TEST 5 p1c0", + "TEST 12 p1c0", + "TEST 5 p1c1", + "TEST 12 p1c1", + "TEST 5 p1c2", + "TEST 12 p1c2", + "TEST 7 p1 OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI", + "skill 0 15 14 13", + "TEST 1 8 10 10 6 10 10", + "TEST 4 p0", + "TEST 5 p0c0", + "TEST 12 p0c0", + "TEST 5 p0c1", + "TEST 12 p0c1", + "TEST 5 p0c2", + "TEST 12 p0c2", + "TEST 7 p0 OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI", + "TEST 4 p1", + "TEST 5 p1c0", + "TEST 12 p1c0", + "TEST 5 p1c1", + "TEST 12 p1c1", + "TEST 5 p1c2", + "TEST 12 p1c2", + "TEST 7 p1 OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI", + "skill 0 12 11 10", + "TEST 1 6 10 10 2 10 10", + "TEST 4 p0", + "TEST 5 p0c0 2", + "TEST 12 p0c0", + "TEST 5 p0c1", + "TEST 12 p0c1", + "TEST 5 p0c2", + "TEST 12 p0c2", + "TEST 7 p0 OMNI OMNI OMNI OMNI OMNI", + "TEST 4 p1", + "TEST 5 p1c0", + "TEST 12 p1c0", + "TEST 5 p1c1", + "TEST 12 p1c1", + "TEST 5 p1c2", + "TEST 12 p1c2", + "TEST 7 p1 OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI", + "sw_char 1 9", + "TEST 1 6 10 10 2 10 10", + "TEST 4 p0", + "TEST 5 p0c0 2", + "TEST 12 p0c0", + "TEST 5 p0c1", + "TEST 12 p0c1", + "TEST 5 p0c2 1", + "TEST 12 p0c2", + "TEST 7 p0 OMNI OMNI OMNI OMNI OMNI", + "TEST 4 p1", + "TEST 5 p1c0", + "TEST 12 p1c0", + "TEST 5 p1c1", + "TEST 12 p1c1", + "TEST 5 p1c2", + "TEST 12 p1c2", + "TEST 7 p1 OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI", + "skill 1 8 7 6", + "TEST 1 6 10 8 2 10 10", + "TEST 4 p0", + "TEST 5 p0c0 2", + "TEST 12 p0c0", + "TEST 5 p0c1", + "TEST 12 p0c1", + "TEST 5 p0c2 1", + "TEST 12 p0c2", + "TEST 7 p0 OMNI OMNI OMNI OMNI", + "TEST 4 p1 2", + "TEST 5 p1c0", + "TEST 12 p1c0", + "TEST 5 p1c1", + "TEST 12 p1c1", + "TEST 5 p1c2", + "TEST 12 p1c2", + "TEST 7 p1 OMNI OMNI OMNI OMNI OMNI OMNI", + "card 3 0 5 4", + "TEST 1 6 10 8 2 10 10", + "TEST 4 p0", + "TEST 5 p0c0 2", + "TEST 12 p0c0", + "TEST 5 p0c1", + "TEST 12 p0c1", + "TEST 5 p0c2 1", + "TEST 12 p0c2", + "TEST 7 p0 OMNI OMNI OMNI OMNI", + "TEST 4 p1 2", + "TEST 5 p1c0", + "TEST 12 p1c0", + "TEST 5 p1c1", + "TEST 12 p1c1", + "TEST 5 p1c2", + "TEST 12 p1c2", + "TEST 7 p1 OMNI OMNI OMNI OMNI", + "sw_char 2", + "TEST 1 6 10 8 2 10 10", + "TEST 4 p0", + "TEST 5 p0c0 2", + "TEST 12 p0c0", + "TEST 5 p0c1", + "TEST 12 p0c1", + "TEST 5 p0c2 1", + "TEST 12 p0c2", + "TEST 7 p0 OMNI OMNI OMNI OMNI", + "TEST 4 p1 1", + "TEST 5 p1c0", + "TEST 12 p1c0", + "TEST 5 p1c1", + "TEST 12 p1c1", + "TEST 5 p1c2 1", + "TEST 12 p1c2", + "TEST 7 p1 OMNI OMNI OMNI OMNI", + "sw_char 1", + "TEST 1 6 10 8 2 10 10", + "TEST 4 p0", + "TEST 5 p0c0 2", + "TEST 12 p0c0", + "TEST 5 p0c1", + "TEST 12 p0c1", + "TEST 5 p0c2 1", + "TEST 12 p0c2", + "TEST 7 p0 OMNI OMNI OMNI OMNI", + "TEST 4 p1", + "TEST 5 p1c0", + "TEST 12 p1c0", + "TEST 5 p1c1", + "TEST 12 p1c1", + "TEST 5 p1c2 1", + "TEST 12 p1c2", + "TEST 7 p1 OMNI OMNI OMNI OMNI", + "sw_char 2", + "TEST 1 6 10 8 2 10 10", + "TEST 4 p0", + "TEST 5 p0c0 2", + "TEST 12 p0c0", + "TEST 5 p0c1", + "TEST 12 p0c1", + "TEST 5 p0c2 1", + "TEST 12 p0c2", + "TEST 7 p0 OMNI OMNI OMNI OMNI", + "TEST 4 p1", + "TEST 5 p1c0", + "TEST 12 p1c0", + "TEST 5 p1c1", + "TEST 12 p1c1", + "TEST 5 p1c2 1", + "TEST 12 p1c2", + "TEST 7 p1 OMNI OMNI OMNI OMNI", + "sw_char 1 3", + "TEST 1 6 10 8 2 10 10", + "TEST 4 p0", + "TEST 5 p0c0 2", + "TEST 12 p0c0", + "TEST 5 p0c1", + "TEST 12 p0c1", + "TEST 5 p0c2 1", + "TEST 12 p0c2", + "TEST 7 p0 OMNI OMNI OMNI OMNI", + "TEST 4 p1", + "TEST 5 p1c0", + "TEST 12 p1c0", + "TEST 5 p1c1", + "TEST 12 p1c1", + "TEST 5 p1c2 1", + "TEST 12 p1c2", + "TEST 7 p1 OMNI OMNI OMNI", + "skill 1 2 1 0", + "TEST 1 6 10 6 2 10 10", + "TEST 4 p0", + "TEST 5 p0c0 2", + "TEST 12 p0c0", + "TEST 5 p0c1", + "TEST 12 p0c1", + "TEST 5 p0c2 1", + "TEST 12 p0c2", + "TEST 7 p0 OMNI OMNI OMNI OMNI", + "TEST 4 p1 2", + "TEST 5 p1c0", + "TEST 12 p1c0", + "TEST 5 p1c1", + "TEST 12 p1c1", + "TEST 5 p1c2 1", + "TEST 12 p1c2", + "TEST 7 p1", + "end", + "TEST 1 6 10 6 2 10 10", + "TEST 4 p0", + "TEST 5 p0c0 1", + "TEST 12 p0c0", + "TEST 5 p0c1", + "TEST 12 p0c1", + "TEST 5 p0c2", + "TEST 12 p0c2", + "TEST 7 p0 OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI", + "TEST 4 p1 2", + "TEST 5 p1c0", + "TEST 12 p1c0", + "TEST 5 p1c1", + "TEST 12 p1c1", + "TEST 5 p1c2", + "TEST 12 p1c2", + "TEST 7 p1 OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI", + "sw_char 0", + "TEST 1 6 10 6 2 10 10", + "TEST 4 p0", + "TEST 5 p0c0 1", + "TEST 12 p0c0", + "TEST 5 p0c1", + "TEST 12 p0c1", + "TEST 5 p0c2", + "TEST 12 p0c2", + "TEST 7 p0 OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI", + "TEST 4 p1 1", + "TEST 5 p1c0", + "TEST 12 p1c0", + "TEST 5 p1c1", + "TEST 12 p1c1", + "TEST 5 p1c2", + "TEST 12 p1c2", + "TEST 7 p1 OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI", + "skill 2 15 14 13", + "TEST 1 6 6 6 2 10 10", + "TEST 4 p0", + "TEST 5 p0c0 1", + "TEST 12 p0c0", + "TEST 5 p0c1", + "TEST 12 p0c1", + "TEST 5 p0c2", + "TEST 12 p0c2", + "TEST 7 p0 OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI", + "TEST 4 p1 1", + "TEST 5 p1c0 2", + "TEST 12 p1c0", + "TEST 5 p1c1", + "TEST 12 p1c1", + "TEST 5 p1c2", + "TEST 12 p1c2", + "TEST 7 p1 OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI", + "sw_char 2", + "TEST 1 6 6 6 2 10 10", + "TEST 4 p0", + "TEST 5 p0c0 1", + "TEST 12 p0c0", + "TEST 5 p0c1", + "TEST 12 p0c1", + "TEST 5 p0c2", + "TEST 12 p0c2", + "TEST 7 p0 OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI", + "TEST 4 p1 1", + "TEST 5 p1c0 2", + "TEST 12 p1c0", + "TEST 5 p1c1", + "TEST 12 p1c1", + "TEST 5 p1c2 1", + "TEST 12 p1c2", + "TEST 7 p1 OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI", + "sw_char 1", + "TEST 1 6 6 6 2 10 10", + "TEST 4 p0", + "TEST 5 p0c0 1", + "TEST 12 p0c0", + "TEST 5 p0c1", + "TEST 12 p0c1", + "TEST 5 p0c2", + "TEST 12 p0c2", + "TEST 7 p0 OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI", + "TEST 4 p1", + "TEST 5 p1c0 2", + "TEST 12 p1c0", + "TEST 5 p1c1", + "TEST 12 p1c1", + "TEST 5 p1c2 1", + "TEST 12 p1c2", + "TEST 7 p1 OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI", + "sw_char 2", + "TEST 1 6 6 6 2 10 10", + "TEST 4 p0", + "TEST 5 p0c0 1", + "TEST 12 p0c0", + "TEST 5 p0c1", + "TEST 12 p0c1", + "TEST 5 p0c2", + "TEST 12 p0c2", + "TEST 7 p0 OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI", + "TEST 4 p1", + "TEST 5 p1c0 2", + "TEST 12 p1c0", + "TEST 5 p1c1", + "TEST 12 p1c1", + "TEST 5 p1c2 1", + "TEST 12 p1c2", + "TEST 7 p1 OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI", + "sw_char 1 12", + "TEST 1 6 6 6 2 10 10", + "TEST 4 p0", + "TEST 5 p0c0 1", + "TEST 12 p0c0", + "TEST 5 p0c1", + "TEST 12 p0c1", + "TEST 5 p0c2", + "TEST 12 p0c2", + "TEST 7 p0 OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI", + "TEST 4 p1", + "TEST 5 p1c0 2", + "TEST 12 p1c0", + "TEST 5 p1c1", + "TEST 12 p1c1", + "TEST 5 p1c2 1", + "TEST 12 p1c2", + "TEST 7 p1 OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI OMNI", + "end" + ] + ], + "match_config": { + "random_first_player": false, + "player_go_first": 0, + "check_deck_restriction": false, + "initial_hand_size": 5, + "initial_card_draw": 2, + "initial_dice_number": 16, + "initial_dice_reroll_times": 1, + "card_number": null, + "max_same_card_number": null, + "character_number": null, + "max_round_number": 999, + "max_hand_size": 10, + "max_dice_number": 16, + "max_summon_number": 4, + "max_support_number": 4, + "make_skill_prediction": false, + "history_level": 10, + "compress_history": true, + "recreate_mode": false, + "random_object_information": [] + }, + "command_history_raw": [ + [ + [ + 2, + "sw_card", + 0 + ], + [ + 4, + "choose 0", + 2 + ], + [ + 7, + "card 1 0 15 14", + 4 + ], + [ + 10, + "skill 0 13 12 11", + 5 + ], + [ + 16, + "skill 0 10 9 8", + 7 + ], + [ + 22, + "card 1 0 7 6 5", + 9 + ], + [ + 29, + "sw_char 2", + 11 + ], + [ + 34, + "sw_char 1 4", + 13 + ], + [ + 41, + "sw_char 2", + 16 + ], + [ + 45, + "end", + 18 + ], + [ + 59, + "sw_char 1 15", + 23 + ], + [ + 63, + "end", + 25 + ] + ], + [ + [ + 2, + "sw_card", + 1 + ], + [ + 4, + "choose 0", + 3 + ], + [ + 13, + "skill 0 15 14 13", + 6 + ], + [ + 19, + "skill 0 12 11 10", + 8 + ], + [ + 27, + "sw_char 1 9", + 10 + ], + [ + 31, + "skill 1 8 7 6", + 12 + ], + [ + 36, + "card 3 0 5 4", + 14 + ], + [ + 39, + "sw_char 2", + 15 + ], + [ + 43, + "sw_char 1", + 17 + ], + [ + 47, + "sw_char 2", + 19 + ], + [ + 49, + "sw_char 1 3", + 20 + ], + [ + 51, + "skill 1 2 1 0", + 21 + ], + [ + 54, + "end", + 22 + ], + [ + 61, + "sw_char 0", + 24 + ], + [ + 65, + "skill 2 15 14 13", + 26 + ], + [ + 68, + "sw_char 2", + 27 + ], + [ + 70, + "sw_char 1", + 28 + ], + [ + 72, + "sw_char 2", + 29 + ], + [ + 74, + "sw_char 1 12", + 30 + ], + [ + 76, + "end", + 31 + ] + ] + ] +} \ No newline at end of file diff --git a/tests/server/bugfix/test_json_bugfix.py b/tests/server/bugfix/test_json_bugfix.py index cde9159c..3ddca4b2 100644 --- a/tests/server/bugfix/test_json_bugfix.py +++ b/tests/server/bugfix/test_json_bugfix.py @@ -8,5 +8,12 @@ def test_issue_106(): do_log_tests(json_path) +def test_issue_82(): + json_fname = "test_issue_82.json" + json_path = os.path.join(os.path.dirname(__file__), "jsons", json_fname) + do_log_tests(json_path) + + if __name__ == "__main__": test_issue_106() + test_issue_82()