// File: /workspace/github_cpp_makefile_star2_O2/hobbitsyfeet[P]Turn/unit.cc
// Function: Unit::lootUnit(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, Unit&)
void Unit::lootUnit(string iName,Unit& target){
  if(iName == "Fists"){
    cout<<"You cannot yet remove hands";
    return;
  }
  if(distanceTo(target.getPosX(),target.getPosY() ) <= 1){
  vector<Item>::iterator it;
  for(it=target.inv.invContainer.begin();it<target.inv.invContainer.end();it++){
      if(iName == it->itemGetName()){
       it->itemUnequip();
			 this->unEquipItem(iName);
			 inv.pickUp(*it);
       target.inv.invContainer.erase(it);
      }
    }
    cout<<"You grabbed "<<iName;
  }
  else{
    cout<<"Cannot loot"<<target.getName();
    if(distanceTo(target.getPosX(),target.getPosY() ) > 1 ){
      if(target.getHealth() > 0)
        cout<<" is still alive, cannot grab his things just yet!";
      else
        cout<<" is too far";
    }
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb8, %rsp
movq %rdx, %rbx
movq %rsi, %rax
movq %rdi, %r12
leaq 0x591c(%rip), %rsi      # 0x9208
movq %rax, -0x30(%rbp)
movq %rax, %rdi
callq 0x2e13
testb %al, %al
je 0x3920
movq 0xa6cd(%rip), %rdi      # 0xdfd0
leaq 0x5904(%rip), %rsi      # 0x920e
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x21c0
movl 0x78(%rbx), %esi
movl 0x7c(%rbx), %edx
movq %r12, %rdi
callq 0x37b0
cmpl $0x1, %eax
ja 0x3a04
movl $0x80, %eax
leaq (%rbx,%rax), %rcx
movq %rcx, -0x38(%rbp)
movq 0x80(%rbx), %r14
movq %r12, -0x48(%rbp)
addq %r12, %rax
movq %rax, -0x40(%rbp)
leaq -0x68(%rbp), %r13
leaq -0x88(%rbp), %r12
cmpq 0x88(%rbx), %r14
jae 0x3a66
movq %rbx, %r15
movq %r13, %rdi
movq %r14, %rsi
callq 0x4992
movq -0x30(%rbp), %rdi
movq %r13, %rsi
callq 0x4753
movq %r12, %rbx
movl %eax, %r12d
movq %r13, %rdi
callq 0x2100
testb %r12b, %r12b
movq %rbx, %r12
je 0x39f8
movq %r14, %rdi
callq 0x4b84
movq %r12, %rdi
movq -0x30(%rbp), %rsi
callq 0x2250
movq -0x48(%rbp), %rdi
movq %r12, %rsi
callq 0x3ade
movq %r12, %rdi
callq 0x2100
leaq -0xe0(%rbp), %rbx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x4780
movq -0x40(%rbp), %rdi
movq %rbx, %rsi
callq 0x7558
movq %rbx, %rdi
callq 0x2f08
movq -0x38(%rbp), %rdi
movq %r14, %rsi
callq 0x47c8
addq $0x58, %r14
movq %r15, %rbx
jmp 0x3961
movq 0xa5c5(%rip), %rdi      # 0xdfd0
leaq 0x5825(%rip), %rsi      # 0x9237
callq 0x21c0
movq %rax, %r14
leaq -0x68(%rbp), %r15
movq %r15, %rdi
movq %rbx, %rsi
callq 0x2250
movq %r14, %rdi
movq %r15, %rsi
callq 0x21b0
leaq -0x68(%rbp), %rdi
callq 0x2100
movl 0x78(%rbx), %esi
movl 0x7c(%rbx), %edx
movq %r12, %rdi
callq 0x37b0
cmpl $0x2, %eax
jb 0x3a9a
cmpl $0x0, 0x20(%rbx)
jle 0x3a87
movq 0xa573(%rip), %rdi      # 0xdfd0
leaq 0x57df(%rip), %rsi      # 0x9243
jmp 0x3a95
movq 0xa563(%rip), %rdi      # 0xdfd0
leaq 0x57b6(%rip), %rsi      # 0x922a
callq 0x21c0
movq %rax, %rdi
movq -0x30(%rbp), %rsi
callq 0x21b0
jmp 0x3a9a
movq 0xa542(%rip), %rdi      # 0xdfd0
leaq 0x57e0(%rip), %rsi      # 0x9275
callq 0x21c0
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq -0x68(%rbp), %rdi
jmp 0x3ad0
movq %rax, %rbx
leaq -0xe0(%rbp), %rdi
callq 0x2f08
jmp 0x3ad5
movq %rax, %rbx
leaq -0x88(%rbp), %rdi
callq 0x2100
movq %rbx, %rdi
callq 0x2300
nop