added
this(damaged) added targetchooser [damaged] status added targetchooser [controllerdamager] targetchooser [opponentdamager] basically checks for whos doing damage to who in a match per turn.
This commit is contained in:
@@ -59,6 +59,8 @@ class CardDescriptor: public MTGCardInstance{
|
|||||||
int nameComparisonMode;
|
int nameComparisonMode;
|
||||||
int colorComparisonMode;
|
int colorComparisonMode;
|
||||||
string compareName;
|
string compareName;
|
||||||
|
int CDopponentDamaged;
|
||||||
|
int CDcontrollerDamaged;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -50,6 +50,9 @@ class MTGCardInstance: public CardPrimitive, public MTGCard, public Damageable {
|
|||||||
int sunburst;
|
int sunburst;
|
||||||
int equipment;
|
int equipment;
|
||||||
int auras;
|
int auras;
|
||||||
|
bool wasDealtDamage;
|
||||||
|
bool damageToOpponent;
|
||||||
|
bool damageToController;
|
||||||
int reduxamount;
|
int reduxamount;
|
||||||
int flanked;
|
int flanked;
|
||||||
int regenerateTokens;
|
int regenerateTokens;
|
||||||
@@ -65,6 +68,7 @@ class MTGCardInstance: public CardPrimitive, public MTGCard, public Damageable {
|
|||||||
int isLeveler;
|
int isLeveler;
|
||||||
bool enchanted;
|
bool enchanted;
|
||||||
int CDenchanted;
|
int CDenchanted;
|
||||||
|
int CDdamaged;
|
||||||
bool blinked;
|
bool blinked;
|
||||||
bool isExtraCostTarget;
|
bool isExtraCostTarget;
|
||||||
bool morphed;
|
bool morphed;
|
||||||
|
|||||||
@@ -105,6 +105,13 @@ class ThisNotBlocked:public ThisDescriptor{
|
|||||||
ThisNotBlocked(int unblocked);
|
ThisNotBlocked(int unblocked);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class ThisDamaged:public ThisDescriptor{
|
||||||
|
public:
|
||||||
|
virtual int match(MTGCardInstance * card);
|
||||||
|
|
||||||
|
ThisDamaged(int wasDealtDamage);
|
||||||
|
};
|
||||||
|
|
||||||
class ThisPower:public ThisDescriptor{
|
class ThisPower:public ThisDescriptor{
|
||||||
public:
|
public:
|
||||||
virtual int match(MTGCardInstance * card);
|
virtual int match(MTGCardInstance * card);
|
||||||
|
|||||||
@@ -20,6 +20,8 @@ CardDescriptor::CardDescriptor() : MTGCardInstance()
|
|||||||
compareName ="";
|
compareName ="";
|
||||||
nameComparisonMode = COMPARISON_NONE;
|
nameComparisonMode = COMPARISON_NONE;
|
||||||
colorComparisonMode = COMPARISON_NONE;
|
colorComparisonMode = COMPARISON_NONE;
|
||||||
|
CDopponentDamaged = 0;
|
||||||
|
CDcontrollerDamaged = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CardDescriptor::init()
|
int CardDescriptor::init()
|
||||||
@@ -281,6 +283,21 @@ MTGCardInstance * CardDescriptor::match(MTGCardInstance * card)
|
|||||||
{
|
{
|
||||||
match = NULL;
|
match = NULL;
|
||||||
}
|
}
|
||||||
|
if ((CDdamaged == -1 && card->wasDealtDamage) || (CDdamaged == 1 && !card->wasDealtDamage))
|
||||||
|
{
|
||||||
|
match = NULL;
|
||||||
|
}
|
||||||
|
Player * p = controller()->opponent();
|
||||||
|
if ((CDopponentDamaged == -1 && card->damageToOpponent && card->controller() == p) || (CDopponentDamaged == 1 && !card->damageToOpponent && card->controller() == p)
|
||||||
|
|| (CDopponentDamaged == -1 && card->damageToController && card->controller() == p->opponent()) || (CDopponentDamaged == 1 && !card->damageToController && card->controller() == p->opponent()))
|
||||||
|
{
|
||||||
|
match = NULL;
|
||||||
|
}
|
||||||
|
if ((CDcontrollerDamaged == -1 && card->damageToController && card->controller() == p) || (CDcontrollerDamaged == 1 && !card->damageToController && card->controller() == p)
|
||||||
|
|| (CDcontrollerDamaged == -1 && card->damageToOpponent && card->controller() == p->opponent()) || (CDcontrollerDamaged == 1 && !card->damageToOpponent && card->controller() == p->opponent()))
|
||||||
|
{
|
||||||
|
match = NULL;
|
||||||
|
}
|
||||||
if ((isToken == -1 && card->isToken) || (isToken == 1 && !card->isToken))
|
if ((isToken == -1 && card->isToken) || (isToken == 1 && !card->isToken))
|
||||||
{
|
{
|
||||||
match = NULL;
|
match = NULL;
|
||||||
|
|||||||
@@ -171,8 +171,18 @@ int Damage::resolve()
|
|||||||
//return the left over amount after effects have been applied to them.
|
//return the left over amount after effects have been applied to them.
|
||||||
a = target->dealDamage(damage);
|
a = target->dealDamage(damage);
|
||||||
target->damageCount += 1;
|
target->damageCount += 1;
|
||||||
|
if (target->type_as_damageable == DAMAGEABLE_MTGCARDINSTANCE)
|
||||||
|
((MTGCardInstance*)target)->wasDealtDamage = true;
|
||||||
if (target->type_as_damageable == DAMAGEABLE_PLAYER)
|
if (target->type_as_damageable == DAMAGEABLE_PLAYER)
|
||||||
{
|
{
|
||||||
|
if(target == source->controller())
|
||||||
|
{
|
||||||
|
((MTGCardInstance*)source)->damageToController = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
((MTGCardInstance*)source)->damageToOpponent = true;
|
||||||
|
}
|
||||||
target->lifeLostThisTurn += damage;
|
target->lifeLostThisTurn += damage;
|
||||||
WEvent * lifed = NEW WEventLife((Player*)target,-damage);
|
WEvent * lifed = NEW WEventLife((Player*)target,-damage);
|
||||||
GameObserver * game = GameObserver::GetInstance();
|
GameObserver * game = GameObserver::GetInstance();
|
||||||
|
|||||||
@@ -620,7 +620,7 @@ void GameObserver::gameStateBasedEffects()
|
|||||||
/////////////////////////////////////////////////
|
/////////////////////////////////////////////////
|
||||||
//handle end of turn effects while we're at it.//
|
//handle end of turn effects while we're at it.//
|
||||||
/////////////////////////////////////////////////
|
/////////////////////////////////////////////////
|
||||||
if (currentGamePhase == Constants::MTG_PHASE_ENDOFTURN)
|
if (currentGamePhase == Constants::MTG_PHASE_ENDOFTURN+1)
|
||||||
{
|
{
|
||||||
for (int j = 0; j < nbcards; ++j)
|
for (int j = 0; j < nbcards; ++j)
|
||||||
{
|
{
|
||||||
@@ -637,6 +637,10 @@ void GameObserver::gameStateBasedEffects()
|
|||||||
c->flanked -= 1;
|
c->flanked -= 1;
|
||||||
}
|
}
|
||||||
if (c->fresh) c->fresh = 0;
|
if (c->fresh) c->fresh = 0;
|
||||||
|
if(c->wasDealtDamage && c->isInPlay())
|
||||||
|
c->wasDealtDamage = false;
|
||||||
|
c->damageToController = false;
|
||||||
|
c->damageToOpponent = false;
|
||||||
if (c->has(Constants::ONLYONEBOTH))
|
if (c->has(Constants::ONLYONEBOTH))
|
||||||
{
|
{
|
||||||
c->controller()->castcount = 0;
|
c->controller()->castcount = 0;
|
||||||
|
|||||||
@@ -127,6 +127,7 @@ void MTGCardInstance::initMTGCI()
|
|||||||
isLeveler = 0;
|
isLeveler = 0;
|
||||||
enchanted = false;
|
enchanted = false;
|
||||||
CDenchanted = NULL;
|
CDenchanted = NULL;
|
||||||
|
CDdamaged = 0;
|
||||||
blinked = false;
|
blinked = false;
|
||||||
isExtraCostTarget = false;
|
isExtraCostTarget = false;
|
||||||
morphed = false;
|
morphed = false;
|
||||||
@@ -141,6 +142,9 @@ void MTGCardInstance::initMTGCI()
|
|||||||
sunburst = NULL;
|
sunburst = NULL;
|
||||||
equipment = 0;
|
equipment = 0;
|
||||||
auras = 0;
|
auras = 0;
|
||||||
|
damageToOpponent = false;
|
||||||
|
damageToController = false;
|
||||||
|
wasDealtDamage = false;
|
||||||
|
|
||||||
for (int i = 0; i < ManaCost::MANA_PAID_WITH_RETRACE +1; i++)
|
for (int i = 0; i < ManaCost::MANA_PAID_WITH_RETRACE +1; i++)
|
||||||
alternateCostPaid[i] = 0;
|
alternateCostPaid[i] = 0;
|
||||||
|
|||||||
@@ -337,7 +337,7 @@ TargetChooser * TargetChooserFactory::createTargetChooser(string s, MTGCardInsta
|
|||||||
cd->isLeveler = 1;
|
cd->isLeveler = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//creature is a level up creature
|
//creature is enchanted
|
||||||
else if (attribute.find("enchanted") != string::npos)
|
else if (attribute.find("enchanted") != string::npos)
|
||||||
{
|
{
|
||||||
if (minus)
|
if (minus)
|
||||||
@@ -349,6 +349,42 @@ TargetChooser * TargetChooserFactory::createTargetChooser(string s, MTGCardInsta
|
|||||||
cd->CDenchanted = 1;
|
cd->CDenchanted = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//creature was damaged
|
||||||
|
else if (attribute.find("damaged") != string::npos)
|
||||||
|
{
|
||||||
|
if (minus)
|
||||||
|
{
|
||||||
|
cd->CDdamaged = -1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cd->CDdamaged = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//creature dealt damage to opponent
|
||||||
|
else if (attribute.find("opponentdamager") != string::npos)
|
||||||
|
{
|
||||||
|
if (minus)
|
||||||
|
{
|
||||||
|
cd->CDopponentDamaged = -1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cd->CDopponentDamaged = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//creature dealt damage to controller
|
||||||
|
else if (attribute.find("controllerdamager") != string::npos)
|
||||||
|
{
|
||||||
|
if (minus)
|
||||||
|
{
|
||||||
|
cd->CDcontrollerDamaged = -1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cd->CDcontrollerDamaged = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
else if (attribute.find("multicolor") != string::npos)
|
else if (attribute.find("multicolor") != string::npos)
|
||||||
{
|
{
|
||||||
//card is multicolored?
|
//card is multicolored?
|
||||||
|
|||||||
@@ -228,6 +228,19 @@ ThisDescriptor * ThisDescriptorFactory::createThisDescriptor(string s)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//this creature was dealt damage this turn
|
||||||
|
found = s.find("damaged");
|
||||||
|
if (found != string::npos)
|
||||||
|
{
|
||||||
|
ThisDamaged * td = NEW ThisDamaged(criterion);
|
||||||
|
if (td)
|
||||||
|
{
|
||||||
|
td->comparisonMode = mode;
|
||||||
|
return td;
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
//controller life
|
//controller life
|
||||||
found = s.find("opponentlife");
|
found = s.find("opponentlife");
|
||||||
if (found != string::npos)
|
if (found != string::npos)
|
||||||
@@ -443,6 +456,20 @@ int ThisNotBlocked::match(MTGCardInstance * card)
|
|||||||
return matchValue(card->notblocked);
|
return matchValue(card->notblocked);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ThisDamaged::ThisDamaged(int wasDealtDamage)
|
||||||
|
{
|
||||||
|
|
||||||
|
comparisonCriterion = wasDealtDamage;
|
||||||
|
}
|
||||||
|
|
||||||
|
int ThisDamaged::match(MTGCardInstance * card)
|
||||||
|
{
|
||||||
|
int result = 0;
|
||||||
|
if(card->wasDealtDamage)
|
||||||
|
result = 1;
|
||||||
|
return matchValue(result);
|
||||||
|
}
|
||||||
|
|
||||||
ThisToughness::ThisToughness(int toughness)
|
ThisToughness::ThisToughness(int toughness)
|
||||||
{
|
{
|
||||||
comparisonCriterion = toughness;
|
comparisonCriterion = toughness;
|
||||||
|
|||||||
Reference in New Issue
Block a user