Genericize Target Adjusters (#12107)

* Create generic X MV adjuster

* Update XTargetsAdjuster

* Create DynamicValueTargetsAdjuster to replace VerseCounterAdjuster

* Convert XTargetsAdjuster to use DynamicValueTargetsAdjuster

* Genericize MV target adjuster

* Converting custom classes for A and B cards, fix Back in Town to only target creature cards

* Add Power and Toughness target adjusters, C cards

* Set up and use Monstrosity X DynamicValue

* Move Scry amount dynamic value to common, add D and E cards

* Convert F to I cards

* Cards K-M

* N, O cards

* Cards O-R

* S cards (check Scrap Welder)

* Cards T - Z

* Rename target adjusters

* Add filter messages, don't add 0 count targets

* Clear blueprint targets (just in case), fix target names, Temporal Firestorm is not target

* Requested renames

* Aether Burst is "up to"

* Review fixes

* Add new cards, add source to dynamic value calculation
This commit is contained in:
ssk97 2024-05-02 22:12:52 -07:00 committed by GitHub
parent 5e8aee48b3
commit 32bf3eb9bf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
161 changed files with 949 additions and 2567 deletions

View file

@ -0,0 +1,41 @@
package mage.abilities.dynamicvalue.common;
import mage.abilities.Ability;
import mage.abilities.common.BecomesMonstrousSourceTriggeredAbility;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.effects.Effect;
import mage.game.Game;
/**
* Monstrosity X
*
* @author notgreat
*/
public enum GetMonstrosityXValue implements DynamicValue {
instance;
@Override
public int calculate(Game game, Ability sourceAbility, Effect effect) {
if (sourceAbility instanceof BecomesMonstrousSourceTriggeredAbility) {
return ((BecomesMonstrousSourceTriggeredAbility) sourceAbility).getMonstrosityValue();
} else {
throw new IllegalArgumentException("Trying to get Monstrosity X value with non-Monstrosity sourceAbility "+sourceAbility.getClass().getName());
}
}
@Override
public GetMonstrosityXValue copy() {
return GetMonstrosityXValue.instance;
}
@Override
public String toString() {
return "X";
}
@Override
public String getMessage() {
return "";
}
}

View file

@ -0,0 +1,39 @@
package mage.abilities.dynamicvalue.common;
import mage.abilities.Ability;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.effects.Effect;
import mage.game.Game;
/**
* @author notgreat
*/
public enum GetScryAmount implements DynamicValue {
instance;
@Override
public int calculate(Game game, Ability sourceAbility, Effect effect) {
return sourceAbility
.getEffects()
.stream()
.mapToInt(thisEffect -> (Integer) thisEffect.getValue("amount"))
.findFirst()
.orElse(0);
}
@Override
public GetScryAmount copy() {
return GetScryAmount.instance;
}
@Override
public String getMessage() {
return "card looked at while scrying this way";
}
@Override
public String toString() {
return "1";
}
}