#include "macros/btlcmd.inc"


_000:
    PrintAttackMessage 
    Wait 
    CheckAbility CHECK_HAVE, BTLSCR_ATTACKER, ABILITY_INSOMNIA, _098
    CheckAbility CHECK_HAVE, BTLSCR_ATTACKER, ABILITY_VITAL_SPIRIT, _098
    CompareMonDataToValue OPCODE_FLAG_SET, BTLSCR_ATTACKER, BATTLEMON_STATUS, MON_CONDITION_SLEEP, _107
    CheckAbility CHECK_HAVE, BTLSCR_ATTACKER, ABILITY_SOUNDPROOF, _027
    CompareVarToValue OPCODE_FLAG_SET, BTLVAR_FIELD_CONDITIONS, FIELD_CONDITION_UPROAR, _115

_027:
    UpdateMonDataFromVar OPCODE_GET, BTLSCR_ATTACKER, BATTLEMON_MAX_HP, BTLVAR_HP_CALC_TEMP
    CompareMonDataToVar OPCODE_EQU, BTLSCR_ATTACKER, BATTLEMON_CUR_HP, BTLVAR_HP_CALC_TEMP, _137
    PlayMoveAnimation BTLSCR_ATTACKER
    Wait 
    CompareMonDataToValue OPCODE_FLAG_SET, BTLSCR_ATTACKER, BATTLEMON_STATUS, MON_CONDITION_NOT_SLEEP, _053
    // {0} went to sleep!
    PrintMessage pl_msg_00000368_00205, TAG_NICKNAME, BTLSCR_ATTACKER
    GoTo _065

_053:
    SetHealthbarStatus BTLSCR_ATTACKER, BATTLE_ANIMATION_NONE
    UpdateMonData OPCODE_FLAG_OFF, BTLSCR_ATTACKER, BATTLEMON_STATUS, MON_CONDITION_NOT_SLEEP
    // {0} slept and became healthy!
    PrintMessage pl_msg_00000368_00208, TAG_NICKNAME, BTLSCR_ATTACKER

_065:
    Wait 
    WaitButtonABTime 30
    UpdateMonData OPCODE_FLAG_ON, BTLSCR_ATTACKER, BATTLEMON_STATUS, MON_CONDITION_SLEEP_0|MON_CONDITION_SLEEP_1
    SetHealthbarStatus BTLSCR_ATTACKER, BATTLE_ANIMATION_ASLEEP
    UpdateVarFromVar OPCODE_SET, BTLVAR_MSG_BATTLER_TEMP, BTLVAR_ATTACKER
    UpdateVar OPCODE_FLAG_ON, BTLVAR_BATTLE_CTX_STATUS, SYSCTL_SKIP_SPRITE_BLINK
    Call BATTLE_SUBSCRIPT_UPDATE_HP
    CompareMonDataToValue OPCODE_FLAG_SET, BTLSCR_ATTACKER, BATTLEMON_STATUS, MON_CONDITION_NOT_SLEEP, _053
    // {0} regained health!
    PrintMessage pl_msg_00000368_00184, TAG_NICKNAME, BTLSCR_ATTACKER
    GoTo _147

_098:
    WaitButtonABTime 30
    // {0} stayed awake because of its {1}!
    PrintMessage pl_msg_00000368_00329, TAG_NICKNAME_ABILITY, BTLSCR_ATTACKER, BTLSCR_ATTACKER
    GoTo _143

_107:
    WaitButtonABTime 30
    // {0} is already asleep!
    PrintMessage pl_msg_00000368_00057, TAG_NICKNAME, BTLSCR_ATTACKER
    GoTo _143

_115:
    CompareMonDataToValue OPCODE_FLAG_SET, BTLSCR_ATTACKER, BATTLEMON_VOLATILE_STATUS, VOLATILE_CONDITION_UPROAR, _129
    WaitButtonABTime 30
    // But the uproar kept {0} awake!
    PrintMessage pl_msg_00000368_00326, TAG_NICKNAME, BTLSCR_ATTACKER
    GoTo _143

_129:
    WaitButtonABTime 30
    // But {0} can’t sleep in an uproar!
    PrintMessage pl_msg_00000368_00323, TAG_NICKNAME, BTLSCR_ATTACKER
    GoTo _143

_137:
    WaitButtonABTime 30
    // {0}’s HP is full!
    PrintMessage pl_msg_00000368_00187, TAG_NICKNAME, BTLSCR_ATTACKER

_143:
    UpdateVar OPCODE_FLAG_ON, BTLVAR_MOVE_STATUS_FLAGS, MOVE_STATUS_NO_MORE_WORK

_147:
    Wait 
    WaitButtonABTime 30
    End 
