Implements every script function
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2022-08-27 18:04:56 +02:00
parent bd62c1ac62
commit ba5992e925
19 changed files with 919 additions and 158 deletions

View File

@@ -92,8 +92,8 @@ impl Battle {
/// Executes a move choice.
fn execute_move_choice<'func>(&'func self, choice: &'func TurnChoice) -> PkmnResult<()> {
let choice = choice.get_move_turn_data();
let used_move = choice.used_move();
let move_choice = choice.get_move_turn_data();
let used_move = move_choice.used_move();
let move_data = {
let move_data_lock = used_move;
let move_data = move_data_lock.move_data();
@@ -103,7 +103,7 @@ impl Battle {
};
// FIXME: also change the script on the choice if changed;
let target_type = move_data.target();
let targets = resolve_targets(choice.target_side(), choice.target_index(), target_type, self);
let targets = resolve_targets(move_choice.target_side(), move_choice.target_index(), target_type, self);
let mut number_of_hits: u8 = 1;
script_hook!(change_number_of_hits, choice, choice, &mut number_of_hits);
@@ -116,7 +116,7 @@ impl Battle {
choice.user().clone(),
used_move.clone(),
move_data.clone(),
choice.script().clone(),
move_choice.script().clone(),
);
let mut prevented = false;
script_hook!(prevent_move, executing_move, &executing_move, &mut prevented);