Code cleanup

This commit is contained in:
Oleg Agafonov 2020-01-08 05:18:21 +04:00
parent ca4a4528fb
commit 85e65c8f44
10 changed files with 42 additions and 78 deletions

View file

@ -1,23 +1,16 @@
package mage.cards.a;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.LookLibraryAndPickControllerEffect;
import mage.cards.*;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.filter.FilterCard;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.players.Player;
import mage.target.TargetCard;
import java.util.UUID;
/**
*
* @author Quercitron
*/
public final class AncestralMemories extends CardImpl {
@ -38,41 +31,4 @@ public final class AncestralMemories extends CardImpl {
public AncestralMemories copy() {
return new AncestralMemories(this);
}
}
class AncestralMemoriesEffect extends OneShotEffect {
public AncestralMemoriesEffect() {
super(Outcome.DrawCard);
this.staticText = "Look at the top seven cards of your library. Put two of them into your hand and the rest into your graveyard";
}
public AncestralMemoriesEffect(final AncestralMemoriesEffect effect) {
super(effect);
}
@Override
public AncestralMemoriesEffect copy() {
return new AncestralMemoriesEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
Cards cards = new CardsImpl(controller.getLibrary().getTopCards(game, 7));
if (!cards.isEmpty()) {
controller.lookAtCards(source, null, cards, game);
TargetCard target = new TargetCard(Math.min(2, cards.size()), Zone.LIBRARY, new FilterCard("two cards to put in your hand"));
if (controller.choose(Outcome.DrawCard, cards, target, game)) {
Cards toHand = new CardsImpl(target.getTargets());
controller.moveCards(cards, Zone.HAND, source, game);
cards.removeAll(toHand);
}
controller.moveCards(cards, Zone.GRAVEYARD, source, game);
}
return true;
}
return false;
}
}
}

View file

@ -1,7 +1,5 @@
package mage.cards.t;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.EntersBattlefieldTappedAbility;
import mage.abilities.common.SimpleActivatedAbility;
@ -12,22 +10,28 @@ import mage.abilities.mana.GreenManaAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.Duration;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.game.permanent.token.TokenImpl;
import mage.game.permanent.token.Token;
import java.util.UUID;
/**
*
* @author Loki
*/
public final class TreetopVillage extends CardImpl {
public TreetopVillage(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.LAND},"");
super(ownerId, setInfo, new CardType[]{CardType.LAND}, "");
// Treetop Village enters the battlefield tapped.
this.addAbility(new EntersBattlefieldTappedAbility());
// {T}: Add {G}.
this.addAbility(new GreenManaAbility());
// {1}{G}: Treetop Village becomes a 3/3 green Ape creature with trample until end of turn. Its still a land. (It can deal excess combat damage to the player or planeswalker its attacking.)
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new BecomesCreatureSourceEffect(new ApeToken(), "land", Duration.EndOfTurn), new ManaCostsImpl("{1}{G}")));
}
@ -51,6 +55,7 @@ class ApeToken extends TokenImpl {
toughness = new MageInt(3);
this.addAbility(TrampleAbility.getInstance());
}
public ApeToken(final ApeToken token) {
super(token);
}