// File: /workspace/github_cpp_makefile_star2_O1/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 0x6592
movq 0x10(%r14), %rsi
movq %r13, %rdi
callq 0xc78e
movq -0x48(%rbp), %rdx
cmpq 0x8(%r12), %rdx
jne 0x63ed
testq %rdx, %rdx
je 0x63f2
movq (%r12), %rsi
movq -0x50(%rbp), %rdi
callq 0x31a0
testl %eax, %eax
sete %r15b
jmp 0x63f5
xorl %r15d, %r15d
jmp 0x63f5
movb $0x1, %r15b
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x640e
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x3190
testb %r15b, %r15b
je 0x63b0
movq 0x10(%r14), %rsi
leaq -0x50(%rbp), %r13
movq %r13, %rdi
callq 0xcda4
leaq 0x806f(%rip), %rsi      # 0xe499
movq %r13, %rdi
callq 0x30a0
movl %eax, %r12d
movq (%r13), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x644e
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x3190
addq $0x10, %r14
testl %r12d, %r12d
je 0x65d9
movq (%r14), %rsi
movq %r13, %rdi
callq 0xcda4
leaq 0x8037(%rip), %rsi      # 0xe4a4
movq %r13, %rdi
callq 0x30a0
movl %eax, %r12d
movq (%r13), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x6491
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x3190
testl %r12d, %r12d
je 0x65ee
movq (%r14), %rsi
movq %r13, %rdi
callq 0xcda4
leaq 0x8004(%rip), %rsi      # 0xe4b0
movq %r13, %rdi
callq 0x30a0
movl %eax, %r12d
movq (%r13), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x64d0
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x3190
testl %r12d, %r12d
je 0x6626
movq (%r14), %rsi
movq %r13, %rdi
callq 0xcda4
leaq 0x7fce(%rip), %rsi      # 0xe4b9
movq %r13, %rdi
callq 0x30a0
movl %eax, %r12d
movq (%r13), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x650f
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x3190
testl %r12d, %r12d
je 0x665e
movq (%r14), %rsi
movq %r13, %rdi
callq 0xcda4
leaq 0x7f97(%rip), %rsi      # 0xe4c1
movq %r13, %rdi
callq 0x30a0
movl %eax, %r12d
movq (%r13), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x654e
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x3190
testl %r12d, %r12d
jne 0x6694
movq -0x30(%rbp), %r12
movl 0x40(%r12), %r15d
movq (%r14), %rdi
movq (%rdi), %rax
callq *0x20(%rax)
imull 0x40(%r12), %eax
cltq
imulq $0x51eb851f, %rax, %rax # imm = 0x51EB851F
movq %rax, %rcx
shrq $0x3f, %rcx
sarq $0x25, %rax
addl %ecx, %eax
addl %r15d, %eax
movl %eax, 0x40(%r12)
jmp 0x6694
movq 0xda37(%rip), %rbx      # 0x13fd0
leaq 0x7f2b(%rip), %rsi      # 0xe4cb
movl $0x2b, %edx
movq %rbx, %rdi
callq 0x31c0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3160
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x3100
jmp 0x669f
movq (%r14), %rdi
movq (%rdi), %rax
callq *0x20(%rax)
movq -0x30(%rbp), %rcx
addl %eax, 0x34(%rcx)
jmp 0x6694
movq -0x30(%rbp), %r12
movl 0x2c(%r12), %r15d
movq (%r14), %rdi
movq (%rdi), %rax
callq *0x20(%rax)
imull 0x2c(%r12), %eax
cltq
imulq $0x51eb851f, %rax, %rax # imm = 0x51EB851F
movq %rax, %rcx
shrq $0x3f, %rcx
sarq $0x25, %rax
addl %ecx, %eax
addl %r15d, %eax
movl %eax, 0x2c(%r12)
jmp 0x6694
movq -0x30(%rbp), %r12
movl 0x38(%r12), %r15d
movq (%r14), %rdi
movq (%rdi), %rax
callq *0x20(%rax)
imull 0x38(%r12), %eax
cltq
imulq $0x51eb851f, %rax, %rax # imm = 0x51EB851F
movq %rax, %rcx
shrq $0x3f, %rcx
sarq $0x25, %rax
addl %ecx, %eax
addl %r15d, %eax
movl %eax, 0x38(%r12)
jmp 0x6694
movq -0x30(%rbp), %r12
movl 0x3c(%r12), %r15d
movq (%r14), %rdi
movq (%rdi), %rax
callq *0x20(%rax)
imull 0x3c(%r12), %eax
cltq
imulq $0x51eb851f, %rax, %rax # imm = 0x51EB851F
movq %rax, %rcx
shrq $0x3f, %rcx
sarq $0x25, %rax
addl %ecx, %eax
addl %r15d, %eax
movl %eax, 0x3c(%r12)
movq %rbx, %rdi
movq %r14, %rsi
callq 0x6f24
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq