// File: AngelPn[P]L5R-card_game/src/Player.cpp
// Function: Player::tapHoldings()
void Player::tapHoldings()
{
	char input;
	unsigned int i, count = 0;

	while (holdings.size() - count > 0) //while player possesses untapped holdings (other than stronghold)
	{
		input = '0';
		i=0;
		this->printHoldings(); //print players holdings so they can decide whether to tap a holding for extra money or not

		while (input != 'y' && input != 'n')
		{
			cout << this->name<< ", do you want to tap any of your holdings for extra money (y:yes / n:no) ?" << endl;
			cin >> input;
		}

		if (input == 'y')
		{
			while ( i < 1 || i > (holdings.size()))
			{
				this->printHoldings();
				cout << "Choose a holding to tap : (1-" << holdings.size() << ")" << endl;
				cin >> i;
			}

			if (holdings[i-1]->is_tapped() == true)
			{
				cout << "Card already tapped can't be used for the remainder of the round " << endl;
				continue;
			}

			holdings[i-1]->tap(); //card is tapped
			money += holdings[i-1]->get_harvestValue();
			count++;
			cout << "Holding tapped and its harvest value was added to your money " << endl << endl;
		}

		else
			return;

	}

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x20(%rbp)
movl $0x0, -0x14(%rbp)
movq -0x20(%rbp), %rdi
addq $0x38, %rdi
callq 0x13910
movl -0x14(%rbp), %ecx
subq %rcx, %rax
cmpq $0x0, %rax
jbe 0x10a7d
movq -0x20(%rbp), %rdi
movb $0x30, -0x9(%rbp)
movl $0x0, -0x10(%rbp)
callq 0x12530
movsbl -0x9(%rbp), %ecx
xorl %eax, %eax
cmpl $0x79, %ecx
movb %al, -0x21(%rbp)
je 0x10897
movsbl -0x9(%rbp), %eax
cmpl $0x6e, %eax
setne %al
movb %al, -0x21(%rbp)
movb -0x21(%rbp), %al
testb $0x1, %al
jne 0x108a0
jmp 0x108e7
movq -0x20(%rbp), %rsi
addq $0xa8, %rsi
movq 0x1471e(%rip), %rdi     # 0x24fd0
callq 0x41d0
movq %rax, %rdi
leaq 0x8aae(%rip), %rsi      # 0x1936f
callq 0x4200
movq %rax, %rdi
movq 0x146f0(%rip), %rsi     # 0x24fc0
callq 0x4230
movq 0x14704(%rip), %rdi     # 0x24fe0
leaq -0x9(%rbp), %rsi
callq 0x42b0
jmp 0x1087c
movsbl -0x9(%rbp), %eax
cmpl $0x79, %eax
jne 0x10a76
jmp 0x108f6
movb $0x1, %al
cmpl $0x1, -0x10(%rbp)
movb %al, -0x22(%rbp)
jb 0x10925
movq -0x20(%rbp), %rdi
movl -0x10(%rbp), %eax
movq %rax, -0x30(%rbp)
addq $0x38, %rdi
callq 0x13910
movq %rax, %rcx
movq -0x30(%rbp), %rax
cmpq %rcx, %rax
seta %al
movb %al, -0x22(%rbp)
movb -0x22(%rbp), %al
testb $0x1, %al
jne 0x1092e
jmp 0x1099a
movq -0x20(%rbp), %rdi
callq 0x12530
movq 0x14692(%rip), %rdi     # 0x24fd0
leaq 0x8a75(%rip), %rsi      # 0x193ba
callq 0x4200
movq -0x20(%rbp), %rdi
movq %rax, -0x38(%rbp)
addq $0x38, %rdi
callq 0x13910
movq -0x38(%rbp), %rdi
movq %rax, %rsi
callq 0x4090
movq %rax, %rdi
leaq 0x8ba0(%rip), %rsi      # 0x19511
callq 0x4200
movq %rax, %rdi
movq 0x14640(%rip), %rsi     # 0x24fc0
callq 0x4230
movq 0x14654(%rip), %rdi     # 0x24fe0
leaq -0x10(%rbp), %rsi
callq 0x4050
jmp 0x108f6
movq -0x20(%rbp), %rdi
addq $0x38, %rdi
movl -0x10(%rbp), %eax
subl $0x1, %eax
movl %eax, %eax
movl %eax, %esi
callq 0x13770
movq (%rax), %rdi
callq 0x14410
andb $0x1, %al
movzbl %al, %eax
cmpl $0x1, %eax
jne 0x109ea
movq 0x14606(%rip), %rdi     # 0x24fd0
leaq 0x8a07(%rip), %rsi      # 0x193d8
callq 0x4200
movq %rax, %rdi
movq 0x145e0(%rip), %rsi     # 0x24fc0
callq 0x4230
jmp 0x1084b
movq -0x20(%rbp), %rdi
addq $0x38, %rdi
movl -0x10(%rbp), %eax
subl $0x1, %eax
movl %eax, %eax
movl %eax, %esi
callq 0x13770
movq (%rax), %rdi
callq 0xe300
movq -0x20(%rbp), %rdi
addq $0x38, %rdi
movl -0x10(%rbp), %eax
subl $0x1, %eax
movl %eax, %eax
movl %eax, %esi
callq 0x13770
movq (%rax), %rdi
callq 0x14430
movl %eax, %ecx
movq -0x20(%rbp), %rax
addl 0xa0(%rax), %ecx
movl %ecx, 0xa0(%rax)
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
movq 0x14586(%rip), %rdi     # 0x24fd0
leaq 0x89c9(%rip), %rsi      # 0x1941a
callq 0x4200
movq %rax, %rdi
movq 0x14560(%rip), %rsi     # 0x24fc0
callq 0x4230
movq %rax, %rdi
movq 0x14551(%rip), %rsi     # 0x24fc0
callq 0x4230
jmp 0x10a78
jmp 0x10a7d
jmp 0x1084b
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)