foul-magics/Mage/src/main/java/mage/game/permanent/token/DogIllusionToken.java
Evan Kranzler 9e0ea945ca
Refactoring token names to reflect new rule (ready for review) (#8446)
* updated Riptide Replicator and Volrath's Laboratory

* refactored token names

* some test fixes

* more test fixes

* even more test fixes

* the final test fixes

* fixed a few missed tokens

* merge fix

* fixed a test failure

* fixed test failure

* updated ignored verify test

* fixed token images not appearing

* updated tests
2022-03-14 22:37:21 -04:00

73 lines
2.2 KiB
Java

package mage.game.permanent.token;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.continuous.SetPowerToughnessSourceEffect;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.game.Game;
import mage.players.Player;
import java.util.Arrays;
/**
*
* @author weirddan455
*/
public final class DogIllusionToken extends TokenImpl {
public DogIllusionToken() {
super("Dog Illusion Token", "blue Dog Illusion creature token with \"This creature's power and toughness are each equal to twice the number of cards in your hand.\"");
cardType.add(CardType.CREATURE);
color.setBlue(true);
subtype.add(SubType.DOG);
subtype.add(SubType.ILLUSION);
power = new MageInt(0);
toughness = new MageInt(0);
// This creature's power and toughness are each equal to twice the number of cards in your hand.
this.addAbility(new SimpleStaticAbility(Zone.ALL, new SetPowerToughnessSourceEffect(
DogIllusionValue.instance, Duration.EndOfGame)
.setText("this creature's power and toughness are each equal to twice the number of cards in your hand")
));
availableImageSetCodes = Arrays.asList("AFR");
}
private DogIllusionToken(final DogIllusionToken token) {
super(token);
}
@Override
public DogIllusionToken copy() {
return new DogIllusionToken(this);
}
}
enum DogIllusionValue implements DynamicValue {
instance;
@Override
public int calculate(Game game, Ability sourceAbility, Effect effect) {
Player controller = game.getPlayer(sourceAbility.getControllerId());
if (controller == null) {
return 0;
}
return controller.getHand().size() * 2;
}
@Override
public DogIllusionValue copy() {
return instance;
}
@Override
public String getMessage() {
return "twice the number of cards in your hand";
}
}