-fix issue 33
This commit is contained in:
wagic.the.homebrew@gmail.com
2009-09-25 14:06:31 +00:00
parent eabb99c675
commit 1534397f2b
4 changed files with 13 additions and 6 deletions

View File

@@ -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&);

View File

@@ -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

View File

@@ -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();

View File

@@ -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){