diff --git a/crates/logic/src/battle/logic_simulation.rs b/crates/logic/src/battle/logic_simulation.rs index 3618164..9155231 100644 --- a/crates/logic/src/battle/logic_simulation.rs +++ b/crates/logic/src/battle/logic_simulation.rs @@ -90,11 +90,11 @@ pub fn integer_sqrt(value: i64) -> i64 { if value <= 0 { return 0; } - let mut root = value.min(46340); - let mut previous = 0; - while root != previous { - previous = root; - root = (root + value / root) / 2; + let mut root = value; + let mut next = (root + 1) / 2; + while next < root { + root = next; + next = (root + value / root) / 2; } root }