{
    name: "Last Stand",
    rating: 4.5,
    num: -356005,
    
    
    onTryBoost(boost, target, source, effect) {
        if (effect.name === "Intimidate" && boost.atk) {
            delete boost.atk;
            this.add("-fail", target, "unboost", "Attack", "[from] ability: Last Stand", "[of] " + target);
            return false;
        }
    },
    
    
    onBasePowerPriority: 21,
    onBasePower(basePower, attacker, defender, move) {
        if (move.category === "Status") return;
        
        const hpPercent = attacker.hp / attacker.maxhp;
        const damageModifier = 1.0 + (1.0 - hpPercent); 
        
        
        const finalModifier = Math.min(damageModifier, 2.0);
        
        if (finalModifier > 1.0) {
            this.debug(`Last Stand damage boost: ${finalModifier.toFixed(2)}x`);
            return this.chainModify(finalModifier);
        }
    }, 
    onStart(pokemon) {
        this.add('-ability', pokemon, 'Last Stand');
    },
    
    
    onDamage(damage, target, source, effect) {
        const hpPercent = target.hp / target.maxhp;
        
        
        if (hpPercent <= 0.25 && hpPercent > 0) {
            this.add('-activate', target, 'ability: Last Stand', '[low HP]');
        }
    }
}