mirror of
https://github.com/correl/mage.git
synced 2024-12-26 11:09:27 +00:00
- Fixed #6157
This commit is contained in:
parent
584d6ca614
commit
292a0a2912
3 changed files with 102 additions and 7 deletions
|
@ -10,7 +10,6 @@ import mage.abilities.costs.common.TapSourceCost;
|
|||
import mage.abilities.costs.mana.GenericManaCost;
|
||||
import mage.abilities.effects.common.GainLifeEffect;
|
||||
import mage.abilities.mana.ColorlessManaAbility;
|
||||
import mage.abilities.mana.ConditionalAnyColorManaAbility;
|
||||
import mage.abilities.mana.builder.ConditionalManaBuilder;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
|
@ -18,8 +17,8 @@ import mage.constants.CardType;
|
|||
import mage.filter.FilterSpell;
|
||||
import mage.game.Game;
|
||||
import mage.game.stack.Spell;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.mana.conditional.ConditionalAddManaOfTwoDifferentColorsAbility;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
|
@ -44,8 +43,8 @@ public final class InterplanarBeacon extends CardImpl {
|
|||
this.addAbility(new ColorlessManaAbility());
|
||||
|
||||
// {1}, {T}: Add two mana of different colors. Spend this mana only to cast planeswalker spells.
|
||||
Ability ability = new ConditionalAnyColorManaAbility(
|
||||
new GenericManaCost(1), 2,
|
||||
Ability ability = new ConditionalAddManaOfTwoDifferentColorsAbility(
|
||||
new GenericManaCost(1),
|
||||
new InterplanarBeaconManaBuilder()
|
||||
);
|
||||
ability.addCost(new TapSourceCost());
|
||||
|
@ -80,7 +79,7 @@ class InterplanarBeaconConditionalMana extends ConditionalMana {
|
|||
InterplanarBeaconConditionalMana(Mana mana) {
|
||||
super(mana);
|
||||
this.staticText = "Spend this mana only to cast planeswalker spells";
|
||||
addCondition(new InterplanarBeaconManaCondition());
|
||||
this.addCondition(new InterplanarBeaconManaCondition());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -89,6 +88,7 @@ class InterplanarBeaconManaCondition implements Condition {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
MageObject object = source.getSourceObject(game);
|
||||
return object instanceof Spell && object.isPlaneswalker();
|
||||
return object instanceof Spell
|
||||
&& object.isPlaneswalker();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package mage.abilities.effects.mana;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import mage.ConditionalMana;
|
||||
import mage.Mana;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.common.ManaEffect;
|
||||
import mage.abilities.mana.builder.ConditionalManaBuilder;
|
||||
import mage.choices.ManaChoice;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author jeffwadsworth
|
||||
*/
|
||||
public class AddConditionalManaOfTwoDifferentColorsEffect extends ManaEffect {
|
||||
|
||||
private final ConditionalManaBuilder manaBuilder;
|
||||
|
||||
public AddConditionalManaOfTwoDifferentColorsEffect(ConditionalManaBuilder manaBuilder) {
|
||||
super();
|
||||
this.manaBuilder = manaBuilder;
|
||||
staticText = "Add two mana of different colors. " + manaBuilder.getRule();
|
||||
}
|
||||
|
||||
private AddConditionalManaOfTwoDifferentColorsEffect(final AddConditionalManaOfTwoDifferentColorsEffect effect) {
|
||||
super(effect);
|
||||
this.manaBuilder = effect.manaBuilder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Mana> getNetMana(Game game, Ability source) {
|
||||
ArrayList<Mana> netMana = new ArrayList<>();
|
||||
netMana.add(Mana.AnyMana(2));
|
||||
return netMana;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mana produceMana(Game game, Ability source) {
|
||||
Player player = getPlayer(game, source);
|
||||
Mana mana = new ConditionalMana(manaBuilder.setMana(
|
||||
ManaChoice.chooseTwoDifferentColors(
|
||||
player, game), source, game).build());
|
||||
return mana;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AddConditionalManaOfTwoDifferentColorsEffect copy() {
|
||||
return new AddConditionalManaOfTwoDifferentColorsEffect(this);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package mage.abilities.mana.conditional;
|
||||
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.costs.common.TapSourceCost;
|
||||
import mage.abilities.effects.mana.AddConditionalManaOfTwoDifferentColorsEffect;
|
||||
import mage.abilities.mana.ActivatedManaAbilityImpl;
|
||||
import mage.abilities.mana.builder.ConditionalManaBuilder;
|
||||
import mage.constants.Zone;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author jeffwadsworth
|
||||
*/
|
||||
public class ConditionalAddManaOfTwoDifferentColorsAbility extends ActivatedManaAbilityImpl {
|
||||
|
||||
public ConditionalAddManaOfTwoDifferentColorsAbility(ConditionalManaBuilder manaBuilder) {
|
||||
this(new TapSourceCost(), manaBuilder);
|
||||
}
|
||||
|
||||
public ConditionalAddManaOfTwoDifferentColorsAbility(Cost cost, ConditionalManaBuilder manaBuilder) {
|
||||
super(Zone.BATTLEFIELD, new AddConditionalManaOfTwoDifferentColorsEffect(manaBuilder), cost);
|
||||
}
|
||||
|
||||
public ConditionalAddManaOfTwoDifferentColorsAbility(final ConditionalAddManaOfTwoDifferentColorsAbility ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConditionalAddManaOfTwoDifferentColorsAbility copy() {
|
||||
return new ConditionalAddManaOfTwoDifferentColorsAbility(this);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue