First chunk of battling is now fully working, along with integration tests! 🎉
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
@@ -83,7 +83,11 @@ impl<'own, 'library> Battle<'own, 'library> {
|
||||
return Ok(());
|
||||
}
|
||||
match choice_guard.deref() {
|
||||
TurnChoice::Move(..) => self.execute_move_choice(&choice)?,
|
||||
TurnChoice::Move(..) => {
|
||||
drop(user);
|
||||
drop(choice_guard);
|
||||
self.execute_move_choice(&choice)?
|
||||
}
|
||||
TurnChoice::Item(_) => {}
|
||||
TurnChoice::Switch(_) => {}
|
||||
TurnChoice::Flee(_) => {}
|
||||
@@ -100,13 +104,12 @@ impl<'own, 'library> Battle<'own, 'library> {
|
||||
let choice = write_guard.get_move_turn_data();
|
||||
let used_move = choice.used_move();
|
||||
let move_data_lock = used_move.read();
|
||||
let mut move_data = move_data_lock.move_data();
|
||||
let move_data = move_data_lock.move_data();
|
||||
let mut move_name = move_data.name().clone();
|
||||
script_hook!(change_move, choice, choice, &mut move_name);
|
||||
if move_name != *move_data.name() {
|
||||
move_data = self.library().static_data().moves().get(&move_name).unwrap();
|
||||
// FIXME: also change the script on the choice.
|
||||
}
|
||||
let move_data = self.library().static_data().moves().get(&move_name).unwrap();
|
||||
drop(move_data_lock);
|
||||
// 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);
|
||||
|
||||
@@ -154,8 +157,8 @@ impl<'own, 'library> Battle<'own, 'library> {
|
||||
|
||||
fn handle_move_for_target(
|
||||
&self,
|
||||
executing_move: &mut ExecutingMove<'_, 'own, '_>,
|
||||
target: &Arc<RwLock<Pokemon<'own, '_>>>,
|
||||
executing_move: &mut ExecutingMove<'_, 'own, 'library>,
|
||||
target: &Arc<RwLock<Pokemon<'own, 'library>>>,
|
||||
) -> PkmnResult<()> {
|
||||
{
|
||||
let mut fail = false;
|
||||
|
||||
Reference in New Issue
Block a user