mirror of
https://github.com/correl/mage.git
synced 2024-12-25 03:00:15 +00:00
commit
54cb5cfbc9
2 changed files with 21 additions and 17 deletions
|
@ -1,22 +1,21 @@
|
||||||
package mage.abilities.effects.keyword;
|
package mage.abilities.effects.keyword;
|
||||||
|
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.effects.AsThoughEffectImpl;
|
import mage.abilities.effects.OneShotEffect;
|
||||||
import mage.constants.AsThoughEffectType;
|
import mage.cards.Card;
|
||||||
import mage.constants.Duration;
|
|
||||||
import mage.constants.Outcome;
|
import mage.constants.Outcome;
|
||||||
|
import mage.constants.Zone;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
|
import mage.players.Player;
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @author emerald000
|
* @author emerald000
|
||||||
*/
|
*/
|
||||||
public class CompanionEffect extends AsThoughEffectImpl {
|
public class CompanionEffect extends OneShotEffect {
|
||||||
|
|
||||||
public CompanionEffect() {
|
public CompanionEffect() {
|
||||||
super(AsThoughEffectType.PLAY_FROM_NOT_OWN_HAND_ZONE, Duration.Custom, Outcome.Benefit);
|
super(Outcome.DrawCard);
|
||||||
staticText = "Once during the game, you may cast your chosen companion from your sideboard";
|
staticText = "put {this} into your hand";
|
||||||
}
|
}
|
||||||
|
|
||||||
private CompanionEffect(final CompanionEffect effect) {
|
private CompanionEffect(final CompanionEffect effect) {
|
||||||
|
@ -28,13 +27,13 @@ public class CompanionEffect extends AsThoughEffectImpl {
|
||||||
return new CompanionEffect(this);
|
return new CompanionEffect(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) {
|
|
||||||
return objectId.equals(source.getSourceId()) && affectedControllerId.equals(source.getControllerId());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
return true;
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
|
Card card = (Card) source.getSourceObjectIfItStillExists(game);
|
||||||
|
if (controller != null && card != null && game.getState().getZone(card.getId()) == Zone.OUTSIDE) {
|
||||||
|
return controller.moveCards(card, Zone.HAND, source, game);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
package mage.abilities.keyword;
|
package mage.abilities.keyword;
|
||||||
|
|
||||||
import mage.abilities.StaticAbility;
|
import mage.abilities.SpecialAction;
|
||||||
|
import mage.abilities.costs.mana.GenericManaCost;
|
||||||
import mage.abilities.effects.keyword.CompanionEffect;
|
import mage.abilities.effects.keyword.CompanionEffect;
|
||||||
import mage.cards.Card;
|
import mage.cards.Card;
|
||||||
|
import mage.constants.TimingRule;
|
||||||
import mage.constants.Zone;
|
import mage.constants.Zone;
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
@ -10,13 +12,16 @@ import java.util.Set;
|
||||||
/*
|
/*
|
||||||
* @author emerald000
|
* @author emerald000
|
||||||
*/
|
*/
|
||||||
public class CompanionAbility extends StaticAbility {
|
public class CompanionAbility extends SpecialAction {
|
||||||
|
|
||||||
private final CompanionCondition condition;
|
private final CompanionCondition condition;
|
||||||
|
|
||||||
public CompanionAbility(CompanionCondition condition) {
|
public CompanionAbility(CompanionCondition condition) {
|
||||||
super(Zone.OUTSIDE, new CompanionEffect());
|
super(Zone.OUTSIDE);
|
||||||
this.condition = condition;
|
this.condition = condition;
|
||||||
|
this.addCost(new GenericManaCost(3));
|
||||||
|
this.addEffect(new CompanionEffect());
|
||||||
|
this.setTiming(TimingRule.SORCERY);
|
||||||
}
|
}
|
||||||
|
|
||||||
private CompanionAbility(final CompanionAbility ability) {
|
private CompanionAbility(final CompanionAbility ability) {
|
||||||
|
|
Loading…
Reference in a new issue