mirror of
https://github.com/magefree/mage.git
synced 2025-12-26 05:22:02 -08:00
- Fixed #6157
This commit is contained in:
parent
584d6ca614
commit
292a0a2912
3 changed files with 102 additions and 7 deletions
|
|
@ -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…
Add table
Add a link
Reference in a new issue