Erwan
-fix issue 33
This commit is contained in:
@@ -129,6 +129,10 @@ class MTGCardInstance: public MTGCard, public Damageable {
|
||||
JSample * getSample();
|
||||
|
||||
ostream& toString(ostream&) const;
|
||||
|
||||
static MTGCardInstance AnyCard;
|
||||
static MTGCardInstance NoCard;
|
||||
|
||||
};
|
||||
|
||||
ostream& operator<<(ostream&, const MTGCardInstance&);
|
||||
|
||||
@@ -112,21 +112,21 @@ MTGCardInstance * CardDescriptor::match(MTGCardInstance * card){
|
||||
|
||||
|
||||
if (attacker == 1){
|
||||
if ((int)defenser == 1){
|
||||
if (defenser == &AnyCard){
|
||||
if (!card->attacker && !card->defenser) match = NULL;
|
||||
}else{
|
||||
if (!card->attacker) match = NULL;
|
||||
}
|
||||
}else if (attacker == -1){
|
||||
if ((int)defenser == -1){
|
||||
if (defenser == &NoCard){
|
||||
if (card->attacker || card->defenser) match = NULL;
|
||||
}else{
|
||||
if (card->attacker) match = NULL;
|
||||
}
|
||||
}else{
|
||||
if ((int)defenser == -1){
|
||||
if (defenser == &NoCard){
|
||||
if (card->defenser) match = NULL;
|
||||
}else if ((int)defenser == 1){
|
||||
}else if (defenser == &AnyCard){
|
||||
if (!card->defenser) match = NULL;
|
||||
}else{
|
||||
// we don't care about the attack/blocker state
|
||||
|
||||
@@ -12,6 +12,9 @@
|
||||
#include <algorithm>
|
||||
using namespace std;
|
||||
|
||||
MTGCardInstance MTGCardInstance::AnyCard = MTGCardInstance();
|
||||
MTGCardInstance MTGCardInstance::NoCard = MTGCardInstance();
|
||||
|
||||
MTGCardInstance::MTGCardInstance(): MTGCard(), Damageable(0), view(NULL){
|
||||
LOG("==Creating MTGCardInstance==");
|
||||
initMTGCI();
|
||||
|
||||
@@ -124,9 +124,9 @@ TargetChooser * TargetChooserFactory::createTargetChooser(string s, MTGCardInsta
|
||||
//Blocker
|
||||
}else if (attribute.find("blocking") != string::npos){
|
||||
if (minus){
|
||||
cd->defenser = (MTGCardInstance *)-1; //Oh yeah, that's ugly....
|
||||
cd->defenser = & MTGCardInstance::NoCard;
|
||||
}else{
|
||||
cd->defenser = (MTGCardInstance *)1;
|
||||
cd->defenser = & MTGCardInstance::AnyCard;
|
||||
}
|
||||
//Tapped, untapped
|
||||
}else if (attribute.find("tapped") != string::npos){
|
||||
|
||||
Reference in New Issue
Block a user