mirror of
https://github.com/magefree/mage.git
synced 2025-12-27 22:12:03 -08:00
[OTC] Implement Cactus Preserve
This commit is contained in:
parent
24e3a5b7ac
commit
b5d0943b9d
4 changed files with 126 additions and 36 deletions
|
|
@ -0,0 +1,41 @@
|
|||
package mage.abilities.dynamicvalue.common;
|
||||
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.dynamicvalue.DynamicValue;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.constants.CommanderCardType;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
|
||||
/**
|
||||
* @author PurpleCrowbar
|
||||
*/
|
||||
public enum CommanderGreatestManaValue implements DynamicValue {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public int calculate(Game game, Ability sourceAbility, Effect effect) {
|
||||
return game.getCommanderCardsFromAnyZones(
|
||||
game.getPlayer(sourceAbility.getControllerId()), CommanderCardType.ANY, Zone.ALL)
|
||||
.stream()
|
||||
.mapToInt(MageObject::getManaValue)
|
||||
.max()
|
||||
.orElse(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommanderGreatestManaValue copy() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "X";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return "the greatest mana value among your commanders";
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue