mirror of
https://github.com/magefree/mage.git
synced 2025-12-27 22:12:03 -08:00
[BRO] Implement Clay Champion
This commit is contained in:
parent
867fa64156
commit
ee92809a10
3 changed files with 116 additions and 0 deletions
|
|
@ -0,0 +1,51 @@
|
|||
package mage.abilities.dynamicvalue.common;
|
||||
|
||||
import mage.Mana;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.dynamicvalue.DynamicValue;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.constants.AbilityType;
|
||||
import mage.constants.ColoredManaSymbol;
|
||||
import mage.game.Game;
|
||||
import mage.watchers.common.ManaSpentToCastWatcher;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public enum EachTwoManaSpentToCastValue implements DynamicValue {
|
||||
WHITE(ColoredManaSymbol.W),
|
||||
BLUE(ColoredManaSymbol.U),
|
||||
BLACK(ColoredManaSymbol.B),
|
||||
RED(ColoredManaSymbol.R),
|
||||
GREEN(ColoredManaSymbol.G);
|
||||
private final ColoredManaSymbol coloredManaSymbol;
|
||||
|
||||
EachTwoManaSpentToCastValue(ColoredManaSymbol manaSymbol) {
|
||||
this.coloredManaSymbol = manaSymbol;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int calculate(Game game, Ability sourceAbility, Effect effect) {
|
||||
if (sourceAbility.getAbilityType() == AbilityType.SPELL) {
|
||||
return sourceAbility.getManaCostsToPay().getUsedManaToPay().getColor(coloredManaSymbol) / 2;
|
||||
}
|
||||
Mana payment = game
|
||||
.getState()
|
||||
.getWatcher(ManaSpentToCastWatcher.class)
|
||||
.getLastManaPayment(sourceAbility.getSourceId());
|
||||
if (payment == null) {
|
||||
return 0;
|
||||
}
|
||||
return payment.getColor(coloredManaSymbol) / 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EachTwoManaSpentToCastValue copy() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return "for each {" + this.coloredManaSymbol + "}{" + this.coloredManaSymbol + "} spent to cast it";
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue