[CMM] Implement Demon of Fate's Design (#10737)

* refactor SacrificeCostManaValue to be an enum.

* [CMM] Implement Demon of Fates Design

* Add Unit Tests, including one bug on alternative cost.

* fix alternativeCosts made from dynamicCost returning that they were not activated when paid.

* fix small issues, add hint

* cleanup tests and add a couple

* Capitalize enum instances

* Minor fixes

* simplify the ContinuousEffect

* use the ConditionPermanentHint made for the Demon

* fix text
This commit is contained in:
Susucre 2023-08-12 21:49:06 +02:00 committed by GitHub
parent 0ce21d12a5
commit eef8f508e4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
22 changed files with 707 additions and 111 deletions

View file

@ -1,56 +0,0 @@
package mage.abilities.dynamicvalue.common;
import mage.abilities.Ability;
import mage.abilities.costs.Cost;
import mage.abilities.costs.common.SacrificeTargetCost;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.effects.Effect;
import mage.game.Game;
import mage.game.permanent.Permanent;
/**
* @author LoneFox
*/
public class SacrificeCostConvertedMana implements DynamicValue {
private final String type;
public SacrificeCostConvertedMana(String type) {
this.type = type;
}
public SacrificeCostConvertedMana(SacrificeCostConvertedMana value) {
this.type = value.type;
}
@Override
public int calculate(Game game, Ability sourceAbility, Effect effect) {
for(Cost cost : sourceAbility.getCosts()) {
if(cost instanceof SacrificeTargetCost) {
SacrificeTargetCost sacrificeCost = (SacrificeTargetCost) cost;
int totalCMC = 0;
for(Permanent permanent : sacrificeCost.getPermanents()) {
totalCMC += permanent.getManaValue();
}
return totalCMC;
}
}
return 0;
}
@Override
public SacrificeCostConvertedMana copy() {
return new SacrificeCostConvertedMana(this);
}
@Override
public String toString() {
return "X";
}
@Override
public String getMessage() {
return "the sacrificed " + type + "'s mana value";
}
}