diff --git a/PkmnLib.Dynamic/BattleFlow/TurnRunner.cs b/PkmnLib.Dynamic/BattleFlow/TurnRunner.cs
index 4f3e07b..f8f5a4c 100644
--- a/PkmnLib.Dynamic/BattleFlow/TurnRunner.cs
+++ b/PkmnLib.Dynamic/BattleFlow/TurnRunner.cs
@@ -162,10 +162,14 @@ public static class TurnRunner
}
if (!battle.Library.MiscLibrary.CanFlee(battle, fleeChoice))
+ {
+ battle.EventHook.Invoke(new FleeEvent(user, false));
return;
+ }
var userSide = battle.Sides[battleData.SideIndex];
userSide.MarkAsFled();
+ battle.EventHook.Invoke(new FleeEvent(user, true));
battle.ValidateBattleState();
}
diff --git a/PkmnLib.Dynamic/Events/FleeEvent.cs b/PkmnLib.Dynamic/Events/FleeEvent.cs
new file mode 100644
index 0000000..2a82cad
--- /dev/null
+++ b/PkmnLib.Dynamic/Events/FleeEvent.cs
@@ -0,0 +1,29 @@
+using PkmnLib.Dynamic.Models;
+
+namespace PkmnLib.Dynamic.Events;
+
+///
+/// Event data for when a Pokémon attempts to flee from battle. Indicates which Pokémon attempted to flee and whether the attempt was successful.
+///
+public class FleeEvent : IEventData
+{
+ ///
+ public FleeEvent(IPokemon pokemon, bool success)
+ {
+ Pokemon = pokemon;
+ Success = success;
+ }
+
+ ///
+ /// The Pokémon that attempted to flee.
+ ///
+ public IPokemon Pokemon { get; }
+
+ ///
+ /// Indicates whether the flee attempt was successful.
+ ///
+ public bool Success { get; }
+
+ ///
+ public EventBatchId BatchId { get; init; }
+}
\ No newline at end of file
diff --git a/Plugins/PkmnLib.Plugin.Gen7/Libraries/Battling/Gen7MiscLibrary.cs b/Plugins/PkmnLib.Plugin.Gen7/Libraries/Battling/Gen7MiscLibrary.cs
index c9314f5..11c043e 100644
--- a/Plugins/PkmnLib.Plugin.Gen7/Libraries/Battling/Gen7MiscLibrary.cs
+++ b/Plugins/PkmnLib.Plugin.Gen7/Libraries/Battling/Gen7MiscLibrary.cs
@@ -55,8 +55,8 @@ public class Gen7MiscLibrary : IMiscLibrary
var userSide = battle.Sides[battleData.SideIndex];
userSide.RegisterFleeAttempt();
- var fleeChance = (userSpeed * 32 / (opponentSpeed / 4) + 30 * userSide.FleeAttempts) / 256;
- var random = battle.Random.GetInt(0, 100);
+ var fleeChance = userSpeed * 32 / (opponentSpeed / 4) + 30 * userSide.FleeAttempts;
+ var random = battle.Random.GetInt(0, 256);
return random < fleeChance;
}
}
\ No newline at end of file