Spaces:
Sleeping
Sleeping
| # @generated by tools/sync_metadata.py on 2026-03-19T22:09:45.151488 | |
| def to_signed_32(x): | |
| x = int(x) & 0xFFFFFFFF | |
| return x - 0x100000000 if x >= 0x80000000 else x | |
| def pack_a_standard(target_player=0, card_type=0, group_enabled=0, group_id=0, is_tapped=0, has_blade_heart=0, not_has_blade_heart=0, unique_names=0, unit_enabled=0, unit_id=0, value_enabled=0, value_threshold=0, is_le=0, is_cost_type=0, color_mask=0, char_id_1=0, char_id_2=0, zone_mask=0, special_id=0, is_setsuna=0, compare_accumulated=0, is_optional=0, keyword_energy=0, keyword_member=0): | |
| res = 0 | |
| res |= ((target_player) & 0x3) << 0 | |
| res |= ((card_type) & 0x3) << 2 | |
| res |= ((group_enabled) & 0x1) << 4 | |
| res |= ((group_id) & 0x7f) << 5 | |
| res |= ((is_tapped) & 0x1) << 12 | |
| res |= ((has_blade_heart) & 0x1) << 13 | |
| res |= ((not_has_blade_heart) & 0x1) << 14 | |
| res |= ((unique_names) & 0x1) << 15 | |
| res |= ((unit_enabled) & 0x1) << 16 | |
| res |= ((unit_id) & 0x7f) << 17 | |
| res |= ((value_enabled) & 0x1) << 24 | |
| res |= ((value_threshold) & 0x1f) << 25 | |
| res |= ((is_le) & 0x1) << 30 | |
| res |= ((is_cost_type) & 0x1) << 31 | |
| res |= ((color_mask) & 0x7f) << 32 | |
| res |= ((char_id_1) & 0x7f) << 39 | |
| res |= ((char_id_2) & 0x7f) << 46 | |
| res |= ((zone_mask) & 0x7) << 53 | |
| res |= ((special_id) & 0x7) << 56 | |
| res |= ((is_setsuna) & 0x1) << 59 | |
| res |= ((compare_accumulated) & 0x1) << 60 | |
| res |= ((is_optional) & 0x1) << 61 | |
| res |= ((keyword_energy) & 0x1) << 62 | |
| res |= ((keyword_member) & 0x1) << 63 | |
| return res | |
| def unpack_a_standard(val): | |
| return { | |
| 'target_player': (val >> 0) & 0x3, | |
| 'card_type': (val >> 2) & 0x3, | |
| 'group_enabled': (val >> 4) & 0x1, | |
| 'group_id': (val >> 5) & 0x7f, | |
| 'is_tapped': (val >> 12) & 0x1, | |
| 'has_blade_heart': (val >> 13) & 0x1, | |
| 'not_has_blade_heart': (val >> 14) & 0x1, | |
| 'unique_names': (val >> 15) & 0x1, | |
| 'unit_enabled': (val >> 16) & 0x1, | |
| 'unit_id': (val >> 17) & 0x7f, | |
| 'value_enabled': (val >> 24) & 0x1, | |
| 'value_threshold': (val >> 25) & 0x1f, | |
| 'is_le': (val >> 30) & 0x1, | |
| 'is_cost_type': (val >> 31) & 0x1, | |
| 'color_mask': (val >> 32) & 0x7f, | |
| 'char_id_1': (val >> 39) & 0x7f, | |
| 'char_id_2': (val >> 46) & 0x7f, | |
| 'zone_mask': (val >> 53) & 0x7, | |
| 'special_id': (val >> 56) & 0x7, | |
| 'is_setsuna': (val >> 59) & 0x1, | |
| 'compare_accumulated': (val >> 60) & 0x1, | |
| 'is_optional': (val >> 61) & 0x1, | |
| 'keyword_energy': (val >> 62) & 0x1, | |
| 'keyword_member': (val >> 63) & 0x1, | |
| } | |
| def pack_a_heart_cost(req_1=0, req_2=0, req_3=0, req_4=0, req_5=0, req_6=0, req_7=0, req_8=0, unit_enabled=0, unit_id=0): | |
| res = 0 | |
| res |= ((req_1) & 0xf) << 0 | |
| res |= ((req_2) & 0xf) << 4 | |
| res |= ((req_3) & 0xf) << 8 | |
| res |= ((req_4) & 0xf) << 12 | |
| res |= ((req_5) & 0xf) << 16 | |
| res |= ((req_6) & 0xf) << 20 | |
| res |= ((req_7) & 0xf) << 24 | |
| res |= ((req_8) & 0xf) << 28 | |
| res |= ((unit_enabled) & 0x1) << 48 | |
| res |= ((unit_id) & 0x7f) << 49 | |
| return res | |
| def unpack_a_heart_cost(val): | |
| return { | |
| 'req_1': (val >> 0) & 0xf, | |
| 'req_2': (val >> 4) & 0xf, | |
| 'req_3': (val >> 8) & 0xf, | |
| 'req_4': (val >> 12) & 0xf, | |
| 'req_5': (val >> 16) & 0xf, | |
| 'req_6': (val >> 20) & 0xf, | |
| 'req_7': (val >> 24) & 0xf, | |
| 'req_8': (val >> 28) & 0xf, | |
| 'unit_enabled': (val >> 48) & 0x1, | |
| 'unit_id': (val >> 49) & 0x7f, | |
| } | |
| def pack_a_look_choose(): | |
| res = 0 | |
| return res | |
| def unpack_a_look_choose(val): | |
| return { | |
| } | |
| def pack_v_heart_counts(pink=0, red=0, yellow=0, green=0, blue=0, purple=0, any=0): | |
| res = 0 | |
| res |= ((pink) & 0xf) << 0 | |
| res |= ((red) & 0xf) << 4 | |
| res |= ((yellow) & 0xf) << 8 | |
| res |= ((green) & 0xf) << 12 | |
| res |= ((blue) & 0xf) << 16 | |
| res |= ((purple) & 0xf) << 20 | |
| res |= ((any) & 0xf) << 24 | |
| return res | |
| def unpack_v_heart_counts(val): | |
| return { | |
| 'pink': (val >> 0) & 0xf, | |
| 'red': (val >> 4) & 0xf, | |
| 'yellow': (val >> 8) & 0xf, | |
| 'green': (val >> 12) & 0xf, | |
| 'blue': (val >> 16) & 0xf, | |
| 'purple': (val >> 20) & 0xf, | |
| 'any': (val >> 24) & 0xf, | |
| } | |
| def pack_v_look_choose(count=0, char_id_1=0, reveal=0, char_id_2=0, char_id_3=0, dest_discard=0): | |
| res = 0 | |
| res |= ((count) & 0xff) << 0 | |
| res |= ((char_id_1) & 0x7f) << 16 | |
| res |= ((reveal) & 0x1) << 30 | |
| res |= ((char_id_2) & 0x7f) << 8 | |
| res |= ((char_id_3) & 0x7f) << 23 | |
| res |= ((dest_discard) & 0x1) << 31 | |
| return res | |
| def unpack_v_look_choose(val): | |
| return { | |
| 'count': (val >> 0) & 0xff, | |
| 'char_id_1': (val >> 16) & 0x7f, | |
| 'reveal': (val >> 30) & 0x1, | |
| 'char_id_2': (val >> 8) & 0x7f, | |
| 'char_id_3': (val >> 23) & 0x7f, | |
| 'dest_discard': (val >> 31) & 0x1, | |
| } | |
| def pack_v_scalar_dynamic(base_value=0, divisor=0): | |
| res = 0 | |
| res |= ((base_value) & 0xffff) << 0 | |
| res |= ((divisor) & 0xffff) << 16 | |
| return res | |
| def unpack_v_scalar_dynamic(val): | |
| return { | |
| 'base_value': (val >> 0) & 0xffff, | |
| 'divisor': (val >> 16) & 0xffff, | |
| } | |
| def pack_s_standard(target_slot=0, remainder_zone=0, source_zone=0, dest_zone=0, is_opponent=0, is_reveal_until_live=0, is_empty_slot=0, is_wait=0, is_dynamic=0, area_idx=0, is_baton_slot=0): | |
| res = 0 | |
| res |= ((target_slot) & 0xff) << 0 | |
| res |= ((remainder_zone) & 0xff) << 8 | |
| res |= ((source_zone) & 0xf) << 16 | |
| res |= ((dest_zone) & 0xf) << 20 | |
| res |= ((is_opponent) & 0x1) << 24 | |
| res |= ((is_reveal_until_live | is_baton_slot) & 0x1) << 25 | |
| res |= ((is_empty_slot) & 0x1) << 26 | |
| res |= ((is_wait) & 0x1) << 27 | |
| res |= ((is_dynamic) & 0x1) << 28 | |
| res |= ((area_idx) & 0x7) << 29 | |
| return res | |
| def unpack_s_standard(val): | |
| return { | |
| 'target_slot': (val >> 0) & 0xff, | |
| 'remainder_zone': (val >> 8) & 0xff, | |
| 'source_zone': (val >> 16) & 0xf, | |
| 'dest_zone': (val >> 20) & 0xf, | |
| 'is_opponent': (val >> 24) & 0x1, | |
| 'is_reveal_until_live': (val >> 25) & 0x1, | |
| 'is_baton_slot': (val >> 25) & 0x1, | |
| 'is_empty_slot': (val >> 26) & 0x1, | |
| 'is_wait': (val >> 27) & 0x1, | |
| 'is_dynamic': (val >> 28) & 0x1, | |
| 'area_idx': (val >> 29) & 0x7, | |
| } | |