mirror of
https://github.com/magefree/mage.git
synced 2025-12-20 02:30:08 -08:00
[FIN] fix PuPu UFO setting its toughness to 0
This commit is contained in:
parent
5f25032d75
commit
7175b5e458
1 changed files with 42 additions and 13 deletions
|
|
@ -1,14 +1,14 @@
|
|||
package mage.cards.p;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.costs.common.TapSourceCost;
|
||||
import mage.abilities.costs.mana.GenericManaCost;
|
||||
import mage.abilities.dynamicvalue.DynamicValue;
|
||||
import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount;
|
||||
import mage.abilities.dynamicvalue.common.StaticValue;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.PutCardFromHandOntoBattlefieldEffect;
|
||||
import mage.abilities.effects.common.continuous.SetBasePowerToughnessSourceEffect;
|
||||
import mage.abilities.effects.common.continuous.SetBasePowerSourceEffect;
|
||||
import mage.abilities.hint.Hint;
|
||||
import mage.abilities.hint.ValueHint;
|
||||
import mage.abilities.keyword.FlyingAbility;
|
||||
|
|
@ -16,9 +16,12 @@ import mage.cards.CardImpl;
|
|||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubType;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.filter.common.FilterControlledPermanent;
|
||||
import mage.game.Game;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
|
|
@ -27,10 +30,6 @@ import java.util.UUID;
|
|||
*/
|
||||
public final class PuPuUFO extends CardImpl {
|
||||
|
||||
private static final DynamicValue xValue
|
||||
= new PermanentsOnBattlefieldCount(new FilterControlledPermanent(SubType.TOWN));
|
||||
private static final Hint hint = new ValueHint("Towns you control", xValue);
|
||||
|
||||
public PuPuUFO(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{2}");
|
||||
|
||||
|
|
@ -48,12 +47,7 @@ public final class PuPuUFO extends CardImpl {
|
|||
));
|
||||
|
||||
// {3}: Until end of turn, this creature's base power becomes equal to the number of Towns you control.
|
||||
this.addAbility(new SimpleActivatedAbility(
|
||||
new SetBasePowerToughnessSourceEffect(
|
||||
xValue, StaticValue.get(0), Duration.EndOfTurn, "until end of turn, " +
|
||||
"this creature's base power becomes equal to the number of Towns you control"
|
||||
), new GenericManaCost(3)
|
||||
).addHint(hint));
|
||||
this.addAbility(new SimpleActivatedAbility(new PuPuUFOEffect(), new GenericManaCost(3)).addHint(PuPuUFOEffect.getHint()));
|
||||
}
|
||||
|
||||
private PuPuUFO(final PuPuUFO card) {
|
||||
|
|
@ -65,3 +59,38 @@ public final class PuPuUFO extends CardImpl {
|
|||
return new PuPuUFO(this);
|
||||
}
|
||||
}
|
||||
|
||||
class PuPuUFOEffect extends OneShotEffect {
|
||||
|
||||
private static final FilterPermanent filter = new FilterControlledPermanent(SubType.TOWN);
|
||||
private static final Hint hint = new ValueHint("Towns you control", new PermanentsOnBattlefieldCount(filter));
|
||||
|
||||
public static Hint getHint() {
|
||||
return hint;
|
||||
}
|
||||
|
||||
PuPuUFOEffect() {
|
||||
super(Outcome.Benefit);
|
||||
staticText = "until end of turn, {this}'s base power becomes equal to the number of Towns you control";
|
||||
}
|
||||
|
||||
private PuPuUFOEffect(final PuPuUFOEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PuPuUFOEffect copy() {
|
||||
return new PuPuUFOEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
if (source.getSourcePermanentIfItStillExists(game) == null) {
|
||||
return false;
|
||||
}
|
||||
game.addEffect(new SetBasePowerSourceEffect(
|
||||
game.getBattlefield().count(filter, source.getControllerId(), source, game), Duration.EndOfTurn
|
||||
), source);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue