unattach animated equipment

another bug found is when the equipment becomes a creature, its ability
is granted to itself...
This commit is contained in:
Anthony Calosa
2017-01-26 02:12:02 +08:00
parent 60f6c683a3
commit de2d663968
3 changed files with 12 additions and 4 deletions

View File

@@ -73,6 +73,8 @@ public:
class MTGPutInPlayRule: public PermanentAbility
{
protected:
string defaultPlayName;
public:
int isReactingToClick(MTGCardInstance * card, ManaCost * mana = NULL);
int reactToClick(MTGCardInstance * card);
@@ -80,8 +82,8 @@ public:
MTGPutInPlayRule(GameObserver* observer, int _id);
const string getMenuText()
{
if(game && game->gameType() == GAME_TYPE_MOMIR)
return "Play Land";
if(defaultPlayName.size())
return defaultPlayName.c_str();
return "Cast Card Normally";
}
virtual MTGPutInPlayRule * clone() const;

View File

@@ -773,7 +773,7 @@ void GameObserver::gameStateBasedEffects()
////////////////////////////////////////////////////
//Unattach Equipments that dont have valid targets//
////////////////////////////////////////////////////
if (!card->isCreature() && card->hasType(Subtypes::TYPE_EQUIPMENT))
if (card->hasType(Subtypes::TYPE_EQUIPMENT))
{
if(isInPlay(card))
{
@@ -785,7 +785,7 @@ void GameObserver::gameStateBasedEffects()
{
if(card->target)//unattach equipments from cards that has protection from quality ex. protection from artifacts
{
if((card->target)->protectedAgainst(card))
if((card->target)->protectedAgainst(card)||card->isCreature())
((AEquip*)a)->unequip();
}
if(card->controller())

View File

@@ -296,11 +296,13 @@ MTGPutInPlayRule::MTGPutInPlayRule(GameObserver* observer, int _id) :
PermanentAbility(observer, _id)
{
aType = MTGAbility::PUT_INTO_PLAY;
defaultPlayName = "";
}
int MTGPutInPlayRule::isReactingToClick(MTGCardInstance * card, ManaCost *)
{
int cardsinhand = game->players[0]->game->hand->nb_cards;
defaultPlayName = card->isLand()?"Play Land":"Cast Card Normally";
Player * player = game->currentlyActing();
if (!player->game->hand->hasCard(card) && !player->game->graveyard->hasCard(card) && !player->game->exile->hasCard(card))
return 0;
@@ -753,6 +755,8 @@ int MTGAlternativeCostRule::isReactingToClick(MTGCardInstance * card, ManaCost *
if(!allowedToAltCast(card,player))
return 0;
alternativeName = "Pay Alternative Cost";
if(card->has(Constants::CANPLAYFROMGRAVEYARD))
alternativeName = "Alternate Cast From Graveyard";
@@ -763,6 +767,8 @@ int MTGAlternativeCostRule::isReactingToClick(MTGCardInstance * card, ManaCost *
if (card->isLand())
{
alternativeName = "Play Land";
if (game->currentActionPlayer->game->playRestrictions->canPutIntoZone(card, game->currentActionPlayer->game->inPlay) == PlayRestriction::CANT_PLAY)
return 0;
if (card->StackIsEmptyandSorcerySpeed())