[USG] fixed text and implementation of Wizard Mentor

This commit is contained in:
Evan Kranzler 2021-03-02 14:59:09 -05:00
parent 3b5147f6ee
commit b9d5e34f8b

View file

@ -1,50 +1,39 @@
package mage.cards.w;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.ReturnToHandSourceEffect;
import mage.abilities.effects.common.ReturnToHandTargetEffect;
import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.cards.Cards;
import mage.cards.CardsImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.predicate.mageobject.AnotherPredicate;
import mage.game.Game;
import mage.players.Player;
import mage.target.common.TargetControlledCreaturePermanent;
import java.util.UUID;
/**
*
* @author fireshoes
*/
public final class WizardMentor extends CardImpl {
private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("another target creature");
static {
filter.add(AnotherPredicate.instance);
}
public WizardMentor(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{U}");
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{U}");
this.subtype.add(SubType.HUMAN);
this.subtype.add(SubType.WIZARD);
this.power = new MageInt(2);
this.toughness = new MageInt(2);
// {tap}: Return Wizard Mentor and target creature you control to their owner's hand.
Effect effect = new ReturnToHandSourceEffect(true);
effect.setText("Return Wizard Mentor");
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new TapSourceCost());
ability.addEffect(effect);
effect = new ReturnToHandTargetEffect();
ability.addEffect(effect);
effect.setText("and another target creature you control to their owners' hands");
ability.addTarget(new TargetControlledCreaturePermanent(filter));
Ability ability = new SimpleActivatedAbility(new WizardMentorEffect(), new TapSourceCost());
ability.addTarget(new TargetControlledCreaturePermanent());
this.addAbility(ability);
}
@ -57,3 +46,31 @@ public final class WizardMentor extends CardImpl {
return new WizardMentor(this);
}
}
class WizardMentorEffect extends OneShotEffect {
WizardMentorEffect() {
super(Outcome.Benefit);
staticText = "return {this} and target creature you control to their owner's hand";
}
private WizardMentorEffect(final WizardMentorEffect effect) {
super(effect);
}
@Override
public WizardMentorEffect copy() {
return new WizardMentorEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getSourceId());
if (player == null) {
return false;
}
Cards cards = new CardsImpl(source.getSourcePermanentIfItStillExists(game));
cards.add(source.getFirstTarget());
return player.moveCards(cards, Zone.HAND, source, game);
}
}