Support for errors from scripts through separate script error handling.
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -119,7 +119,7 @@ fn validate_assurance() {
|
||||
|
||||
let mv = p1.learned_moves().read()[0].as_ref().unwrap().clone();
|
||||
let choice = TurnChoice::Move(MoveChoice::new(p1.clone(), mv.clone(), 1, 0));
|
||||
script.on_before_turn(&choice);
|
||||
script.on_before_turn(&choice).unwrap();
|
||||
assert!(battle.sides()[1].has_volatile_script(&"assurance_data".into()));
|
||||
|
||||
let executing_move = ExecutingMove::new(
|
||||
@@ -131,19 +131,19 @@ fn validate_assurance() {
|
||||
ScriptContainer::default(),
|
||||
);
|
||||
let mut v = 20_u8;
|
||||
script.change_base_power(&executing_move, &p2, 0, &mut v);
|
||||
script.change_base_power(&executing_move, &p2, 0, &mut v).unwrap();
|
||||
assert_eq!(v, 20_u8);
|
||||
|
||||
let s = battle.sides()[1].get_volatile_script(&"assurance_data".into());
|
||||
let binding = s.as_ref().unwrap().get().unwrap().read();
|
||||
let data_script = binding.as_ref().unwrap();
|
||||
|
||||
data_script.on_damage(&p2, DamageSource::Misc, 100, 50);
|
||||
data_script.on_damage(&p2, DamageSource::Misc, 100, 50).unwrap();
|
||||
|
||||
let mut v = 20_u8;
|
||||
script.change_base_power(&executing_move, &p2, 0, &mut v);
|
||||
script.change_base_power(&executing_move, &p2, 0, &mut v).unwrap();
|
||||
assert_eq!(v, 40_u8);
|
||||
|
||||
data_script.on_end_turn();
|
||||
data_script.on_end_turn().unwrap();
|
||||
assert!(!battle.sides()[1].has_volatile_script(&"assurance_data".into()));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user