This commit is contained in:
@@ -167,13 +167,6 @@ impl<'own, 'library> Battle<'own, 'library> {
|
||||
}
|
||||
}
|
||||
let number_of_hits = executing_move.number_of_hits();
|
||||
if number_of_hits == 0 {
|
||||
script_hook!(on_move_miss, target, executing_move, target);
|
||||
self.event_hook().trigger(Event::Miss {
|
||||
user: executing_move.user().deref(),
|
||||
});
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
let target_hit_stat = executing_move.get_index_of_target(target)?;
|
||||
for hit_index in 0..number_of_hits {
|
||||
@@ -252,6 +245,23 @@ impl<'own, 'library> Battle<'own, 'library> {
|
||||
);
|
||||
hit_data.set_damage(damage);
|
||||
|
||||
let mut accuracy = executing_move.use_move().accuracy();
|
||||
script_hook!(
|
||||
change_accuracy,
|
||||
executing_move,
|
||||
executing_move,
|
||||
target,
|
||||
hit_index,
|
||||
&mut accuracy
|
||||
);
|
||||
if accuracy < 100 && self.random().get_max(100) as u8 >= accuracy {
|
||||
script_hook!(on_move_miss, target, executing_move, target);
|
||||
self.event_hook().trigger(Event::Miss {
|
||||
user: executing_move.user().deref(),
|
||||
});
|
||||
break;
|
||||
}
|
||||
|
||||
if used_move.category() == MoveCategory::Status {
|
||||
if let Some(secondary_effect) = used_move.secondary_effect() {
|
||||
let secondary_effect_chance = secondary_effect.chance();
|
||||
@@ -316,6 +326,13 @@ impl<'own, 'library> Battle<'own, 'library> {
|
||||
}
|
||||
}
|
||||
|
||||
if number_of_hits == 0 {
|
||||
script_hook!(on_move_miss, target, executing_move, target);
|
||||
self.event_hook().trigger(Event::Miss {
|
||||
user: executing_move.user().deref(),
|
||||
});
|
||||
}
|
||||
|
||||
if !executing_move.user().is_fainted() {
|
||||
script_hook!(on_after_hits, executing_move, executing_move, target);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user