// File: MichaelXanth[P]RPG_Game/Battle/Battle.cpp
// Function: Battle::FindMonster(unsigned int)
Monster* Battle::FindMonster(unsigned int heroLvl) 
{
    short monChance = rand() % 3;
    Monster* newMon = NULL;

    switch(monChance)
    {
        case 0:
            newMon = new Exoskeleton("Exoskeleton",/*increased defence*/
                                     Monster::MonsterGetBaseHP() + heroLvl * 4 , heroLvl,
                                     Monster::MonsterGetBaseDamage() + heroLvl,
                                     Monster::MonsterGetBaseDamage() + heroLvl * 2,
                                     Monster::MonsterGetBaseDefence() + heroLvl * 3,
                                     Monster::MonsterGetBaseAvoidance() + heroLvl * 0.001);
            break;
        case 1:
            newMon = new Spirit("Spirit",/*increased avoidance*/
                                Monster::MonsterGetBaseHP() + heroLvl * 4 , heroLvl,
                                Monster::MonsterGetBaseDamage() + heroLvl,
                                Monster::MonsterGetBaseDamage() + heroLvl * 2,
                                Monster::MonsterGetBaseDefence() + heroLvl * 2,
                                Monster::MonsterGetBaseAvoidance() + heroLvl * 0.0015);
            break;
        case 2:
            newMon = new Dragon("Dragon",/*increased damage*/
                                Monster::MonsterGetBaseHP() + heroLvl * 4 , heroLvl,
                                Monster::MonsterGetBaseDamage() + heroLvl,
                                Monster::MonsterGetBaseDamage() + heroLvl * 2,
                                Monster::MonsterGetBaseDefence() + heroLvl * 2,
                                Monster::MonsterGetBaseAvoidance() + heroLvl * 0.001);
            break;
    }
    return newMon;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x170, %rsp            # imm = 0x170
movl %edi, -0x4(%rbp)
callq 0x40a0
movslq %eax, %rcx
imulq $0x55555556, %rcx, %rdx # imm = 0x55555556
movq %rdx, %rcx
shrq $0x3f, %rcx
shrq $0x20, %rdx
addl %ecx, %edx
movl %edx, %ecx
leal (%rcx,%rcx,2), %ecx
subl %ecx, %eax
movw %ax, -0x6(%rbp)
movq $0x0, -0x10(%rbp)
movswl -0x6(%rbp), %eax
movl %eax, -0xe0(%rbp)
testl %eax, %eax
je 0x170a2
jmp 0x1707d
movl -0xe0(%rbp), %eax
subl $0x1, %eax
je 0x1723b
jmp 0x1708e
movl -0xe0(%rbp), %eax
subl $0x2, %eax
je 0x17404
jmp 0x175d3
movl $0x68, %edi
callq 0x4270
movq %rax, -0xf0(%rbp)
movb $0x1, -0x59(%rbp)
leaq -0x31(%rbp), %rdi
movq %rdi, -0xe8(%rbp)
callq 0x4450
movq -0xe8(%rbp), %rdx
leaq 0x261a7(%rip), %rsi     # 0x3d27c
leaq -0x30(%rbp), %rdi
callq 0x16380
jmp 0x170e0
callq 0x2e670
movl %eax, -0xf4(%rbp)
jmp 0x170ed
movl -0xf4(%rbp), %edx
movl -0x4(%rbp), %eax
movl %eax, %ecx
movl %edx, %eax
leal (%rax,%rcx,4), %eax
movl %eax, -0x48(%rbp)
callq 0x2e680
movl %eax, -0xf8(%rbp)
jmp 0x1710d
movl -0xf8(%rbp), %eax
movl -0x4(%rbp), %ecx
addl %ecx, %eax
movl %eax, -0x4c(%rbp)
callq 0x2e680
movl %eax, -0xfc(%rbp)
jmp 0x17128
movl -0xfc(%rbp), %edx
movl -0x4(%rbp), %eax
movl %eax, %ecx
movl %edx, %eax
leal (%rax,%rcx,2), %eax
movl %eax, -0x50(%rbp)
callq 0x2e690
movl %eax, -0x100(%rbp)
jmp 0x17148
movl -0x100(%rbp), %eax
movl -0x4(%rbp), %edx
movl %edx, %ecx
leal (%rcx,%rcx,2), %ecx
addl %ecx, %eax
movl %eax, -0x54(%rbp)
callq 0x2e6a0
movss %xmm0, -0x104(%rbp)
jmp 0x1716a
movq -0xf0(%rbp), %rdi
movss -0x104(%rbp), %xmm0
cvtss2sd %xmm0, %xmm1
movl -0x4(%rbp), %eax
cvtsi2sd %rax, %xmm0
movsd 0x260db(%rip), %xmm2    # 0x3d268
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0x58(%rbp)
movq %rsp, %rax
leaq -0x58(%rbp), %rcx
movq %rcx, 0x8(%rax)
leaq -0x54(%rbp), %rcx
movq %rcx, (%rax)
leaq -0x30(%rbp), %rsi
leaq -0x48(%rbp), %rdx
leaq -0x4(%rbp), %rcx
leaq -0x4c(%rbp), %r8
leaq -0x50(%rbp), %r9
callq 0x2ec50
jmp 0x171cb
movq -0xf0(%rbp), %rax
movb $0x0, -0x59(%rbp)
movq %rax, -0x10(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x4160
leaq -0x31(%rbp), %rdi
callq 0x42b0
jmp 0x175d3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x17214
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x4160
leaq -0x31(%rbp), %rdi
callq 0x42b0
testb $0x1, -0x59(%rbp)
jne 0x17225
jmp 0x17236
movq -0xf0(%rbp), %rdi
movl $0x68, %esi
callq 0x4280
jmp 0x175e0
movl $0x68, %edi
callq 0x4270
movq %rax, -0x118(%rbp)
movb $0x1, -0x99(%rbp)
leaq -0x81(%rbp), %rdi
movq %rdi, -0x110(%rbp)
callq 0x4450
movq -0x110(%rbp), %rdx
leaq 0x25b7d(%rip), %rsi     # 0x3cdf1
leaq -0x80(%rbp), %rdi
callq 0x16380
jmp 0x1727f
callq 0x2e670
movl %eax, -0x11c(%rbp)
jmp 0x1728c
movl -0x11c(%rbp), %edx
movl -0x4(%rbp), %eax
movl %eax, %ecx
movl %edx, %eax
leal (%rax,%rcx,4), %eax
movl %eax, -0x88(%rbp)
callq 0x2e680
movl %eax, -0x120(%rbp)
jmp 0x172af
movl -0x120(%rbp), %eax
movl -0x4(%rbp), %ecx
addl %ecx, %eax
movl %eax, -0x8c(%rbp)
callq 0x2e680
movl %eax, -0x124(%rbp)
jmp 0x172cd
movl -0x124(%rbp), %edx
movl -0x4(%rbp), %eax
movl %eax, %ecx
movl %edx, %eax
leal (%rax,%rcx,2), %eax
movl %eax, -0x90(%rbp)
callq 0x2e690
movl %eax, -0x128(%rbp)
jmp 0x172f0
movl -0x128(%rbp), %edx
movl -0x4(%rbp), %eax
movl %eax, %ecx
movl %edx, %eax
leal (%rax,%rcx,2), %eax
movl %eax, -0x94(%rbp)
callq 0x2e6a0
movss %xmm0, -0x12c(%rbp)
jmp 0x17315
movq -0x118(%rbp), %rdi
movss -0x12c(%rbp), %xmm0
cvtss2sd %xmm0, %xmm1
movl -0x4(%rbp), %eax
cvtsi2sd %rax, %xmm0
movsd 0x25f38(%rip), %xmm2    # 0x3d270
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0x98(%rbp)
movq %rsp, %rax
leaq -0x98(%rbp), %rcx
movq %rcx, 0x8(%rax)
leaq -0x94(%rbp), %rcx
movq %rcx, (%rax)
leaq -0x80(%rbp), %rsi
leaq -0x88(%rbp), %rdx
leaq -0x4(%rbp), %rcx
leaq -0x8c(%rbp), %r8
leaq -0x90(%rbp), %r9
callq 0x2eb80
jmp 0x17388
movq -0x118(%rbp), %rax
movb $0x0, -0x99(%rbp)
movq %rax, -0x10(%rbp)
leaq -0x80(%rbp), %rdi
callq 0x4160
leaq -0x81(%rbp), %rdi
callq 0x42b0
jmp 0x175d3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x173d7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x80(%rbp), %rdi
callq 0x4160
leaq -0x81(%rbp), %rdi
callq 0x42b0
testb $0x1, -0x99(%rbp)
jne 0x173ee
jmp 0x173ff
movq -0x118(%rbp), %rdi
movl $0x68, %esi
callq 0x4280
jmp 0x175e0
movl $0x68, %edi
callq 0x4270
movq %rax, -0x140(%rbp)
movb $0x1, -0xd9(%rbp)
leaq -0xc1(%rbp), %rdi
movq %rdi, -0x138(%rbp)
callq 0x4450
movq -0x138(%rbp), %rdx
leaq 0x25e4b(%rip), %rsi     # 0x3d288
leaq -0xc0(%rbp), %rdi
callq 0x16380
jmp 0x1744b
callq 0x2e670
movl %eax, -0x144(%rbp)
jmp 0x17458
movl -0x144(%rbp), %edx
movl -0x4(%rbp), %eax
movl %eax, %ecx
movl %edx, %eax
leal (%rax,%rcx,4), %eax
movl %eax, -0xc8(%rbp)
callq 0x2e680
movl %eax, -0x148(%rbp)
jmp 0x1747b
movl -0x148(%rbp), %eax
movl -0x4(%rbp), %ecx
addl %ecx, %eax
movl %eax, -0xcc(%rbp)
callq 0x2e680
movl %eax, -0x14c(%rbp)
jmp 0x17499
movl -0x14c(%rbp), %edx
movl -0x4(%rbp), %eax
movl %eax, %ecx
movl %edx, %eax
leal (%rax,%rcx,2), %eax
movl %eax, -0xd0(%rbp)
callq 0x2e690
movl %eax, -0x150(%rbp)
jmp 0x174bc
movl -0x150(%rbp), %edx
movl -0x4(%rbp), %eax
movl %eax, %ecx
movl %edx, %eax
leal (%rax,%rcx,2), %eax
movl %eax, -0xd4(%rbp)
callq 0x2e6a0
movss %xmm0, -0x154(%rbp)
jmp 0x174e1
movq -0x140(%rbp), %rdi
movss -0x154(%rbp), %xmm0
cvtss2sd %xmm0, %xmm1
movl -0x4(%rbp), %eax
cvtsi2sd %rax, %xmm0
movsd 0x25d64(%rip), %xmm2    # 0x3d268
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0xd8(%rbp)
movq %rsp, %rax
leaq -0xd8(%rbp), %rcx
movq %rcx, 0x8(%rax)
leaq -0xd4(%rbp), %rcx
movq %rcx, (%rax)
leaq -0xc0(%rbp), %rsi
leaq -0xc8(%rbp), %rdx
leaq -0x4(%rbp), %rcx
leaq -0xcc(%rbp), %r8
leaq -0xd0(%rbp), %r9
callq 0x2eab0
jmp 0x17557
movq -0x140(%rbp), %rax
movb $0x0, -0xd9(%rbp)
movq %rax, -0x10(%rbp)
leaq -0xc0(%rbp), %rdi
callq 0x4160
leaq -0xc1(%rbp), %rdi
callq 0x42b0
jmp 0x175d3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x175a9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0xc0(%rbp), %rdi
callq 0x4160
leaq -0xc1(%rbp), %rdi
callq 0x42b0
testb $0x1, -0xd9(%rbp)
jne 0x175c0
jmp 0x175d1
movq -0x140(%rbp), %rdi
movl $0x68, %esi
callq 0x4280
jmp 0x175e0
movq -0x10(%rbp), %rax
addq $0x170, %rsp            # imm = 0x170
popq %rbp
retq
movq -0x40(%rbp), %rdi
callq 0x4440
nopl (%rax)