mirror of
https://github.com/correl/mage.git
synced 2024-12-24 11:50:45 +00:00
commit
54cb5cfbc9
2 changed files with 21 additions and 17 deletions
|
@ -1,22 +1,21 @@
|
|||
package mage.abilities.effects.keyword;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.AsThoughEffectImpl;
|
||||
import mage.constants.AsThoughEffectType;
|
||||
import mage.constants.Duration;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.players.Player;
|
||||
|
||||
/*
|
||||
* @author emerald000
|
||||
*/
|
||||
public class CompanionEffect extends AsThoughEffectImpl {
|
||||
public class CompanionEffect extends OneShotEffect {
|
||||
|
||||
public CompanionEffect() {
|
||||
super(AsThoughEffectType.PLAY_FROM_NOT_OWN_HAND_ZONE, Duration.Custom, Outcome.Benefit);
|
||||
staticText = "Once during the game, you may cast your chosen companion from your sideboard";
|
||||
super(Outcome.DrawCard);
|
||||
staticText = "put {this} into your hand";
|
||||
}
|
||||
|
||||
private CompanionEffect(final CompanionEffect effect) {
|
||||
|
@ -28,13 +27,13 @@ public class CompanionEffect extends AsThoughEffectImpl {
|
|||
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
|
||||
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;
|
||||
|
||||
import mage.abilities.StaticAbility;
|
||||
import mage.abilities.SpecialAction;
|
||||
import mage.abilities.costs.mana.GenericManaCost;
|
||||
import mage.abilities.effects.keyword.CompanionEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.constants.TimingRule;
|
||||
import mage.constants.Zone;
|
||||
|
||||
import java.util.Set;
|
||||
|
@ -10,13 +12,16 @@ import java.util.Set;
|
|||
/*
|
||||
* @author emerald000
|
||||
*/
|
||||
public class CompanionAbility extends StaticAbility {
|
||||
public class CompanionAbility extends SpecialAction {
|
||||
|
||||
private final CompanionCondition condition;
|
||||
|
||||
public CompanionAbility(CompanionCondition condition) {
|
||||
super(Zone.OUTSIDE, new CompanionEffect());
|
||||
super(Zone.OUTSIDE);
|
||||
this.condition = condition;
|
||||
this.addCost(new GenericManaCost(3));
|
||||
this.addEffect(new CompanionEffect());
|
||||
this.setTiming(TimingRule.SORCERY);
|
||||
}
|
||||
|
||||
private CompanionAbility(final CompanionAbility ability) {
|
||||
|
|
Loading…
Reference in a new issue