More documentation for script hooks, reworks stat changes to only be changeable through a function that allows for script hooks, and events.
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2022-06-27 18:26:27 +02:00
parent 1c9edd4d9c
commit cf4d74d898
5 changed files with 119 additions and 9 deletions

View File

@@ -43,7 +43,7 @@ impl Gen7BattleStatCalculator {
/// This functions returns the modifier we need to do to a stat for a given stat boost.
fn get_stat_boost_modifier(&self, pokemon: &Pokemon, stat: Statistic) -> f32 {
let boost = pokemon.stat_boost().get_stat(stat);
let boost = pokemon.stat_boost(stat);
match boost {
-6 => 2.0 / 8.0,
-5 => 2.0 / 7.0,

View File

@@ -191,8 +191,7 @@ impl DamageLibrary for Gen7DamageLibrary {
offensive_stat = Statistic::SpecialAttack;
defensive_stat = Statistic::SpecialDefense;
}
let mut bypass_defensive_stat_boost =
hit_data.is_critical() && target.stat_boost().get_stat(defensive_stat) > 0;
let mut bypass_defensive_stat_boost = hit_data.is_critical() && target.stat_boost(defensive_stat) > 0;
script_hook!(
bypass_defensive_stat_boost,
executing_move,
@@ -201,7 +200,7 @@ impl DamageLibrary for Gen7DamageLibrary {
hit_number,
&mut bypass_defensive_stat_boost
);
let mut bypass_offensive_stat_boost = hit_data.is_critical() && user.stat_boost().get_stat(offensive_stat) > 0;
let mut bypass_offensive_stat_boost = hit_data.is_critical() && user.stat_boost(offensive_stat) > 0;
script_hook!(
bypass_offensive_stat_boost,
executing_move,