mirror of
https://github.com/italicsjenga/agb.git
synced 2025-01-28 01:56:43 +11:00
Use saturating_sub rather than regular subtraction
This commit is contained in:
parent
cdd77afe22
commit
f01d3bff36
1 changed files with 4 additions and 4 deletions
|
@ -393,10 +393,10 @@ impl SwordState {
|
||||||
}
|
}
|
||||||
fn attack_frame(self, timer: u16) -> u16 {
|
fn attack_frame(self, timer: u16) -> u16 {
|
||||||
match self {
|
match self {
|
||||||
SwordState::LongSword => (self.attack_duration() - timer) / 8,
|
SwordState::LongSword => (self.attack_duration().saturating_sub(timer)) / 8,
|
||||||
SwordState::ShortSword => (self.attack_duration() - timer) / 8,
|
SwordState::ShortSword => (self.attack_duration().saturating_sub(timer)) / 8,
|
||||||
SwordState::Dagger => (self.attack_duration() - timer) / 8,
|
SwordState::Dagger => (self.attack_duration().saturating_sub(timer)) / 8,
|
||||||
SwordState::Swordless => (self.attack_duration() - timer) / 8,
|
SwordState::Swordless => (self.attack_duration().saturating_sub(timer)) / 8,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn jump_attack_tag(self) -> &'static Tag {
|
fn jump_attack_tag(self) -> &'static Tag {
|
||||||
|
|
Loading…
Add table
Reference in a new issue