# Path: data/pokedex.py



import math
from data.pokedex import Pokedex
    return cur

def requiresOpponentItem(cur, _, defender):
    if not defender.item:
        return 0
    return cur

def targetStatusBoosted(cur, _, target):
    if target.condition or target.ability == "Comatose": return cur * 2
    return cur

def variableBasedOnHpPercentageRemaining(cur, attacker, _):
    hp, maxhp = map(int, attacker.condition.split('/'))
    return cur * (hp / maxhp)

def variableBasedOnHpRatioRemaining(cur, attacker, _):
    hp, maxhp = map(int, attacker.condition.split('/'))
    ratio = hp * 48 / maxhp
    if ratio < 2: return 200
    if ratio < 5: return 150
    if ratio < 10: return 100
    if ratio < 17: return 80
    if ratio < 33: return 40
    return 20

def doublesAgainstDynamax(cur, _, defender):
    return cur * 2 if defender.dynamaxed else cur

def doublesIfMovingFirst(cur, attacker, defender):
    # Approximation, but good enough

# Path: data/pokedex.py



# Path: plugins/battling/battleCallbacks.py
import math
from data.pokedex import Pokedex

    return cur

def requiresOpponentItem(cur, _, defender):
    if not defender.item:
        return 0
    return cur

def targetStatusBoosted(cur, _, target):
    if target.condition or target.ability == "Comatose": return cur * 2
    return cur

def variableBasedOnHpPercentageRemaining(cur, attacker, _):
    hp, maxhp = map(int, attacker.condition.split('/'))
    return cur * (hp / maxhp)

def variableBasedOnHpRatioRemaining(cur, attacker, _):
    hp, maxhp = map(int, attacker.condition.split('/'))
    ratio = hp * 48 / maxhp
    if ratio < 2: return 200
    if ratio < 5: return 150
    if ratio < 10: return 100
    if ratio < 17: return 80
    if ratio < 33: return 40
    return 20

def doublesAgainstDynamax(cur, _, defender):
    return cur * 2 if defender.dynamaxed else cur

def doublesIfMovingFirst(cur, attacker, defender):
    # Approximation, but good enough

    atkSpeed = Pokedex[getBaseSpecies(attacker.species)]['baseStats']['spe']