mirror of
https://github.com/correl/mage.git
synced 2024-11-16 03:00:12 +00:00
[BRO] Implemented Fateful Handoff
This commit is contained in:
parent
6726371756
commit
20dc819bb5
2 changed files with 117 additions and 0 deletions
116
Mage.Sets/src/mage/cards/f/FatefulHandoff.java
Normal file
116
Mage.Sets/src/mage/cards/f/FatefulHandoff.java
Normal file
|
@ -0,0 +1,116 @@
|
||||||
|
package mage.cards.f;
|
||||||
|
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import mage.abilities.Ability;
|
||||||
|
import mage.abilities.effects.ContinuousEffectImpl;
|
||||||
|
import mage.abilities.effects.OneShotEffect;
|
||||||
|
import mage.cards.CardImpl;
|
||||||
|
import mage.cards.CardSetInfo;
|
||||||
|
import mage.constants.*;
|
||||||
|
import mage.filter.StaticFilters;
|
||||||
|
import mage.game.Game;
|
||||||
|
import mage.game.permanent.Permanent;
|
||||||
|
import mage.players.Player;
|
||||||
|
import mage.target.common.TargetControlledPermanent;
|
||||||
|
import mage.target.common.TargetOpponent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author weirddan455
|
||||||
|
*/
|
||||||
|
public final class FatefulHandoff extends CardImpl {
|
||||||
|
|
||||||
|
public FatefulHandoff(UUID ownerId, CardSetInfo setInfo) {
|
||||||
|
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{3}{B}");
|
||||||
|
|
||||||
|
// Draw cards equal to the mana value of target artifact or creature you control. An opponent gains control of that permanent.
|
||||||
|
this.getSpellAbility().addEffect(new FatefulHandoffEffect());
|
||||||
|
this.getSpellAbility().addTarget(new TargetControlledPermanent(StaticFilters.FILTER_CONTROLLED_PERMANENT_ARTIFACT_OR_CREATURE));
|
||||||
|
}
|
||||||
|
|
||||||
|
private FatefulHandoff(final FatefulHandoff card) {
|
||||||
|
super(card);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FatefulHandoff copy() {
|
||||||
|
return new FatefulHandoff(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class FatefulHandoffEffect extends OneShotEffect {
|
||||||
|
|
||||||
|
public FatefulHandoffEffect() {
|
||||||
|
super(Outcome.Benefit);
|
||||||
|
this.staticText = "Draw cards equal to the mana value of target artifact or creature you control. An opponent gains control of that permanent.";
|
||||||
|
}
|
||||||
|
|
||||||
|
private FatefulHandoffEffect(final FatefulHandoffEffect effect) {
|
||||||
|
super(effect);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FatefulHandoffEffect copy() {
|
||||||
|
return new FatefulHandoffEffect(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean apply(Game game, Ability source) {
|
||||||
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
|
Permanent permanent = game.getPermanent(source.getFirstTarget());
|
||||||
|
if (controller == null || permanent == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
controller.drawCards(permanent.getManaValue(), source, game);
|
||||||
|
Player opponent;
|
||||||
|
Set<UUID> opponents = game.getOpponents(controller.getId());
|
||||||
|
if (opponents.size() == 1) {
|
||||||
|
opponent = game.getPlayer(opponents.iterator().next());
|
||||||
|
} else {
|
||||||
|
TargetOpponent target = new TargetOpponent(true);
|
||||||
|
controller.chooseTarget(Outcome.GainControl, target, source, game);
|
||||||
|
opponent = game.getPlayer(target.getFirstTarget());
|
||||||
|
}
|
||||||
|
if (opponent != null) {
|
||||||
|
game.addEffect(new FatefulHandoffControlEffect(permanent.getId(), opponent.getId()), source);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class FatefulHandoffControlEffect extends ContinuousEffectImpl {
|
||||||
|
|
||||||
|
private final UUID permanentId;
|
||||||
|
private final UUID opponentId;
|
||||||
|
|
||||||
|
public FatefulHandoffControlEffect(UUID permanentId, UUID opponentId) {
|
||||||
|
super(Duration.EndOfGame, Layer.ControlChangingEffects_2, SubLayer.NA, Outcome.GainControl);
|
||||||
|
this.permanentId = permanentId;
|
||||||
|
this.opponentId = opponentId;
|
||||||
|
}
|
||||||
|
|
||||||
|
private FatefulHandoffControlEffect(final FatefulHandoffControlEffect effect) {
|
||||||
|
super(effect);
|
||||||
|
this.permanentId = effect.permanentId;
|
||||||
|
this.opponentId = effect.opponentId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FatefulHandoffControlEffect copy() {
|
||||||
|
return new FatefulHandoffControlEffect(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean apply(Game game, Ability source) {
|
||||||
|
Player opponent = game.getPlayer(opponentId);
|
||||||
|
Permanent permanent = game.getPermanent(permanentId);
|
||||||
|
if (opponent != null && permanent != null) {
|
||||||
|
permanent.changeControllerId(opponentId, game, source);
|
||||||
|
} else {
|
||||||
|
this.discard();
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
|
@ -104,6 +104,7 @@ public final class TheBrothersWar extends ExpansionSet {
|
||||||
cards.add(new SetCardInfo("Fallaji Dragon Engine", 159, Rarity.UNCOMMON, mage.cards.f.FallajiDragonEngine.class));
|
cards.add(new SetCardInfo("Fallaji Dragon Engine", 159, Rarity.UNCOMMON, mage.cards.f.FallajiDragonEngine.class));
|
||||||
cards.add(new SetCardInfo("Fallaji Excavation", 178, Rarity.UNCOMMON, mage.cards.f.FallajiExcavation.class));
|
cards.add(new SetCardInfo("Fallaji Excavation", 178, Rarity.UNCOMMON, mage.cards.f.FallajiExcavation.class));
|
||||||
cards.add(new SetCardInfo("Fallaji Vanguard", 210, Rarity.UNCOMMON, mage.cards.f.FallajiVanguard.class));
|
cards.add(new SetCardInfo("Fallaji Vanguard", 210, Rarity.UNCOMMON, mage.cards.f.FallajiVanguard.class));
|
||||||
|
cards.add(new SetCardInfo("Fateful Handoff", 94, Rarity.RARE, mage.cards.f.FatefulHandoff.class));
|
||||||
cards.add(new SetCardInfo("Fauna Shaman", 179, Rarity.RARE, mage.cards.f.FaunaShaman.class));
|
cards.add(new SetCardInfo("Fauna Shaman", 179, Rarity.RARE, mage.cards.f.FaunaShaman.class));
|
||||||
cards.add(new SetCardInfo("Feldon, Ronom Excavator", 135, Rarity.RARE, mage.cards.f.FeldonRonomExcavator.class));
|
cards.add(new SetCardInfo("Feldon, Ronom Excavator", 135, Rarity.RARE, mage.cards.f.FeldonRonomExcavator.class));
|
||||||
cards.add(new SetCardInfo("Flow of Knowledge", 49, Rarity.UNCOMMON, mage.cards.f.FlowOfKnowledge.class));
|
cards.add(new SetCardInfo("Flow of Knowledge", 49, Rarity.UNCOMMON, mage.cards.f.FlowOfKnowledge.class));
|
||||||
|
|
Loading…
Reference in a new issue