Revert "Added missing fields to many copy constructors. (#8957)" (#8999)

This reverts commit 82708e4273.

Some of these (AI related result in bloated memory usage, needs more investigation).
This commit is contained in:
Alex Vasile 2022-05-25 12:57:24 -06:00 committed by GitHub
parent 2f3831599d
commit 015cdf3136
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
79 changed files with 597 additions and 811 deletions

View file

@ -23,10 +23,10 @@ public abstract class TriggeredAbilityImpl extends AbilityImpl implements Trigge
protected boolean optional;
protected boolean leavesTheBattlefieldTrigger;
private boolean triggersOnce;
private boolean doOnlyOnce;
private GameEvent triggerEvent;
private String triggerPhrase;
private boolean triggersOnce = false;
private boolean doOnlyOnce = false;
private GameEvent triggerEvent = null;
private String triggerPhrase = null;
public TriggeredAbilityImpl(Zone zone, Effect effect) {
this(zone, effect, false);
@ -55,7 +55,6 @@ public abstract class TriggeredAbilityImpl extends AbilityImpl implements Trigge
this.triggersOnce = ability.triggersOnce;
this.doOnlyOnce = ability.doOnlyOnce;
this.triggerPhrase = ability.triggerPhrase;
this.triggerEvent = ability.triggerEvent;
}
@Override

View file

@ -15,8 +15,8 @@ import mage.target.targetpointer.FixedTarget;
*/
public class BlocksAttachedTriggeredAbility extends TriggeredAbilityImpl {
private final boolean setFixedTargetPointer;
private final String attachedDescription;
private boolean setFixedTargetPointer;
private String attachedDescription;
private boolean setFixedTargetPointerToBlocked;
public BlocksAttachedTriggeredAbility(Effect effect, String attachedDescription, boolean optional) {
@ -40,7 +40,6 @@ public class BlocksAttachedTriggeredAbility extends TriggeredAbilityImpl {
super(ability);
this.setFixedTargetPointer = ability.setFixedTargetPointer;
this.attachedDescription = ability.attachedDescription;
this.setFixedTargetPointerToBlocked = ability.setFixedTargetPointerToBlocked;
}
@Override

View file

@ -16,14 +16,13 @@ import java.util.UUID;
*/
public class CyclingDiscardCost extends CostImpl {
private MageObjectReference cycledCard;
private MageObjectReference cycledCard = null;
public CyclingDiscardCost() {
}
private CyclingDiscardCost(CyclingDiscardCost cost) {
super(cost);
this.cycledCard = cost.cycledCard;
}
@Override

View file

@ -49,7 +49,6 @@ public class ManaCostsImpl<T extends ManaCost> extends ArrayList<T> implements M
this.add(cost.copy());
}
this.phyrexian = costs.phyrexian;
this.phyrexianPaid = costs.phyrexianPaid;
}
@Override

View file

@ -42,7 +42,9 @@ public abstract class EffectImpl implements Effect {
if (effect.values != null) {
values = new HashMap<>();
Map<String, Object> map = effect.values;
values.putAll(map);
for (Map.Entry<String, Object> entry : map.entrySet()) {
values.put(entry.getKey(), entry.getValue());
}
}
}

View file

@ -21,7 +21,6 @@ public class DontUntapInControllersNextUntapStepSourceEffect extends ContinuousR
public DontUntapInControllersNextUntapStepSourceEffect(final DontUntapInControllersNextUntapStepSourceEffect effect) {
super(effect);
this.validForTurnNum = effect.validForTurnNum;
}
@Override

View file

@ -17,6 +17,7 @@ import mage.util.CardUtil;
public class ExileCardsFromTopOfLibraryTargetEffect extends OneShotEffect {
int amount;
String targetName;
public ExileCardsFromTopOfLibraryTargetEffect(int amount) {
this(amount, null);

View file

@ -10,10 +10,9 @@ import mage.game.ExileZone;
import mage.game.Game;
import mage.players.Player;
// TODO: Remove this class? Nothing uses it.
public class ReturnCreaturesFromExileEffect extends OneShotEffect {
private final UUID exileId;
private UUID exileId;
private boolean byOwner;
public ReturnCreaturesFromExileEffect(UUID exileId, boolean byOwner, String description) {
@ -24,10 +23,9 @@ public class ReturnCreaturesFromExileEffect extends OneShotEffect {
}
private ReturnCreaturesFromExileEffect(final ReturnCreaturesFromExileEffect effect) {
public ReturnCreaturesFromExileEffect(final ReturnCreaturesFromExileEffect effect) {
super(effect);
this.exileId = effect.exileId;
this.byOwner = effect.byOwner;
}
@Override

View file

@ -29,7 +29,6 @@ public class MustBeBlockedByAllAttachedEffect extends RequirementEffect {
public MustBeBlockedByAllAttachedEffect(final MustBeBlockedByAllAttachedEffect effect) {
super(effect);
this.attachmentType = effect.attachmentType;
}
@Override

View file

@ -11,7 +11,7 @@ import mage.game.permanent.Permanent;
*/
public class BecomesCreatureIfVehicleEffect extends ContinuousEffectImpl {
private static final CardType addedType = CardType.CREATURE;
private CardType addedType = CardType.CREATURE;
public BecomesCreatureIfVehicleEffect() {
super(Duration.WhileOnBattlefield, Layer.TypeChangingEffects_4, SubLayer.NA, Outcome.Benefit);

View file

@ -22,7 +22,7 @@ public class BecomesCreatureTargetEffect extends ContinuousEffectImpl {
protected boolean addStillALandText;
protected boolean loseName;
protected boolean keepAbilities;
protected boolean removeSubtypes;
protected boolean removeSubtypes = false;
public BecomesCreatureTargetEffect(Token token, boolean loseAllAbilities, boolean stillALand, Duration duration) {
@ -58,7 +58,6 @@ public class BecomesCreatureTargetEffect extends ContinuousEffectImpl {
this.addStillALandText = effect.addStillALandText;
this.loseName = effect.loseName;
this.keepAbilities = effect.keepAbilities;
this.removeSubtypes = effect.removeSubtypes;
}
@Override

View file

@ -57,7 +57,6 @@ public class GainControlTargetEffect extends ContinuousEffectImpl {
super(effect);
this.controllingPlayerId = effect.controllingPlayerId;
this.fixedControl = effect.fixedControl;
this.firstControlChange = effect.firstControlChange;
}
@Override

View file

@ -32,7 +32,7 @@ public class AmassEffect extends OneShotEffect {
}
private final DynamicValue amassNumber;
private UUID amassedCreatureId;
private UUID amassedCreatureId = null;
public AmassEffect(int amassNumber) {
this(StaticValue.get(amassNumber));
@ -53,7 +53,6 @@ public class AmassEffect extends OneShotEffect {
private AmassEffect(final AmassEffect effect) {
super(effect);
this.amassNumber = effect.amassNumber;
this.amassedCreatureId = effect.amassedCreatureId;
}
@Override

View file

@ -39,7 +39,6 @@ public class ProtectionChosenColorAttachedEffect extends ContinuousEffectImpl {
this.protectionAbility = effect.protectionAbility.copy();
}
this.notRemoveItself = effect.notRemoveItself;
this.notRemoveControlled = effect.notRemoveControlled;
}
@Override

View file

@ -135,7 +135,7 @@ class ReturnAttackerToHandTargetCost extends CostImpl {
filter.add(UnblockedPredicate.instance);
}
private UUID defendingPlayerId;
private UUID defendingPlayerId = null;
public ReturnAttackerToHandTargetCost() {
this.addTarget(new TargetControlledPermanent(filter));
@ -144,7 +144,6 @@ class ReturnAttackerToHandTargetCost extends CostImpl {
public ReturnAttackerToHandTargetCost(ReturnAttackerToHandTargetCost cost) {
super(cost);
this.defendingPlayerId = cost.defendingPlayerId;
}
@Override
@ -153,7 +152,8 @@ class ReturnAttackerToHandTargetCost extends CostImpl {
for (UUID targetId : targets.get(0).getTargets()) {
Permanent permanent = game.getPermanent(targetId);
Player controller = game.getPlayer(controllerId);
if (permanent == null || controller == null) {
if (permanent == null
|| controller == null) {
return false;
}
defendingPlayerId = game.getCombat().getDefenderId(permanent.getId());

View file

@ -12,8 +12,8 @@ import mage.util.CardUtil;
public class VanishingUpkeepAbility extends BeginningOfUpkeepTriggeredAbility {
private final int vanishingAmount;
private final String permanentType;
private int vanishingAmount;
private String permanentType;
public VanishingUpkeepAbility(int vanishingEffect) {
super(new VanishingEffect(), TargetController.YOU, false);
@ -27,10 +27,9 @@ public class VanishingUpkeepAbility extends BeginningOfUpkeepTriggeredAbility {
this.permanentType = permanentType;
}
private VanishingUpkeepAbility(final VanishingUpkeepAbility ability) {
public VanishingUpkeepAbility(final VanishingUpkeepAbility ability) {
super(ability);
this.vanishingAmount = ability.vanishingAmount;
this.permanentType = ability.permanentType;
}
@Override
@ -64,16 +63,15 @@ class VanishingEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Permanent p = game.getPermanent(source.getSourceId());
if (p == null) {
return false;
if (p != null) {
int amount = p.getCounters(game).getCount(CounterType.TIME);
if (amount > 0) {
p.removeCounters(CounterType.TIME.createInstance(), source, game);
game.informPlayers("Removed a time counter from " + p.getLogName() + " (" + amount + " left)");
}
return true;
}
int amount = p.getCounters(game).getCount(CounterType.TIME);
if (amount > 0) {
p.removeCounters(CounterType.TIME.createInstance(), source, game);
game.informPlayers("Removed a time counter from " + p.getLogName() + " (" + amount + " left)");
}
return true;
return false;
}
@Override

View file

@ -73,7 +73,7 @@ class AnyColorLandsProduceManaEffect extends ManaEffect {
private final FilterPermanent filter;
private final boolean onlyColors; // false if mana types can be produced (also Colorless mana), if true only colors can be produced (no Colorless mana).
private boolean inManaTypeCalculation;
private boolean inManaTypeCalculation = false;
AnyColorLandsProduceManaEffect(TargetController targetController, boolean onlyColors, FilterPermanent filter) {
super();
@ -93,7 +93,6 @@ class AnyColorLandsProduceManaEffect extends ManaEffect {
super(effect);
this.filter = effect.filter.copy();
this.onlyColors = effect.onlyColors;
this.inManaTypeCalculation = effect.inManaTypeCalculation;
}
@Override

View file

@ -57,7 +57,7 @@ class AnyColorPermanentTypesManaEffect extends ManaEffect {
private final FilterPermanent filter;
private final boolean onlyColors; // false if mana types can be produced (also Colorless mana), if true only colors can be produced (no Colorless mana).
private boolean inManaTypeCalculation;
private boolean inManaTypeCalculation = false;
public AnyColorPermanentTypesManaEffect(TargetController targetController, boolean onlyColors, FilterPermanent permanentTypes) {
super();
@ -72,7 +72,6 @@ class AnyColorPermanentTypesManaEffect extends ManaEffect {
super(effect);
this.filter = effect.filter.copy();
this.onlyColors = effect.onlyColors;
this.inManaTypeCalculation = effect.inManaTypeCalculation;
}
@Override