// File: MichaelXanth[P]RPG_Game/Main.cpp
// Function: main
int main(void)
{
    srand(time(NULL));
    Grid grid;
    Market market;
    Names name;
    vector<Hero*> heroes;

    grid.BuildGrid();

    heroes.push_back(new Paladin(name.names[rand() % name.names.size()],
                                 Hero::GetBaseHealth() , 1 , Hero::GetBaseMagicPower(),
                                 Hero::GetBaseDexterity() + (float(rand()) / RAND_MAX * 600), Hero::GetBaseStrength() + 2,
                                 Hero::GetBaseAgility(), 50));

    heroes.push_back(new Sorcerer(name.names[rand() % name.names.size()],
                                  Hero::GetBaseHealth() , 1 , Hero::GetBaseMagicPower(),
                                  Hero::GetBaseDexterity() + (float(rand()) / RAND_MAX * 800), Hero::GetBaseStrength(),
                                  Hero::GetBaseAgility() + (float(rand()) / RAND_MAX * 0.7), 50));

    heroes.push_back(new Warrior(name.names[rand() % name.names.size()],
                                 Hero::GetBaseHealth() , 1 , Hero::GetBaseMagicPower(),
                                 Hero::GetBaseDexterity() , Hero::GetBaseStrength() + 3,
                                 Hero::GetBaseAgility() + (float(rand()) / RAND_MAX * 0.8), 50));
    
    Game game(heroes , grid , market);
    game.Play();

    delete heroes[0];
    delete heroes[1];
    delete heroes[2];
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x480, %rsp            # imm = 0x480
movl $0x0, -0x4(%rbp)
xorl %eax, %eax
movl %eax, %edi
callq 0x4230
movl %eax, %edi
callq 0x4250
leaq -0x30(%rbp), %rdi
callq 0x1cdc0
leaq -0x228(%rbp), %rdi
callq 0x2f440
jmp 0x4829
leaq -0x2e0(%rbp), %rdi
callq 0x5e50
jmp 0x4837
leaq -0x2f8(%rbp), %rdi
callq 0x4fa0
leaq -0x30(%rbp), %rdi
callq 0x1cf90
jmp 0x484e
movl $0x128, %edi            # imm = 0x128
callq 0x4270
movq %rax, -0x390(%rbp)
jmp 0x4861
callq 0x40a0
cltq
movq %rax, -0x3a8(%rbp)
leaq -0x2e0(%rbp), %rdi
movq %rdi, -0x3b0(%rbp)
callq 0x5010
movq -0x3b0(%rbp), %rdi
movq %rax, %rcx
movq -0x3a8(%rbp), %rax
xorl %edx, %edx
divq %rcx
movq %rdx, %rsi
callq 0x4ff0
movq %rax, -0x3a0(%rbp)
callq 0x1ed60
movl %eax, -0x394(%rbp)
jmp 0x48b4
movl -0x394(%rbp), %eax
movl %eax, -0x304(%rbp)
movl $0x1, -0x308(%rbp)
callq 0x1ed30
movl %eax, -0x3b4(%rbp)
jmp 0x48d7
movl -0x3b4(%rbp), %eax
movl %eax, -0x30c(%rbp)
callq 0x1ed40
movl %eax, -0x3b8(%rbp)
jmp 0x48f0
movl -0x3b8(%rbp), %eax
movl %eax, %eax
cvtsi2ss %rax, %xmm0
movss %xmm0, -0x3c0(%rbp)
callq 0x40a0
movss -0x3c0(%rbp), %xmm1
cvtsi2ss %eax, %xmm0
movss 0x376e6(%rip), %xmm2    # 0x3c004
mulss %xmm2, %xmm0
movss 0x376de(%rip), %xmm2    # 0x3c008
mulss %xmm2, %xmm0
addss %xmm1, %xmm0
cvttss2si %xmm0, %rax
movl %eax, -0x310(%rbp)
callq 0x1ed50
movl %eax, -0x3bc(%rbp)
jmp 0x494a
movl -0x3bc(%rbp), %eax
addl $0x2, %eax
movl %eax, -0x314(%rbp)
callq 0x1ed70
movss %xmm0, -0x3c4(%rbp)
jmp 0x4968
movq -0x3a0(%rbp), %rsi
movq -0x390(%rbp), %rdi
movss -0x3c4(%rbp), %xmm0
movss %xmm0, -0x318(%rbp)
movl $0x32, -0x31c(%rbp)
movq %rsp, %rax
leaq -0x31c(%rbp), %rcx
movq %rcx, 0x10(%rax)
leaq -0x318(%rbp), %rcx
movq %rcx, 0x8(%rax)
leaq -0x314(%rbp), %rcx
movq %rcx, (%rax)
leaq -0x304(%rbp), %rdx
leaq -0x308(%rbp), %rcx
leaq -0x30c(%rbp), %r8
leaq -0x310(%rbp), %r9
callq 0x2d660
jmp 0x49d6
movq -0x390(%rbp), %rax
movq %rax, -0x300(%rbp)
leaq -0x2f8(%rbp), %rdi
leaq -0x300(%rbp), %rsi
callq 0x4fc0
jmp 0x49f9
movl $0x128, %edi            # imm = 0x128
callq 0x4270
movq %rax, -0x3d0(%rbp)
jmp 0x4a0c
callq 0x40a0
cltq
movq %rax, -0x3e8(%rbp)
leaq -0x2e0(%rbp), %rdi
movq %rdi, -0x3f0(%rbp)
callq 0x5010
movq -0x3f0(%rbp), %rdi
movq %rax, %rcx
movq -0x3e8(%rbp), %rax
xorl %edx, %edx
divq %rcx
movq %rdx, %rsi
callq 0x4ff0
movq %rax, -0x3e0(%rbp)
callq 0x1ed60
movl %eax, -0x3d4(%rbp)
jmp 0x4a5f
movl -0x3d4(%rbp), %eax
movl %eax, -0x32c(%rbp)
movl $0x1, -0x330(%rbp)
callq 0x1ed30
movl %eax, -0x3f4(%rbp)
jmp 0x4a82
movl -0x3f4(%rbp), %eax
movl %eax, -0x334(%rbp)
callq 0x1ed40
movl %eax, -0x3f8(%rbp)
jmp 0x4a9b
movl -0x3f8(%rbp), %eax
movl %eax, %eax
cvtsi2ss %rax, %xmm0
movss %xmm0, -0x400(%rbp)
callq 0x40a0
movss -0x400(%rbp), %xmm1
cvtsi2ss %eax, %xmm0
movss 0x3753b(%rip), %xmm2    # 0x3c004
mulss %xmm2, %xmm0
movss 0x37537(%rip), %xmm2    # 0x3c00c
mulss %xmm2, %xmm0
addss %xmm1, %xmm0
cvttss2si %xmm0, %rax
movl %eax, -0x338(%rbp)
callq 0x1ed50
movl %eax, -0x3fc(%rbp)
jmp 0x4af5
movl -0x3fc(%rbp), %eax
movl %eax, -0x33c(%rbp)
callq 0x1ed70
movss %xmm0, -0x404(%rbp)
jmp 0x4b10
movss -0x404(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
movsd %xmm0, -0x410(%rbp)
callq 0x40a0
movsd -0x410(%rbp), %xmm1
movq -0x3d0(%rbp), %rdi
movq -0x3e0(%rbp), %rsi
cvtsi2ss %eax, %xmm0
movss 0x374b9(%rip), %xmm2    # 0x3c004
mulss %xmm2, %xmm0
cvtss2sd %xmm0, %xmm0
movsd 0x374b5(%rip), %xmm2    # 0x3c010
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0x340(%rbp)
movl $0x32, -0x344(%rbp)
movq %rsp, %rax
leaq -0x344(%rbp), %rcx
movq %rcx, 0x10(%rax)
leaq -0x340(%rbp), %rcx
movq %rcx, 0x8(%rax)
leaq -0x33c(%rbp), %rcx
movq %rcx, (%rax)
leaq -0x32c(%rbp), %rdx
leaq -0x330(%rbp), %rcx
leaq -0x334(%rbp), %r8
leaq -0x338(%rbp), %r9
callq 0x2dde0
jmp 0x4bbf
movq -0x3d0(%rbp), %rax
movq %rax, -0x328(%rbp)
leaq -0x2f8(%rbp), %rdi
leaq -0x328(%rbp), %rsi
callq 0x4fc0
jmp 0x4be2
movl $0x128, %edi            # imm = 0x128
callq 0x4270
movq %rax, -0x418(%rbp)
jmp 0x4bf5
callq 0x40a0
cltq
movq %rax, -0x430(%rbp)
leaq -0x2e0(%rbp), %rdi
movq %rdi, -0x438(%rbp)
callq 0x5010
movq -0x438(%rbp), %rdi
movq %rax, %rcx
movq -0x430(%rbp), %rax
xorl %edx, %edx
divq %rcx
movq %rdx, %rsi
callq 0x4ff0
movq %rax, -0x428(%rbp)
callq 0x1ed60
movl %eax, -0x41c(%rbp)
jmp 0x4c48
movl -0x41c(%rbp), %eax
movl %eax, -0x354(%rbp)
movl $0x1, -0x358(%rbp)
callq 0x1ed30
movl %eax, -0x43c(%rbp)
jmp 0x4c6b
movl -0x43c(%rbp), %eax
movl %eax, -0x35c(%rbp)
callq 0x1ed40
movl %eax, -0x440(%rbp)
jmp 0x4c84
movl -0x440(%rbp), %eax
movl %eax, -0x360(%rbp)
callq 0x1ed50
movl %eax, -0x444(%rbp)
jmp 0x4c9d
movl -0x444(%rbp), %eax
addl $0x3, %eax
movl %eax, -0x364(%rbp)
callq 0x1ed70
movss %xmm0, -0x448(%rbp)
jmp 0x4cbb
movss -0x448(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
movsd %xmm0, -0x450(%rbp)
callq 0x40a0
movsd -0x450(%rbp), %xmm1
movq -0x418(%rbp), %rdi
movq -0x428(%rbp), %rsi
cvtsi2ss %eax, %xmm0
movss 0x3730e(%rip), %xmm2    # 0x3c004
mulss %xmm2, %xmm0
cvtss2sd %xmm0, %xmm0
movsd 0x37312(%rip), %xmm2    # 0x3c018
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0x368(%rbp)
movl $0x32, -0x36c(%rbp)
movq %rsp, %rax
leaq -0x36c(%rbp), %rcx
movq %rcx, 0x10(%rax)
leaq -0x368(%rbp), %rcx
movq %rcx, 0x8(%rax)
leaq -0x364(%rbp), %rcx
movq %rcx, (%rax)
leaq -0x354(%rbp), %rdx
leaq -0x358(%rbp), %rcx
leaq -0x35c(%rbp), %r8
leaq -0x360(%rbp), %r9
callq 0x2cb80
jmp 0x4d6a
movq -0x418(%rbp), %rax
movq %rax, -0x350(%rbp)
leaq -0x2f8(%rbp), %rdi
leaq -0x350(%rbp), %rsi
callq 0x4fc0
jmp 0x4d8d
leaq -0x388(%rbp), %rdi
leaq -0x2f8(%rbp), %rsi
leaq -0x30(%rbp), %rdx
leaq -0x228(%rbp), %rcx
callq 0x17c00
jmp 0x4dad
leaq -0x388(%rbp), %rdi
callq 0x17cd0
jmp 0x4dbb
leaq -0x2f8(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x5030
movq (%rax), %rax
movq %rax, -0x458(%rbp)
cmpq $0x0, %rax
je 0x4de8
movq -0x458(%rbp), %rdi
movq (%rdi), %rax
callq *0x18(%rax)
leaq -0x2f8(%rbp), %rdi
movl $0x1, %esi
callq 0x5030
movq (%rax), %rax
movq %rax, -0x460(%rbp)
cmpq $0x0, %rax
je 0x4e16
movq -0x460(%rbp), %rdi
movq (%rdi), %rax
callq *0x18(%rax)
leaq -0x2f8(%rbp), %rdi
movl $0x2, %esi
callq 0x5030
movq (%rax), %rax
movq %rax, -0x468(%rbp)
cmpq $0x0, %rax
je 0x4e44
movq -0x468(%rbp), %rdi
movq (%rdi), %rax
callq *0x18(%rax)
leaq -0x388(%rbp), %rdi
callq 0x17c40
leaq -0x2f8(%rbp), %rdi
callq 0x5050
leaq -0x2e0(%rbp), %rdi
callq 0x50b0
leaq -0x228(%rbp), %rdi
callq 0x30c10
leaq -0x30(%rbp), %rdi
callq 0x1cef0
movl -0x4(%rbp), %eax
addq $0x480, %rsp            # imm = 0x480
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x230(%rbp)
movl %eax, -0x234(%rbp)
jmp 0x4f7f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x230(%rbp)
movl %eax, -0x234(%rbp)
jmp 0x4f73
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x230(%rbp)
movl %eax, -0x234(%rbp)
jmp 0x4f5b
movq -0x390(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x230(%rbp)
movl %eax, -0x234(%rbp)
movl $0x128, %esi            # imm = 0x128
callq 0x4280
jmp 0x4f5b
movq -0x3d0(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x230(%rbp)
movl %eax, -0x234(%rbp)
movl $0x128, %esi            # imm = 0x128
callq 0x4280
jmp 0x4f5b
movq -0x418(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x230(%rbp)
movl %eax, -0x234(%rbp)
movl $0x128, %esi            # imm = 0x128
callq 0x4280
jmp 0x4f5b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x230(%rbp)
movl %eax, -0x234(%rbp)
leaq -0x388(%rbp), %rdi
callq 0x17c40
leaq -0x2f8(%rbp), %rdi
callq 0x5050
leaq -0x2e0(%rbp), %rdi
callq 0x50b0
leaq -0x228(%rbp), %rdi
callq 0x30c10
leaq -0x30(%rbp), %rdi
callq 0x1cef0
movq -0x230(%rbp), %rdi
callq 0x4440
nopw %cs:(%rax,%rax)
nop