// File: kongrigoriou[P]Text-Based-RPG/src/Heroes.cpp
// Function: Hero::usePotion(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void Hero::usePotion(string potion_name){

    int flag = 0;
    list<Potion*> :: iterator pt;
    for(pt = Potions.begin(); pt != Potions.end(); ++pt){

        if( (*pt)->get_name() == potion_name) {
            flag = 1;
            break;
        }
    }

    if(flag == 1){
        if( (*pt)->get_statname() == "MagicPower"){

            MagicPower += (*pt)->get_buff();

        }else if( (*pt)->get_statname() == "HealthPower"){

            HealthPower = HealthPower + (*pt)->get_buff()*HealthPower/100;


        }else if((*pt)->get_statname() == "Strength"){

            Strength = Strength + (*pt)->get_buff()*Strength/100;


        }else if((*pt)->get_statname() == "Agility"){

            Agility = Agility + (*pt)->get_buff()*Agility/100;


        }else if((*pt)->get_statname() == "Dexterity"){

            Dexterity = Dexterity + (*pt)->get_buff()*Dexterity/100;

        }
        Potions.remove(*pt);

    }else{

         cout << "You dont have that potion in your inventory" << endl;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x170, %rsp            # imm = 0x170
movq %rsi, -0x110(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x108(%rbp)
movl $0x0, -0x14(%rbp)
leaq -0x20(%rbp), %rdi
callq 0x7b10
movq -0x108(%rbp), %rdi
addq $0xb0, %rdi
callq 0x7cf0
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x108(%rbp), %rdi
addq $0xb0, %rdi
callq 0x7d50
movq %rax, -0x30(%rbp)
leaq -0x20(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x7d20
testb $0x1, %al
jne 0x69ae
jmp 0x6a04
leaq -0x20(%rbp), %rdi
callq 0x7d80
movq (%rax), %rsi
leaq -0x50(%rbp), %rdi
callq 0x12640
movq -0x110(%rbp), %rsi
leaq -0x50(%rbp), %rdi
callq 0x7eb0
movb %al, -0x111(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x3120
movb -0x111(%rbp), %al
testb $0x1, %al
jne 0x69ee
jmp 0x69f7
movl $0x1, -0x14(%rbp)
jmp 0x6a04
jmp 0x69f9
leaq -0x20(%rbp), %rdi
callq 0x7da0
jmp 0x6984
cmpl $0x1, -0x14(%rbp)
jne 0x6dbe
leaq -0x20(%rbp), %rdi
callq 0x7d80
movq (%rax), %rsi
leaq -0x70(%rbp), %rdi
movq %rdi, -0x120(%rbp)
callq 0x12cd0
movq -0x120(%rbp), %rdi
leaq 0xea39(%rip), %rsi      # 0x15471
callq 0x7f70
movb %al, -0x112(%rbp)
jmp 0x6a45
leaq -0x70(%rbp), %rdi
callq 0x3120
movb -0x112(%rbp), %al
testb $0x1, %al
jne 0x6a5a
jmp 0x6a9a
leaq -0x20(%rbp), %rdi
callq 0x7d80
movq (%rax), %rdi
movq (%rdi), %rax
callq *0x20(%rax)
movl %eax, %ecx
movq -0x108(%rbp), %rax
addl 0x34(%rax), %ecx
movl %ecx, 0x34(%rax)
jmp 0x6d90
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x3120
jmp 0x6de9
leaq -0x20(%rbp), %rdi
callq 0x7d80
movq (%rax), %rsi
leaq -0xa0(%rbp), %rdi
movq %rdi, -0x130(%rbp)
callq 0x12cd0
movq -0x130(%rbp), %rdi
leaq 0xe9b5(%rip), %rsi      # 0x1547c
callq 0x7f70
movb %al, -0x121(%rbp)
jmp 0x6ad4
leaq -0xa0(%rbp), %rdi
callq 0x3120
movb -0x121(%rbp), %al
testb $0x1, %al
jne 0x6aec
jmp 0x6b57
movq -0x108(%rbp), %rax
movl 0x2c(%rax), %eax
movl %eax, -0x134(%rbp)
leaq -0x20(%rbp), %rdi
callq 0x7d80
movq (%rax), %rdi
movq (%rdi), %rax
callq *0x20(%rax)
movl -0x134(%rbp), %ecx
movq -0x108(%rbp), %rdx
imull 0x2c(%rdx), %eax
movl $0x64, %esi
cltd
idivl %esi
movl %eax, %edx
movq -0x108(%rbp), %rax
addl %edx, %ecx
movl %ecx, 0x2c(%rax)
jmp 0x6d8e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
leaq -0xa0(%rbp), %rdi
callq 0x3120
jmp 0x6de9
leaq -0x20(%rbp), %rdi
callq 0x7d80
movq (%rax), %rsi
leaq -0xc0(%rbp), %rdi
movq %rdi, -0x140(%rbp)
callq 0x12cd0
movq -0x140(%rbp), %rdi
leaq 0xe904(%rip), %rsi      # 0x15488
callq 0x7f70
movb %al, -0x135(%rbp)
jmp 0x6b91
leaq -0xc0(%rbp), %rdi
callq 0x3120
movb -0x135(%rbp), %al
testb $0x1, %al
jne 0x6ba9
jmp 0x6c14
movq -0x108(%rbp), %rax
movl 0x38(%rax), %eax
movl %eax, -0x144(%rbp)
leaq -0x20(%rbp), %rdi
callq 0x7d80
movq (%rax), %rdi
movq (%rdi), %rax
callq *0x20(%rax)
movl -0x144(%rbp), %ecx
movq -0x108(%rbp), %rdx
imull 0x38(%rdx), %eax
movl $0x64, %esi
cltd
idivl %esi
movl %eax, %edx
movq -0x108(%rbp), %rax
addl %edx, %ecx
movl %ecx, 0x38(%rax)
jmp 0x6d8c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
leaq -0xc0(%rbp), %rdi
callq 0x3120
jmp 0x6de9
leaq -0x20(%rbp), %rdi
callq 0x7d80
movq (%rax), %rsi
leaq -0xe0(%rbp), %rdi
movq %rdi, -0x150(%rbp)
callq 0x12cd0
movq -0x150(%rbp), %rdi
leaq 0xe850(%rip), %rsi      # 0x15491
callq 0x7f70
movb %al, -0x145(%rbp)
jmp 0x6c4e
leaq -0xe0(%rbp), %rdi
callq 0x3120
movb -0x145(%rbp), %al
testb $0x1, %al
jne 0x6c66
jmp 0x6cd1
movq -0x108(%rbp), %rax
movl 0x3c(%rax), %eax
movl %eax, -0x154(%rbp)
leaq -0x20(%rbp), %rdi
callq 0x7d80
movq (%rax), %rdi
movq (%rdi), %rax
callq *0x20(%rax)
movl -0x154(%rbp), %ecx
movq -0x108(%rbp), %rdx
imull 0x3c(%rdx), %eax
movl $0x64, %esi
cltd
idivl %esi
movl %eax, %edx
movq -0x108(%rbp), %rax
addl %edx, %ecx
movl %ecx, 0x3c(%rax)
jmp 0x6d8a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
leaq -0xe0(%rbp), %rdi
callq 0x3120
jmp 0x6de9
leaq -0x20(%rbp), %rdi
callq 0x7d80
movq (%rax), %rsi
leaq -0x100(%rbp), %rdi
movq %rdi, -0x160(%rbp)
callq 0x12cd0
movq -0x160(%rbp), %rdi
leaq 0xe79b(%rip), %rsi      # 0x15499
callq 0x7f70
movb %al, -0x155(%rbp)
jmp 0x6d0b
leaq -0x100(%rbp), %rdi
callq 0x3120
movb -0x155(%rbp), %al
testb $0x1, %al
jne 0x6d23
jmp 0x6d88
movq -0x108(%rbp), %rax
movl 0x40(%rax), %eax
movl %eax, -0x164(%rbp)
leaq -0x20(%rbp), %rdi
callq 0x7d80
movq (%rax), %rdi
movq (%rdi), %rax
callq *0x20(%rax)
movl -0x164(%rbp), %ecx
movq -0x108(%rbp), %rdx
imull 0x40(%rdx), %eax
movl $0x64, %esi
cltd
idivl %esi
movl %eax, %edx
movq -0x108(%rbp), %rax
addl %edx, %ecx
movl %ecx, 0x40(%rax)
jmp 0x6d88
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
leaq -0x100(%rbp), %rdi
callq 0x3120
jmp 0x6de9
jmp 0x6d8a
jmp 0x6d8c
jmp 0x6d8e
jmp 0x6d90
movq -0x108(%rbp), %rax
addq $0xb0, %rax
movq %rax, -0x170(%rbp)
leaq -0x20(%rbp), %rdi
callq 0x7d80
movq -0x170(%rbp), %rdi
movq %rax, %rsi
callq 0x7910
jmp 0x6de0
movq 0x1820b(%rip), %rdi     # 0x1efd0
leaq 0xe6d7(%rip), %rsi      # 0x154a3
callq 0x31e0
movq %rax, %rdi
movq 0x181e5(%rip), %rsi     # 0x1efc0
callq 0x3210
addq $0x170, %rsp            # imm = 0x170
popq %rbp
retq
movq -0x78(%rbp), %rdi
callq 0x3330
nopw %cs:(%rax,%rax)