added auraward, added event for unattach, added statebased check for protection from quality
auraward -> an exception for protection from quality used for aura, like flickering ward added event for unattach added state based check for protection from quality. 702.16c A permanent or player with protection can’t be enchanted by Auras that have the stated quality. Such Auras attached to the permanent or player with protection will be put into their owners’ graveyards as a state-based action. 702.16d A permanent with protection can’t be equipped by Equipment that have the stated quality or fortified by Fortifications that have the stated quality. Such Equipment or Fortifications become unattached from that permanent as a state-based action, but remain on the battlefield.
This commit is contained in:
@@ -617,6 +617,24 @@ void GameObserver::gameStateBasedEffects()
|
||||
card->myPair->myPair = NULL;
|
||||
card->myPair = NULL;
|
||||
}
|
||||
////////////////////////////////////////////////////
|
||||
//Unattach Equipments that dont have valid targets//
|
||||
////////////////////////////////////////////////////
|
||||
if ((card->target) && card->hasType(Subtypes::TYPE_EQUIPMENT))
|
||||
{
|
||||
if(card->target && isInPlay(card->target) && (card->target)->protectedAgainst(card))//protection from quality
|
||||
{
|
||||
for (size_t i = 1; i < mLayers->actionLayer()->mObjects.size(); i++)
|
||||
{
|
||||
MTGAbility * a = ((MTGAbility *) mLayers->actionLayer()->mObjects[i]);
|
||||
AEquip * eq = dynamic_cast<AEquip*> (a);
|
||||
if (eq && eq->source == card)
|
||||
{
|
||||
((AEquip*)a)->unequip();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
///////////////////////////////////////////////////////
|
||||
//Remove auras that don't have a valid target anymore//
|
||||
///////////////////////////////////////////////////////
|
||||
@@ -624,6 +642,8 @@ void GameObserver::gameStateBasedEffects()
|
||||
{
|
||||
if(card->target && !isInPlay(card->target))
|
||||
players[i]->game->putInGraveyard(card);
|
||||
if(card->target && isInPlay(card->target) && (card->target)->protectedAgainst(card) && !card->has(Constants::AURAWARD))//protection from quality except aura cards like flickering ward
|
||||
players[i]->game->putInGraveyard(card);
|
||||
}
|
||||
card->enchanted = false;
|
||||
if (card->target && isInPlay(card->target) && !card->hasType(Subtypes::TYPE_EQUIPMENT) && card->hasSubtype(Subtypes::TYPE_AURA))
|
||||
|
||||
Reference in New Issue
Block a user