Skip to content

Commit

Permalink
check no_finishing_hit
Browse files Browse the repository at this point in the history
  • Loading branch information
SuddyN committed Mar 23, 2024
1 parent 8832e2e commit fb8a684
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions utils/src/modules/meter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -496,13 +496,28 @@ const COUNTER: i32 = 0x01FE;
const NUM_ANGLE_CHECK: i32 = 10;
const NUM_FALSE_ANGLES_ALLOWED: i32 = 1;

unsafe extern "C" fn is_no_finishing_hit(attacker_boma: &mut BattleObjectModuleAccessor) -> bool {
for is_abs in [false, true] {
for id in 0..8 {
let attack_data = AttackModule::attack_data(attacker_boma, id, is_abs);
let off = if is_abs { 0xd9 } else { 0xc9 };
if AttackModule::is_attack(attacker_boma, id, is_abs)
&& *attack_data.cast::<bool>().add(off) {
return true;
}
}
}
return false;
}

unsafe extern "C" fn is_potential_finishing_hit(defender_boma: &mut BattleObjectModuleAccessor, attacker_boma: &mut BattleObjectModuleAccessor) -> bool {
if !defender_boma.is_fighter() { return false; }
if !attacker_boma.is_fighter() && !attacker_boma.is_weapon() { return false; }
if VarModule::get_int(defender_boma.object(), COUNTER) > 0 {
println!("no effects because COUNTER: {}", VarModule::get_int(defender_boma.object(), COUNTER));
return false;
}
if is_no_finishing_hit(attacker_boma) { return false; }
if !is_training_mode() {
// ensure kill calculations only occur when the defender is on their last stock
let entry_id = WorkModule::get_int(defender_boma, *FIGHTER_INSTANCE_WORK_ID_INT_ENTRY_ID);
Expand Down

0 comments on commit fb8a684

Please sign in to comment.