Added new primitives from BRO and BRC sets, fixed some primitives, fixed BRR dat file, fixed castcard ability to avoid double activities activation, fixed a bug on "canloyaltytwice" ability.

This commit is contained in:
Vittorio Alfieri
2023-05-31 15:35:22 +02:00
parent 21687bc3ee
commit ea9d053d76
6 changed files with 407 additions and 35 deletions

View File

@@ -10068,8 +10068,29 @@ int AACastCard::resolveSpell()
if(theNamedCard)
{
Spell * spell = NULL;
MTGCardInstance * copy = source->controller()->game->putInZone(theNamedCard, theNamedCard->currentZone, source->controller()->game->stack, noEvent); // Fixed a bug when using noevent option with namedcard option.
MTGCardInstance * copy = NULL;
if ((normal || asNormalMadness) || !theNamedCard->isSorceryorInstant())
{
if (putinplay && theNamedCard->isPermanent())
copy = theNamedCard->controller()->game->putInZone(theNamedCard, theNamedCard->currentZone, source->controller()->game->battlefield, noEvent); // Fixed a problem with double activation of card abilities.
else
copy = theNamedCard->controller()->game->putInZone(theNamedCard, theNamedCard->currentZone, source->controller()->game->stack, noEvent); // Fixed a bug when using noevent option with namedcard option.
}
else
{
if (putinplay && theNamedCard->isPermanent())
copy = theNamedCard->controller()->game->putInZone(theNamedCard, theNamedCard->currentZone, source->controller()->game->battlefield, noEvent); // Fixed a problem with double activation of card abilities.
else
copy = theNamedCard->controller()->game->putInZone(theNamedCard, theNamedCard->currentZone, source->controller()->game->stack, noEvent); // Fixed a bug when using noevent option with namedcard option.
}
if(!copy){
this->forceDestroy = true;
processed = false;
return 0;
}
copy->changeController(source->controller(),true);
if(asNormalMadness)
copy->MadnessPlay = true;
if(asCopy)
copy->isToken = 1; // Fixed a bug when using copied option with namedcard option.
if(alternative)
@@ -10083,7 +10104,6 @@ int AACastCard::resolveSpell()
copy->setX = costx;
copy->X = costx;
}
if (game->targetChooser)
{
game->targetChooser->Owner = source->controller();
@@ -10094,7 +10114,6 @@ int AACastCard::resolveSpell()
{
spell = game->mLayers->stackLayer()->addSpell(copy, NULL, NULL, 1, 0);
}
if (copy->has(Constants::STORM))
{
int storm = source->controller()->game->stack->seenThisTurn("*", Constants::CAST_ALL) + source->controller()->opponent()->game->stack->seenThisTurn("*", Constants::CAST_ALL);
@@ -10112,10 +10131,6 @@ int AACastCard::resolveSpell()
copy->castX = copy->X;
}
}
if (putinplay && (copy->hasType(Subtypes::TYPE_ARTIFACT) || copy->hasType(Subtypes::TYPE_CREATURE) || copy->hasType(Subtypes::TYPE_ENCHANTMENT) || copy->hasType(Subtypes::TYPE_PLANESWALKER) || copy->hasType(Subtypes::TYPE_BATTLE)))
spell->resolve(); // Fixed a crash when using and!()! with namedcard permanents.
if(andAbility)
{
MTGAbility * andAbilityClone = andAbility->clone();
@@ -10139,22 +10154,26 @@ int AACastCard::resolveSpell()
MTGCardInstance * copy = NULL;
if ((normal || asNormalMadness)||(!_target->hasType(Subtypes::TYPE_INSTANT) && !_target->hasType(Subtypes::TYPE_SORCERY)))
{
if (putinplay && (_target->hasType(Subtypes::TYPE_ARTIFACT)||_target->hasType(Subtypes::TYPE_CREATURE)||_target->hasType(Subtypes::TYPE_ENCHANTMENT)||_target->hasType(Subtypes::TYPE_PLANESWALKER)||_target->hasType(Subtypes::TYPE_BATTLE)))
copy = _target->controller()->game->putInZone(_target, _target->currentZone, source->controller()->game->reveal, noEvent); // Fixed a problem with previous zone of card, it cannot be directly battlefield.
if (putinplay && _target->isPermanent())
copy = _target->controller()->game->putInZone(_target, _target->currentZone, source->controller()->game->battlefield, noEvent); // Fixed a problem with double activation of card abilities.
else
copy = _target->controller()->game->putInZone(_target, _target->currentZone, source->controller()->game->stack, noEvent);
copy->changeController(source->controller(),true);
if(asNormalMadness)
copy->MadnessPlay = true;
copy = _target->controller()->game->putInZone(_target, _target->currentZone, source->controller()->game->stack, noEvent); // Fixed a bug when using noevent option with namedcard option.
}
else
{
if (putinplay && (_target->hasType(Subtypes::TYPE_ARTIFACT)||_target->hasType(Subtypes::TYPE_CREATURE)||_target->hasType(Subtypes::TYPE_ENCHANTMENT)||_target->hasType(Subtypes::TYPE_PLANESWALKER)||_target->hasType(Subtypes::TYPE_BATTLE)))
copy = _target->controller()->game->putInZone(_target, _target->currentZone, source->controller()->game->reveal, noEvent); // Fixed a problem with previous zone of card, it cannot be directly battlefield.
if (putinplay && _target->isPermanent())
copy = _target->controller()->game->putInZone(_target, _target->currentZone, source->controller()->game->battlefield, noEvent); // Fixed a problem with double activation of card abilities.
else
copy = _target->controller()->game->putInZone(_target, _target->currentZone, source->controller()->game->stack, noEvent);
copy->changeController(source->controller(),true);
copy = _target->controller()->game->putInZone(_target, _target->currentZone, source->controller()->game->stack, noEvent); // Fixed a bug when using noevent option with namedcard option.
}
if(!copy){
this->forceDestroy = true;
processed = false;
return 0;
}
copy->changeController(source->controller(), true);
if(asNormalMadness)
copy->MadnessPlay = true;
if(alternative)
copy->alternateCostPaid[ManaCost::MANA_PAID_WITH_ALTERNATIVE] = 1;
if(kicked > 0){
@@ -10188,7 +10207,6 @@ int AACastCard::resolveSpell()
else if(!flipped)
spell = game->mLayers->stackLayer()->addSpell(copy, NULL, NULL, 1, 0);
}
if (copy->has(Constants::STORM))
{
int storm = _target->controller()->game->stack->seenThisTurn("*", Constants::CAST_ALL) + source->controller()->opponent()->game->stack->seenThisTurn("*", Constants::CAST_ALL);
@@ -10220,7 +10238,6 @@ int AACastCard::resolveSpell()
andAbilityClone->addToGame();
}
}
this->forceDestroy = true;
processed = true;
return 1;

View File

@@ -7044,14 +7044,9 @@ int ActivatedAbility::isReactingToClick(MTGCardInstance * card, ManaCost * mana)
return 1;
if(card->hasType(Subtypes::TYPE_PLANESWALKER))
{
/*for(unsigned int k = 0;k < card->cardsAbilities.size();++k)
{
ActivatedAbility * check = dynamic_cast<ActivatedAbility*>(card->cardsAbilities[k]);
if(check && check->counters)
return 0;
}*/
// Improved the check to avoid the multiple triggers in case of abilities gained from other cards (e.g. Kasmina, Enigma Sage)
bool turnSide = false;
int howMany = 0;
for(unsigned int k = 0; k < card->getObserver()->mLayers->actionLayer()->mObjects.size(); ++k)
{
ActivatedAbility * check = dynamic_cast<ActivatedAbility*>(card->getObserver()->mLayers->actionLayer()->mObjects[k]);
@@ -7059,10 +7054,11 @@ int ActivatedAbility::isReactingToClick(MTGCardInstance * card, ManaCost * mana)
if(!turnSide && check && check->source == card){
if(check->counters && !card->has(Constants::CANLOYALTYTWICE))
return 0;
else if(check->counters > 1 && card->has(Constants::CANLOYALTYTWICE))
return 0;
howMany += check->counters;
}
}
if(howMany > 1 && card->has(Constants::CANLOYALTYTWICE))
return 0;
if (player != game->currentPlayer)
return 0;
if (!turnSide && (cPhase != MTG_PHASE_FIRSTMAIN && cPhase != MTG_PHASE_SECONDMAIN))
@@ -7090,9 +7086,7 @@ int ActivatedAbility::isReactingToClick(MTGCardInstance * card, ManaCost * mana)
return 0;
}
}
}
if (!mana)
mana = player->getManaPool();
if (!mana->canAfford(cost,card->has(Constants::ANYTYPEOFMANAABILITY)))