mirror of
https://github.com/magefree/mage.git
synced 2025-12-24 12:31:59 -08:00
* Fixed that some P/T settings were handled as character defining abilities but they were not.
This commit is contained in:
parent
0ff6dc1a59
commit
6b643fbda8
21 changed files with 98 additions and 79 deletions
|
|
@ -72,6 +72,14 @@ public abstract class ContinuousEffectImpl extends EffectImpl implements Continu
|
|||
protected List<MageObjectReference> affectedObjectList = new ArrayList<>();
|
||||
protected boolean temporary = false;
|
||||
protected EnumSet<DependencyType> dependencyTypes;
|
||||
/*
|
||||
A Characteristic Defining Ability (CDA) is an ability that defines a characteristic of a card or token.
|
||||
There are 3 specific rules that distinguish a CDA from other abilities.
|
||||
1) A CDA can only define a characteristic of either the card or token it comes from.
|
||||
2) A CDA can not be triggered, activated, or conditional.
|
||||
3) A CDA must define a characteristic. Usually color, power and/or toughness, or sub-type.
|
||||
*/
|
||||
protected boolean characterDefining = false;
|
||||
|
||||
// until your next turn
|
||||
protected int startingTurn;
|
||||
|
|
@ -105,6 +113,7 @@ public abstract class ContinuousEffectImpl extends EffectImpl implements Continu
|
|||
this.startingTurn = effect.startingTurn;
|
||||
this.startingControllerId = effect.startingControllerId;
|
||||
this.dependencyTypes = effect.dependencyTypes;
|
||||
this.characterDefining = effect.characterDefining;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -256,6 +265,14 @@ public abstract class ContinuousEffectImpl extends EffectImpl implements Continu
|
|||
this.temporary = temporary;
|
||||
}
|
||||
|
||||
public boolean isCharacterDefining() {
|
||||
return characterDefining;
|
||||
}
|
||||
|
||||
public void setCharacterDefining(boolean characterDefining) {
|
||||
this.characterDefining = characterDefining;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<UUID> isDependentTo(List<ContinuousEffect> allEffectsInLayer) {
|
||||
return null;
|
||||
|
|
|
|||
|
|
@ -30,7 +30,6 @@
|
|||
*/
|
||||
package mage.abilities.effects.common.continuous;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageObject;
|
||||
import mage.ObjectColor;
|
||||
import mage.abilities.Ability;
|
||||
|
|
@ -73,24 +72,23 @@ public class BecomesColorSourceEffect extends ContinuousEffectImpl {
|
|||
@Override
|
||||
public void init(Ability source, Game game) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if(controller == null) {
|
||||
if (controller == null) {
|
||||
return;
|
||||
}
|
||||
if(setColor == null) {
|
||||
if (setColor == null) {
|
||||
ChoiceColor choice = new ChoiceColor();
|
||||
while(!choice.isChosen()) {
|
||||
while (!choice.isChosen()) {
|
||||
controller.choose(Outcome.PutManaInPool, choice, game);
|
||||
if(!controller.canRespond()) {
|
||||
if (!controller.canRespond()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if(choice.getColor() != null) {
|
||||
if (choice.getColor() != null) {
|
||||
setColor = choice.getColor();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
if(!game.isSimulation()) {
|
||||
if (!game.isSimulation()) {
|
||||
game.informPlayers(controller.getLogName() + " has chosen the color: " + setColor.toString());
|
||||
}
|
||||
}
|
||||
|
|
@ -103,12 +101,11 @@ public class BecomesColorSourceEffect extends ContinuousEffectImpl {
|
|||
if (controller == null) {
|
||||
return false;
|
||||
}
|
||||
if(setColor != null) {
|
||||
if (setColor != null) {
|
||||
MageObject sourceObject = game.getObject(source.getSourceId());
|
||||
if(sourceObject != null) {
|
||||
if (sourceObject != null) {
|
||||
sourceObject.getColor(game).setColor(setColor);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
this.discard();
|
||||
}
|
||||
return true;
|
||||
|
|
@ -119,10 +116,10 @@ public class BecomesColorSourceEffect extends ContinuousEffectImpl {
|
|||
|
||||
@Override
|
||||
public String getText(Mode mode) {
|
||||
if(staticText != null && !staticText.isEmpty()) {
|
||||
if (staticText != null && !staticText.isEmpty()) {
|
||||
return staticText;
|
||||
}
|
||||
return "{this} becomes " + (setColor == null ? "the color of your choice" : setColor.getDescription())
|
||||
+ " " + duration.toString();
|
||||
+ " " + duration.toString();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ public class BecomesCreatureAllEffect extends ContinuousEffectImpl {
|
|||
if (sublayer == SubLayer.NA) {
|
||||
if (token.getAbilities().size() > 0) {
|
||||
for (Ability ability : token.getAbilities()) {
|
||||
permanent.addAbility(ability, game);
|
||||
permanent.addAbility(ability, source.getSourceId(), game);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,18 +51,19 @@ public class BecomesCreatureSourceEffect extends ContinuousEffectImpl implements
|
|||
protected String type;
|
||||
protected boolean losePreviousTypes;
|
||||
|
||||
public BecomesCreatureSourceEffect(Token token, String type, Duration duration, boolean losePreviousTypes) {
|
||||
public BecomesCreatureSourceEffect(Token token, String type, Duration duration) {
|
||||
this(token, type, duration, false, false);
|
||||
}
|
||||
|
||||
public BecomesCreatureSourceEffect(Token token, String type, Duration duration, boolean losePreviousTypes, boolean characterDefining) {
|
||||
super(duration, Outcome.BecomeCreature);
|
||||
this.characterDefining = characterDefining;
|
||||
this.token = token;
|
||||
this.type = type;
|
||||
this.losePreviousTypes = losePreviousTypes;
|
||||
setText();
|
||||
}
|
||||
|
||||
public BecomesCreatureSourceEffect(Token token, String type, Duration duration) {
|
||||
this(token, type, duration, false);
|
||||
}
|
||||
|
||||
public BecomesCreatureSourceEffect(final BecomesCreatureSourceEffect effect) {
|
||||
super(effect);
|
||||
this.token = effect.token.copy();
|
||||
|
|
@ -130,7 +131,8 @@ public class BecomesCreatureSourceEffect extends ContinuousEffectImpl implements
|
|||
}
|
||||
break;
|
||||
case PTChangingEffects_7:
|
||||
if (sublayer == SubLayer.CharacteristicDefining_7a) {
|
||||
if ((sublayer == SubLayer.CharacteristicDefining_7a && isCharacterDefining())
|
||||
|| (sublayer == SubLayer.SetPT_7b && !isCharacterDefining())) {
|
||||
MageInt power = token.getPower();
|
||||
MageInt toughness = token.getToughness();
|
||||
if (power != null && toughness != null) {
|
||||
|
|
|
|||
|
|
@ -136,7 +136,7 @@ public class BecomesCreatureTargetEffect extends ContinuousEffectImpl {
|
|||
}
|
||||
break;
|
||||
case PTChangingEffects_7:
|
||||
if (sublayer == SubLayer.CharacteristicDefining_7a) {
|
||||
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());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,6 +53,7 @@ public class SetPowerToughnessSourceEffect extends ContinuousEffectImpl {
|
|||
|
||||
public SetPowerToughnessSourceEffect(DynamicValue amount, Duration duration, SubLayer subLayer) {
|
||||
super(duration, Layer.PTChangingEffects_7, subLayer, Outcome.BoostCreature);
|
||||
setCharacterDefining(subLayer.equals(SubLayer.CharacteristicDefining_7a));
|
||||
this.amount = amount;
|
||||
staticText = "{this}'s power and toughness are each equal to the number of " + amount.getMessage();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue