Fixed some primitives, fixed several bug on damage management for planeswalkers and battle cards, added new keywords "noloyaltydamage" and "nodefensedamage" to avoid damage remove counters,
This commit is contained in:
@@ -81333,8 +81333,11 @@ toughness=3
|
||||
[card]
|
||||
name=Spark Rupture
|
||||
auto=draw:1 controller
|
||||
auto=lord(planeswalker[counter{0/0.1.Loyatly}]|battlefield) loseabilities
|
||||
auto=lord(planeswalker[counter{0/0.1.Loyatly}]|battlefield) transforms((Creature,setpower=hascntloyalty,settoughness=hascntloyalty))
|
||||
auto=lord(planeswalker[counter{0/0.1.Loyalty}]|battlefield) loseabilities
|
||||
auto=lord(planeswalker[counter{0/0.1.Loyalty}]|battlefield) noloyaltydamage
|
||||
auto=lord(planeswalker[counter{0/0.1.Loyalty}]|battlefield) transforms((Creature,setpower=hascntloyalty,settoughness=hascntloyalty))
|
||||
auto=@counterremoved(0/0,1,Loyalty) from(planeswalker[counter{0/0.1.Loyalty}]|battlefield):lord(planeswalker[counter{0/0.1.Loyalty}]|battlefield) transforms((Creature,setpower=hascntloyalty,settoughness=hascntloyalty))
|
||||
auto=@counteradded(0/0,1,Loyalty) from(planeswalker[counter{0/0.1.Loyalty}]|battlefield):lord(planeswalker[counter{0/0.1.Loyalty}]|battlefield) transforms((Creature,setpower=hascntloyalty,settoughness=hascntloyalty))
|
||||
text=When Spark Rupture enters the battlefield, draw a card. -- Each planeswalker with one or more loyalty counters on it loses all abilities and is a creature with power and toughness each equal to the number of loyalty counters on it.
|
||||
mana={2}{W}
|
||||
type=Enchantment
|
||||
@@ -90712,7 +90715,7 @@ otherrestriction=can play equipment,compare(isflipped)~equalto~1
|
||||
restriction=compare(isflipped)~equalto~0
|
||||
anyzone={0}:doubleside(Toralf's Hammer)
|
||||
autostack=if paid(alternative) then flip(Toralf's Hammer) forcetype(Legendary Artifact)
|
||||
auto=@noncombatdamaged(*[creature;planeswalker]|opponentbattlefield) restriction{compare(isflipped)~equalto~0}:name(Deals damage) target(player,creature,planeswalker) damage:excessdamage
|
||||
auto=@noncombatdamaged(*[creature;planeswalker]|opponentbattlefield) restriction{compare(isflipped)~equalto~0,compare(excessdamage)~morethan~0}:name(Deals damage) target(player,creature,planeswalker) damage:excessdamage
|
||||
text=Trample -- Whenever a creature or planeswalker an opponent controls is dealt excess noncombat damage, Toralf, God of Fury deals damage equal to the excess to any target other than that permanent. // {1}{R} Toralf's Hammer
|
||||
mana={2}{R}{R}
|
||||
type=Legendary Creature
|
||||
|
||||
@@ -1240,6 +1240,10 @@ public:
|
||||
e->damage->target->exceededDamage = e->damage->target->life;
|
||||
e->damage->source->exceededDamage = e->damage->target->life;
|
||||
this->source->exceededDamage = e->damage->target->life;
|
||||
} else {
|
||||
e->damage->target->exceededDamage = 0;
|
||||
e->damage->source->exceededDamage = 0;
|
||||
this->source->exceededDamage = 0;
|
||||
}
|
||||
triggeredTurn = game->turn;
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ public:
|
||||
DamageableType type_as_damageable;
|
||||
Damageable(GameObserver* observer, int _life)
|
||||
: Targetable(observer), life(_life), handsize(0),
|
||||
poisonCount(0), damageCount(0), preventable(0), thatmuch(0),
|
||||
poisonCount(0), damageCount(0), preventable(0), thatmuch(0), exceededDamage(0),
|
||||
lifeLostThisTurn(0), lifeGainedThisTurn(0), type_as_damageable(DAMAGEABLE_MTGCARDINSTANCE)
|
||||
{}
|
||||
int getLife(){return life;}
|
||||
|
||||
@@ -341,7 +341,9 @@ class Constants
|
||||
NODAMAGEREMOVED = 213,
|
||||
BACKGROUNDPARTNER = 214,
|
||||
BOTTOMLIBRARYDEATH = 215,
|
||||
NB_BASIC_ABILITIES = 216,
|
||||
NOLOYALTYDAMAGE = 216,
|
||||
NODEFENSEDAMAGE = 217,
|
||||
NB_BASIC_ABILITIES = 218,
|
||||
|
||||
RARITY_S = 'S', //Special Rarity
|
||||
RARITY_M = 'M', //Mythics
|
||||
|
||||
@@ -3962,8 +3962,18 @@ ADrawReplacer::~ADrawReplacer()
|
||||
int AAResetDamage::resolve()
|
||||
{
|
||||
MTGCardInstance * _target = (MTGCardInstance *)target;
|
||||
if(!_target->has(Constants::NODAMAGEREMOVED)) // Added to avoid damage is removed from a card (e.g. "Patient Zero").
|
||||
_target->life = _target->toughness;
|
||||
if(!_target->has(Constants::NODAMAGEREMOVED)){ // Added to avoid damage is removed from a card (e.g. "Patient Zero").
|
||||
if (!_target->isCreature() && _target->hasType(Subtypes::TYPE_PLANESWALKER)){ // Fix life calculation for planeswalker damage.
|
||||
if (_target->counters && _target->counters->hasCounter("loyalty", 0, 0)) {
|
||||
_target->life = _target->counters->hasCounter("loyalty", 0, 0)->nb;
|
||||
}
|
||||
} else if (!_target->isCreature() && _target->hasType(Subtypes::TYPE_BATTLE)){ // Fix life calculation for battle damage.
|
||||
if (_target->counters && _target->counters->hasCounter("defense", 0, 0)) {
|
||||
_target->life = _target->counters->hasCounter("defense", 0, 0)->nb;
|
||||
}
|
||||
} else
|
||||
_target->life = _target->toughness;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -7824,6 +7834,9 @@ int ATransformer::addToGame()
|
||||
else
|
||||
_target->addbaseT(val->getValue());
|
||||
delete val;
|
||||
|
||||
if(_target->isCreature() && (_target->hasType(Subtypes::TYPE_BATTLE) || _target->hasType(Subtypes::TYPE_PLANESWALKER)) && _target->life > _target->toughness)
|
||||
_target->life = _target->toughness; // Fix for a Planeswalker or a Battle that becomes a creature (e.g. "Spark Rupture").
|
||||
}
|
||||
//remove manacost
|
||||
if(removemc)
|
||||
|
||||
@@ -189,7 +189,7 @@ MTGCardInstance * CardDescriptor::match_or(MTGCardInstance * card)
|
||||
if (powerComparisonMode && !valueInRange(powerComparisonMode, card->getPower(), power))
|
||||
return NULL;
|
||||
if (toughnessComparisonMode){ // Toughness comparison has a different meaning for planeswalkers and battles.
|
||||
if(card->counters && (card->hasType(Subtypes::TYPE_PLANESWALKER) || card->hasType(Subtypes::TYPE_BATTLE))){
|
||||
if(!card->isCreature() && card->counters && (card->hasType(Subtypes::TYPE_PLANESWALKER) || card->hasType(Subtypes::TYPE_BATTLE))){
|
||||
for(size_t i = 0; i < card->counters->counters.size(); ++i){
|
||||
if((card->counters->counters[i]->name == "loyalty" && card->hasType(Subtypes::TYPE_PLANESWALKER)) || (card->counters->counters[i]->name == "defense" && card->hasType(Subtypes::TYPE_BATTLE))){
|
||||
if(!valueInRange(toughnessComparisonMode, card->counters->counters[i]->nb, toughness))
|
||||
@@ -246,7 +246,7 @@ MTGCardInstance * CardDescriptor::match_and(MTGCardInstance * card)
|
||||
if (powerComparisonMode && !valueInRange(powerComparisonMode, card->getPower(), power))
|
||||
match = NULL;
|
||||
if (toughnessComparisonMode){ // Toughness comparison has a different meaning for planeswalkers and battles.
|
||||
if(card->counters && (card->hasType(Subtypes::TYPE_PLANESWALKER) || card->hasType(Subtypes::TYPE_BATTLE))){
|
||||
if(!card->isCreature() && card->counters && (card->hasType(Subtypes::TYPE_PLANESWALKER) || card->hasType(Subtypes::TYPE_BATTLE))){
|
||||
for(size_t i = 0; i < card->counters->counters.size(); ++i){
|
||||
if((card->counters->counters[i]->name == "loyalty" && card->hasType(Subtypes::TYPE_PLANESWALKER)) || (card->counters->counters[i]->name == "defense" && card->hasType(Subtypes::TYPE_BATTLE))){
|
||||
if(!valueInRange(toughnessComparisonMode, card->counters->counters[i]->nb, toughness))
|
||||
|
||||
@@ -297,32 +297,6 @@ int Damage::resolve()
|
||||
observer->setLoser(((MTGCardInstance*)source)->controller()->opponent());
|
||||
}
|
||||
}
|
||||
|
||||
if (target->type_as_damageable == Damageable::DAMAGEABLE_MTGCARDINSTANCE && ((MTGCardInstance*)target)->hasType(Subtypes::TYPE_PLANESWALKER)){ // Fix life calculation for planeswalker damage.
|
||||
if (((MTGCardInstance*)target)->counters){
|
||||
Counters * counters = ((MTGCardInstance*)target)->counters;
|
||||
for(size_t i = 0; i < counters->counters.size(); ++i){
|
||||
Counter * counter = counters->counters[i];
|
||||
if(counter->name == "loyalty"){
|
||||
target->life = counter->nb - target->damageCount;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (target->type_as_damageable == Damageable::DAMAGEABLE_MTGCARDINSTANCE && ((MTGCardInstance*)target)->hasType(Subtypes::TYPE_BATTLE)){ // Fix life calculation for battle damage.
|
||||
if (((MTGCardInstance*)target)->counters){
|
||||
Counters * counters = ((MTGCardInstance*)target)->counters;
|
||||
for(size_t i = 0; i < counters->counters.size(); ++i){
|
||||
Counter * counter = counters->counters[i];
|
||||
if(counter->name == "defense"){
|
||||
target->life = counter->nb - target->damageCount;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//Send (Damage/Replaced effect) event to listeners
|
||||
observer->receiveEvent(e);
|
||||
return a;
|
||||
|
||||
@@ -738,6 +738,17 @@ void GameObserver::gameStateBasedEffects()
|
||||
card->mPropertiesChangedSinceLastUpdate = false;
|
||||
if(card->hasType(Subtypes::TYPE_PLANESWALKER) && (!card->counters||!card->counters->hasCounter("loyalty",0,0)))
|
||||
players[i]->game->putInGraveyard(card);
|
||||
if(card->hasType(Subtypes::TYPE_BATTLE) && (!card->counters||!card->counters->hasCounter("defense",0,0))){
|
||||
if(!card->isDefeated){
|
||||
card->isDefeated = true;
|
||||
WEvent * e = NEW WEventCardDefeated(card);
|
||||
receiveEvent(e);
|
||||
}
|
||||
}
|
||||
if(!card->isCreature() && card->hasType(Subtypes::TYPE_PLANESWALKER) && card->counters->hasCounter("loyalty", 0, 0))
|
||||
card->life = card->counters->hasCounter("loyalty", 0, 0)->nb;
|
||||
if(!card->isCreature() && card->hasType(Subtypes::TYPE_BATTLE) && card->counters->hasCounter("defense", 0, 0))
|
||||
card->life = card->counters->hasCounter("defense", 0, 0)->nb;
|
||||
if(card->myPair && !isInPlay(card->myPair))
|
||||
{
|
||||
card->myPair->myPair = NULL;
|
||||
|
||||
@@ -246,7 +246,9 @@ const char* Constants::MTGBasicAbilities[] = {
|
||||
"nonight", //It can't become night (e.g. "Angel of Eternal Dawn").
|
||||
"nodamageremoved", //Damage is not removed from card (e.g. "Patient Zero").
|
||||
"backgroundpartner", //Can choose a backgorund partner as commander (e.g. "Faceless One").
|
||||
"bottomlibrarydeath" //It goes to bottom of library after death (e.g. "Quintorius, Loremaster").
|
||||
"bottomlibrarydeath", //It goes to bottom of library after death (e.g. "Quintorius, Loremaster").
|
||||
"noloyaltydamage", //Damage does not cause loyalty counter to be removed from a Planeswalker (e.g. "Spark Rupture").
|
||||
"nodefensedamage" //Damage does not cause defense counter to be removed from a Battle.
|
||||
};
|
||||
|
||||
map<string,int> Constants::MTGBasicAbilitiesMap;
|
||||
|
||||
@@ -3970,8 +3970,11 @@ int MTGPlaneswalkerDamage::receiveEvent(WEvent * event)
|
||||
int howMany = d->damage;
|
||||
for(int k = 0; k < howMany; k++)
|
||||
{
|
||||
card->counters->removeCounter("loyalty", 0, 0);
|
||||
if(!card->basicAbilities[Constants::NOLOYALTYDAMAGE])
|
||||
card->counters->removeCounter("loyalty", 0, 0);
|
||||
}
|
||||
if(!card->isCreature() && card->counters->hasCounter("loyalty", 0, 0))
|
||||
card->life = card->counters->hasCounter("loyalty", 0, 0)->nb;
|
||||
return 1;
|
||||
}
|
||||
if (d->damage > 0 && card && card->hasType(Subtypes::TYPE_BATTLE))
|
||||
@@ -3979,8 +3982,11 @@ int MTGPlaneswalkerDamage::receiveEvent(WEvent * event)
|
||||
int howMany = d->damage;
|
||||
for(int k = 0; k < howMany; k++)
|
||||
{
|
||||
card->counters->removeCounter("defense", 0, 0);
|
||||
if(!card->basicAbilities[Constants::NODEFENSEDAMAGE])
|
||||
card->counters->removeCounter("defense", 0, 0);
|
||||
}
|
||||
if(!card->isCreature() && card->counters->hasCounter("defense", 0, 0))
|
||||
card->life = card->counters->hasCounter("defense", 0, 0)->nb;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user