* Genesis Hydra - Fixed that if other Genesis Hydra cards were brought into play with its ability, they got wrongly the same number of +X/+X counters as the origin Genesis Hydra.

This commit is contained in:
LevelX2 2014-08-09 18:24:33 +02:00
parent a7fc5b9583
commit 0178325e83

View file

@ -27,10 +27,11 @@
*/
package mage.sets.magic2015;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.SpellAbility;
import mage.abilities.common.EntersBattlefieldAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.EntersBattlefieldEffect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.CastSourceTriggeredAbility;
@ -45,16 +46,16 @@ import mage.constants.Zone;
import mage.counters.CounterType;
import mage.filter.Filter.ComparisonType;
import mage.filter.FilterCard;
import mage.filter.common.FilterPermanentCard;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.predicate.mageobject.ConvertedManaCostPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.TargetCard;
import java.util.UUID;
import mage.filter.common.FilterPermanentCard;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardTypePredicate;
/**
*
@ -76,7 +77,7 @@ public class GenesisHydra extends CardImpl {
// When you cast Genesis Hydra, reveal the top X cards of your library. You may put a nonland permanent card with converted mana cost X or less from among them onto the battlefield. Then shuffle the rest into your library.
this.addAbility(new CastSourceTriggeredAbility(new GenesisHydraPutOntoBattlefieldEffect(), false));
// Genesis Hydra enters the battlefield with X +1/+1 counters on it.
this.addAbility(new EntersBattlefieldAbility(new GenesisHydraEntersBattlefieldEffect(), "with X +1/+1 counters on it"));
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new EntersBattlefieldEffect(new GenesisHydraEntersBattlefieldEffect())));
}
public GenesisHydra(final GenesisHydra card) {
@ -106,9 +107,12 @@ class GenesisHydraEntersBattlefieldEffect extends OneShotEffect {
if (permanent != null) {
Object obj = getValue(EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY);
if (obj != null && obj instanceof SpellAbility) {
int amount = ((SpellAbility) obj).getManaCostsToPay().getX();
if (amount > 0) {
permanent.addCounters(CounterType.P1P1.createInstance(amount), game);
SpellAbility spellAbility = (SpellAbility) obj;
if (spellAbility.getSourceId().equals(source.getSourceId())) { // put into play by normal cast
int amount = spellAbility.getManaCostsToPay().getX();
if (amount > 0) {
permanent.addCounters(CounterType.P1P1.createInstance(amount), game);
}
}
}
}