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 colorComparisonMode;
|
||||
string compareName;
|
||||
int CDopponentDamaged;
|
||||
int CDcontrollerDamaged;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -50,8 +50,11 @@ class MTGCardInstance: public CardPrimitive, public MTGCard, public Damageable {
|
||||
int sunburst;
|
||||
int equipment;
|
||||
int auras;
|
||||
bool wasDealtDamage;
|
||||
bool damageToOpponent;
|
||||
bool damageToController;
|
||||
int reduxamount;
|
||||
int flanked;
|
||||
int flanked;
|
||||
int regenerateTokens;
|
||||
int isToken;
|
||||
int origpower;
|
||||
@@ -65,6 +68,7 @@ class MTGCardInstance: public CardPrimitive, public MTGCard, public Damageable {
|
||||
int isLeveler;
|
||||
bool enchanted;
|
||||
int CDenchanted;
|
||||
int CDdamaged;
|
||||
bool blinked;
|
||||
bool isExtraCostTarget;
|
||||
bool morphed;
|
||||
@@ -75,14 +79,14 @@ class MTGCardInstance: public CardPrimitive, public MTGCard, public Damageable {
|
||||
int phasedTurn;
|
||||
bool graveEffects;
|
||||
bool exileEffects;
|
||||
|
||||
int stillInUse();
|
||||
int didattacked;
|
||||
int didblocked;
|
||||
int notblocked;
|
||||
int fresh;
|
||||
int MaxLevelUp;
|
||||
Player * lastController;
|
||||
|
||||
int stillInUse();
|
||||
int didattacked;
|
||||
int didblocked;
|
||||
int notblocked;
|
||||
int fresh;
|
||||
int MaxLevelUp;
|
||||
Player * lastController;
|
||||
MTGGameZone * getCurrentZone();
|
||||
MTGGameZone * previousZone;
|
||||
MTGCardInstance * previous;
|
||||
|
||||
@@ -105,6 +105,13 @@ class ThisNotBlocked:public ThisDescriptor{
|
||||
ThisNotBlocked(int unblocked);
|
||||
};
|
||||
|
||||
class ThisDamaged:public ThisDescriptor{
|
||||
public:
|
||||
virtual int match(MTGCardInstance * card);
|
||||
|
||||
ThisDamaged(int wasDealtDamage);
|
||||
};
|
||||
|
||||
class ThisPower:public ThisDescriptor{
|
||||
public:
|
||||
virtual int match(MTGCardInstance * card);
|
||||
|
||||
@@ -20,6 +20,8 @@ CardDescriptor::CardDescriptor() : MTGCardInstance()
|
||||
compareName ="";
|
||||
nameComparisonMode = COMPARISON_NONE;
|
||||
colorComparisonMode = COMPARISON_NONE;
|
||||
CDopponentDamaged = 0;
|
||||
CDcontrollerDamaged = 0;
|
||||
}
|
||||
|
||||
int CardDescriptor::init()
|
||||
@@ -281,6 +283,21 @@ MTGCardInstance * CardDescriptor::match(MTGCardInstance * card)
|
||||
{
|
||||
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))
|
||||
{
|
||||
match = NULL;
|
||||
|
||||
@@ -171,8 +171,18 @@ int Damage::resolve()
|
||||
//return the left over amount after effects have been applied to them.
|
||||
a = target->dealDamage(damage);
|
||||
target->damageCount += 1;
|
||||
if (target->type_as_damageable == DAMAGEABLE_MTGCARDINSTANCE)
|
||||
((MTGCardInstance*)target)->wasDealtDamage = true;
|
||||
if (target->type_as_damageable == DAMAGEABLE_PLAYER)
|
||||
{
|
||||
if(target == source->controller())
|
||||
{
|
||||
((MTGCardInstance*)source)->damageToController = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
((MTGCardInstance*)source)->damageToOpponent = true;
|
||||
}
|
||||
target->lifeLostThisTurn += damage;
|
||||
WEvent * lifed = NEW WEventLife((Player*)target,-damage);
|
||||
GameObserver * game = GameObserver::GetInstance();
|
||||
|
||||
@@ -620,7 +620,7 @@ void GameObserver::gameStateBasedEffects()
|
||||
/////////////////////////////////////////////////
|
||||
//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)
|
||||
{
|
||||
@@ -637,6 +637,10 @@ void GameObserver::gameStateBasedEffects()
|
||||
c->flanked -= 1;
|
||||
}
|
||||
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))
|
||||
{
|
||||
c->controller()->castcount = 0;
|
||||
|
||||
@@ -127,6 +127,7 @@ void MTGCardInstance::initMTGCI()
|
||||
isLeveler = 0;
|
||||
enchanted = false;
|
||||
CDenchanted = NULL;
|
||||
CDdamaged = 0;
|
||||
blinked = false;
|
||||
isExtraCostTarget = false;
|
||||
morphed = false;
|
||||
@@ -141,7 +142,10 @@ void MTGCardInstance::initMTGCI()
|
||||
sunburst = NULL;
|
||||
equipment = 0;
|
||||
auras = 0;
|
||||
|
||||
damageToOpponent = false;
|
||||
damageToController = false;
|
||||
wasDealtDamage = false;
|
||||
|
||||
for (int i = 0; i < ManaCost::MANA_PAID_WITH_RETRACE +1; i++)
|
||||
alternateCostPaid[i] = 0;
|
||||
|
||||
|
||||
@@ -337,7 +337,7 @@ TargetChooser * TargetChooserFactory::createTargetChooser(string s, MTGCardInsta
|
||||
cd->isLeveler = 1;
|
||||
}
|
||||
}
|
||||
//creature is a level up creature
|
||||
//creature is enchanted
|
||||
else if (attribute.find("enchanted") != string::npos)
|
||||
{
|
||||
if (minus)
|
||||
@@ -349,6 +349,42 @@ TargetChooser * TargetChooserFactory::createTargetChooser(string s, MTGCardInsta
|
||||
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)
|
||||
{
|
||||
//card is multicolored?
|
||||
|
||||
@@ -228,6 +228,19 @@ ThisDescriptor * ThisDescriptorFactory::createThisDescriptor(string s)
|
||||
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
|
||||
found = s.find("opponentlife");
|
||||
if (found != string::npos)
|
||||
@@ -443,6 +456,20 @@ int ThisNotBlocked::match(MTGCardInstance * card)
|
||||
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)
|
||||
{
|
||||
comparisonCriterion = toughness;
|
||||
|
||||
Reference in New Issue
Block a user