// File: /workspace/github_cpp_makefile_star2_O1/BohangZhang[P]Sorcery-C-Project/act_minion.cc
// Function: Act_Minion::use(int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void Act_Minion::use(int p, string t) {
    if (getSilent()) throw 1;//Number; The minion has been silented
    // use(int, "r"), bonus part if we want to add an action attacking the Ritual card
    shared_ptr<Player> targetplayer = nullptr;
    if (p == 1) {
        targetplayer = this->master->getGame()->get1();
    } else {
        targetplayer = this->master->getGame()->get2();
    }
    
    /*if (t == "r") {
        if (targetplayer->isRitualEmpty()) {
            throw 1; // You haven't played a Ritual card!
        }
        if (name == "Banish") {
            targetplayer->getRitual() = nullptr;
        } else {
            throw 4; // The Spell cannot be played upon a Ritual!
        }
    } else {
    */
    int j;
    istringstream ss{t};
    ss >> j;
    
    if (targetplayer->getSlot()->getSize() < j) throw 3; // The target Minion DNE!
    if (name == "Novice Pyromancer") {
        shared_ptr<Minion> m = targetplayer->getSlot()->getSlot()[j-1];
        m->subDefense(1);    
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x1a0, %rsp            # imm = 0x1A0
movq %rdx, %r12
movl %esi, %ebx
movq %rdi, %r14
movq (%rdi), %rax
callq *0x60(%rax)
testb %al, %al
jne 0xc5f7
cmpl $0x1, %ebx
jne 0xc48b
movq 0x70(%r14), %rsi
leaq 0x8(%rsp), %rdi
callq 0x17b9e
movq 0x8(%rsp), %rsi
leaq 0x20(%rsp), %rdi
callq 0x12096
jmp 0xc4a8
movq 0x70(%r14), %rsi
leaq 0x8(%rsp), %rdi
callq 0x17b9e
movq 0x8(%rsp), %rsi
leaq 0x20(%rsp), %rdi
callq 0x120c2
movq 0x20(%rsp), %r15
movq 0x28(%rsp), %rbx
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%rsp)
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0xc4c9
callq 0xb634
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0xc4d8
callq 0xb634
leaq 0x20(%rsp), %rdi
movq %r12, %rsi
movl $0x8, %edx
callq 0x52e0
leaq 0x20(%rsp), %rdi
leaq 0x1c(%rsp), %rsi
callq 0x5130
leaq 0x8(%rsp), %rdi
movq %r15, %rsi
callq 0x17bd0
movq 0x8(%rsp), %rdi
callq 0x2470a
movl %eax, %ebp
movl 0x1c(%rsp), %r12d
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0xc526
callq 0xb634
cmpl %r12d, %ebp
jl 0xc618
addq $0x8, %r14
leaq 0x1b348(%rip), %rsi     # 0x27882
movq %r14, %rdi
callq 0x50a0
testl %eax, %eax
jne 0xc5bc
leaq 0x8(%rsp), %rdi
movq %r15, %rsi
callq 0x17bd0
movq 0x8(%rsp), %rdi
callq 0x24706
movslq 0x1c(%rsp), %rcx
movq (%rax), %rax
shlq $0x4, %rcx
movq -0x10(%rax,%rcx), %r14
movq -0x8(%rax,%rcx), %r15
testq %r15, %r15
je 0xc58f
movq 0x27a41(%rip), %rax     # 0x33fc0
cmpb $0x0, (%rax)
je 0xc58a
incl 0x8(%r15)
jmp 0xc58f
lock
incl 0x8(%r15)
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0xc59e
callq 0xb634
movq (%r14), %rax
movq %r14, %rdi
movl $0x1, %esi
callq *0xb8(%rax)
testq %r15, %r15
je 0xc5bc
movq %r15, %rdi
callq 0xb634
movq 0x279ed(%rip), %rsi     # 0x33fb0
leaq 0x20(%rsp), %rdi
callq 0x5280
leaq 0x98(%rsp), %rdi
callq 0x50b0
testq %rbx, %rbx
je 0xc5e7
movq %rbx, %rdi
callq 0xb634
addq $0x1a0, %rsp            # imm = 0x1A0
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movl $0x4, %edi
callq 0x5100
movl $0x1, (%rax)
movq 0x27982(%rip), %rsi     # 0x33f90
movq %rax, %rdi
xorl %edx, %edx
callq 0x5300
movl $0x4, %edi
callq 0x5100
movl $0x3, (%rax)
movq 0x27961(%rip), %rsi     # 0x33f90
movq %rax, %rdi
xorl %edx, %edx
callq 0x5300
movq %rax, %r14
testq %r15, %r15
je 0xc687
movq %r15, %rdi
jmp 0xc676
jmp 0xc669
jmp 0xc684
jmp 0xc64c
movq %rax, %r14
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0xc665
callq 0xb634
jmp 0xc665
jmp 0xc662
movq %rax, %r14
xorl %ebx, %ebx
jmp 0xc6a5
movq %rax, %r14
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0xc687
callq 0xb634
jmp 0xc687
jmp 0xc684
movq %rax, %r14
jmp 0xc6a5
movq %rax, %r14
movq 0x27922(%rip), %rsi     # 0x33fb0
leaq 0x20(%rsp), %rdi
callq 0x5280
leaq 0x98(%rsp), %rdi
callq 0x50b0
testq %rbx, %rbx
je 0xc6b2
movq %rbx, %rdi
callq 0xb634
movq %r14, %rdi
callq 0x5320