// File: Matteo-Grellier[P]RPG/Menu.cpp
// Function: Menu::isEndOfCombat()
bool Menu::isEndOfCombat(){

    int deadGoodGuys = 0;
    int deadMonsters = 0;
    string awnser = "none";

    for (Character* c : Character::charactersList) { //for every characters
        
        if(c->getCurrentHp() <= 0 && c->getJob() != 7) {
            deadGoodGuys++;

        } else if(c->getCurrentHp() <= 0 && c->getJob() == 7) {
            deadMonsters++;

        }

        if (deadMonsters == 3) {
            end("win");
            return true;

        } else if (deadGoodGuys == 3) {
            end("defeat");
            return true;
        }

    }

    return false;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xe0, %rsp
movl $0x0, -0x8(%rbp)
movl $0x0, -0xc(%rbp)
leaq -0x31(%rbp), %rdi
movq %rdi, -0xc0(%rbp)
callq 0x33a0
movq -0xc0(%rbp), %rdx
leaq 0x4bfb(%rip), %rsi      # 0xe602
leaq -0x30(%rbp), %rdi
callq 0x4500
jmp 0x9a12
leaq -0x31(%rbp), %rdi
callq 0x3280
leaq 0xa826(%rip), %rax      # 0x14248
movq %rax, -0x50(%rbp)
leaq 0xa81b(%rip), %rdi      # 0x14248
callq 0x6e60
movq %rax, -0x58(%rbp)
leaq 0xa80b(%rip), %rdi      # 0x14248
callq 0x6cb0
movq %rax, -0x60(%rbp)
leaq -0x58(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x8ce0
testb $0x1, %al
jne 0x9a5c
jmp 0x9c7b
leaq -0x58(%rbp), %rdi
callq 0x7240
movq (%rax), %rax
movq %rax, -0x68(%rbp)
movq -0x68(%rbp), %rdi
callq 0x5da0
movl %eax, -0xc4(%rbp)
jmp 0x9a7d
movl -0xc4(%rbp), %eax
cmpl $0x0, %eax
jg 0x9ada
movq -0x68(%rbp), %rdi
callq 0x64e0
movl %eax, -0xc8(%rbp)
jmp 0x9a99
movl -0xc8(%rbp), %eax
cmpl $0x7, %eax
je 0x9ada
movl -0x8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8(%rbp)
jmp 0x9b1d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x31(%rbp), %rdi
callq 0x3280
jmp 0x9ca9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x9ca0
movq -0x68(%rbp), %rdi
callq 0x5da0
movl %eax, -0xcc(%rbp)
jmp 0x9aeb
movl -0xcc(%rbp), %eax
cmpl $0x0, %eax
jg 0x9b1b
movq -0x68(%rbp), %rdi
callq 0x64e0
movl %eax, -0xd0(%rbp)
jmp 0x9b07
movl -0xd0(%rbp), %eax
cmpl $0x7, %eax
jne 0x9b1b
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x9b1d
cmpl $0x3, -0xc(%rbp)
jne 0x9bc6
leaq -0x89(%rbp), %rdi
movq %rdi, -0xd8(%rbp)
callq 0x33a0
movq -0xd8(%rbp), %rdx
leaq 0x4abf(%rip), %rsi      # 0xe607
leaq -0x88(%rbp), %rdi
callq 0x4500
jmp 0x9b56
leaq -0x88(%rbp), %rdi
callq 0xa780
jmp 0x9b64
leaq -0x88(%rbp), %rdi
callq 0x3418
leaq -0x89(%rbp), %rdi
callq 0x3280
movb $0x1, -0x1(%rbp)
movl $0x1, -0x90(%rbp)
jmp 0x9c89
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x9bb5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x88(%rbp), %rdi
callq 0x3418
leaq -0x89(%rbp), %rdi
callq 0x3280
jmp 0x9ca0
cmpl $0x3, -0x8(%rbp)
jne 0x9c69
leaq -0xb1(%rbp), %rdi
movq %rdi, -0xe0(%rbp)
callq 0x33a0
movq -0xe0(%rbp), %rdx
leaq 0x4a1a(%rip), %rsi      # 0xe60b
leaq -0xb0(%rbp), %rdi
callq 0x4500
jmp 0x9bff
leaq -0xb0(%rbp), %rdi
callq 0xa780
jmp 0x9c0d
leaq -0xb0(%rbp), %rdi
callq 0x3418
leaq -0xb1(%rbp), %rdi
callq 0x3280
movb $0x1, -0x1(%rbp)
movl $0x1, -0x90(%rbp)
jmp 0x9c89
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x9c5b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0xb0(%rbp), %rdi
callq 0x3418
leaq -0xb1(%rbp), %rdi
callq 0x3280
jmp 0x9ca0
jmp 0x9c6b
jmp 0x9c6d
leaq -0x58(%rbp), %rdi
callq 0x8d20
jmp 0x9a46
movb $0x0, -0x1(%rbp)
movl $0x1, -0x90(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x3418
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0xe0, %rsp
popq %rbp
retq
leaq -0x30(%rbp), %rdi
callq 0x3418
movq -0x40(%rbp), %rdi
callq 0x3390
nopw %cs:(%rax,%rax)