mirror of
https://github.com/magefree/mage.git
synced 2025-12-25 04:52:07 -08:00
[CLB] Implemented Majestic Genesis
This commit is contained in:
parent
9497f8b6c3
commit
23ed717c8c
10 changed files with 159 additions and 66 deletions
|
|
@ -1,12 +1,9 @@
|
|||
package mage.abilities.costs.costadjusters;
|
||||
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.costs.CostAdjuster;
|
||||
import mage.constants.CommanderCardType;
|
||||
import mage.constants.Zone;
|
||||
import mage.abilities.dynamicvalue.common.GreatestCommanderManaValue;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
/**
|
||||
|
|
@ -17,19 +14,6 @@ public enum CommanderManaValueAdjuster implements CostAdjuster {
|
|||
|
||||
@Override
|
||||
public void adjustCosts(Ability ability, Game game) {
|
||||
Player player = game.getPlayer(ability.getControllerId());
|
||||
if (player == null) {
|
||||
return;
|
||||
}
|
||||
int maxValue = game
|
||||
.getCommanderCardsFromAnyZones(
|
||||
player, CommanderCardType.ANY,
|
||||
Zone.BATTLEFIELD, Zone.COMMAND
|
||||
)
|
||||
.stream()
|
||||
.mapToInt(MageObject::getManaValue)
|
||||
.max()
|
||||
.orElse(0);
|
||||
CardUtil.reduceCost(ability, maxValue);
|
||||
CardUtil.reduceCost(ability, GreatestCommanderManaValue.instance.calculate(game, ability, null));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,54 @@
|
|||
package mage.abilities.dynamicvalue.common;
|
||||
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.dynamicvalue.DynamicValue;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.hint.Hint;
|
||||
import mage.abilities.hint.ValueHint;
|
||||
import mage.constants.CommanderCardType;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public enum GreatestCommanderManaValue implements DynamicValue {
|
||||
instance;
|
||||
|
||||
private static final Hint hint = new ValueHint("Greatest mana value of a commander you own", instance);
|
||||
|
||||
public static Hint getHint() {
|
||||
return hint;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int calculate(Game game, Ability sourceAbility, Effect effect) {
|
||||
Player player = game.getPlayer(sourceAbility.getControllerId());
|
||||
return player != null ? game
|
||||
.getCommanderCardsFromAnyZones(
|
||||
player, CommanderCardType.ANY,
|
||||
Zone.BATTLEFIELD, Zone.COMMAND
|
||||
)
|
||||
.stream()
|
||||
.mapToInt(MageObject::getManaValue)
|
||||
.max()
|
||||
.orElse(0) : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public GreatestCommanderManaValue copy() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return "the greatest mana value of a commander you own on the battlefield or in the command zone";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "X";
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue