#include "macros/btlcmd.inc"


_000:
    PrintAttackMessage 
    Wait 
    CompareMonDataToValue OPCODE_EQU, BTLSCR_ATTACKER, BATTLEMON_STOCKPILE_COUNT, 3, _077
    PlayMoveAnimation BTLSCR_ATTACKER
    Wait 
    UpdateVar OPCODE_FLAG_ON, BTLVAR_BATTLE_CTX_STATUS, SYSCTL_PLAYED_MOVE_ANIMATION
    UpdateMonData OPCODE_ADD, BTLSCR_ATTACKER, BATTLEMON_STOCKPILE_COUNT, 1
    UpdateMonDataFromVar OPCODE_GET, BTLSCR_ATTACKER, BATTLEMON_STOCKPILE_COUNT, BTLVAR_MSG_TEMP
    // {0} stockpiled {1}!
    PrintMessage pl_msg_00000368_00317, TAG_NICKNAME_NUM, BTLSCR_ATTACKER, BTLSCR_MSG_TEMP
    Wait 
    WaitButtonABTime 30
    UpdateVar OPCODE_FLAG_ON, BTLVAR_BATTLE_CTX_STATUS_2, SYSCTL_STAT_STAGE_CHANGE_SHOWN
    UpdateVar OPCODE_SET, BTLVAR_SIDE_EFFECT_PARAM, MOVE_SUBSCRIPT_PTR_DEFENSE_UP_1_STAGE
    Call BATTLE_SUBSCRIPT_UPDATE_STAT_STAGE
    CompareVarToValue OPCODE_FLAG_SET, BTLVAR_BATTLE_CTX_STATUS, SYSCTL_FAIL_STAT_STAGE_CHANGE, _052
    UpdateMonData OPCODE_ADD, BTLSCR_ATTACKER, BATTLEMON_STOCKPILE_DEF_BOOSTS, 1

_052:
    UpdateVar OPCODE_SET, BTLVAR_SIDE_EFFECT_PARAM, MOVE_SUBSCRIPT_PTR_SP_DEFENSE_UP_1_STAGE
    Call BATTLE_SUBSCRIPT_UPDATE_STAT_STAGE
    CompareVarToValue OPCODE_FLAG_SET, BTLVAR_BATTLE_CTX_STATUS, SYSCTL_FAIL_STAT_STAGE_CHANGE, _068
    UpdateMonData OPCODE_ADD, BTLSCR_ATTACKER, BATTLEMON_STOCKPILE_SPDEF_BOOSTS, 1

_068:
    UpdateVar OPCODE_FLAG_OFF, BTLVAR_BATTLE_CTX_STATUS_2, SYSCTL_UPDATE_STAT_STAGES
    UpdateVar OPCODE_FLAG_OFF, BTLVAR_BATTLE_CTX_STATUS_2, SYSCTL_STAT_STAGE_CHANGE_SHOWN
    End 

_077:
    WaitButtonABTime 30
    // {0} can’t stockpile any more!
    PrintMessage pl_msg_00000368_00320, TAG_NICKNAME_NUM, BTLSCR_ATTACKER, BTLSCR_MSG_TEMP
    Wait 
    WaitButtonABTime 30
    UpdateVar OPCODE_FLAG_ON, BTLVAR_MOVE_STATUS_FLAGS, MOVE_STATUS_NO_MORE_WORK
    End 
