// File: /workspace/github_cpp_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %r12
movq %rdi, -0x30(%rbp)
leaq 0xb0(%rdi), %rbx
leaq -0x50(%rbp), %r13
movq %rbx, %r14
movq (%r14), %r14
cmpq %rbx, %r14
je 0x547d
movq 0x10(%r14), %rsi
movq %r13, %rdi
callq 0x9f40
movq %r13, %rdi
movq %r12, %rsi
callq 0x5ce4
movl %eax, %r15d
movq %r13, %rdi
callq 0x30e0
testb %r15b, %r15b
je 0x5406
movq 0x10(%r14), %rsi
addq $0x10, %r14
leaq -0x50(%rbp), %r15
movq %r15, %rdi
callq 0xa304
leaq 0x7021(%rip), %rsi      # 0xc471
movq %r15, %rdi
callq 0x5d10
movl %eax, %r12d
movq %r15, %rdi
callq 0x30e0
testb %r12b, %r12b
je 0x549d
movq (%r14), %rdi
movq (%rdi), %rax
callq *0x20(%rax)
movq -0x30(%rbp), %rcx
addl %eax, 0x34(%rcx)
jmp 0x55e9
movq 0xdb4c(%rip), %rdi      # 0x12fd0
leaq 0x7018(%rip), %rsi      # 0xc4a3
callq 0x31a0
movq %rax, %rdi
callq 0x30f0
jmp 0x55f4
movq (%r14), %rsi
movq %r15, %rdi
callq 0xa304
leaq 0x6fcd(%rip), %rsi      # 0xc47c
movq %r15, %rdi
callq 0x5d10
movl %eax, %r12d
movq %r15, %rdi
callq 0x30e0
testb %r12b, %r12b
je 0x54f2
movq -0x30(%rbp), %r12
movl 0x2c(%r12), %r15d
movq (%r14), %rdi
movq (%rdi), %rax
callq *0x20(%rax)
imull 0x2c(%r12), %eax
pushq $0x64
popq %rcx
cltd
idivl %ecx
addl %r15d, %eax
movl %eax, 0x2c(%r12)
jmp 0x55e9
movq (%r14), %rsi
movq %r15, %rdi
callq 0xa304
leaq 0x6f84(%rip), %rsi      # 0xc488
movq %r15, %rdi
callq 0x5d10
movl %eax, %r12d
movq %r15, %rdi
callq 0x30e0
testb %r12b, %r12b
je 0x5547
movq -0x30(%rbp), %r12
movl 0x38(%r12), %r15d
movq (%r14), %rdi
movq (%rdi), %rax
callq *0x20(%rax)
imull 0x38(%r12), %eax
pushq $0x64
popq %rcx
cltd
idivl %ecx
addl %r15d, %eax
movl %eax, 0x38(%r12)
jmp 0x55e9
movq (%r14), %rsi
movq %r15, %rdi
callq 0xa304
leaq 0x6f38(%rip), %rsi      # 0xc491
movq %r15, %rdi
callq 0x5d10
movl %eax, %r12d
movq %r15, %rdi
callq 0x30e0
testb %r12b, %r12b
je 0x5599
movq -0x30(%rbp), %r12
movl 0x3c(%r12), %r15d
movq (%r14), %rdi
movq (%rdi), %rax
callq *0x20(%rax)
imull 0x3c(%r12), %eax
pushq $0x64
popq %rcx
cltd
idivl %ecx
addl %r15d, %eax
movl %eax, 0x3c(%r12)
jmp 0x55e9
movq (%r14), %rsi
movq %r15, %rdi
callq 0xa304
leaq 0x6eee(%rip), %rsi      # 0xc499
movq %r15, %rdi
callq 0x5d10
movl %eax, %r12d
movq %r15, %rdi
callq 0x30e0
testb %r12b, %r12b
je 0x55e9
movq -0x30(%rbp), %r12
movl 0x40(%r12), %r15d
movq (%r14), %rdi
movq (%rdi), %rax
callq *0x20(%rax)
imull 0x40(%r12), %eax
pushq $0x64
popq %rcx
cltd
idivl %ecx
addl %r15d, %eax
movl %eax, 0x40(%r12)
movq %rbx, %rdi
movq %r14, %rsi
callq 0x5c1c
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop