#include <battle_script.h>

.align 2
.thumb
.text

.global bs_close_combat
bs_close_combat:
    attackcanceler
    accuracycheck 0x081D695E 0
    attackstring
    ppreduce
    calculatedamage
    attackanimation
    waitanimation
    missmessage
    cmd5c 0
    waitstate
    graphicalhpupdate 0
    datahpupdate 0
    critmessage
    waitmessage 0x40
    resultmessage
    waitmessage 0x40
    faintpokemon 0 0 0
    callasm close_combat_choose_script+1

bs_lower_def:
    setbyte 0x02023FDF 0
    playstatchangeanimation 1 0x20 1
    setbyte 0x02023FDE 0x95
    statbuffchange 0x41 0x081D694E
    jumpifbyte 0 0x02023FDE 0x2 0x081D694E
    printfromtable 0x083FE588
    waitmessage 0x40
    goto 0x081D694E

bs_lower_sdef:
    setbyte 0x2023FDF 0x0
    playstatchangeanimation 0x1 0x4 0x1
    setbyte 0x2023FDE 0x92
    statbuffchange 0x41 0x081D694E
    jumpifbyte 0x0 0x02023FDE 0x2 0x081D694E
    printfromtable 0x83FE588
    waitmessage 0x40
    goto 0x081D694E

bs_lower_both:
    setbyte 0x2023FDF 0x0
    playstatchangeanimation 0x1 0x24 0x1
    setbyte 0x2023FDE 0x92
    statbuffchange 0x41 0x081D694E
    jumpifbyte 0x0 0x02023FDE 0x2 0x081D694E
    printfromtable 0x83FE588
    waitmessage 0x40
    setbyte 0x2023FDE 0x95
    statbuffchange 0x41 0x081D694E
    jumpifbyte 0x0 0x02023FDE 0x2 0x081D694E
    printfromtable 0x83FE588
    waitmessage 0x40
    goto 0x081D694E

.global bs_cc_lower_def
bs_cc_lower_def:
    .word bs_lower_def

.global bs_cc_lower_sdef
bs_cc_lower_sdef:
    .word bs_lower_sdef

.global bs_cc_lower_both
bs_cc_lower_both:
    .word bs_lower_both

.global as_close_combat
as_close_combat:
    .byte 0x14, 0x09, 0x17, 0x03, 0x2D, 0xB8, 0x0B, 0x08, 0x05, 0x04, 0x00, 0xF7, 0x00, 0x00, 0x01, 0x00
    .byte 0xFF, 0xFF, 0x00, 0x97, 0x27, 0x00, 0x9F, 0x27, 0x0A, 0x03, 0x0C, 0x0C, 0x08, 0x03, 0x7D, 0x90
    .byte 0x09, 0x08, 0x02, 0x05, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x04, 0x04
    .byte 0x02, 0x08, 0x7C, 0x3E, 0x08, 0x02, 0x04, 0xF1, 0xFF, 0x12, 0x00, 0x01, 0x00, 0x00, 0x00, 0x19
    .byte 0x74, 0x00, 0x3F, 0x04, 0x01, 0x03, 0xF9, 0x89, 0x09, 0x08, 0x02, 0x05, 0x01, 0x00, 0x05, 0x00
    .byte 0x00, 0x00, 0x19, 0x00, 0x01, 0x00, 0x02, 0x10, 0x67, 0x3E, 0x08, 0x03, 0x05, 0xF1, 0xFF, 0x12
    .byte 0x00, 0x08, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x03, 0x02, 0x08, 0x7C, 0x3E, 0x08, 0x02, 0x04
    .byte 0x00, 0x00, 0xFC, 0xFF, 0x01, 0x00, 0x00, 0x00, 0x19, 0x74, 0x00, 0x3F, 0x04, 0x01, 0x02, 0x10
    .byte 0x67, 0x3E, 0x08, 0x03, 0x05, 0x00, 0x00, 0xFC, 0xFF, 0x08, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04
    .byte 0x03, 0x02, 0x08, 0x7C, 0x3E, 0x08, 0x02, 0x04, 0x0F, 0x00, 0x09, 0x00, 0x01, 0x00, 0x00, 0x00
    .byte 0x19, 0x74, 0x00, 0x3F, 0x04, 0x01, 0x02, 0x10, 0x67, 0x3E, 0x08, 0x03, 0x05, 0x0F, 0x00, 0x09
    .byte 0x00, 0x08, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x05, 0x02, 0x84, 0x4E, 0x3D, 0x08, 0x02, 0x03
    .byte 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x0B, 0x03, 0x0D, 0x0E, 0xC7, 0x59, 0x1D, 0x08, 0x08

