forked from External/mage
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:
parent
5e8aee48b3
commit
32bf3eb9bf
161 changed files with 949 additions and 2567 deletions
|
|
@ -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 "";
|
||||
}
|
||||
}
|
||||
|
|
@ -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";
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue