Skip to content

Commit

Permalink
Update unknown values in move data (#388)
Browse files Browse the repository at this point in the history
* SkyTemple/skytemple#573: Update unknown values in move data

* Update  to be bool

* Fix type of ai_frozen_check for attribute test

* Fix some typing related issues

* Fix test fixtures for WazaP tests
  • Loading branch information
theCapypara authored Jul 30, 2023
1 parent 0bc157f commit b871e5f
Show file tree
Hide file tree
Showing 7 changed files with 3,546 additions and 3,546 deletions.
20 changes: 10 additions & 10 deletions skytemple_files/data/waza_p/_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,9 @@ class WazaMove(WazaMoveProtocol[WazaMoveRangeSettings], AutoString):
affected_by_magic_coat: bool
is_snatchable: bool
uses_mouth: bool
unk13: u8
ai_frozen_check: bool
ignores_taunted: bool
unk15: u8
range_check_text: u8
move_id: u16
message_id: u8

Expand Down Expand Up @@ -179,12 +179,12 @@ def __init__(self, data: bytes):
self.is_snatchable = bool(read_u8(data, 0x11))
# 0x12 1 uint8 Unk#15 Boolean, whether the move is disabled by the "muzzled" status.
self.uses_mouth = bool(read_u8(data, 0x12))
# 0x13 1 uint8 Unk#16 Unknown.
self.unk13 = read_u8(data, 0x13)
# 0x13 1 uint8 Unk#16 If true, the AI won't try to use the move on frozen targets.
self.ai_frozen_check = bool(read_u8(data, 0x13))
# 0x14 1 uint8 Unk#17 Boolean, whether the move can be used while taunted.
self.ignores_taunted = bool(read_u8(data, 0x14))
# 0x15 1 uint8 Unk#18 Unknown. Possible bitfield.
self.unk15 = read_u8(data, 0x15)
# 0x15 1 uint8 Unk#18 Determines the string that is displayed for the range of the move in-game
self.range_check_text = read_u8(data, 0x15)
# 0x16 2 uint16 Move ID The move's ID, possibly used by the game code for allocating resources and etc..
self.move_id = read_u16(data, 0x16)
# 0x18 1 uint8 Unk#19 Message ID offset that is displayed for the move.
Expand All @@ -209,9 +209,9 @@ def to_bytes(self) -> bytes:
write_u8(data, u8(int(self.affected_by_magic_coat)), 16)
write_u8(data, u8(int(self.is_snatchable)), 17)
write_u8(data, u8(int(self.uses_mouth)), 18)
write_u8(data, self.unk13, 19)
write_u8(data, u8(int(self.ai_frozen_check)), 19)
write_u8(data, u8(int(self.ignores_taunted)), 20)
write_u8(data, self.unk15, 21)
write_u8(data, self.range_check_text, 21)
write_u16(data, self.move_id, 22)
write_u8(data, self.message_id, 24)
return bytes(data)
Expand All @@ -236,9 +236,9 @@ def __eq__(self, other: object) -> bool:
and self.affected_by_magic_coat == other.affected_by_magic_coat
and self.is_snatchable == other.is_snatchable
and self.uses_mouth == other.uses_mouth
and self.unk13 == other.unk13
and self.ai_frozen_check == other.ai_frozen_check
and self.ignores_taunted == other.ignores_taunted
and self.unk15 == other.unk15
and self.range_check_text == other.range_check_text
and self.move_id == other.move_id
and self.message_id == other.message_id
)
Expand Down
4 changes: 2 additions & 2 deletions skytemple_files/data/waza_p/protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,9 +249,9 @@ class WazaMoveProtocol(Protocol[R]):
affected_by_magic_coat: bool
is_snatchable: bool
uses_mouth: bool
unk13: u8
ai_frozen_check: bool
ignores_taunted: bool
unk15: u8
range_check_text: u8
move_id: u16
message_id: u8

Expand Down
16 changes: 8 additions & 8 deletions test/skytemple_files_test/data/waza_p/fixture.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@ def eq_move(one: WazaMoveProtocol, two: WazaMoveProtocol) -> bool:
one.affected_by_magic_coat == two.affected_by_magic_coat and
one.is_snatchable == two.is_snatchable and
one.uses_mouth == two.uses_mouth and
one.unk13 == two.unk13 and
one.ai_frozen_check == two.ai_frozen_check and
one.ignores_taunted == two.ignores_taunted and
one.unk15 == two.unk15 and
one.range_check_text == two.range_check_text and
one.move_id == two.move_id and
one.message_id == two.message_id
)
Expand Down Expand Up @@ -152,9 +152,9 @@ class WazaMoveStub(WazaMoveProtocol[int]): # type: ignore
affected_by_magic_coat: bool
is_snatchable: bool
uses_mouth: bool
unk13: u8
ai_frozen_check: bool
ignores_taunted: bool
unk15: u8
range_check_text: u8
move_id: u16
message_id: u8

Expand All @@ -177,9 +177,9 @@ def stub_new(
affected_by_magic_coat: bool,
is_snatchable: bool,
uses_mouth: bool,
unk13: u8,
ai_frozen_check: u8,
ignores_taunted: bool,
unk15: u8,
range_check_text: u8,
move_id: u16,
message_id: u8,
) -> WazaMoveStub:
Expand All @@ -200,9 +200,9 @@ def stub_new(
self.affected_by_magic_coat = affected_by_magic_coat
self.is_snatchable = is_snatchable
self.uses_mouth = uses_mouth
self.unk13 = unk13
self.ai_frozen_check = ai_frozen_check
self.ignores_taunted = ignores_taunted
self.unk15 = unk15
self.range_check_text = range_check_text
self.move_id = move_id
self.message_id = message_id
return self
Expand Down
Loading

0 comments on commit b871e5f

Please sign in to comment.