// File: /workspace/github_cpp_makefile_star2_O2/XxAdi101xX[P]ChamberCrawler/Character/Character.cc
// Function: Character::attack(Character&, Generator&)
void Character::attack(Character& defender, Generator& rng) {
	int damage = ceil((100.0/(100.0 + defender.getTotalDefence()))
		* this->getTotalAttack());

	bool firstRollForHit = this->dealDamageTo(defender, damage, rng);
	bool secondRollForHit = defender.defend(*this, damage, rng);

	if (firstRollForHit && secondRollForHit) {
		// reports hit
		this->addAction(makeMsg(this->name, WORD_DEAL_PAST_TENSE + " "
			+ to_string(damage) + " " + WORD_DAMAGE_NOUN + " "
			+ WORD_TO_PREPOSITION, defender.getName() + " ("
			+ to_string(defender.getHP()) + ")"));

	}

	else {
		// reports miss
		this->addAction(makeMsg(this->name, WORD_MISS_PAST_TENSE + " ("
		+ to_string(damage) + " " + WORD_DAMAGE_NOUN + ")",
		defender.getName()));
	}

	this->postAttackRoutine(defender, firstRollForHit && secondRollForHit, rng);

	// checks for defender's death
	if (defender.getHP() <= 0) {
		this->addGold(defender.getWallet());

		defender.deathRoutine();

		// removes character from floor
		(defender.getCurrentCell())->setOccupant(nullptr);

		this->addAction(
				makeMsg(this->name, WORD_KILL_PAST_TENSE, defender.getName()));

		defender.addAction(makeMsg(defender.getName(), WORD_IS_PAST_TENSE + " "
			+ WORD_KILL_PAST_TENSE + " " + WORD_BY_PREPOSITION, this->name));
	}

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x368, %rsp            # imm = 0x368
movq %rdx, %r12
movq %rsi, %rbx
movq %rdi, %r15
movq %rsi, %rdi
callq 0x11f32
cvtsi2sd %eax, %xmm0
movsd 0x6fa6(%rip), %xmm1     # 0x19148
addsd %xmm1, %xmm0
divsd %xmm0, %xmm1
movsd %xmm1, 0x68(%rsp)
movq %r15, %rdi
callq 0x11f20
cvtsi2sd %eax, %xmm0
mulsd 0x68(%rsp), %xmm0
callq 0x5080
cvttsd2si %xmm0, %eax
leaq 0x4(%rsp), %r14
movl %eax, (%r14)
movq (%r15), %rax
movq %r15, %rdi
movq %rbx, %rsi
movq %r14, %rdx
movq %r12, %rcx
callq *0x38(%rax)
movl %eax, %r13d
movq %rbx, %rdi
movq %r15, %rsi
movq %r14, %rdx
movq %r12, %rcx
callq 0x111ec
movl %eax, %ebp
andb %r13b, %bpl
leaq 0x88(%r15), %r14
cmpb $0x1, %bpl
jne 0x1240f
leaq 0x348(%rsp), %rdi
movq %r14, %rsi
callq 0x52e0
leaq 0x13fb2(%rip), %rsi     # 0x261d8
leaq 0x696e(%rip), %rdx      # 0x18b9b
leaq 0x70(%rsp), %rdi
callq 0x12c08
movl 0x4(%rsp), %esi
leaq 0x2c8(%rsp), %rdi
callq 0x12c40
leaq 0x90(%rsp), %rdi
leaq 0x70(%rsp), %rsi
leaq 0x2c8(%rsp), %rdx
callq 0x12ba1
leaq 0x6932(%rip), %rdx      # 0x18b9b
leaq 0x28(%rsp), %rdi
leaq 0x90(%rsp), %rsi
callq 0xcdf7
leaq 0x13f36(%rip), %rdx     # 0x261b8
leaq 0x48(%rsp), %rdi
leaq 0x28(%rsp), %rsi
callq 0x12b82
leaq 0x6903(%rip), %rdx      # 0x18b9b
leaq 0x8(%rsp), %rdi
leaq 0x48(%rsp), %rsi
callq 0xcdf7
leaq 0x140aa(%rip), %rdx     # 0x26358
leaq 0x2e8(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x12b82
leaq 0x88(%rbx), %rsi
leaq 0x248(%rsp), %rdi
callq 0x52e0
leaq 0x6e75(%rip), %rdx      # 0x19150
leaq 0x268(%rsp), %rdi
leaq 0x248(%rsp), %rsi
callq 0xcdf7
movl 0x34(%rbx), %esi
leaq 0x228(%rsp), %rdi
callq 0x12c40
leaq 0x288(%rsp), %rdi
leaq 0x268(%rsp), %rsi
leaq 0x228(%rsp), %rdx
callq 0x12ba1
leaq 0x68d7(%rip), %rdx      # 0x18bfb
leaq 0x2a8(%rsp), %rdi
leaq 0x288(%rsp), %rsi
callq 0xcdf7
leaq 0x308(%rsp), %rdi
leaq 0x348(%rsp), %r13
leaq 0x2e8(%rsp), %rdx
leaq 0x2a8(%rsp), %rcx
movq %r13, %rsi
callq 0x13ce8
leaq 0x68(%r15), %rdi
leaq 0x308(%rsp), %rsi
callq 0x5410
leaq 0x308(%rsp), %rdi
callq 0x5428
leaq 0x2a8(%rsp), %rdi
callq 0x5428
leaq 0x288(%rsp), %rdi
callq 0x5428
leaq 0x228(%rsp), %rdi
callq 0x5428
leaq 0x268(%rsp), %rdi
callq 0x5428
leaq 0x248(%rsp), %rdi
callq 0x5428
leaq 0x2e8(%rsp), %rdi
callq 0x5428
leaq 0x8(%rsp), %rdi
callq 0x5428
leaq 0x48(%rsp), %rdi
callq 0x5428
leaq 0x28(%rsp), %rdi
callq 0x5428
leaq 0x90(%rsp), %rdi
callq 0x5428
leaq 0x2c8(%rsp), %rdi
callq 0x5428
leaq 0x70(%rsp), %rdi
jmp 0x12548
leaq 0x328(%rsp), %rdi
movq %r14, %rsi
callq 0x52e0
leaq 0x13eb2(%rip), %rsi     # 0x262d8
leaq 0x6d23(%rip), %rdx      # 0x19150
leaq 0x90(%rsp), %rdi
callq 0x12c08
movl 0x4(%rsp), %esi
leaq 0x70(%rsp), %rdi
callq 0x12c40
leaq 0x28(%rsp), %rdi
leaq 0x90(%rsp), %rsi
leaq 0x70(%rsp), %rdx
callq 0x12ba1
leaq 0x6735(%rip), %rdx      # 0x18b9b
leaq 0x48(%rsp), %rdi
leaq 0x28(%rsp), %rsi
callq 0xcdf7
leaq 0x13d3c(%rip), %rdx     # 0x261b8
leaq 0x8(%rsp), %rdi
leaq 0x48(%rsp), %rsi
callq 0x12b82
leaq 0x6769(%rip), %rdx      # 0x18bfb
leaq 0x1e8(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0xcdf7
leaq 0x88(%rbx), %rsi
leaq 0x1c8(%rsp), %rdi
callq 0x52e0
leaq 0x208(%rsp), %rdi
leaq 0x328(%rsp), %r13
leaq 0x1e8(%rsp), %rdx
leaq 0x1c8(%rsp), %rcx
movq %r13, %rsi
callq 0x13ce8
leaq 0x68(%r15), %rdi
leaq 0x208(%rsp), %rsi
callq 0x5410
leaq 0x208(%rsp), %rdi
callq 0x5428
leaq 0x1c8(%rsp), %rdi
callq 0x5428
leaq 0x1e8(%rsp), %rdi
callq 0x5428
leaq 0x8(%rsp), %rdi
callq 0x5428
leaq 0x48(%rsp), %rdi
callq 0x5428
leaq 0x28(%rsp), %rdi
callq 0x5428
leaq 0x70(%rsp), %rdi
callq 0x5428
leaq 0x90(%rsp), %rdi
callq 0x5428
movq %r13, %rdi
callq 0x5428
movq (%r15), %rax
movzbl %bpl, %edx
movq %r15, %rdi
movq %rbx, %rsi
movq %r12, %rcx
callq *0x20(%rax)
cmpl $0x0, 0x34(%rbx)
jg 0x12777
movl 0x60(%rbx), %esi
movq %r15, %rdi
callq 0x11f56
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x28(%rax)
leaq 0x50(%rbx), %rsi
leaq 0x8(%rsp), %r12
movq %r12, %rdi
callq 0xd360
movq (%r12), %rdi
xorpd %xmm0, %xmm0
leaq 0xb0(%rsp), %rsi
movapd %xmm0, (%rsi)
callq 0x108da
leaq 0xb8(%rsp), %rdi
callq 0xd24a
leaq 0x10(%rsp), %rdi
callq 0xd24a
leaq 0x188(%rsp), %rdi
movq %r14, %rsi
callq 0x52e0
leaq 0x13cba(%rip), %rsi     # 0x26298
leaq 0x168(%rsp), %rdi
callq 0x52e0
leaq 0x88(%rbx), %r12
leaq 0x148(%rsp), %rdi
movq %r12, %rsi
callq 0x52e0
leaq 0x1a8(%rsp), %rdi
leaq 0x188(%rsp), %rsi
leaq 0x168(%rsp), %rdx
leaq 0x148(%rsp), %rcx
callq 0x13ce8
addq $0x68, %r15
leaq 0x1a8(%rsp), %rsi
movq %r15, %rdi
callq 0x5410
leaq 0x1a8(%rsp), %rdi
callq 0x5428
leaq 0x148(%rsp), %rdi
callq 0x5428
leaq 0x168(%rsp), %rdi
callq 0x5428
leaq 0x188(%rsp), %rdi
callq 0x5428
leaq 0x108(%rsp), %rdi
movq %r12, %rsi
callq 0x52e0
leaq 0x13bf2(%rip), %rsi     # 0x26278
leaq 0x650e(%rip), %rdx      # 0x18b9b
leaq 0x28(%rsp), %rdi
callq 0x12c08
leaq 0x13bfa(%rip), %rdx     # 0x26298
leaq 0x48(%rsp), %rdi
leaq 0x28(%rsp), %rsi
callq 0x12b82
leaq 0x64e7(%rip), %rdx      # 0x18b9b
leaq 0x8(%rsp), %rdi
leaq 0x48(%rsp), %rsi
callq 0xcdf7
leaq 0x13ace(%rip), %rdx     # 0x26198
leaq 0xe8(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x12b82
leaq 0xc8(%rsp), %rdi
movq %r14, %rsi
callq 0x52e0
leaq 0x128(%rsp), %rdi
leaq 0x108(%rsp), %rsi
leaq 0xe8(%rsp), %rdx
leaq 0xc8(%rsp), %rcx
callq 0x13ce8
addq $0x68, %rbx
leaq 0x128(%rsp), %rsi
movq %rbx, %rdi
callq 0x5410
leaq 0x128(%rsp), %rdi
callq 0x5428
leaq 0xc8(%rsp), %rdi
callq 0x5428
leaq 0xe8(%rsp), %rdi
callq 0x5428
leaq 0x8(%rsp), %rdi
callq 0x5428
leaq 0x48(%rsp), %rdi
callq 0x5428
leaq 0x28(%rsp), %rdi
callq 0x5428
leaq 0x108(%rsp), %rdi
callq 0x5428
addq $0x368, %rsp            # imm = 0x368
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x128(%rsp), %rdi
callq 0x5428
jmp 0x1279e
movq %rax, %rbx
leaq 0xc8(%rsp), %rdi
callq 0x5428
jmp 0x127b0
movq %rax, %rbx
leaq 0xe8(%rsp), %rdi
callq 0x5428
jmp 0x127c2
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x5428
jmp 0x127d1
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
callq 0x5428
leaq 0x28(%rsp), %rdi
callq 0x5428
leaq 0x108(%rsp), %rdi
jmp 0x129ba
movq %rax, %rbx
jmp 0x127db
movq %rax, %rbx
jmp 0x127e5
movq %rax, %rbx
leaq 0x1a8(%rsp), %rdi
callq 0x5428
jmp 0x12811
movq %rax, %rbx
leaq 0x148(%rsp), %rdi
callq 0x5428
jmp 0x12823
movq %rax, %rbx
leaq 0x168(%rsp), %rdi
callq 0x5428
jmp 0x12835
movq %rax, %rbx
leaq 0x188(%rsp), %rdi
jmp 0x129ba
movq %rax, %rbx
leaq 0xb8(%rsp), %rdi
callq 0xd24a
leaq 0x10(%rsp), %rdi
callq 0xd24a
jmp 0x129bf
movq %rax, %rbx
leaq 0x308(%rsp), %rdi
callq 0x5428
jmp 0x12876
movq %rax, %rbx
leaq 0x2a8(%rsp), %rdi
callq 0x5428
jmp 0x12888
movq %rax, %rbx
leaq 0x288(%rsp), %rdi
callq 0x5428
jmp 0x1289a
movq %rax, %rbx
leaq 0x228(%rsp), %rdi
callq 0x5428
jmp 0x128ac
movq %rax, %rbx
leaq 0x268(%rsp), %rdi
callq 0x5428
leaq 0x248(%rsp), %rdi
callq 0x5428
leaq 0x2e8(%rsp), %rdi
callq 0x5428
leaq 0x8(%rsp), %rdi
callq 0x5428
leaq 0x48(%rsp), %rdi
callq 0x5428
leaq 0x28(%rsp), %rdi
callq 0x5428
leaq 0x90(%rsp), %rdi
callq 0x5428
leaq 0x2c8(%rsp), %rdi
callq 0x5428
leaq 0x70(%rsp), %rdi
callq 0x5428
leaq 0x348(%rsp), %rdi
jmp 0x129ba
movq %rax, %rbx
leaq 0x208(%rsp), %rdi
callq 0x5428
jmp 0x1293c
movq %rax, %rbx
jmp 0x128b9
movq %rax, %rbx
leaq 0x1c8(%rsp), %rdi
callq 0x5428
jmp 0x12956
movq %rax, %rbx
jmp 0x128c6
movq %rax, %rbx
leaq 0x1e8(%rsp), %rdi
callq 0x5428
jmp 0x12970
movq %rax, %rbx
jmp 0x128d3
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x5428
jmp 0x12987
movq %rax, %rbx
jmp 0x128dd
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
callq 0x5428
leaq 0x28(%rsp), %rdi
callq 0x5428
leaq 0x70(%rsp), %rdi
callq 0x5428
leaq 0x90(%rsp), %rdi
callq 0x5428
leaq 0x328(%rsp), %rdi
callq 0x5428
movq %rbx, %rdi
callq 0x53c0
movq %rax, %rbx
jmp 0x128e7
movq %rax, %rbx
jmp 0x12991
movq %rax, %rbx
jmp 0x128f1
movq %rax, %rbx
jmp 0x1299b
movq %rax, %rbx
jmp 0x128fe
movq %rax, %rbx
jmp 0x129a5
movq %rax, %rbx
jmp 0x1290b
movq %rax, %rbx
jmp 0x129b2
movq %rax, %rbx
jmp 0x12915
nop