-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbanish.cc
More file actions
35 lines (32 loc) · 846 Bytes
/
banish.cc
File metadata and controls
35 lines (32 loc) · 846 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include <iostream>
#include <sstream>
#include "banish.h"
#include "board.h"
using namespace std;
Banish::Banish() : Spell{"Banish", 2, "Destroy target minion or ritual"} {}
void Banish::use(shared_ptr<Board> myBoard, int p, string t, shared_ptr<Board> oBoard)
{
if (t == "r")
{
if (p == myBoard->owner)
myBoard->myRitual = nullptr;
else
oBoard->myRitual = nullptr;
}
else
{
istringstream iss{t};
int i;
iss >> i;
if (p == myBoard->owner)
{
myBoard->sendGrave(myBoard->minions[i - 1]);
myBoard->minions.erase(myBoard->minions.begin() + i - 1);
}
else
{
oBoard->sendGrave(oBoard->minions[i - 1]);
oBoard->minions.erase(oBoard->minions.begin() + i - 1);
}
}
}