// File: permui[P]CastleAdventure/src/command.cpp
// Function: EncounterMonster(Player&, Grid&)
void EncounterMonster(Player &player, Grid &grid) {
	cout << "Encounter Monster!" << endl;
	cout << "A shield (" << shield_price << " BTC) can defend against one time of monster attact, but cannot kill the monster." << endl;
	cout << "A sword (" << sword_price << " BTC) can kill the monster." << endl;
	cout << "Commands: use_shield use_sword give_up" << endl;
	while (true) {
		string com = GetA<string>();
		if (com == "use_shield") {
			if (player.shield > 0) {
				--player.shield;
				cout << "You defend the monster!" << endl;
				break;
			}
			cout << "not enough shield, choose an alternative" << endl;
		} else if (com == "use_sword") {
			if (player.sword > 0) {
				--player.sword;
				grid.info.t = GT::None;
				cout << "You kill the monster!" << endl;
				break;
			}
			cout << "not enogh sword, choose an alternative" << endl;
		} else if (com == "give_up") {
			player.pos = FAIL_POS;
			break;
		} else {
			cout << "given command not available, see the command list" << endl;
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq 0x8f16(%rip), %rdi      # 0x19fd0
leaq 0x19f2(%rip), %rsi      # 0x12ab3
callq 0x3210
movq %rax, %rdi
movq 0x8ef0(%rip), %rsi      # 0x19fc0
callq 0x3250
movq 0x8ef4(%rip), %rdi      # 0x19fd0
leaq 0x19e3(%rip), %rsi      # 0x12ac6
callq 0x3210
movq %rax, %rdi
movl $0xa, %esi
callq 0x3380
movq %rax, %rdi
leaq 0x19d2(%rip), %rsi      # 0x12ad1
callq 0x3210
movq %rax, %rdi
movq 0x8eb2(%rip), %rsi      # 0x19fc0
callq 0x3250
movq 0x8eb6(%rip), %rdi      # 0x19fd0
leaq 0x1a02(%rip), %rsi      # 0x12b23
callq 0x3210
movq %rax, %rdi
movl $0xf, %esi
callq 0x3380
movq %rax, %rdi
leaq 0x19f0(%rip), %rsi      # 0x12b2d
callq 0x3210
movq %rax, %rdi
movq 0x8e74(%rip), %rsi      # 0x19fc0
callq 0x3250
movq 0x8e78(%rip), %rdi      # 0x19fd0
leaq 0x19ea(%rip), %rsi      # 0x12b49
callq 0x3210
movq %rax, %rdi
movq 0x8e52(%rip), %rsi      # 0x19fc0
callq 0x3250
leaq -0x30(%rbp), %rdi
movq %rdi, -0x50(%rbp)
callq 0x11590
movq -0x50(%rbp), %rdi
leaq 0x19e5(%rip), %rsi      # 0x12b70
callq 0x11750
movb %al, -0x41(%rbp)
jmp 0x11195
movb -0x41(%rbp), %al
testb $0x1, %al
jne 0x111a1
jmp 0x11238
movq -0x8(%rbp), %rax
cmpl $0x0, 0x8(%rax)
jle 0x11208
movq -0x8(%rbp), %rax
movl 0x8(%rax), %ecx
decl %ecx
movl %ecx, 0x8(%rax)
movq 0x8e12(%rip), %rdi      # 0x19fd0
leaq 0x19b6(%rip), %rsi      # 0x12b7b
callq 0x3210
movq %rax, -0x58(%rbp)
jmp 0x111d0
movq -0x58(%rbp), %rdi
movq 0x8de5(%rip), %rsi      # 0x19fc0
callq 0x3250
jmp 0x111e2
movl $0x3, -0x40(%rbp)
jmp 0x11351
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x3130
jmp 0x11373
movq 0x8dc1(%rip), %rdi      # 0x19fd0
leaq 0x197d(%rip), %rsi      # 0x12b93
callq 0x3210
movq %rax, -0x60(%rbp)
jmp 0x11221
movq -0x60(%rbp), %rdi
movq 0x8d94(%rip), %rsi      # 0x19fc0
callq 0x3250
jmp 0x11233
jmp 0x1134a
leaq 0x197d(%rip), %rsi      # 0x12bbc
leaq -0x30(%rbp), %rdi
callq 0x11750
movb %al, -0x61(%rbp)
jmp 0x1124d
movb -0x61(%rbp), %al
testb $0x1, %al
jne 0x11259
jmp 0x112de
movq -0x8(%rbp), %rax
cmpl $0x0, 0xc(%rax)
jle 0x112b1
movq -0x8(%rbp), %rax
movl 0xc(%rax), %ecx
decl %ecx
movl %ecx, 0xc(%rax)
movq -0x10(%rbp), %rax
movl $0x3, 0x8(%rax)
movq 0x8d4f(%rip), %rdi      # 0x19fd0
leaq 0x193e(%rip), %rsi      # 0x12bc6
callq 0x3210
movq %rax, -0x70(%rbp)
jmp 0x11293
movq -0x70(%rbp), %rdi
movq 0x8d22(%rip), %rsi      # 0x19fc0
callq 0x3250
jmp 0x112a5
movl $0x3, -0x40(%rbp)
jmp 0x11351
movq 0x8d18(%rip), %rdi      # 0x19fd0
leaq 0x191d(%rip), %rsi      # 0x12bdc
callq 0x3210
movq %rax, -0x78(%rbp)
jmp 0x112ca
movq -0x78(%rbp), %rdi
movq 0x8ceb(%rip), %rsi      # 0x19fc0
callq 0x3250
jmp 0x112dc
jmp 0x11348
leaq 0x1883(%rip), %rsi      # 0x12b68
leaq -0x30(%rbp), %rdi
callq 0x11750
movb %al, -0x79(%rbp)
jmp 0x112f3
movb -0x79(%rbp), %al
testb $0x1, %al
jne 0x112fc
jmp 0x11313
movq -0x8(%rbp), %rax
movq 0x1749(%rip), %rcx      # 0x12a50
movq %rcx, (%rax)
movl $0x3, -0x40(%rbp)
jmp 0x11351
movq 0x8cb6(%rip), %rdi      # 0x19fd0
leaq 0x1760(%rip), %rsi      # 0x12a81
callq 0x3210
movq %rax, -0x88(%rbp)
jmp 0x1132f
movq -0x88(%rbp), %rdi
movq 0x8c83(%rip), %rsi      # 0x19fc0
callq 0x3250
jmp 0x11344
jmp 0x11346
jmp 0x11348
jmp 0x1134a
movl $0x0, -0x40(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x3130
movl -0x40(%rbp), %eax
testl %eax, %eax
je 0x11365
jmp 0x11363
jmp 0x1136a
jmp 0x11173
addq $0x90, %rsp
popq %rbp
retq
movq -0x38(%rbp), %rdi
callq 0x33a0
nopl (%rax)