mirror of
https://github.com/magefree/mage.git
synced 2026-01-10 21:02:08 -08:00
Refactor: Add proper support for modifying and querying base P/T (#9409)
This commit is contained in:
parent
d83eb41073
commit
07a142c9e8
415 changed files with 1844 additions and 2095 deletions
|
|
@ -6,6 +6,9 @@ import mage.util.Copyable;
|
|||
import java.io.Serializable;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* Wrapper class for the Integer used to represent power and toughness.
|
||||
*/
|
||||
public class MageInt implements Serializable, Copyable<MageInt> {
|
||||
|
||||
public static final MageInt EmptyMageInt = new MageInt(Integer.MIN_VALUE, "") {
|
||||
|
|
@ -13,38 +16,39 @@ public class MageInt implements Serializable, Copyable<MageInt> {
|
|||
private static final String exceptionMessage = "MageInt.EmptyMageInt can't be modified.";
|
||||
|
||||
@Override
|
||||
public void boostValue(int amount) {
|
||||
public void increaseBoostedValue(int amount) {
|
||||
throw new RuntimeException(exceptionMessage);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValue(int value) {
|
||||
public void setBoostedValue(int value) {
|
||||
throw new RuntimeException(exceptionMessage);
|
||||
}
|
||||
};
|
||||
|
||||
protected int baseValue;
|
||||
protected int baseValueModified;
|
||||
// The original P/T value, can never change
|
||||
protected final int baseValue;
|
||||
// The current base value. Can be changed by effects such as Biomass Mutation
|
||||
protected int modifiedBaseValue;
|
||||
// The curent final value: current base + any modifications (e.g. +1/+1 counters or "creature gets +1/+1")
|
||||
protected int boostedValue;
|
||||
protected String cardValue = "";
|
||||
// String representation of the current base value, update automatically
|
||||
protected String cardValue;
|
||||
|
||||
public MageInt(int value) {
|
||||
this.baseValue = value;
|
||||
this.baseValueModified = baseValue;
|
||||
this.boostedValue = baseValue;
|
||||
this.cardValue = Integer.toString(value);
|
||||
this(value, Integer.toString(value));
|
||||
}
|
||||
|
||||
public MageInt(int baseValue, String cardValue) {
|
||||
this.baseValue = baseValue;
|
||||
this.baseValueModified = baseValue;
|
||||
this.boostedValue = baseValue;
|
||||
this.modifiedBaseValue = this.baseValue;
|
||||
this.boostedValue = this.baseValue;
|
||||
this.cardValue = cardValue;
|
||||
}
|
||||
|
||||
public MageInt(int baseValue, int baseValueModified, int boostedValue, String cardValue) {
|
||||
this.baseValue = baseValue;
|
||||
this.baseValueModified = baseValueModified;
|
||||
this.modifiedBaseValue = baseValueModified;
|
||||
this.boostedValue = boostedValue;
|
||||
this.cardValue = cardValue;
|
||||
}
|
||||
|
|
@ -54,42 +58,41 @@ public class MageInt implements Serializable, Copyable<MageInt> {
|
|||
if (Objects.equals(this, EmptyMageInt)) {
|
||||
return this;
|
||||
}
|
||||
return new MageInt(baseValue, baseValueModified, boostedValue, cardValue);
|
||||
return new MageInt(baseValue, modifiedBaseValue, boostedValue, cardValue);
|
||||
}
|
||||
|
||||
public int getBaseValue() {
|
||||
return baseValue;
|
||||
}
|
||||
|
||||
public int getBaseValueModified() {
|
||||
return baseValueModified;
|
||||
public int getModifiedBaseValue() {
|
||||
return modifiedBaseValue;
|
||||
}
|
||||
|
||||
public int getValue() {
|
||||
return boostedValue;
|
||||
}
|
||||
|
||||
public void modifyBaseValue(int value) {
|
||||
this.baseValueModified = value;
|
||||
public void setModifiedBaseValue(int value) {
|
||||
this.modifiedBaseValue = value;
|
||||
this.boostedValue = value;
|
||||
this.cardValue = Integer.toString(value);
|
||||
}
|
||||
|
||||
public void setValue(int value) {
|
||||
public void setBoostedValue(int value) {
|
||||
this.boostedValue = value;
|
||||
}
|
||||
|
||||
public void boostValue(int amount) {
|
||||
public void increaseBoostedValue(int amount) {
|
||||
this.boostedValue = CardUtil.overflowInc(this.boostedValue, amount);
|
||||
}
|
||||
|
||||
public void resetToBaseValue() {
|
||||
this.boostedValue = this.baseValueModified;
|
||||
setModifiedBaseValue(this.baseValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return cardValue;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -130,8 +130,8 @@ public class CopyEffect extends ContinuousEffectImpl {
|
|||
// Primal Clay example:
|
||||
// If a creature that’s already on the battlefield becomes a copy of this creature, it copies the power, toughness,
|
||||
// and abilities that were chosen for this creature as it entered the battlefield. (2018-03-16)
|
||||
permanent.getPower().setValue(copyFromObject.getPower().getBaseValueModified());
|
||||
permanent.getToughness().setValue(copyFromObject.getToughness().getBaseValueModified());
|
||||
permanent.getPower().setModifiedBaseValue(copyFromObject.getPower().getModifiedBaseValue());
|
||||
permanent.getToughness().setModifiedBaseValue(copyFromObject.getToughness().getModifiedBaseValue());
|
||||
permanent.setStartingLoyalty(copyFromObject.getStartingLoyalty());
|
||||
if (copyFromObject instanceof Permanent) {
|
||||
Permanent targetPermanent = (Permanent) copyFromObject;
|
||||
|
|
|
|||
|
|
@ -41,9 +41,9 @@ public class CopyTokenEffect extends ContinuousEffectImpl {
|
|||
for (Ability ability : token.getAbilities()) {
|
||||
permanent.addAbility(ability, source.getSourceId(), game);
|
||||
}
|
||||
permanent.getPower().setValue(token.getPower().getValue());
|
||||
permanent.getToughness().setValue(token.getToughness().getValue());
|
||||
//permanent.getLoyalty().setValue(card.getLoyalty().getValue());
|
||||
permanent.getPower().setModifiedBaseValue(token.getPower().getModifiedBaseValue());
|
||||
permanent.getToughness().setModifiedBaseValue(token.getToughness().getModifiedBaseValue());
|
||||
//permanent.getLoyalty().setBoostedValue(card.getLoyalty().getValue());
|
||||
|
||||
return true;
|
||||
|
||||
|
|
|
|||
|
|
@ -224,11 +224,11 @@ public class CreateTokenCopyTargetEffect extends OneShotEffect {
|
|||
}
|
||||
if (tokenPower != Integer.MIN_VALUE) {
|
||||
token.removePTCDA();
|
||||
token.getPower().modifyBaseValue(tokenPower);
|
||||
token.setPower(tokenPower);
|
||||
}
|
||||
if (tokenToughness != Integer.MIN_VALUE) {
|
||||
token.removePTCDA();
|
||||
token.getToughness().modifyBaseValue(tokenToughness);
|
||||
token.setToughness(tokenToughness);
|
||||
}
|
||||
if (onlySubType != null) {
|
||||
token.removeAllCreatureTypes();
|
||||
|
|
|
|||
|
|
@ -140,8 +140,8 @@ public class BecomesCreatureAllEffect extends ContinuousEffectImpl {
|
|||
int power = token.getPower().getValue();
|
||||
int toughness = token.getToughness().getValue();
|
||||
if (power != 0 && toughness != 0) {
|
||||
permanent.getPower().setValue(power);
|
||||
permanent.getToughness().setValue(toughness);
|
||||
permanent.getPower().setModifiedBaseValue(power);
|
||||
permanent.getToughness().setModifiedBaseValue(toughness);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -119,8 +119,8 @@ public class BecomesCreatureAttachedEffect extends ContinuousEffectImpl {
|
|||
|
||||
case PTChangingEffects_7:
|
||||
if (sublayer == SubLayer.SetPT_7b) {
|
||||
permanent.getPower().setValue(token.getPower().getValue());
|
||||
permanent.getToughness().setValue(token.getToughness().getValue());
|
||||
permanent.getPower().setModifiedBaseValue(token.getPower().getValue());
|
||||
permanent.getToughness().setModifiedBaseValue(token.getToughness().getValue());
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -123,14 +123,14 @@ public class BecomesCreatureSourceEffect extends ContinuousEffectImpl implements
|
|||
if ((sublayer == SubLayer.CharacteristicDefining_7a && isCharacterDefining())
|
||||
|| (sublayer == SubLayer.SetPT_7b && !isCharacterDefining())) {
|
||||
if (power != null) {
|
||||
permanent.getPower().setValue(power.calculate(game, source, this)); // check all other becomes to use calculate?
|
||||
permanent.getPower().setModifiedBaseValue(power.calculate(game, source, this)); // check all other becomes to use calculate?
|
||||
} else if (token.getPower() != null) {
|
||||
permanent.getPower().setValue(token.getPower().getValue());
|
||||
permanent.getPower().setModifiedBaseValue(token.getPower().getValue());
|
||||
}
|
||||
if (toughness != null) {
|
||||
permanent.getToughness().setValue(toughness.calculate(game, source, this));
|
||||
permanent.getToughness().setModifiedBaseValue(toughness.calculate(game, source, this));
|
||||
} else if (token.getToughness() != null) {
|
||||
permanent.getToughness().setValue(token.getToughness().getValue());
|
||||
permanent.getToughness().setModifiedBaseValue(token.getToughness().getValue());
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -127,8 +127,8 @@ public class BecomesCreatureTargetEffect extends ContinuousEffectImpl {
|
|||
|
||||
case PTChangingEffects_7:
|
||||
if (sublayer == SubLayer.SetPT_7b) { // CDA can only define a characteristic of either the card or token it comes from.
|
||||
permanent.getToughness().setValue(token.getToughness().getValue());
|
||||
permanent.getPower().setValue(token.getPower().getValue());
|
||||
permanent.getToughness().setModifiedBaseValue(token.getToughness().getValue());
|
||||
permanent.getPower().setModifiedBaseValue(token.getPower().getValue());
|
||||
}
|
||||
}
|
||||
result = true;
|
||||
|
|
|
|||
|
|
@ -116,8 +116,8 @@ public class BecomesFaceDownCreatureAllEffect extends ContinuousEffectImpl imple
|
|||
break;
|
||||
case PTChangingEffects_7:
|
||||
if (sublayer == SubLayer.SetPT_7b) {
|
||||
permanent.getPower().setValue(2);
|
||||
permanent.getToughness().setValue(2);
|
||||
permanent.getPower().setModifiedBaseValue(2);
|
||||
permanent.getToughness().setModifiedBaseValue(2);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -176,8 +176,8 @@ public class BecomesFaceDownCreatureEffect extends ContinuousEffectImpl implemen
|
|||
break;
|
||||
case PTChangingEffects_7:
|
||||
if (sublayer == SubLayer.SetPT_7b) {
|
||||
permanent.getPower().setValue(2);
|
||||
permanent.getToughness().setValue(2);
|
||||
permanent.getPower().setModifiedBaseValue(2);
|
||||
permanent.getToughness().setModifiedBaseValue(2);
|
||||
}
|
||||
}
|
||||
} else if (duration == Duration.Custom && foundPermanent == true) {
|
||||
|
|
|
|||
|
|
@ -13,38 +13,39 @@ import mage.game.permanent.Permanent;
|
|||
*
|
||||
* @author jeffwadsworth
|
||||
*/
|
||||
public class SetPowerEnchantedEffect extends ContinuousEffectImpl {
|
||||
public class SetBasePowerEnchantedEffect extends ContinuousEffectImpl {
|
||||
|
||||
private final int power;
|
||||
|
||||
public SetPowerEnchantedEffect(int power) {
|
||||
super(Duration.WhileOnBattlefield, Layer.PTChangingEffects_7, SubLayer.SetPT_7b, Outcome.Neutral);
|
||||
public SetBasePowerEnchantedEffect(int power) {
|
||||
super(Duration.WhileOnBattlefield, Layer.PTChangingEffects_7, SubLayer.SetPT_7b, (power > 0 ? Outcome.BoostCreature : Outcome.Neutral));
|
||||
staticText = "Enchanted creature has base power " + power;
|
||||
this.power = power;
|
||||
}
|
||||
|
||||
public SetPowerEnchantedEffect(final SetPowerEnchantedEffect effect) {
|
||||
public SetBasePowerEnchantedEffect(final SetBasePowerEnchantedEffect effect) {
|
||||
super(effect);
|
||||
this.power = effect.power;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SetPowerEnchantedEffect copy() {
|
||||
return new SetPowerEnchantedEffect(this);
|
||||
public SetBasePowerEnchantedEffect copy() {
|
||||
return new SetBasePowerEnchantedEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent enchantment = game.getPermanent(source.getSourceId());
|
||||
if (enchantment != null
|
||||
&& enchantment.getAttachedTo() != null) {
|
||||
Permanent enchanted = game.getPermanent(enchantment.getAttachedTo());
|
||||
if (enchanted != null) {
|
||||
enchanted.getPower().setValue(power);
|
||||
}
|
||||
return true;
|
||||
if (enchantment == null || enchantment.getAttachedTo() == null) {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Permanent enchanted = game.getPermanent(enchantment.getAttachedTo());
|
||||
if (enchanted == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
enchanted.getPower().setModifiedBaseValue(power);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -15,39 +15,40 @@ import mage.game.Game;
|
|||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class SetPowerSourceEffect extends ContinuousEffectImpl {
|
||||
public class SetBasePowerSourceEffect extends ContinuousEffectImpl {
|
||||
|
||||
private final DynamicValue amount;
|
||||
|
||||
public SetPowerSourceEffect(DynamicValue amount, Duration duration) {
|
||||
public SetBasePowerSourceEffect(DynamicValue amount, Duration duration) {
|
||||
this(amount, duration, SubLayer.CharacteristicDefining_7a);
|
||||
}
|
||||
|
||||
public SetPowerSourceEffect(DynamicValue amount, Duration duration, SubLayer subLayer) {
|
||||
public SetBasePowerSourceEffect(DynamicValue amount, Duration duration, SubLayer subLayer) {
|
||||
super(duration, Layer.PTChangingEffects_7, subLayer, Outcome.BoostCreature);
|
||||
setCharacterDefining(subLayer == SubLayer.CharacteristicDefining_7a);
|
||||
this.amount = amount;
|
||||
staticText = "{this}'s power is equal to the number of " + amount.getMessage();
|
||||
}
|
||||
|
||||
public SetPowerSourceEffect(final SetPowerSourceEffect effect) {
|
||||
public SetBasePowerSourceEffect(final SetBasePowerSourceEffect effect) {
|
||||
super(effect);
|
||||
this.amount = effect.amount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SetPowerSourceEffect copy() {
|
||||
return new SetPowerSourceEffect(this);
|
||||
public SetBasePowerSourceEffect copy() {
|
||||
return new SetBasePowerSourceEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
MageObject mageObject = game.getObject(source);
|
||||
if (mageObject != null) {
|
||||
int value = amount.calculate(game, source, this);
|
||||
mageObject.getPower().setValue(value);
|
||||
return true;
|
||||
if (mageObject == null) {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
int value = amount.calculate(game, source, this);
|
||||
mageObject.getPower().setModifiedBaseValue(value);
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -21,22 +21,22 @@ import java.util.Locale;
|
|||
/**
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class SetPowerToughnessAllEffect extends ContinuousEffectImpl {
|
||||
public class SetBasePowerToughnessAllEffect extends ContinuousEffectImpl {
|
||||
|
||||
private final FilterPermanent filter;
|
||||
private DynamicValue power;
|
||||
private DynamicValue toughness;
|
||||
private final boolean lockedInPT;
|
||||
|
||||
public SetPowerToughnessAllEffect(int power, int toughness, Duration duration) {
|
||||
public SetBasePowerToughnessAllEffect(int power, int toughness, Duration duration) {
|
||||
this(StaticValue.get(power), StaticValue.get(toughness), duration, new FilterCreaturePermanent("Creatures"), true);
|
||||
}
|
||||
|
||||
public SetPowerToughnessAllEffect(int power, int toughness, Duration duration, FilterPermanent filter, boolean lockedInPT) {
|
||||
public SetBasePowerToughnessAllEffect(int power, int toughness, Duration duration, FilterPermanent filter, boolean lockedInPT) {
|
||||
this(StaticValue.get(power), StaticValue.get(toughness), duration, filter, lockedInPT);
|
||||
}
|
||||
|
||||
public SetPowerToughnessAllEffect(DynamicValue power, DynamicValue toughness, Duration duration, FilterPermanent filter, boolean lockedInPT) {
|
||||
public SetBasePowerToughnessAllEffect(DynamicValue power, DynamicValue toughness, Duration duration, FilterPermanent filter, boolean lockedInPT) {
|
||||
super(duration, Layer.PTChangingEffects_7, SubLayer.SetPT_7b, Outcome.BoostCreature);
|
||||
this.power = power;
|
||||
this.toughness = toughness;
|
||||
|
|
@ -44,7 +44,7 @@ public class SetPowerToughnessAllEffect extends ContinuousEffectImpl {
|
|||
this.lockedInPT = lockedInPT;
|
||||
}
|
||||
|
||||
public SetPowerToughnessAllEffect(final SetPowerToughnessAllEffect effect) {
|
||||
public SetBasePowerToughnessAllEffect(final SetBasePowerToughnessAllEffect effect) {
|
||||
super(effect);
|
||||
this.power = effect.power;
|
||||
this.toughness = effect.toughness;
|
||||
|
|
@ -53,8 +53,8 @@ public class SetPowerToughnessAllEffect extends ContinuousEffectImpl {
|
|||
}
|
||||
|
||||
@Override
|
||||
public SetPowerToughnessAllEffect copy() {
|
||||
return new SetPowerToughnessAllEffect(this);
|
||||
public SetBasePowerToughnessAllEffect copy() {
|
||||
return new SetBasePowerToughnessAllEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -79,16 +79,16 @@ public class SetPowerToughnessAllEffect extends ContinuousEffectImpl {
|
|||
for (Iterator<MageObjectReference> it = affectedObjectList.iterator(); it.hasNext(); ) {
|
||||
Permanent permanent = it.next().getPermanent(game);
|
||||
if (permanent != null) {
|
||||
permanent.getPower().setValue(newPower);
|
||||
permanent.getToughness().setValue(newToughness);
|
||||
permanent.getPower().setModifiedBaseValue(newPower);
|
||||
permanent.getToughness().setModifiedBaseValue(newToughness);
|
||||
} else {
|
||||
it.remove(); // no longer on the battlefield, remove reference to object
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source, game)) {
|
||||
permanent.getPower().setValue(newPower);
|
||||
permanent.getToughness().setValue(newToughness);
|
||||
permanent.getPower().setModifiedBaseValue(newPower);
|
||||
permanent.getToughness().setModifiedBaseValue(newToughness);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
|
@ -13,45 +13,48 @@ import mage.game.permanent.Permanent;
|
|||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class SetPowerToughnessEnchantedEffect extends ContinuousEffectImpl {
|
||||
public class SetBasePowerToughnessEnchantedEffect extends ContinuousEffectImpl {
|
||||
|
||||
private final int power;
|
||||
private final int toughness;
|
||||
|
||||
public SetPowerToughnessEnchantedEffect() {
|
||||
public SetBasePowerToughnessEnchantedEffect() {
|
||||
this(0, 2);
|
||||
}
|
||||
|
||||
public SetPowerToughnessEnchantedEffect(int power, int toughness) {
|
||||
public SetBasePowerToughnessEnchantedEffect(int power, int toughness) {
|
||||
super(Duration.WhileOnBattlefield, Layer.PTChangingEffects_7, SubLayer.SetPT_7b, Outcome.BoostCreature);
|
||||
staticText = "Enchanted creature has base power and toughness " + power + "/" + toughness;
|
||||
this.power = power;
|
||||
this.toughness = toughness;
|
||||
}
|
||||
|
||||
public SetPowerToughnessEnchantedEffect(final SetPowerToughnessEnchantedEffect effect) {
|
||||
public SetBasePowerToughnessEnchantedEffect(final SetBasePowerToughnessEnchantedEffect effect) {
|
||||
super(effect);
|
||||
this.power = effect.power;
|
||||
this.toughness = effect.toughness;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SetPowerToughnessEnchantedEffect copy() {
|
||||
return new SetPowerToughnessEnchantedEffect(this);
|
||||
public SetBasePowerToughnessEnchantedEffect copy() {
|
||||
return new SetBasePowerToughnessEnchantedEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent enchantment = game.getPermanent(source.getSourceId());
|
||||
if (enchantment != null && enchantment.getAttachedTo() != null) {
|
||||
Permanent enchanted = game.getPermanent(enchantment.getAttachedTo());
|
||||
if (enchanted != null) {
|
||||
enchanted.getPower().setValue(power);
|
||||
enchanted.getToughness().setValue(toughness);
|
||||
}
|
||||
return true;
|
||||
if (enchantment == null || enchantment.getAttachedTo() == null) {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
|
||||
Permanent enchanted = game.getPermanent(enchantment.getAttachedTo());
|
||||
if (enchanted == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
enchanted.getPower().setModifiedBaseValue(power);
|
||||
enchanted.getToughness().setModifiedBaseValue(toughness);
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,107 @@
|
|||
|
||||
package mage.abilities.effects.common.continuous;
|
||||
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.dynamicvalue.DynamicValue;
|
||||
import mage.abilities.dynamicvalue.common.StaticValue;
|
||||
import mage.abilities.effects.ContinuousEffectImpl;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Layer;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubLayer;
|
||||
import mage.game.Game;
|
||||
|
||||
/**
|
||||
* RENAME
|
||||
* @author BetaSteward_at_googlemail.com, North, Alex-Vasile
|
||||
*/
|
||||
public class SetBasePowerToughnessSourceEffect extends ContinuousEffectImpl {
|
||||
|
||||
private DynamicValue power;
|
||||
private DynamicValue toughness;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param power
|
||||
* @param toughness
|
||||
* @param duration
|
||||
* @param subLayer
|
||||
* @param baseInText Whether or not the rules text should refer to "base power and toughness" or "power and toughness"
|
||||
* Either way, it is always the based power and toughness that are set.
|
||||
*/
|
||||
public SetBasePowerToughnessSourceEffect(DynamicValue power, DynamicValue toughness, Duration duration, SubLayer subLayer, boolean baseInText) {
|
||||
super(duration, Layer.PTChangingEffects_7, subLayer, Outcome.BoostCreature);
|
||||
setCharacterDefining(subLayer == SubLayer.CharacteristicDefining_7a);
|
||||
this.power = power;
|
||||
this.toughness = toughness;
|
||||
if (power == toughness) { // When power and toughness are equal, a previous constructor passes the same object for both power nad toughness, so use == instead of .equals
|
||||
this.staticText = "{this}'s " + (baseInText ? "base " : "") + "power and toughness are each equal to the number of " + power.getMessage();
|
||||
} else { // The only other constructor creates the power and toughenss dynamic values as static values from passed-in ints.
|
||||
String value = (power != null ? power.toString() : toughness.toString());
|
||||
this.staticText = "{this}'s " + (baseInText ? "base " : "") + "power and toughness is " + value + '/' + toughness + ' ' + duration.toString();
|
||||
}
|
||||
}
|
||||
|
||||
public SetBasePowerToughnessSourceEffect(DynamicValue amount, Duration duration) {
|
||||
this(amount, duration, SubLayer.CharacteristicDefining_7a, false);
|
||||
}
|
||||
|
||||
public SetBasePowerToughnessSourceEffect(DynamicValue amount, Duration duration, SubLayer subLayer) {
|
||||
this(amount, duration, subLayer, true);
|
||||
}
|
||||
|
||||
public SetBasePowerToughnessSourceEffect(DynamicValue amount, Duration duration, SubLayer subLayer, boolean changeBaseValue) {
|
||||
this(amount, amount, duration, subLayer, changeBaseValue);
|
||||
}
|
||||
|
||||
public SetBasePowerToughnessSourceEffect(int power, int toughness, Duration duration, boolean changeBaseValue) {
|
||||
this(power, toughness, duration, SubLayer.CharacteristicDefining_7a, changeBaseValue);
|
||||
}
|
||||
|
||||
public SetBasePowerToughnessSourceEffect(int power, int toughness, Duration duration, SubLayer subLayer) {
|
||||
this(power, toughness, duration, subLayer, false);
|
||||
}
|
||||
|
||||
public SetBasePowerToughnessSourceEffect(int power, int toughness, Duration duration, SubLayer subLayer, boolean changeBaseValue) {
|
||||
this(StaticValue.get(power), StaticValue.get(toughness), duration, subLayer, changeBaseValue);
|
||||
}
|
||||
|
||||
public SetBasePowerToughnessSourceEffect(final SetBasePowerToughnessSourceEffect effect) {
|
||||
super(effect);
|
||||
this.power = effect.power;
|
||||
this.toughness = effect.toughness;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SetBasePowerToughnessSourceEffect copy() {
|
||||
return new SetBasePowerToughnessSourceEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
MageObject mageObject = game.getPermanentEntering(source.getSourceId());
|
||||
if (mageObject == null) {
|
||||
if (duration == Duration.Custom || isTemporary()) {
|
||||
mageObject = game.getPermanent(source.getSourceId());
|
||||
} else {
|
||||
mageObject = game.getObject(source);
|
||||
}
|
||||
}
|
||||
if (mageObject == null || (power == null && toughness == null)) {
|
||||
discard();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.power != null) {
|
||||
int power = this.power.calculate(game, source, this);
|
||||
mageObject.getPower().setModifiedBaseValue(power);
|
||||
}
|
||||
|
||||
if (this.toughness != null) {
|
||||
int toughness = this.toughness.calculate(game, source, this);
|
||||
mageObject.getToughness().setModifiedBaseValue(toughness);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -19,30 +19,30 @@ import java.util.UUID;
|
|||
/**
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public class SetPowerToughnessTargetEffect extends ContinuousEffectImpl {
|
||||
public class SetBasePowerToughnessTargetEffect extends ContinuousEffectImpl {
|
||||
|
||||
private DynamicValue power;
|
||||
private DynamicValue toughness;
|
||||
|
||||
public SetPowerToughnessTargetEffect(DynamicValue power, DynamicValue toughness, Duration duration) {
|
||||
public SetBasePowerToughnessTargetEffect(DynamicValue power, DynamicValue toughness, Duration duration) {
|
||||
super(duration, Layer.PTChangingEffects_7, SubLayer.SetPT_7b, Outcome.BoostCreature);
|
||||
this.power = power;
|
||||
this.toughness = toughness;
|
||||
}
|
||||
|
||||
public SetPowerToughnessTargetEffect(int power, int toughness, Duration duration) {
|
||||
public SetBasePowerToughnessTargetEffect(int power, int toughness, Duration duration) {
|
||||
this(StaticValue.get(power), StaticValue.get(toughness), duration);
|
||||
}
|
||||
|
||||
public SetPowerToughnessTargetEffect(final SetPowerToughnessTargetEffect effect) {
|
||||
public SetBasePowerToughnessTargetEffect(final SetBasePowerToughnessTargetEffect effect) {
|
||||
super(effect);
|
||||
this.power = effect.power;
|
||||
this.toughness = effect.toughness;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SetPowerToughnessTargetEffect copy() {
|
||||
return new SetPowerToughnessTargetEffect(this);
|
||||
public SetBasePowerToughnessTargetEffect copy() {
|
||||
return new SetBasePowerToughnessTargetEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -50,15 +50,16 @@ public class SetPowerToughnessTargetEffect extends ContinuousEffectImpl {
|
|||
boolean result = false;
|
||||
for (UUID targetId : this.getTargetPointer().getTargets(game, source)) {
|
||||
Permanent target = game.getPermanent(targetId);
|
||||
if (target != null) {
|
||||
if (power != null) {
|
||||
target.getPower().setValue(power.calculate(game, source, this));
|
||||
}
|
||||
if (toughness != null) {
|
||||
target.getToughness().setValue(toughness.calculate(game, source, this));
|
||||
}
|
||||
result = true;
|
||||
if (target == null) {
|
||||
continue;
|
||||
}
|
||||
if (power != null) {
|
||||
target.getPower().setModifiedBaseValue(power.calculate(game, source, this));
|
||||
}
|
||||
if (toughness != null) {
|
||||
target.getToughness().setModifiedBaseValue(toughness.calculate(game, source, this));
|
||||
}
|
||||
result = true;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
@ -92,6 +93,4 @@ public class SetPowerToughnessTargetEffect extends ContinuousEffectImpl {
|
|||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -12,30 +12,31 @@ import mage.constants.SubLayer;
|
|||
import mage.game.Game;
|
||||
|
||||
/**
|
||||
* RENAME
|
||||
* @author Backfir3, noxx
|
||||
*/
|
||||
public class SetToughnessSourceEffect extends ContinuousEffectImpl {
|
||||
public class SetBaseToughnessSourceEffect extends ContinuousEffectImpl {
|
||||
|
||||
private final DynamicValue amount;
|
||||
|
||||
public SetToughnessSourceEffect(DynamicValue amount, Duration duration) {
|
||||
public SetBaseToughnessSourceEffect(DynamicValue amount, Duration duration) {
|
||||
this(amount, duration, SubLayer.CharacteristicDefining_7a);
|
||||
}
|
||||
|
||||
public SetToughnessSourceEffect(DynamicValue amount, Duration duration, SubLayer subLayer) {
|
||||
public SetBaseToughnessSourceEffect(DynamicValue amount, Duration duration, SubLayer subLayer) {
|
||||
super(duration, Layer.PTChangingEffects_7, subLayer, Outcome.BoostCreature);
|
||||
this.amount = amount;
|
||||
staticText = "{this}'s toughness is equal to the number of " + amount.getMessage();
|
||||
}
|
||||
|
||||
public SetToughnessSourceEffect(final SetToughnessSourceEffect effect) {
|
||||
public SetBaseToughnessSourceEffect(final SetBaseToughnessSourceEffect effect) {
|
||||
super(effect);
|
||||
this.amount = effect.amount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SetToughnessSourceEffect copy() {
|
||||
return new SetToughnessSourceEffect(this);
|
||||
public SetBaseToughnessSourceEffect copy() {
|
||||
return new SetBaseToughnessSourceEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -43,7 +44,7 @@ public class SetToughnessSourceEffect extends ContinuousEffectImpl {
|
|||
MageObject mageObject = game.getObject(source);
|
||||
if (mageObject != null) {
|
||||
int value = amount.calculate(game, source, this);
|
||||
mageObject.getToughness().setValue(value);
|
||||
mageObject.getToughness().setModifiedBaseValue(value);
|
||||
return true;
|
||||
} else {
|
||||
if (duration == Duration.Custom) {
|
||||
|
|
@ -1,87 +0,0 @@
|
|||
|
||||
package mage.abilities.effects.common.continuous;
|
||||
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.dynamicvalue.DynamicValue;
|
||||
import mage.abilities.effects.ContinuousEffectImpl;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Layer;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubLayer;
|
||||
import mage.game.Game;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com, North
|
||||
*/
|
||||
public class SetPowerToughnessSourceEffect extends ContinuousEffectImpl {
|
||||
|
||||
private DynamicValue amount;
|
||||
private int power;
|
||||
private int toughness;
|
||||
|
||||
public SetPowerToughnessSourceEffect(DynamicValue amount, Duration duration) {
|
||||
this(amount, duration, SubLayer.CharacteristicDefining_7a);
|
||||
}
|
||||
|
||||
public SetPowerToughnessSourceEffect(DynamicValue amount, Duration duration, SubLayer subLayer) {
|
||||
super(duration, Layer.PTChangingEffects_7, subLayer, Outcome.BoostCreature);
|
||||
setCharacterDefining(subLayer == SubLayer.CharacteristicDefining_7a);
|
||||
this.amount = amount;
|
||||
staticText = "{this}'s power and toughness are each equal to the number of " + amount.getMessage();
|
||||
}
|
||||
|
||||
public SetPowerToughnessSourceEffect(int power, int toughness, Duration duration) {
|
||||
this(power, toughness, duration, SubLayer.CharacteristicDefining_7a);
|
||||
}
|
||||
|
||||
public SetPowerToughnessSourceEffect(int power, int toughness, Duration duration, SubLayer subLayer) {
|
||||
super(duration, Layer.PTChangingEffects_7, subLayer, Outcome.BoostCreature);
|
||||
this.power = power;
|
||||
this.toughness = toughness;
|
||||
staticText = "{this}'s power and toughness is " + power + '/' + toughness + ' ' + duration.toString();
|
||||
}
|
||||
|
||||
public SetPowerToughnessSourceEffect(final SetPowerToughnessSourceEffect effect) {
|
||||
super(effect);
|
||||
this.amount = effect.amount;
|
||||
this.power = effect.power;
|
||||
this.toughness = effect.toughness;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SetPowerToughnessSourceEffect copy() {
|
||||
return new SetPowerToughnessSourceEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
MageObject mageObject = game.getPermanentEntering(source.getSourceId());
|
||||
if (mageObject == null) {
|
||||
if (duration == Duration.Custom || isTemporary()) {
|
||||
mageObject = game.getPermanent(source.getSourceId());
|
||||
} else {
|
||||
mageObject = game.getObject(source);
|
||||
}
|
||||
}
|
||||
if (mageObject == null) {
|
||||
discard();
|
||||
return true;
|
||||
}
|
||||
if (amount != null) {
|
||||
int value = amount.calculate(game, source, this);
|
||||
mageObject.getPower().setValue(value);
|
||||
mageObject.getToughness().setValue(value);
|
||||
return true;
|
||||
} else {
|
||||
if (power != Integer.MIN_VALUE) {
|
||||
mageObject.getPower().setValue(power);
|
||||
}
|
||||
if (toughness != Integer.MIN_VALUE) {
|
||||
mageObject.getToughness().setValue(toughness);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -27,6 +27,7 @@ public class SwitchPowerToughnessAllEffect extends ContinuousEffectImpl {
|
|||
|
||||
public SwitchPowerToughnessAllEffect(Duration duration) {
|
||||
super(duration, Layer.PTChangingEffects_7, SubLayer.SwitchPT_e, Outcome.BoostCreature);
|
||||
this.staticText = "Switch each creature's power and toughness" + (duration.toString().isEmpty() ? "" : " " + duration.toString());
|
||||
}
|
||||
|
||||
public SwitchPowerToughnessAllEffect(final SwitchPowerToughnessAllEffect effect) {
|
||||
|
|
@ -41,52 +42,32 @@ public class SwitchPowerToughnessAllEffect extends ContinuousEffectImpl {
|
|||
@Override
|
||||
public void init(Ability source, Game game) {
|
||||
super.init(source, game);
|
||||
if (this.affectedObjectsSet) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
for (Permanent perm :game.getState().getBattlefield().getActivePermanents(filter, source.getControllerId(), source, game)) {
|
||||
affectedObjectList.add(new MageObjectReference(perm, game));
|
||||
}
|
||||
}
|
||||
if (this.affectedObjectsSet && game.getPlayer(source.getControllerId()) != null) {
|
||||
for (Permanent perm :game.getState().getBattlefield().getActivePermanents(filter, source.getControllerId(), source, game)) {
|
||||
affectedObjectList.add(new MageObjectReference(perm, game));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
if (this.affectedObjectsSet) {
|
||||
for (Iterator<MageObjectReference> it = affectedObjectList.iterator(); it.hasNext();) { // filter may not be used again, because object can have changed filter relevant attributes but still geets boost
|
||||
Permanent creature = it.next().getPermanent(game);
|
||||
if (creature != null) {
|
||||
int power = creature.getPower().getValue();
|
||||
creature.getPower().setValue(creature.getToughness().getValue());
|
||||
creature.getToughness().setValue(power);
|
||||
} else {
|
||||
it.remove();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (Permanent creature :game.getState().getBattlefield().getActivePermanents(filter, source.getControllerId(), source, game)) {
|
||||
int power = creature.getPower().getValue();
|
||||
creature.getPower().setValue(creature.getToughness().getValue());
|
||||
creature.getToughness().setValue(power);
|
||||
if (controller == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!this.affectedObjectsSet) {
|
||||
game.getState().getBattlefield().getActivePermanents(filter, source.getControllerId(), source, game).forEach(Permanent::switchPowerToughness);
|
||||
} else {
|
||||
for (Iterator<MageObjectReference> it = affectedObjectList.iterator(); it.hasNext();) { // filter may not be used again, because object can have changed filter relevant attributes but still gets boost
|
||||
Permanent creature = it.next().getPermanent(game);
|
||||
if (creature == null) {
|
||||
it.remove();
|
||||
continue;
|
||||
}
|
||||
creature.switchPowerToughness();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getText(Mode mode) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Switch each creature's power and toughness");
|
||||
if (!duration.toString().isEmpty()) {
|
||||
sb.append(' ');
|
||||
sb.append(duration.toString());
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ public class SwitchPowerToughnessSourceEffect extends ContinuousEffectImpl {
|
|||
|
||||
@Override
|
||||
public void init(Ability source, Game game) {
|
||||
super.init(source, game); //To change body of generated methods, choose Tools | Templates.
|
||||
super.init(source, game); // To change body of generated methods, choose Tools | Templates.
|
||||
if (duration.isOnlyValidIfNoZoneChange()) {
|
||||
// If source permanent is no longer onto battlefield discard the effect
|
||||
if (source.getSourcePermanentIfItStillExists(game) == null) {
|
||||
|
|
@ -43,17 +43,14 @@ public class SwitchPowerToughnessSourceEffect extends ContinuousEffectImpl {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent sourcePermanent = source.getSourcePermanentIfItStillExists(game);
|
||||
if (sourcePermanent != null) {
|
||||
int power = sourcePermanent.getPower().getValue();
|
||||
sourcePermanent.getPower().setValue(sourcePermanent.getToughness().getValue());
|
||||
sourcePermanent.getToughness().setValue(power);
|
||||
return true;
|
||||
} else {
|
||||
if (sourcePermanent == null) {
|
||||
if (duration.isOnlyValidIfNoZoneChange()) {
|
||||
discard();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
sourcePermanent.switchPowerToughness();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,13 +33,12 @@ public class SwitchPowerToughnessTargetEffect extends ContinuousEffectImpl {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent target = game.getPermanent(this.getTargetPointer().getFirst(game, source));
|
||||
if (target != null) {
|
||||
int power = target.getPower().getValue();
|
||||
target.getPower().setValue(target.getToughness().getValue());
|
||||
target.getToughness().setValue(power);
|
||||
return true;
|
||||
if (target == null) {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
|
||||
target.switchPowerToughness();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -49,6 +48,4 @@ public class SwitchPowerToughnessTargetEffect extends ContinuousEffectImpl {
|
|||
.append(' ').append(duration.toString());
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -97,8 +97,8 @@ class EternalizeEffect extends OneShotEffect {
|
|||
token.addSubType(SubType.ZOMBIE);
|
||||
token.getManaCost().clear();
|
||||
token.removePTCDA();
|
||||
token.getPower().modifyBaseValue(4);
|
||||
token.getToughness().modifyBaseValue(4);
|
||||
token.setPower(4);
|
||||
token.setToughness(4);
|
||||
game.fireEvent(GameEvent.getEvent(GameEvent.EventType.ETERNALIZED_CREATURE, token.getId(), source, controller.getId()));
|
||||
token.putOntoBattlefield(1, game, source, controller.getId(), false, false, null);
|
||||
// Probably it makes sense to remove also the Eternalize ability (it's not shown on the token cards).
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import mage.abilities.condition.common.SourceHasCounterCondition;
|
|||
import mage.abilities.decorator.ConditionalContinuousEffect;
|
||||
import mage.abilities.effects.ContinuousEffect;
|
||||
import mage.abilities.effects.common.continuous.GainAbilitySourceEffect;
|
||||
import mage.abilities.effects.common.continuous.SetPowerToughnessSourceEffect;
|
||||
import mage.abilities.effects.common.continuous.SetBasePowerToughnessSourceEffect;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.SubLayer;
|
||||
import mage.constants.Zone;
|
||||
|
|
@ -55,8 +55,7 @@ public class LevelerCardBuilder {
|
|||
staticAbility.setRuleVisible(false);
|
||||
constructed.add(staticAbility);
|
||||
}
|
||||
|
||||
ContinuousEffect effect = new SetPowerToughnessSourceEffect(power, toughness, Duration.WhileOnBattlefield, SubLayer.SetPT_7b);
|
||||
ContinuousEffect effect = new SetBasePowerToughnessSourceEffect(power, toughness, Duration.WhileOnBattlefield, SubLayer.SetPT_7b, true);
|
||||
ConditionalContinuousEffect ptEffect = new ConditionalContinuousEffect(effect, condition, rule);
|
||||
constructed.add(new SimpleStaticAbility(Zone.BATTLEFIELD, ptEffect));
|
||||
|
||||
|
|
|
|||
|
|
@ -134,8 +134,8 @@ public class MorphAbility extends AlternativeSourceCostsImpl {
|
|||
}
|
||||
|
||||
public static void setPermanentToFaceDownCreature(MageObject mageObject, Game game) {
|
||||
mageObject.getPower().modifyBaseValue(2);
|
||||
mageObject.getToughness().modifyBaseValue(2);
|
||||
mageObject.getPower().setModifiedBaseValue(2);
|
||||
mageObject.getToughness().setModifiedBaseValue(2);
|
||||
mageObject.getAbilities().clear();
|
||||
mageObject.getColor(game).setColor(new ObjectColor());
|
||||
mageObject.setName("");
|
||||
|
|
|
|||
|
|
@ -64,8 +64,8 @@ public class TransformAbility extends SimpleStaticAbility {
|
|||
// source != null -- from apply effect
|
||||
permanent.addAbility(ability, source == null ? permanent.getId() : source.getSourceId(), game);
|
||||
}
|
||||
permanent.getPower().modifyBaseValue(sourceCard.getPower().getValue());
|
||||
permanent.getToughness().modifyBaseValue(sourceCard.getToughness().getValue());
|
||||
permanent.getPower().setModifiedBaseValue(sourceCard.getPower().getValue());
|
||||
permanent.getToughness().setModifiedBaseValue(sourceCard.getToughness().getValue());
|
||||
permanent.setStartingLoyalty(sourceCard.getStartingLoyalty());
|
||||
}
|
||||
|
||||
|
|
@ -88,8 +88,8 @@ public class TransformAbility extends SimpleStaticAbility {
|
|||
for (Ability ability : otherSide.getAbilities()) {
|
||||
game.getState().addOtherAbility(newCard, ability);
|
||||
}
|
||||
newCard.getPower().modifyBaseValue(otherSide.getPower().getValue());
|
||||
newCard.getToughness().modifyBaseValue(otherSide.getToughness().getValue());
|
||||
newCard.getPower().setModifiedBaseValue(otherSide.getPower().getValue());
|
||||
newCard.getToughness().setModifiedBaseValue(otherSide.getToughness().getValue());
|
||||
|
||||
return newCard;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import mage.abilities.Ability;
|
|||
import mage.abilities.common.BeginningOfCombatTriggeredAbility;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.common.continuous.AddCardTypeTargetEffect;
|
||||
import mage.abilities.effects.common.continuous.SetPowerToughnessTargetEffect;
|
||||
import mage.abilities.effects.common.continuous.SetBasePowerToughnessTargetEffect;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.TargetController;
|
||||
|
|
@ -26,7 +26,7 @@ public final class TezzeretTheSchemerEmblem extends Emblem {
|
|||
Effect effect = new AddCardTypeTargetEffect(Duration.EndOfGame, CardType.ARTIFACT, CardType.CREATURE);
|
||||
effect.setText("target artifact you control becomes an artifact creature");
|
||||
Ability ability = new BeginningOfCombatTriggeredAbility(Zone.COMMAND, effect, TargetController.YOU, false, true);
|
||||
effect = new SetPowerToughnessTargetEffect(5, 5, Duration.EndOfGame);
|
||||
effect = new SetBasePowerToughnessTargetEffect(5, 5, Duration.EndOfGame);
|
||||
effect.setText("with base power and toughness 5/5");
|
||||
ability.addEffect(effect);
|
||||
ability.addTarget(new TargetPermanent(FILTER_CONTROLLED_PERMANENT_ARTIFACT));
|
||||
|
|
|
|||
|
|
@ -412,4 +412,11 @@ public interface Permanent extends Card, Controllable {
|
|||
}
|
||||
return getAttachedTo().equals(otherId);
|
||||
}
|
||||
|
||||
default void switchPowerToughness() {
|
||||
// This is supposed to use boosted value since its switching the final values
|
||||
int power = this.getPower().getValue();
|
||||
this.getPower().setBoostedValue(this.getToughness().getValue());
|
||||
this.getToughness().setBoostedValue(power);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -163,8 +163,8 @@ public class PermanentCard extends PermanentImpl {
|
|||
@Override
|
||||
public boolean turnFaceUp(Ability source, Game game, UUID playerId) {
|
||||
if (super.turnFaceUp(source, game, playerId)) {
|
||||
power.modifyBaseValue(power.getBaseValue());
|
||||
toughness.modifyBaseValue(toughness.getBaseValue());
|
||||
power.setModifiedBaseValue(power.getBaseValue());
|
||||
toughness.setModifiedBaseValue(toughness.getBaseValue());
|
||||
setManifested(false);
|
||||
setMorphed(false);
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -587,8 +587,8 @@ public abstract class PermanentImpl extends CardImpl implements Permanent {
|
|||
}
|
||||
if (this.transformed) {
|
||||
Card orgCard = this.getMainCard();
|
||||
this.getPower().modifyBaseValue(orgCard.getPower().getValue());
|
||||
this.getToughness().modifyBaseValue(orgCard.getToughness().getValue());
|
||||
this.getPower().setModifiedBaseValue(orgCard.getPower().getValue());
|
||||
this.getToughness().setModifiedBaseValue(orgCard.getToughness().getValue());
|
||||
}
|
||||
game.informPlayers(this.getLogName() + " transforms into " + this.getOtherFace().getLogName()
|
||||
+ CardUtil.getSourceLogName(game, source, this.getId()));
|
||||
|
|
@ -1298,12 +1298,12 @@ public abstract class PermanentImpl extends CardImpl implements Permanent {
|
|||
|
||||
@Override
|
||||
public void addPower(int power) {
|
||||
this.power.boostValue(power);
|
||||
this.power.increaseBoostedValue(power);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addToughness(int toughness) {
|
||||
this.toughness.boostValue(toughness);
|
||||
this.toughness.increaseBoostedValue(toughness);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package mage.game.permanent;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.costs.mana.ManaCost;
|
||||
|
|
@ -25,8 +26,8 @@ public class PermanentToken extends PermanentImpl {
|
|||
this.token = token.copy();
|
||||
this.token.getAbilities().newOriginalId(); // neccessary if token has ability like DevourAbility()
|
||||
this.token.getAbilities().setSourceId(objectId);
|
||||
this.power.modifyBaseValue(token.getPower().getBaseValueModified());
|
||||
this.toughness.modifyBaseValue(token.getToughness().getBaseValueModified());
|
||||
this.power = new MageInt(token.getPower().getModifiedBaseValue());
|
||||
this.toughness = new MageInt(token.getToughness().getModifiedBaseValue());
|
||||
this.copyFromToken(this.token, game, false); // needed to have at this time (e.g. for subtypes for entersTheBattlefield replacement effects)
|
||||
|
||||
// token's ZCC must be synced with original token to keep abilities settings
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
package mage.game.permanent.token;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.abilities.common.DiesSourceTriggeredAbility;
|
||||
|
|
@ -14,8 +15,10 @@ import mage.abilities.effects.common.CreateTokenEffect;
|
|||
public final class ATATToken extends TokenImpl {
|
||||
|
||||
public ATATToken() {
|
||||
super("AT-AT Token", "5/5 white artifact AT-AT creature tokens with \"When this creature dies, create two 1/1 white Trooper creature tokens.\"", 5, 5);
|
||||
super("AT-AT Token", "5/5 white artifact AT-AT creature tokens with \"When this creature dies, create two 1/1 white Trooper creature tokens.\"");
|
||||
this.setOriginalExpansionSetCode("SWS");
|
||||
this.power = new MageInt(5);
|
||||
this.toughness = new MageInt(5);
|
||||
cardType.add(CardType.CREATURE);
|
||||
cardType.add(CardType.ARTIFACT);
|
||||
color.setWhite(true);
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ package mage.game.permanent.token;
|
|||
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.dynamicvalue.common.ControllerLifeCount;
|
||||
import mage.abilities.effects.common.continuous.SetPowerToughnessSourceEffect;
|
||||
import mage.abilities.effects.common.continuous.SetBasePowerToughnessSourceEffect;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.SubLayer;
|
||||
|
|
@ -20,7 +20,7 @@ public final class AvatarToken extends TokenImpl {
|
|||
cardType.add(CardType.CREATURE);
|
||||
subtype.add(SubType.AVATAR);
|
||||
color.setWhite(true);
|
||||
this.addAbility(new SimpleStaticAbility(new SetPowerToughnessSourceEffect(
|
||||
this.addAbility(new SimpleStaticAbility(new SetBasePowerToughnessSourceEffect(
|
||||
ControllerLifeCount.instance, Duration.WhileOnBattlefield,
|
||||
SubLayer.CharacteristicDefining_7a
|
||||
).setText("this creature's power and toughness are each equal to your life total")));
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
|
||||
package mage.game.permanent.token;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
|
||||
|
|
@ -13,8 +14,8 @@ public final class CamaridToken extends TokenImpl {
|
|||
public CamaridToken() {
|
||||
super("Camarid Token", "1/1 blue Camarid creature tokens");
|
||||
this.setOriginalExpansionSetCode("FEM");
|
||||
this.getPower().modifyBaseValue(1);
|
||||
this.getToughness().modifyBaseValue(1);
|
||||
this.power = new MageInt(1);
|
||||
this.toughness = new MageInt(1);
|
||||
this.color.setBlue(true);
|
||||
this.subtype.add(SubType.CAMARID);
|
||||
this.cardType.add(CardType.CREATURE);
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@ package mage.game.permanent.token;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.constants.CardType;
|
||||
import mage.abilities.keyword.ForestwalkAbility;
|
||||
import mage.constants.SubType;
|
||||
|
|
@ -24,8 +26,8 @@ public final class CatWarriorToken extends TokenImpl {
|
|||
super("Cat Warrior Token", "2/2 green Cat Warrior creature token with forestwalk");
|
||||
availableImageSetCodes = tokenImageSets;
|
||||
this.setOriginalExpansionSetCode("PLC");
|
||||
this.getPower().modifyBaseValue(2);
|
||||
this.getToughness().modifyBaseValue(2);
|
||||
this.power = new MageInt(2);
|
||||
this.toughness = new MageInt(2);
|
||||
this.color.setGreen(true);
|
||||
this.subtype.add(SubType.CAT);
|
||||
this.subtype.add(SubType.WARRIOR);
|
||||
|
|
|
|||
|
|
@ -4,10 +4,15 @@ import mage.MageInt;
|
|||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.dynamicvalue.AdditiveDynamicValue;
|
||||
import mage.abilities.dynamicvalue.DynamicValue;
|
||||
import mage.abilities.dynamicvalue.common.CardTypesInGraveyardCount;
|
||||
import mage.abilities.dynamicvalue.common.StaticValue;
|
||||
import mage.abilities.effects.ContinuousEffectImpl;
|
||||
import mage.abilities.effects.common.continuous.SetBasePowerToughnessSourceEffect;
|
||||
import mage.abilities.hint.common.CardTypesInGraveyardHint;
|
||||
import mage.constants.*;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.game.Game;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
|
@ -17,6 +22,9 @@ import java.util.Arrays;
|
|||
*/
|
||||
public final class ConsumingBlobOozeToken extends TokenImpl {
|
||||
|
||||
private static final DynamicValue powerValue = CardTypesInGraveyardCount.YOU;
|
||||
private static final DynamicValue toughnessValue = new AdditiveDynamicValue(powerValue, StaticValue.get(1));
|
||||
|
||||
public ConsumingBlobOozeToken() {
|
||||
super("Ooze Token", "green Ooze creature token with \"This creature's power is equal to the number of card types among cards in your graveyard and its toughness is equal to that number plus 1.\"");
|
||||
cardType.add(CardType.CREATURE);
|
||||
|
|
@ -27,7 +35,11 @@ public final class ConsumingBlobOozeToken extends TokenImpl {
|
|||
toughness = new MageInt(1);
|
||||
|
||||
// This creature's power is equal to the number of card types among cards in your graveyard and its toughness is equal to that number plus 1.
|
||||
this.addAbility(new SimpleStaticAbility(Zone.ALL, new ConsumingBlobTokenEffect()).addHint(CardTypesInGraveyardHint.YOU));
|
||||
this.addAbility(new SimpleStaticAbility(
|
||||
Zone.ALL,
|
||||
new SetBasePowerToughnessSourceEffect(powerValue, toughnessValue, Duration.EndOfGame, SubLayer.CharacteristicDefining_7a, false)
|
||||
.setText("{this}'s power is equal to the number of creature cards in all graveyards and its toughness is equal to that number plus 1")
|
||||
));
|
||||
|
||||
availableImageSetCodes.addAll(Arrays.asList("MID"));
|
||||
}
|
||||
|
|
@ -41,33 +53,3 @@ public final class ConsumingBlobOozeToken extends TokenImpl {
|
|||
return new ConsumingBlobOozeToken(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class ConsumingBlobTokenEffect extends ContinuousEffectImpl {
|
||||
|
||||
public ConsumingBlobTokenEffect() {
|
||||
super(Duration.EndOfGame, Layer.PTChangingEffects_7, SubLayer.CharacteristicDefining_7a, Outcome.BoostCreature);
|
||||
staticText = "{this}'s power is equal to the number of card types among cards in your graveyard and its toughness is equal to that number plus 1";
|
||||
}
|
||||
|
||||
public ConsumingBlobTokenEffect(final ConsumingBlobTokenEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConsumingBlobTokenEffect copy() {
|
||||
return new ConsumingBlobTokenEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
MageObject target = source.getSourceObject(game);
|
||||
if (target == null) {
|
||||
return false;
|
||||
}
|
||||
int number = CardTypesInGraveyardCount.YOU.calculate(game, source, this);
|
||||
target.getPower().setValue(number);
|
||||
target.getToughness().setValue(number + 1);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -75,17 +75,18 @@ class DaxosSpiritSetPTEffect extends ContinuousEffectImpl {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (permanent != null && new MageObjectReference(source.getSourceObject(game), game).refersTo(permanent, game)) {
|
||||
int amount = controller.getCounters().getCount(CounterType.EXPERIENCE);
|
||||
permanent.getPower().setValue(amount);
|
||||
permanent.getToughness().setValue(amount);
|
||||
return true;
|
||||
} else {
|
||||
discard();
|
||||
}
|
||||
if (controller == null) {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (permanent == null || !new MageObjectReference(source.getSourceObject(game), game).refersTo(permanent, game)) {
|
||||
discard();
|
||||
return false;
|
||||
}
|
||||
|
||||
int amount = controller.getCounters().getCount(CounterType.EXPERIENCE);
|
||||
permanent.getPower().setModifiedBaseValue(amount);
|
||||
permanent.getToughness().setModifiedBaseValue(amount);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import mage.abilities.Ability;
|
|||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.dynamicvalue.DynamicValue;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.common.continuous.SetPowerToughnessSourceEffect;
|
||||
import mage.abilities.effects.common.continuous.SetBasePowerToughnessSourceEffect;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.SubType;
|
||||
|
|
@ -31,7 +31,7 @@ public final class DogIllusionToken extends TokenImpl {
|
|||
toughness = new MageInt(0);
|
||||
|
||||
// This creature's power and toughness are each equal to twice the number of cards in your hand.
|
||||
this.addAbility(new SimpleStaticAbility(Zone.ALL, new SetPowerToughnessSourceEffect(
|
||||
this.addAbility(new SimpleStaticAbility(Zone.ALL, new SetBasePowerToughnessSourceEffect(
|
||||
DogIllusionValue.instance, Duration.EndOfGame)
|
||||
.setText("this creature's power and toughness are each equal to twice the number of cards in your hand")
|
||||
));
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import mage.MageInt;
|
|||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.dynamicvalue.DynamicValue;
|
||||
import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount;
|
||||
import mage.abilities.effects.common.continuous.SetPowerToughnessSourceEffect;
|
||||
import mage.abilities.effects.common.continuous.SetBasePowerToughnessSourceEffect;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.SubType;
|
||||
|
|
@ -36,7 +36,7 @@ public final class DoomedArtisanToken extends TokenImpl {
|
|||
toughness = new MageInt(0);
|
||||
|
||||
// This creature's power and toughness are each equal to the number of Sculpturess you control.
|
||||
this.addAbility(new SimpleStaticAbility(new SetPowerToughnessSourceEffect(xValue, Duration.EndOfGame)));
|
||||
this.addAbility(new SimpleStaticAbility(new SetBasePowerToughnessSourceEffect(xValue, Duration.EndOfGame)));
|
||||
}
|
||||
|
||||
private DoomedArtisanToken(final DoomedArtisanToken token) {
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import mage.constants.SubType;
|
|||
import mage.MageInt;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.dynamicvalue.common.CardsInControllerGraveyardCount;
|
||||
import mage.abilities.effects.common.continuous.SetPowerToughnessSourceEffect;
|
||||
import mage.abilities.effects.common.continuous.SetBasePowerToughnessSourceEffect;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.common.FilterCreatureCard;
|
||||
|
|
@ -28,7 +28,7 @@ public final class ElephantResurgenceToken extends TokenImpl {
|
|||
|
||||
this.addAbility(new SimpleStaticAbility(
|
||||
Zone.BATTLEFIELD,
|
||||
new SetPowerToughnessSourceEffect(new CardsInControllerGraveyardCount(new FilterCreatureCard()), Duration.EndOfGame)
|
||||
new SetBasePowerToughnessSourceEffect(new CardsInControllerGraveyardCount(new FilterCreatureCard()), Duration.EndOfGame)
|
||||
.setText("This creature's power and toughness are each equal to the number of creature cards in its controller's graveyard.")
|
||||
));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
package mage.game.permanent.token;
|
||||
import java.util.Collections;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
|
||||
|
|
@ -13,9 +14,10 @@ import mage.constants.SubType;
|
|||
public final class EwokToken extends TokenImpl {
|
||||
|
||||
public EwokToken() {
|
||||
super("Ewok Token", "1/1 green Ewok creature tokens", 1, 1);
|
||||
super("Ewok Token", "1/1 green Ewok creature tokens");
|
||||
availableImageSetCodes.addAll(Collections.singletonList("SWS"));
|
||||
|
||||
this.power = new MageInt(1);
|
||||
this.toughness = new MageInt(1);
|
||||
cardType.add(CardType.CREATURE);
|
||||
subtype.add(SubType.EWOK);
|
||||
color.setGreen(true);
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import mage.abilities.Ability;
|
|||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.dynamicvalue.DynamicValue;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.common.continuous.SetPowerToughnessSourceEffect;
|
||||
import mage.abilities.effects.common.continuous.SetBasePowerToughnessSourceEffect;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Zone;
|
||||
import mage.counters.CounterType;
|
||||
|
|
@ -35,7 +35,7 @@ public final class GutterGrimeToken extends TokenImpl {
|
|||
color.setGreen(true);
|
||||
power = new MageInt(0);
|
||||
toughness = new MageInt(0);
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new SetPowerToughnessSourceEffect(new GutterGrimeCounters(sourceId), Duration.WhileOnBattlefield)));
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new SetBasePowerToughnessSourceEffect(new GutterGrimeCounters(sourceId), Duration.WhileOnBattlefield)));
|
||||
}
|
||||
|
||||
public GutterGrimeToken(final GutterGrimeToken token) {
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
package mage.game.permanent.token;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
|
||||
|
|
@ -12,8 +13,10 @@ import mage.constants.SubType;
|
|||
public final class HunterToken extends TokenImpl {
|
||||
|
||||
public HunterToken() {
|
||||
super("Hunter Token", "4/4 red Hunter creature token", 4, 4);
|
||||
super("Hunter Token", "4/4 red Hunter creature token");
|
||||
this.setOriginalExpansionSetCode("SWS");
|
||||
this.power = new MageInt(4);
|
||||
this.toughness = new MageInt(4);
|
||||
cardType.add(CardType.CREATURE);
|
||||
color.setRed(true);
|
||||
subtype.add(SubType.HUNTER);
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import mage.constants.CardType;
|
|||
import mage.MageInt;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount;
|
||||
import mage.abilities.effects.common.continuous.SetPowerToughnessSourceEffect;
|
||||
import mage.abilities.effects.common.continuous.SetBasePowerToughnessSourceEffect;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Zone;
|
||||
|
|
@ -33,7 +33,7 @@ public final class KalonianTwingroveTreefolkWarriorToken extends TokenImpl {
|
|||
power = new MageInt(0);
|
||||
toughness = new MageInt(0);
|
||||
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new SetPowerToughnessSourceEffect(new PermanentsOnBattlefieldCount(filterLands), Duration.WhileOnBattlefield)));
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new SetBasePowerToughnessSourceEffect(new PermanentsOnBattlefieldCount(filterLands), Duration.WhileOnBattlefield)));
|
||||
}
|
||||
|
||||
public KalonianTwingroveTreefolkWarriorToken(final KalonianTwingroveTreefolkWarriorToken token) {
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@ package mage.game.permanent.token;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.abilities.keyword.FlyingAbility;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
|
|
@ -21,11 +23,13 @@ public final class KaroxBladewingDragonToken extends TokenImpl {
|
|||
}
|
||||
|
||||
public KaroxBladewingDragonToken() {
|
||||
super("Karox Bladewing Token", "legendary 4/4 red Dragon creature token with flying", 4, 4);
|
||||
super("Karox Bladewing Token", "legendary 4/4 red Dragon creature token with flying");
|
||||
|
||||
availableImageSetCodes = tokenImageSets;
|
||||
this.setOriginalExpansionSetCode("DOM");
|
||||
|
||||
this.power = new MageInt(4);
|
||||
this.toughness = new MageInt(4);
|
||||
this.addSuperType(SuperType.LEGENDARY);
|
||||
this.cardType.add(CardType.CREATURE);
|
||||
this.subtype.add(SubType.DRAGON);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
|
||||
package mage.game.permanent.token;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.SuperType;
|
||||
|
|
@ -15,8 +16,8 @@ public final class NissaSageAnimistToken extends TokenImpl {
|
|||
super("Ashaya, the Awoken World", "Ashaya, the Awoken World, a legendary 4/4 green Elemental creature token");
|
||||
this.setOriginalExpansionSetCode("ORI");
|
||||
this.supertype.add(SuperType.LEGENDARY);
|
||||
this.getPower().modifyBaseValue(4);
|
||||
this.getToughness().modifyBaseValue(4);
|
||||
this.power = new MageInt(4);
|
||||
this.toughness = new MageInt(4);
|
||||
this.color.setGreen(true);
|
||||
this.subtype.add(SubType.ELEMENTAL);
|
||||
this.cardType.add(CardType.CREATURE);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
|
||||
|
||||
package mage.game.permanent.token;
|
||||
import mage.MageInt;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.abilities.keyword.DeathtouchAbility;
|
||||
|
|
@ -12,8 +13,10 @@ import mage.abilities.keyword.DeathtouchAbility;
|
|||
public final class PharikaSnakeToken extends TokenImpl {
|
||||
|
||||
public PharikaSnakeToken() {
|
||||
super("Snake Token", "1/1 black and green Snake enchantment creature token with deathtouch", 1, 1);
|
||||
super("Snake Token", "1/1 black and green Snake enchantment creature token with deathtouch");
|
||||
this.setOriginalExpansionSetCode("JOU");
|
||||
this.power = new MageInt(1);
|
||||
this.toughness = new MageInt(1);
|
||||
cardType.add(CardType.ENCHANTMENT);
|
||||
cardType.add(CardType.CREATURE);
|
||||
subtype.add(SubType.SNAKE);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
|
||||
|
||||
package mage.game.permanent.token;
|
||||
import mage.MageInt;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.SuperType;
|
||||
|
|
@ -15,8 +16,8 @@ public final class RagavanToken extends TokenImpl {
|
|||
super("Ragavan", "Ragavan, a legendary 2/1 red Monkey creature token");
|
||||
this.setOriginalExpansionSetCode("AER");
|
||||
this.supertype.add(SuperType.LEGENDARY);
|
||||
this.getPower().modifyBaseValue(2);
|
||||
this.getToughness().modifyBaseValue(1);
|
||||
this.power = new MageInt(2);
|
||||
this.toughness = new MageInt(1);
|
||||
this.color.setRed(true);
|
||||
this.subtype.add(SubType.MONKEY);
|
||||
this.cardType.add(CardType.CREATURE);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
|
||||
|
||||
package mage.game.permanent.token;
|
||||
import mage.MageInt;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.abilities.keyword.SpaceflightAbility;
|
||||
|
|
@ -12,8 +13,10 @@ import mage.abilities.keyword.SpaceflightAbility;
|
|||
public final class RebelStarshipToken extends TokenImpl {
|
||||
|
||||
public RebelStarshipToken() {
|
||||
super("B-Wing Token", "2/3 blue Rebel Starship artifact creature tokens with spaceflight name B-Wing", 2, 3);
|
||||
super("B-Wing Token", "2/3 blue Rebel Starship artifact creature tokens with spaceflight name B-Wing");
|
||||
this.setOriginalExpansionSetCode("SWS");
|
||||
this.power = new MageInt(2);
|
||||
this.toughness = new MageInt(3);
|
||||
cardType.add(CardType.CREATURE);
|
||||
cardType.add(CardType.ARTIFACT);
|
||||
abilities.add(SpaceflightAbility.getInstance());
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
|
||||
|
||||
package mage.game.permanent.token;
|
||||
import mage.MageInt;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
|
||||
|
|
@ -11,8 +12,10 @@ import mage.constants.SubType;
|
|||
public final class RebelToken extends TokenImpl {
|
||||
|
||||
public RebelToken() {
|
||||
super("Rebel Token", "1/1 white Rebel creature token", 1, 1);
|
||||
super("Rebel Token", "1/1 white Rebel creature token");
|
||||
this.setOriginalExpansionSetCode("SWS");
|
||||
this.power = new MageInt(1);
|
||||
this.toughness = new MageInt(1);
|
||||
cardType.add(CardType.CREATURE);
|
||||
color.setWhite(true);
|
||||
subtype.add(SubType.REBEL);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
|
||||
|
||||
package mage.game.permanent.token;
|
||||
import mage.MageInt;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.abilities.keyword.FirstStrikeAbility;
|
||||
|
|
@ -12,8 +13,10 @@ import mage.abilities.keyword.FirstStrikeAbility;
|
|||
public final class RoyalGuardToken extends TokenImpl {
|
||||
|
||||
public RoyalGuardToken() {
|
||||
super("Royal Guard", "2/2 red Soldier creature token with first strike named Royal Guard", 2, 2);
|
||||
super("Royal Guard", "2/2 red Soldier creature token with first strike named Royal Guard");
|
||||
this.setOriginalExpansionSetCode("SWS");
|
||||
this.power = new MageInt(2);
|
||||
this.toughness = new MageInt(2);
|
||||
cardType.add(CardType.CREATURE);
|
||||
color.setRed(true);
|
||||
addAbility(FirstStrikeAbility.getInstance());
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import mage.abilities.Ability;
|
|||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.dynamicvalue.DynamicValue;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.common.continuous.SetPowerToughnessSourceEffect;
|
||||
import mage.abilities.effects.common.continuous.SetBasePowerToughnessSourceEffect;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Zone;
|
||||
import mage.counters.CounterType;
|
||||
|
|
@ -33,7 +33,7 @@ public final class SaprolingBurstToken extends TokenImpl {
|
|||
this.color.setGreen(true);
|
||||
this.subtype.add(SubType.SAPROLING);
|
||||
this.cardType.add(CardType.CREATURE);
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new SetPowerToughnessSourceEffect(new SaprolingBurstTokenDynamicValue(saprolingBurstMOR), Duration.WhileOnBattlefield)));
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new SetBasePowerToughnessSourceEffect(new SaprolingBurstTokenDynamicValue(saprolingBurstMOR), Duration.WhileOnBattlefield)));
|
||||
}
|
||||
|
||||
public SaprolingBurstToken(final SaprolingBurstToken token) {
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import mage.MageInt;
|
|||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.dynamicvalue.DynamicValue;
|
||||
import mage.abilities.dynamicvalue.common.StaticValue;
|
||||
import mage.abilities.effects.common.continuous.SetPowerToughnessSourceEffect;
|
||||
import mage.abilities.effects.common.continuous.SetBasePowerToughnessSourceEffect;
|
||||
import mage.abilities.hint.Hint;
|
||||
import mage.abilities.hint.StaticHint;
|
||||
import mage.abilities.keyword.TrampleAbility;
|
||||
|
|
@ -33,7 +33,7 @@ public final class SeizeTheStormElementalToken extends TokenImpl {
|
|||
power = new MageInt(0);
|
||||
toughness = new MageInt(0);
|
||||
this.addAbility(TrampleAbility.getInstance());
|
||||
this.addAbility(new SimpleStaticAbility(new SetPowerToughnessSourceEffect(
|
||||
this.addAbility(new SimpleStaticAbility(new SetBasePowerToughnessSourceEffect(
|
||||
xValue, Duration.WhileOnBattlefield
|
||||
).setText("this creature's power and toughness are each equal to the number of " +
|
||||
"instant and sorcery cards in your graveyard, plus the number of cards with flashback you own in exile")
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import mage.abilities.Ability;
|
|||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.dynamicvalue.DynamicValue;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.common.continuous.SetPowerToughnessSourceEffect;
|
||||
import mage.abilities.effects.common.continuous.SetBasePowerToughnessSourceEffect;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.SubType;
|
||||
|
|
@ -31,7 +31,7 @@ public class SpiritClericToken extends TokenImpl {
|
|||
toughness = new MageInt(0);
|
||||
|
||||
// This creature’s power and toughness are each equal to the number of Spirits you control.
|
||||
this.addAbility(new SimpleStaticAbility(new SetPowerToughnessSourceEffect(SpiritClericTokenValue.instance, Duration.EndOfGame)));
|
||||
this.addAbility(new SimpleStaticAbility(new SetBasePowerToughnessSourceEffect(SpiritClericTokenValue.instance, Duration.EndOfGame)));
|
||||
|
||||
availableImageSetCodes = Arrays.asList("VOW");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package mage.game.permanent.token;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.abilities.keyword.SpaceflightAbility;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
|
|
@ -11,8 +12,10 @@ import mage.constants.SubType;
|
|||
public final class TIEFighterToken extends TokenImpl {
|
||||
|
||||
public TIEFighterToken() {
|
||||
super("TIE Fighter", "1/1 black Starship artifact creature tokens with Spaceflight named TIE Fighter", 1, 1);
|
||||
super("TIE Fighter", "1/1 black Starship artifact creature tokens with Spaceflight named TIE Fighter");
|
||||
this.setOriginalExpansionSetCode("SWS");
|
||||
this.power = new MageInt(1);
|
||||
this.toughness = new MageInt(1);
|
||||
cardType.add(CardType.CREATURE);
|
||||
cardType.add(CardType.ARTIFACT);
|
||||
color.setBlack(true);
|
||||
|
|
|
|||
|
|
@ -39,12 +39,12 @@ public interface Token extends MageObject {
|
|||
|
||||
boolean putOntoBattlefield(int amount, Game game, Ability source, UUID controllerId, boolean tapped, boolean attacking, UUID attackedPlayer, boolean created);
|
||||
|
||||
int getTokenType();
|
||||
|
||||
void setPower(int power);
|
||||
|
||||
void setToughness(int toughness);
|
||||
|
||||
int getTokenType();
|
||||
|
||||
void setTokenType(int tokenType);
|
||||
|
||||
String getOriginalCardNumber();
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package mage.game.permanent.token;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.MageObject;
|
||||
import mage.MageObjectImpl;
|
||||
import mage.abilities.Ability;
|
||||
|
|
@ -65,12 +66,6 @@ public abstract class TokenImpl extends MageObjectImpl implements Token {
|
|||
this.description = description;
|
||||
}
|
||||
|
||||
public TokenImpl(String name, String description, int power, int toughness) {
|
||||
this(name, description);
|
||||
this.power.modifyBaseValue(power);
|
||||
this.toughness.modifyBaseValue(toughness);
|
||||
}
|
||||
|
||||
public TokenImpl(final TokenImpl token) {
|
||||
super(token);
|
||||
this.description = token.description;
|
||||
|
|
@ -381,12 +376,12 @@ public abstract class TokenImpl extends MageObjectImpl implements Token {
|
|||
|
||||
@Override
|
||||
public void setPower(int power) {
|
||||
this.power.setValue(power);
|
||||
this.power = new MageInt(power);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setToughness(int toughness) {
|
||||
this.toughness.setValue(toughness);
|
||||
this.toughness = new MageInt(toughness);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
|
||||
|
||||
package mage.game.permanent.token;
|
||||
import mage.MageInt;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
|
||||
|
|
@ -11,8 +12,10 @@ import mage.constants.SubType;
|
|||
public final class TuskenRaiderToken extends TokenImpl {
|
||||
|
||||
public TuskenRaiderToken() {
|
||||
super("Tusken Raider Token", "white Tusken Raider creature token", 1, 1);
|
||||
super("Tusken Raider Token", "white Tusken Raider creature token");
|
||||
this.setOriginalExpansionSetCode("SWS");
|
||||
this.power = new MageInt(1);
|
||||
this.toughness = new MageInt(1);
|
||||
cardType.add(CardType.CREATURE);
|
||||
color.setWhite(true);
|
||||
subtype.add(SubType.TUSKEN);
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ package mage.game.permanent.token;
|
|||
import mage.MageInt;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.dynamicvalue.common.CreaturesYouControlCount;
|
||||
import mage.abilities.effects.common.continuous.SetPowerToughnessSourceEffect;
|
||||
import mage.abilities.effects.common.continuous.SetBasePowerToughnessSourceEffect;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.SubType;
|
||||
|
|
@ -28,7 +28,7 @@ public final class VoiceOfResurgenceToken extends TokenImpl {
|
|||
toughness = new MageInt(0);
|
||||
|
||||
// This creature's power and toughness are each equal to the number of creatures you control.
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new SetPowerToughnessSourceEffect(
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new SetBasePowerToughnessSourceEffect(
|
||||
CreaturesYouControlCount.instance, Duration.EndOfGame)));
|
||||
|
||||
availableImageSetCodes = Arrays.asList("DGM", "MM3", "2XM");
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
|
||||
package mage.game.permanent.token;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.constants.CardType;
|
||||
import mage.abilities.keyword.FlyingAbility;
|
||||
import mage.constants.SubType;
|
||||
|
|
@ -14,8 +15,8 @@ public final class WireflyToken extends TokenImpl {
|
|||
public WireflyToken() {
|
||||
super("Wirefly", "2/2 colorless Insect artifact creature token with flying named Wirefly");
|
||||
this.setOriginalExpansionSetCode("DST");
|
||||
this.getPower().modifyBaseValue(2);
|
||||
this.getToughness().modifyBaseValue(2);
|
||||
this.power = new MageInt(2);
|
||||
this.toughness = new MageInt(2);
|
||||
this.subtype.add(SubType.INSECT);
|
||||
this.cardType.add(CardType.ARTIFACT);
|
||||
this.cardType.add(CardType.CREATURE);
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ package mage.game.permanent.token;
|
|||
import mage.MageInt;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.dynamicvalue.common.LandsYouControlCount;
|
||||
import mage.abilities.effects.common.continuous.SetPowerToughnessSourceEffect;
|
||||
import mage.abilities.effects.common.continuous.SetBasePowerToughnessSourceEffect;
|
||||
import mage.abilities.keyword.ReachAbility;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
|
|
@ -25,7 +25,7 @@ public final class WrennAndSevenTreefolkToken extends TokenImpl {
|
|||
power = new MageInt(0);
|
||||
toughness = new MageInt(0);
|
||||
this.addAbility(ReachAbility.getInstance());
|
||||
this.addAbility(new SimpleStaticAbility(Zone.ALL, new SetPowerToughnessSourceEffect(
|
||||
this.addAbility(new SimpleStaticAbility(Zone.ALL, new SetBasePowerToughnessSourceEffect(
|
||||
LandsYouControlCount.instance, Duration.EndOfGame
|
||||
).setText("this creature's power and toughness are each equal to the number of lands you control")));
|
||||
|
||||
|
|
|
|||
|
|
@ -90,8 +90,8 @@ public class CopyTokenFunction implements Function<Token, Card> {
|
|||
target.addAbility(ability);
|
||||
}
|
||||
|
||||
target.getPower().modifyBaseValue(sourceObj.getPower().getBaseValueModified());
|
||||
target.getToughness().modifyBaseValue(sourceObj.getToughness().getBaseValueModified());
|
||||
target.setPower(sourceObj.getPower().getBaseValue());
|
||||
target.setToughness(sourceObj.getToughness().getBaseValue());
|
||||
target.setStartingLoyalty(sourceObj.getStartingLoyalty());
|
||||
|
||||
return target;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue