mirror of
https://github.com/correl/mage.git
synced 2024-12-25 03:00:15 +00:00
* Treasonous Ogre - Fixed available mana generation (#6698).
This commit is contained in:
parent
67dd45c1c7
commit
516a4104f1
3 changed files with 73 additions and 3 deletions
|
@ -5,6 +5,8 @@ import java.util.UUID;
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.Mana;
|
import mage.Mana;
|
||||||
import mage.abilities.costs.common.PayLifeCost;
|
import mage.abilities.costs.common.PayLifeCost;
|
||||||
|
import mage.abilities.dynamicvalue.common.ControllerLifeDividedValue;
|
||||||
|
import mage.abilities.effects.mana.BasicManaEffect;
|
||||||
import mage.abilities.keyword.DethroneAbility;
|
import mage.abilities.keyword.DethroneAbility;
|
||||||
import mage.abilities.mana.SimpleManaAbility;
|
import mage.abilities.mana.SimpleManaAbility;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
|
@ -31,7 +33,10 @@ public final class TreasonousOgre extends CardImpl {
|
||||||
// Dethrone
|
// Dethrone
|
||||||
this.addAbility(new DethroneAbility());
|
this.addAbility(new DethroneAbility());
|
||||||
// Pay 3 life: Add {R}.
|
// Pay 3 life: Add {R}.
|
||||||
this.addAbility(new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(ColoredManaSymbol.R), new PayLifeCost(3)));
|
|
||||||
|
this.addAbility(new SimpleManaAbility(Zone.BATTLEFIELD,
|
||||||
|
new BasicManaEffect(new Mana(ColoredManaSymbol.R), new ControllerLifeDividedValue(3)),
|
||||||
|
new PayLifeCost(3)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public TreasonousOgre(final TreasonousOgre card) {
|
public TreasonousOgre(final TreasonousOgre card) {
|
||||||
|
|
|
@ -236,7 +236,7 @@ public class NonTappingManaAbilitiesTest extends CardTestPlayerBase {
|
||||||
assertManaOptions("{C}{C}{U}{R}{G}", manaOptions);
|
assertManaOptions("{C}{C}{U}{R}{G}", manaOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void TestSquanderedResourcesWithManaConfluence() {
|
public void TestSquanderedResourcesWithManaConfluence() {
|
||||||
setStrictChooseMode(true);
|
setStrictChooseMode(true);
|
||||||
addCard(Zone.BATTLEFIELD, playerA, "Forest", 1);
|
addCard(Zone.BATTLEFIELD, playerA, "Forest", 1);
|
||||||
|
@ -254,5 +254,22 @@ public class NonTappingManaAbilitiesTest extends CardTestPlayerBase {
|
||||||
ManaOptions manaOptions = playerA.getAvailableManaTest(currentGame);
|
ManaOptions manaOptions = playerA.getAvailableManaTest(currentGame);
|
||||||
Assert.assertEquals("mana variations don't fit", 1, manaOptions.size());
|
Assert.assertEquals("mana variations don't fit", 1, manaOptions.size());
|
||||||
assertManaOptions("{G}{Any}{Any}", manaOptions);
|
assertManaOptions("{G}{Any}{Any}", manaOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void TestTreasonousOgre() {
|
||||||
|
setStrictChooseMode(true);
|
||||||
|
// Dethrone
|
||||||
|
// Pay 3 life: Add {R}.
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Treasonous Ogre", 1);
|
||||||
|
|
||||||
|
setStopAt(1, PhaseStep.PRECOMBAT_MAIN);
|
||||||
|
execute();
|
||||||
|
|
||||||
|
assertAllCommandsUsed();
|
||||||
|
|
||||||
|
ManaOptions manaOptions = playerA.getAvailableManaTest(currentGame);
|
||||||
|
Assert.assertEquals("mana variations don't fit", 1, manaOptions.size());
|
||||||
|
assertManaOptions("{R}{R}{R}{R}{R}{R}", manaOptions);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,48 @@
|
||||||
|
package mage.abilities.dynamicvalue.common;
|
||||||
|
|
||||||
|
import mage.abilities.Ability;
|
||||||
|
import mage.abilities.dynamicvalue.DynamicValue;
|
||||||
|
import mage.abilities.effects.Effect;
|
||||||
|
import mage.game.Game;
|
||||||
|
import mage.players.Player;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author LevelX2
|
||||||
|
*/
|
||||||
|
public class ControllerLifeDividedValue implements DynamicValue {
|
||||||
|
|
||||||
|
private final Integer divider;
|
||||||
|
|
||||||
|
public ControllerLifeDividedValue(Integer divider) {
|
||||||
|
this.divider = divider;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ControllerLifeDividedValue(final ControllerLifeDividedValue dynamicValue) {
|
||||||
|
this.divider = dynamicValue.divider;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int calculate(Game game, Ability sourceAbility, Effect effect) {
|
||||||
|
Player p = game.getPlayer(sourceAbility.getControllerId());
|
||||||
|
if (p != null) {
|
||||||
|
return p.getLife() / divider;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ControllerLifeDividedValue copy() {
|
||||||
|
return new ControllerLifeDividedValue(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "X";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getMessage() {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue