// File: LifeAlgorithm[P]RockPaperScissors/Paper.cpp
// Function: Paper::fight(Tool&)
char Paper::fight(Tool &toolIn)
{
	//Temporary strength holders
	int tempPaperStrength = this->strength;
	int tempToolInStrength = toolIn.getStrength();

	char outcome;

	//Paper vs Rock
	if (toolIn.getType() == 'r') {
		tempPaperStrength *= 2; //paper is strong against rock, so strength is doubled
		tempToolInStrength /= 2; //rock is weak to paper, so strength is halved
		outcome = compareStrength(tempPaperStrength, tempToolInStrength); //compare
	}

	//Paper vs. Scissors
	else if (toolIn.getType() == 's') {
		tempPaperStrength /= 2; //paper is weak to scissors, so strength is halved
		tempToolInStrength *= 2;//scissors are strong to paper, so strength is doubled
		outcome = compareStrength(tempPaperStrength, tempToolInStrength); //compare
	}

	//Paper vs. Paper
	else {
		outcome = compareStrength(tempPaperStrength, tempToolInStrength); //no temporary modifiers, compare
	}

	cout << this->longType << " strength: " << this->strength << " (temp: " << tempPaperStrength << ")" << endl;
	cout << toolIn.getLongType() << " strength: " << toolIn.getStrength() << " (temp: " << tempToolInStrength << ")"  << endl;

	return outcome;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x28(%rbp)
movl 0x8(%rax), %eax
movl %eax, -0x14(%rbp)
movq -0x10(%rbp), %rdi
callq 0x26c0
movl %eax, -0x18(%rbp)
movq -0x10(%rbp), %rdi
callq 0x26a0
movsbl %al, %eax
cmpl $0x72, %eax
jne 0x2ca5
movq -0x28(%rbp), %rdi
movl -0x14(%rbp), %eax
shll %eax
movl %eax, -0x14(%rbp)
movl -0x18(%rbp), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, -0x18(%rbp)
movl -0x14(%rbp), %esi
movl -0x18(%rbp), %edx
callq 0x26e0
movb %al, -0x19(%rbp)
jmp 0x2cf4
movq -0x10(%rbp), %rdi
callq 0x26a0
movsbl %al, %eax
cmpl $0x73, %eax
jne 0x2ce0
movq -0x28(%rbp), %rdi
movl -0x14(%rbp), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, -0x14(%rbp)
movl -0x18(%rbp), %eax
shll %eax
movl %eax, -0x18(%rbp)
movl -0x14(%rbp), %esi
movl -0x18(%rbp), %edx
callq 0x26e0
movb %al, -0x19(%rbp)
jmp 0x2cf2
movq -0x28(%rbp), %rdi
movl -0x14(%rbp), %esi
movl -0x18(%rbp), %edx
callq 0x26e0
movb %al, -0x19(%rbp)
jmp 0x2cf4
movq -0x28(%rbp), %rsi
addq $0x10, %rsi
movq 0x62cd(%rip), %rdi      # 0x8fd0
callq 0x2130
movq %rax, %rdi
leaq 0x3551(%rip), %rsi      # 0x6263
callq 0x2160
movq %rax, %rdi
movq -0x28(%rbp), %rax
movl 0x8(%rax), %esi
callq 0x2200
movq %rax, %rdi
leaq 0x32da(%rip), %rsi      # 0x600a
callq 0x2160
movq %rax, %rdi
movl -0x14(%rbp), %esi
callq 0x2200
movq %rax, %rdi
leaq 0x3355(%rip), %rsi      # 0x609f
callq 0x2160
movq %rax, %rdi
movq 0x6267(%rip), %rsi      # 0x8fc0
callq 0x2190
movq -0x10(%rbp), %rdi
callq 0x2720
movq %rax, %rsi
movq 0x625f(%rip), %rdi      # 0x8fd0
callq 0x2130
movq %rax, %rdi
leaq 0x34e3(%rip), %rsi      # 0x6263
callq 0x2160
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rdi
callq 0x26c0
movq -0x30(%rbp), %rdi
movl %eax, %esi
callq 0x2200
movq %rax, %rdi
leaq 0x3263(%rip), %rsi      # 0x600a
callq 0x2160
movq %rax, %rdi
movl -0x18(%rbp), %esi
callq 0x2200
movq %rax, %rdi
leaq 0x32de(%rip), %rsi      # 0x609f
callq 0x2160
movq %rax, %rdi
movq 0x61f0(%rip), %rsi      # 0x8fc0
callq 0x2190
movb -0x19(%rbp), %al
addq $0x30, %rsp
popq %rbp
retq
nop