Code cleanup: protect all copy constructors (#10750)

* apply regex to change public copy constructors to protected
* cleanup code using now protected constructors
* fix manaBuilder weird casting of Mana into ConditionalMana
This commit is contained in:
Susucre 2023-08-05 01:34:58 +02:00 committed by GitHub
parent b04b13d530
commit f75b1c9f0a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
1565 changed files with 2412 additions and 2731 deletions

View file

@ -53,7 +53,7 @@ public class ConditionalMana extends Mana implements Serializable, Emptiable {
super(mana);
}
public ConditionalMana(final ConditionalMana conditionalMana) {
protected ConditionalMana(final ConditionalMana conditionalMana) {
super(conditionalMana);
conditions.addAll(conditionalMana.conditions);
scope = conditionalMana.scope;

View file

@ -67,7 +67,7 @@ public abstract class MageObjectImpl implements MageObject {
abilities = new AbilitiesImpl<>();
}
public MageObjectImpl(final MageObjectImpl object) {
protected MageObjectImpl(final MageObjectImpl object) {
objectId = object.objectId;
name = object.name;
manaCost = object.manaCost.copy();

View file

@ -77,7 +77,7 @@ public class Mana implements Comparable<Mana>, Serializable, Copyable<Mana> {
*
* @param mana object to create copy from.
*/
public Mana(final Mana mana) {
protected Mana(final Mana mana) {
Objects.requireNonNull(mana, "The passed in mana can not be null");
this.white = mana.white;
this.blue = mana.blue;
@ -166,8 +166,8 @@ public class Mana implements Comparable<Mana>, Serializable, Copyable<Mana> {
/**
* Creates a {@link Mana} object of #num mana of the passed {@link ManaType}.
*
* @param manaType The type of mana to set.
* @param num The number of mana available of the passed ManaType.
* @param manaType The type of mana to set.
* @param num The number of mana available of the passed ManaType.
**/
public Mana(final ManaType manaType, int num) {
this();
@ -338,6 +338,7 @@ public class Mana implements Comparable<Mana>, Serializable, Copyable<Mana> {
/**
* Helper function for increase and decrease to not have the code duplicated.
*
* @param manaType
* @param increase
*/
@ -420,6 +421,7 @@ public class Mana implements Comparable<Mana>, Serializable, Copyable<Mana> {
public void increaseAny() {
any = CardUtil.overflowInc(any, 1);
}
public void decreaseAny() {
any = CardUtil.overflowDec(any, 1);
}
@ -697,7 +699,7 @@ public class Mana implements Comparable<Mana>, Serializable, Copyable<Mana> {
* Returns if the cost (this) can be paid by the mana provided by the passed in {@link Mana} object.
*
* @param avail The mana to compare too.
* @return boolean indicating if there is enough available mana to pay.
* @return boolean indicating if there is enough available mana to pay.
*/
public boolean enough(final Mana avail) {
Mana compare = avail.copy();
@ -769,11 +771,11 @@ public class Mana implements Comparable<Mana>, Serializable, Copyable<Mana> {
/**
* Returns the total mana needed to meet the cost of this given the available mana passed in
* as a {@link Mana} object.
*
* <p>
* Used by the AI to calculate what mana it needs to obtain for a spell to become playable.
*
* @param avail the mana available to pay the cost
* @return the total mana needed to pay this given the available mana passed in as a {@link Mana} object.
* @return the total mana needed to pay this given the available mana passed in as a {@link Mana} object.
*/
public Mana needed(final Mana avail) {
Mana compare = avail.copy();
@ -1239,19 +1241,19 @@ public class Mana implements Comparable<Mana>, Serializable, Copyable<Mana> {
* not contain one less mana in any type but generic.
* <p>
* See tests ManaTest.moreValuableManaTest for several examples
*
* <p>
* Examples:
* {1} and {R} -> {R}
* {2} and {1}{W} -> {1}{W}
* {3} and {1}{W} -> {1}{W}
* {1}{W}{R} and {G}{W}{R} -> {G}{W}{R}
* {G}{W}{R} and {G}{W}{R} -> null
* {G}{W}{B} and {G}{W}{R} -> null
* {C} and {ANY} -> null
* {1} and {R} -> {R}
* {2} and {1}{W} -> {1}{W}
* {3} and {1}{W} -> {1}{W}
* {1}{W}{R} and {G}{W}{R} -> {G}{W}{R}
* {G}{W}{R} and {G}{W}{R} -> null
* {G}{W}{B} and {G}{W}{R} -> null
* {C} and {ANY} -> null
*
* @param mana1 The 1st mana to compare.
* @param mana2 The 2nd mana to compare.
* @return The greater of the two manas, or null if they're the same OR they cannot be compared
* @param mana1 The 1st mana to compare.
* @param mana2 The 2nd mana to compare.
* @return The greater of the two manas, or null if they're the same OR they cannot be compared
*/
public static Mana getMoreValuableMana(final Mana mana1, final Mana mana2) {
if (mana1.equals(mana2)) {
@ -1279,8 +1281,8 @@ public class Mana implements Comparable<Mana>, Serializable, Copyable<Mana> {
|| mana2.colorless > mana1.colorless
|| mana2.countColored() > mana1.countColored()
|| (mana2.countColored() == mana1.countColored()
&& mana2.colorless == mana1.colorless
&& mana2.count() > mana1.count())) {
&& mana2.colorless == mana1.colorless
&& mana2.count() > mana1.count())) {
moreMana = mana2;
lessMana = mana1;
} else {

View file

@ -94,7 +94,7 @@ public abstract class AbilityImpl implements Ability {
this.modes = new Modes();
}
public AbilityImpl(final AbilityImpl ability) {
protected AbilityImpl(final AbilityImpl ability) {
this.id = ability.id;
this.originalId = ability.originalId;
this.abilityType = ability.abilityType;

View file

@ -48,7 +48,7 @@ public abstract class ActivatedAbilityImpl extends AbilityImpl implements Activa
super(abilityType, zone);
}
public ActivatedAbilityImpl(final ActivatedAbilityImpl ability) {
protected ActivatedAbilityImpl(final ActivatedAbilityImpl ability) {
super(ability);
timing = ability.timing;
mayActivate = ability.mayActivate;

View file

@ -18,7 +18,7 @@ public class CompoundAbility extends AbilitiesImpl<Ability> {
addAll(Arrays.asList(abilities));
}
public CompoundAbility(final CompoundAbility compoundAbility) {
protected CompoundAbility(final CompoundAbility compoundAbility) {
for (Ability ability : compoundAbility) {
add(ability);
}

View file

@ -14,7 +14,7 @@ public class DelayedTriggeredAbilities extends AbilitiesImpl<DelayedTriggeredAbi
public DelayedTriggeredAbilities() {
}
public DelayedTriggeredAbilities(final DelayedTriggeredAbilities abilities) {
protected DelayedTriggeredAbilities(final DelayedTriggeredAbilities abilities) {
super(abilities);
}

View file

@ -31,7 +31,7 @@ public abstract class DelayedTriggeredAbility extends TriggeredAbilityImpl {
this.triggerOnlyOnce = triggerOnlyOnce;
}
public DelayedTriggeredAbility(final DelayedTriggeredAbility ability) {
protected DelayedTriggeredAbility(final DelayedTriggeredAbility ability) {
super(ability);
this.duration = ability.duration;
this.triggerOnlyOnce = ability.triggerOnlyOnce;

View file

@ -16,7 +16,7 @@ public abstract class EvasionAbility extends StaticAbility {
super(AbilityType.EVASION, zone);
}
public EvasionAbility(final EvasionAbility ability) {
protected EvasionAbility(final EvasionAbility ability) {
super(ability);
}

View file

@ -27,7 +27,7 @@ public class Mode implements Serializable {
}
}
public Mode(final Mode mode) {
protected Mode(final Mode mode) {
this.id = mode.id;
this.targets = mode.targets.copy();
this.effects = mode.effects.copy();

View file

@ -53,7 +53,7 @@ public class Modes extends LinkedHashMap<UUID, Mode> {
this.eachModeMoreThanOnce = false;
}
public Modes(final Modes modes) {
protected Modes(final Modes modes) {
for (Map.Entry<UUID, Mode> entry : modes.entrySet()) {
this.put(entry.getKey(), entry.getValue().copy());
}

View file

@ -33,7 +33,7 @@ public abstract class SpecialAction extends ActivatedAbilityImpl {
this.manaAbility = manaAbility;
}
public SpecialAction(final SpecialAction action) {
protected SpecialAction(final SpecialAction action) {
super(action);
this.unpaidMana = action.unpaidMana;
this.manaAbility = action.manaAbility;

View file

@ -7,27 +7,26 @@ import java.util.Map;
import java.util.UUID;
/**
*
* @author BetaSteward_at_googlemail.com
*/
public class SpecialActions extends AbilitiesImpl<SpecialAction> {
public SpecialActions() {}
public SpecialActions() {
}
public SpecialActions(final SpecialActions actions) {
protected SpecialActions(final SpecialActions actions) {
super(actions);
}
/**
*
* @param controllerId
* @param manaAction true = if mana actions should get returned
* false = only non mana actions get returned
* @param manaAction true = if mana actions should get returned
* false = only non mana actions get returned
* @return
*/
public Map<UUID, SpecialAction> getControlledBy(UUID controllerId, boolean manaAction) {
LinkedHashMap<UUID, SpecialAction> controlledBy = new LinkedHashMap<>();
for (SpecialAction action: this) {
for (SpecialAction action : this) {
if (action.isControlledBy(controllerId) && action.isManaAction() == manaAction) {
controlledBy.put(action.id, action);
}

View file

@ -48,7 +48,7 @@ public class SpellAbility extends ActivatedAbilityImpl {
setSpellName();
}
public SpellAbility(final SpellAbility ability) {
protected SpellAbility(final SpellAbility ability) {
super(ability);
this.spellAbilityType = ability.spellAbilityType;
this.spellAbilityCastMode = ability.spellAbilityCastMode;

View file

@ -25,7 +25,7 @@ public abstract class StateTriggeredAbility extends TriggeredAbilityImpl {
super(zone, effect);
}
public StateTriggeredAbility(final StateTriggeredAbility ability) {
protected StateTriggeredAbility(final StateTriggeredAbility ability) {
super(ability);
}

View file

@ -30,7 +30,7 @@ public class TriggeredAbilities extends ConcurrentHashMap<String, TriggeredAbili
public TriggeredAbilities() {
}
public TriggeredAbilities(final TriggeredAbilities abilities) {
protected TriggeredAbilities(final TriggeredAbilities abilities) {
for (Map.Entry<String, TriggeredAbility> entry : abilities.entrySet()) {
this.put(entry.getKey(), entry.getValue().copy());
}

View file

@ -36,7 +36,7 @@ public class ConstellationAbility extends TriggeredAbilityImpl {
+ " enchantment enters the battlefield under your control, ");
}
public ConstellationAbility(final ConstellationAbility ability) {
protected ConstellationAbility(final ConstellationAbility ability) {
super(ability);
this.thisOr = ability.thisOr;
}

View file

@ -31,7 +31,7 @@ public class GrandeurAbility extends ActivatedAbilityImpl {
setAbilityWord(AbilityWord.GRANDEUR);
}
public GrandeurAbility(final GrandeurAbility ability) {
protected GrandeurAbility(final GrandeurAbility ability) {
super(ability);
this.cardName = ability.cardName;
}

View file

@ -30,7 +30,7 @@ public class KinshipAbility extends TriggeredAbilityImpl {
setTriggerPhrase("At the beginning of your upkeep, ");
}
public KinshipAbility(final KinshipAbility ability) {
protected KinshipAbility(final KinshipAbility ability) {
super(ability);
}
@ -69,7 +69,7 @@ class KinshipBaseEffect extends OneShotEffect {
this.staticText = "you may look at the top card of your library. If it shares a creature type with {this}, you may reveal it. If you do, ";
}
public KinshipBaseEffect(final KinshipBaseEffect effect) {
protected KinshipBaseEffect(final KinshipBaseEffect effect) {
super(effect);
this.kinshipEffects.addAll(effect.kinshipEffects.copy());
}

View file

@ -13,7 +13,6 @@ import mage.constants.Duration;
import mage.constants.Zone;
/**
*
* @author emerald000
*/
@ -23,7 +22,7 @@ public class LieutenantAbility extends SimpleStaticAbility {
super(Zone.BATTLEFIELD, new ConditionalContinuousEffect(new BoostSourceEffect(2, 2, Duration.WhileOnBattlefield), CommanderInPlayCondition.instance, "<i>Lieutenant</i> &mdash; As long as you control your commander, {this} gets +2/+2"));
this.addEffect(new ConditionalContinuousEffect(effect, CommanderInPlayCondition.instance, effect.getText(null)));
}
public LieutenantAbility(Effects effects) {
super(Zone.BATTLEFIELD, new ConditionalContinuousEffect(new BoostSourceEffect(2, 2, Duration.WhileOnBattlefield), CommanderInPlayCondition.instance, "<i>Lieutenant</i> &mdash; As long as you control your commander, {this} gets +2/+2"));
for (Effect effect : effects) {
@ -31,7 +30,7 @@ public class LieutenantAbility extends SimpleStaticAbility {
}
}
public LieutenantAbility(final LieutenantAbility ability) {
protected LieutenantAbility(final LieutenantAbility ability) {
super(ability);
}

View file

@ -25,7 +25,7 @@ public class StriveAbility extends SimpleStaticAbility {
setAbilityWord(AbilityWord.STRIVE);
}
public StriveAbility(final StriveAbility ability) {
protected StriveAbility(final StriveAbility ability) {
super(ability);
this.striveCost = ability.striveCost;
}

View file

@ -18,7 +18,7 @@ public class ActivateAsSorceryActivatedAbility extends ActivatedAbilityImpl {
timing = TimingRule.SORCERY;
}
public ActivateAsSorceryActivatedAbility(final ActivateAsSorceryActivatedAbility ability) {
protected ActivateAsSorceryActivatedAbility(final ActivateAsSorceryActivatedAbility ability) {
super(ability);
}

View file

@ -8,7 +8,6 @@ import mage.constants.Zone;
import mage.constants.TargetController;
/**
*
* @author jeffwadsworth
*/
@ -18,7 +17,7 @@ public class ActivateOnlyByOpponentActivatedAbility extends ActivatedAbilityImpl
mayActivate = TargetController.OPPONENT;
}
public ActivateOnlyByOpponentActivatedAbility(final ActivateOnlyByOpponentActivatedAbility ability) {
protected ActivateOnlyByOpponentActivatedAbility(final ActivateOnlyByOpponentActivatedAbility ability) {
super(ability);
}

View file

@ -8,7 +8,6 @@ import mage.constants.EnterEventType;
import mage.constants.Zone;
/**
*
* @author North
*/
public class AsEntersBattlefieldAbility extends StaticAbility {
@ -25,7 +24,7 @@ public class AsEntersBattlefieldAbility extends StaticAbility {
super(Zone.ALL, new EntersBattlefieldEffect(effect, null, text, true, false, enterEventType));
}
public AsEntersBattlefieldAbility(final AsEntersBattlefieldAbility ability) {
protected AsEntersBattlefieldAbility(final AsEntersBattlefieldAbility ability) {
super(ability);
}

View file

@ -17,7 +17,7 @@ public class AttachedToCreatureSourceTriggeredAbility extends TriggeredAbilityIm
setTriggerPhrase("Whenever {this} becomes attached to a creature, ");
}
public AttachedToCreatureSourceTriggeredAbility(final AttachedToCreatureSourceTriggeredAbility ability) {
protected AttachedToCreatureSourceTriggeredAbility(final AttachedToCreatureSourceTriggeredAbility ability) {
super(ability);
}

View file

@ -2,6 +2,7 @@
package mage.abilities.common;
import java.util.UUID;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.Effect;
import mage.constants.SetTargetPointer;
@ -14,7 +15,6 @@ import mage.game.permanent.Permanent;
import mage.target.targetpointer.FixedTarget;
/**
*
* @author LevelX2
*/
public class AttackedByCreatureTriggeredAbility extends TriggeredAbilityImpl {
@ -45,7 +45,7 @@ public class AttackedByCreatureTriggeredAbility extends TriggeredAbilityImpl {
setTriggerPhrase("Whenever " + filter.getMessage() + " attacks you, ");
}
public AttackedByCreatureTriggeredAbility(final AttackedByCreatureTriggeredAbility ability) {
protected AttackedByCreatureTriggeredAbility(final AttackedByCreatureTriggeredAbility ability) {
super(ability);
this.setTargetPointer = ability.setTargetPointer;
this.filter = ability.filter;

View file

@ -43,10 +43,10 @@ public class AttacksAllTriggeredAbility extends TriggeredAbilityImpl {
this.setTargetPointer = setTargetPointer;
this.controller = controller;
setTriggerPhrase("Whenever " + CardUtil.addArticle(filter.getMessage()) + " attacks"
+ (attacksYouOrYourPlaneswalker ? " you or a planeswalker you control" : "") + ", ");
+ (attacksYouOrYourPlaneswalker ? " you or a planeswalker you control" : "") + ", ");
}
public AttacksAllTriggeredAbility(final AttacksAllTriggeredAbility ability) {
protected AttacksAllTriggeredAbility(final AttacksAllTriggeredAbility ability) {
super(ability);
this.filter = ability.filter; // TODO: Does this have to be a copy?
this.attacksYouOrYourPlaneswalker = ability.attacksYouOrYourPlaneswalker;

View file

@ -26,7 +26,7 @@ public class AttacksAndIsNotBlockedTriggeredAbility extends TriggeredAbilityImpl
setTriggerPhrase("Whenever {this} attacks and isn't blocked, ");
}
public AttacksAndIsNotBlockedTriggeredAbility(final AttacksAndIsNotBlockedTriggeredAbility ability) {
protected AttacksAndIsNotBlockedTriggeredAbility(final AttacksAndIsNotBlockedTriggeredAbility ability) {
super(ability);
this.setTargetPointer = ability.setTargetPointer;
}

View file

@ -11,7 +11,6 @@ import mage.game.permanent.Permanent;
import mage.watchers.common.AttackedThisTurnWatcher;
/**
*
* @author TheElk801
*/
public class AttacksFirstTimeTriggeredAbility extends TriggeredAbilityImpl {
@ -22,7 +21,7 @@ public class AttacksFirstTimeTriggeredAbility extends TriggeredAbilityImpl {
setTriggerPhrase("Whenever {this} attacks for the first time each turn, ");
}
public AttacksFirstTimeTriggeredAbility(final AttacksFirstTimeTriggeredAbility ability) {
protected AttacksFirstTimeTriggeredAbility(final AttacksFirstTimeTriggeredAbility ability) {
super(ability);
}

View file

@ -22,7 +22,7 @@ public class AttacksOrBlocksAttachedTriggeredAbility extends TriggeredAbilityImp
setTriggerPhrase("Whenever " + attachmentType.verb().toLowerCase() + " creature attacks or blocks, ");
}
public AttacksOrBlocksAttachedTriggeredAbility(final AttacksOrBlocksAttachedTriggeredAbility ability) {
protected AttacksOrBlocksAttachedTriggeredAbility(final AttacksOrBlocksAttachedTriggeredAbility ability) {
super(ability);
this.attachmentType = ability.attachmentType;
}

View file

@ -18,7 +18,7 @@ public class AttacksOrBlocksTriggeredAbility extends TriggeredAbilityImpl {
}
}
public AttacksOrBlocksTriggeredAbility(final AttacksOrBlocksTriggeredAbility ability) {
protected AttacksOrBlocksTriggeredAbility(final AttacksOrBlocksTriggeredAbility ability) {
super(ability);
}

View file

@ -53,7 +53,7 @@ public class AttacksWithCreaturesTriggeredAbility extends TriggeredAbilityImpl {
}
}
public AttacksWithCreaturesTriggeredAbility(final AttacksWithCreaturesTriggeredAbility ability) {
protected AttacksWithCreaturesTriggeredAbility(final AttacksWithCreaturesTriggeredAbility ability) {
super(ability);
this.filter = ability.filter;
this.minAttackers = ability.minAttackers;

View file

@ -10,7 +10,6 @@ import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
/**
*
* @author LevelX2
*/
public class AuraAttachedTriggeredAbility extends TriggeredAbilityImpl {
@ -20,7 +19,7 @@ public class AuraAttachedTriggeredAbility extends TriggeredAbilityImpl {
setTriggerPhrase("Whenever an Aura becomes attached to {this}, ");
}
public AuraAttachedTriggeredAbility(final AuraAttachedTriggeredAbility ability) {
protected AuraAttachedTriggeredAbility(final AuraAttachedTriggeredAbility ability) {
super(ability);
}
@ -44,5 +43,5 @@ public class AuraAttachedTriggeredAbility extends TriggeredAbilityImpl {
public AuraAttachedTriggeredAbility copy() {
return new AuraAttachedTriggeredAbility(this);
}
}

View file

@ -15,7 +15,6 @@ import mage.target.Target;
import mage.target.common.TargetCreaturePermanent;
/**
*
* @author LevelX2
*/
public class BecomesAuraAttachToManifestSourceEffect extends OneShotEffect {
@ -25,7 +24,7 @@ public class BecomesAuraAttachToManifestSourceEffect extends OneShotEffect {
this.staticText = "it becomes an Aura with enchant creature. Manifest the top card of your library and attach {this} to it";
}
public BecomesAuraAttachToManifestSourceEffect(final BecomesAuraAttachToManifestSourceEffect effect) {
protected BecomesAuraAttachToManifestSourceEffect(final BecomesAuraAttachToManifestSourceEffect effect) {
super(effect);
}

View file

@ -29,7 +29,7 @@ public class BecomesBlockedAllTriggeredAbility extends TriggeredAbilityImpl {
setTriggerPhrase("Whenever " + filter.getMessage() + " becomes blocked, ");
}
public BecomesBlockedAllTriggeredAbility(final BecomesBlockedAllTriggeredAbility ability) {
protected BecomesBlockedAllTriggeredAbility(final BecomesBlockedAllTriggeredAbility ability) {
super(ability);
this.filter = ability.filter;
this.setTargetPointer = ability.setTargetPointer;

View file

@ -28,7 +28,7 @@ public class BecomesBlockedAttachedTriggeredAbility extends TriggeredAbilityImpl
setTriggerPhrase("Whenever enchanted creature becomes blocked, ");
}
public BecomesBlockedAttachedTriggeredAbility(final BecomesBlockedAttachedTriggeredAbility ability) {
protected BecomesBlockedAttachedTriggeredAbility(final BecomesBlockedAttachedTriggeredAbility ability) {
super(ability);
this.setTargetPointer = ability.setTargetPointer;
}

View file

@ -28,7 +28,7 @@ public class BecomesBlockedByCreatureTriggeredAbility extends TriggeredAbilityIm
setTriggerPhrase("Whenever {this} becomes blocked by " + CardUtil.addArticle(filter.getMessage()) + ", ");
}
public BecomesBlockedByCreatureTriggeredAbility(final BecomesBlockedByCreatureTriggeredAbility ability) {
protected BecomesBlockedByCreatureTriggeredAbility(final BecomesBlockedByCreatureTriggeredAbility ability) {
super(ability);
this.filter = ability.filter;
}

View file

@ -8,7 +8,6 @@ import mage.game.events.GameEvent;
import mage.target.targetpointer.FixedTarget;
/**
*
* @author North
*/
public class BecomesBlockedSourceTriggeredAbility extends TriggeredAbilityImpl {
@ -25,7 +24,7 @@ public class BecomesBlockedSourceTriggeredAbility extends TriggeredAbilityImpl {
setTriggerPhrase("Whenever {this} becomes blocked, ");
}
public BecomesBlockedSourceTriggeredAbility(final BecomesBlockedSourceTriggeredAbility ability) {
protected BecomesBlockedSourceTriggeredAbility(final BecomesBlockedSourceTriggeredAbility ability) {
super(ability);
this.setTargetPointer = ability.setTargetPointer;
}

View file

@ -8,7 +8,6 @@ import mage.game.Game;
import mage.game.events.GameEvent;
/**
*
* @author LevelX2
*/
public class BecomesExertSourceTriggeredAbility extends TriggeredAbilityImpl {
@ -18,7 +17,7 @@ public class BecomesExertSourceTriggeredAbility extends TriggeredAbilityImpl {
setTriggerPhrase("When {this} becomes exerted, ");
}
public BecomesExertSourceTriggeredAbility(final BecomesExertSourceTriggeredAbility ability) {
protected BecomesExertSourceTriggeredAbility(final BecomesExertSourceTriggeredAbility ability) {
super(ability);
}

View file

@ -8,7 +8,6 @@ import mage.game.Game;
import mage.game.events.GameEvent;
/**
*
* @author LevelX2
*/
public class BecomesMonstrousSourceTriggeredAbility extends TriggeredAbilityImpl {
@ -24,7 +23,7 @@ public class BecomesMonstrousSourceTriggeredAbility extends TriggeredAbilityImpl
this(effect, false);
}
public BecomesMonstrousSourceTriggeredAbility(final BecomesMonstrousSourceTriggeredAbility ability) {
protected BecomesMonstrousSourceTriggeredAbility(final BecomesMonstrousSourceTriggeredAbility ability) {
super(ability);
this.monstrosityValue = ability.monstrosityValue;
}

View file

@ -9,7 +9,6 @@ import mage.game.permanent.Permanent;
import mage.target.targetpointer.FixedTarget;
/**
*
* @author Styxo
*/
public class BecomesMonstrousTriggeredAbility extends TriggeredAbilityImpl {
@ -19,7 +18,7 @@ public class BecomesMonstrousTriggeredAbility extends TriggeredAbilityImpl {
setTriggerPhrase("Whenever a creature you control becomes monstrous, ");
}
public BecomesMonstrousTriggeredAbility(final BecomesMonstrousTriggeredAbility ability) {
protected BecomesMonstrousTriggeredAbility(final BecomesMonstrousTriggeredAbility ability) {
super(ability);
}

View file

@ -7,7 +7,6 @@ import mage.game.Game;
import mage.game.events.GameEvent;
/**
*
* @author LevelX2
*/
public class BecomesRenownedSourceTriggeredAbility extends TriggeredAbilityImpl {
@ -19,7 +18,7 @@ public class BecomesRenownedSourceTriggeredAbility extends TriggeredAbilityImpl
setTriggerPhrase("When {this} becomes renowned, ");
}
public BecomesRenownedSourceTriggeredAbility(final BecomesRenownedSourceTriggeredAbility ability) {
protected BecomesRenownedSourceTriggeredAbility(final BecomesRenownedSourceTriggeredAbility ability) {
super(ability);
this.renownValue = ability.renownValue;
}

View file

@ -9,7 +9,6 @@ import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
/**
*
* @author LoneFox
*/
public class BecomesTappedAttachedTriggeredAbility extends TriggeredAbilityImpl {
@ -23,7 +22,7 @@ public class BecomesTappedAttachedTriggeredAbility extends TriggeredAbilityImpl
setTriggerPhrase("Whenever " + description + " becomes tapped, ");
}
public BecomesTappedAttachedTriggeredAbility(final BecomesTappedAttachedTriggeredAbility ability) {
protected BecomesTappedAttachedTriggeredAbility(final BecomesTappedAttachedTriggeredAbility ability) {
super(ability);
}
@ -40,7 +39,7 @@ public class BecomesTappedAttachedTriggeredAbility extends TriggeredAbilityImpl
@Override
public boolean checkTrigger(GameEvent event, Game game) {
Permanent enchantment = game.getPermanent(this.getSourceId());
if(enchantment == null) {
if (enchantment == null) {
return false;
}
Permanent enchanted = game.getPermanent(enchantment.getAttachedTo());

View file

@ -21,7 +21,7 @@ public class BecomesTappedSourceTriggeredAbility extends TriggeredAbilityImpl {
setTriggerPhrase("Whenever {this} becomes tapped, ");
}
public BecomesTappedSourceTriggeredAbility(final BecomesTappedSourceTriggeredAbility ability) {
protected BecomesTappedSourceTriggeredAbility(final BecomesTappedSourceTriggeredAbility ability) {
super(ability);
}

View file

@ -38,7 +38,7 @@ public class BecomesTappedTriggeredAbility extends TriggeredAbilityImpl {
setTriggerPhrase("Whenever " + CardUtil.addArticle(filter.getMessage()) + " becomes tapped, ");
}
public BecomesTappedTriggeredAbility(final BecomesTappedTriggeredAbility ability) {
protected BecomesTappedTriggeredAbility(final BecomesTappedTriggeredAbility ability) {
super(ability);
this.filter = ability.filter.copy();
this.setTargetPointer = ability.setTargetPointer;

View file

@ -11,7 +11,6 @@ import mage.game.stack.StackObject;
import mage.game.permanent.Permanent;
/**
*
* @author LoneFox
*/
public class BecomesTargetAttachedTriggeredAbility extends TriggeredAbilityImpl {
@ -32,7 +31,7 @@ public class BecomesTargetAttachedTriggeredAbility extends TriggeredAbilityImpl
setTriggerPhrase("When enchanted " + enchantType + " becomes the target of " + filter.getMessage() + ", ");
}
public BecomesTargetAttachedTriggeredAbility(final BecomesTargetAttachedTriggeredAbility ability) {
protected BecomesTargetAttachedTriggeredAbility(final BecomesTargetAttachedTriggeredAbility ability) {
super(ability);
this.filter = ability.filter.copy();
}

View file

@ -19,7 +19,7 @@ public class BecomesTargetControllerSpellTriggeredAbility extends TriggeredAbili
setTriggerPhrase("When you become the target of a spell, ");
}
public BecomesTargetControllerSpellTriggeredAbility(final BecomesTargetControllerSpellTriggeredAbility ability) {
protected BecomesTargetControllerSpellTriggeredAbility(final BecomesTargetControllerSpellTriggeredAbility ability) {
super(ability);
}

View file

@ -34,10 +34,10 @@ public class BecomesTargetTriggeredAbility extends TriggeredAbilityImpl {
this.filterTarget = filterTarget;
this.filterStack = filterStack;
setTriggerPhrase("Whenever " + filterTarget.getMessage() + " becomes the target of "
+ filterStack.getMessage() + ", ");
+ filterStack.getMessage() + ", ");
}
public BecomesTargetTriggeredAbility(final BecomesTargetTriggeredAbility ability) {
protected BecomesTargetTriggeredAbility(final BecomesTargetTriggeredAbility ability) {
super(ability);
this.filterTarget = ability.filterTarget;
this.filterStack = ability.filterStack;
@ -57,12 +57,12 @@ public class BecomesTargetTriggeredAbility extends TriggeredAbilityImpl {
public boolean checkTrigger(GameEvent event, Game game) {
StackObject sourceObject = game.getStack().getStackObject(event.getSourceId());
if (sourceObject == null
|| !filterStack.match(sourceObject, getControllerId(), this, game)) {
|| !filterStack.match(sourceObject, getControllerId(), this, game)) {
return false;
}
Permanent permanent = game.getPermanentOrLKIBattlefield(event.getTargetId());
if (permanent == null
|| !filterTarget.match(permanent, getControllerId(), this, game)) {
|| !filterTarget.match(permanent, getControllerId(), this, game)) {
return false;
}

View file

@ -24,7 +24,7 @@ public class BeginningOfCombatTriggeredAbility extends TriggeredAbilityImpl {
setTriggerPhrase(generateTriggerPhrase());
}
public BeginningOfCombatTriggeredAbility(final BeginningOfCombatTriggeredAbility ability) {
protected BeginningOfCombatTriggeredAbility(final BeginningOfCombatTriggeredAbility ability) {
super(ability);
this.targetController = ability.targetController;
this.setTargetPointer = ability.setTargetPointer;

View file

@ -31,7 +31,7 @@ public class BeginningOfDrawTriggeredAbility extends TriggeredAbilityImpl {
setTriggerPhrase(generateTriggerPhrase());
}
public BeginningOfDrawTriggeredAbility(final BeginningOfDrawTriggeredAbility ability) {
protected BeginningOfDrawTriggeredAbility(final BeginningOfDrawTriggeredAbility ability) {
super(ability);
this.targetController = ability.targetController;
}

View file

@ -30,7 +30,7 @@ public class BeginningOfEndStepTriggeredAbility extends TriggeredAbilityImpl {
setTriggerPhrase(generateTriggerPhrase());
}
public BeginningOfEndStepTriggeredAbility(final BeginningOfEndStepTriggeredAbility ability) {
protected BeginningOfEndStepTriggeredAbility(final BeginningOfEndStepTriggeredAbility ability) {
super(ability);
this.targetController = ability.targetController;
this.interveningIfClauseCondition = ability.interveningIfClauseCondition;

View file

@ -27,7 +27,7 @@ public class BeginningOfPostCombatMainTriggeredAbility extends TriggeredAbilityI
setTriggerPhrase(generateTriggerPhrase());
}
public BeginningOfPostCombatMainTriggeredAbility(final BeginningOfPostCombatMainTriggeredAbility ability) {
protected BeginningOfPostCombatMainTriggeredAbility(final BeginningOfPostCombatMainTriggeredAbility ability) {
super(ability);
this.targetController = ability.targetController;
this.setTargetPointer = ability.setTargetPointer;

View file

@ -32,7 +32,7 @@ public class BeginningOfPreCombatMainTriggeredAbility extends TriggeredAbilityIm
setTriggerPhrase(generateTriggerPhrase());
}
public BeginningOfPreCombatMainTriggeredAbility(final BeginningOfPreCombatMainTriggeredAbility ability) {
protected BeginningOfPreCombatMainTriggeredAbility(final BeginningOfPreCombatMainTriggeredAbility ability) {
super(ability);
this.targetController = ability.targetController;
this.setTargetPointer = ability.setTargetPointer;

View file

@ -38,7 +38,7 @@ public class BeginningOfUpkeepTriggeredAbility extends TriggeredAbilityImpl {
setTriggerPhrase(generateTriggerPhrase());
}
public BeginningOfUpkeepTriggeredAbility(final BeginningOfUpkeepTriggeredAbility ability) {
protected BeginningOfUpkeepTriggeredAbility(final BeginningOfUpkeepTriggeredAbility ability) {
super(ability);
this.targetController = ability.targetController;
this.setTargetPointer = ability.setTargetPointer;

View file

@ -21,7 +21,7 @@ public class BeginningOfYourEndStepTriggeredAbility extends TriggeredAbilityImpl
setTriggerPhrase("At the beginning of your end step, ");
}
public BeginningOfYourEndStepTriggeredAbility(final BeginningOfYourEndStepTriggeredAbility ability) {
protected BeginningOfYourEndStepTriggeredAbility(final BeginningOfYourEndStepTriggeredAbility ability) {
super(ability);
}

View file

@ -10,7 +10,6 @@ import mage.game.permanent.Permanent;
import mage.target.targetpointer.FixedTarget;
/**
*
* @author garnold
*/
public class BlocksAttachedTriggeredAbility extends TriggeredAbilityImpl {
@ -33,7 +32,7 @@ public class BlocksAttachedTriggeredAbility extends TriggeredAbilityImpl {
setTriggerPhrase("Whenever " + attachedDescription + " creature blocks" + (setFixedTargetPointerToBlocked ? " a creature, " : ", "));
}
public BlocksAttachedTriggeredAbility(final BlocksAttachedTriggeredAbility ability) {
protected BlocksAttachedTriggeredAbility(final BlocksAttachedTriggeredAbility ability) {
super(ability);
this.setFixedTargetPointer = ability.setFixedTargetPointer;
this.setFixedTargetPointerToBlocked = ability.setFixedTargetPointerToBlocked;

View file

@ -31,7 +31,7 @@ public class BlocksCreatureTriggeredAbility extends TriggeredAbilityImpl {
setTriggerPhrase("Whenever {this} blocks " + CardUtil.addArticle(filter.getMessage()) + ", ");
}
public BlocksCreatureTriggeredAbility(final BlocksCreatureTriggeredAbility ability) {
protected BlocksCreatureTriggeredAbility(final BlocksCreatureTriggeredAbility ability) {
super(ability);
this.filter = ability.filter;
}

View file

@ -37,7 +37,7 @@ public class BlocksOrBecomesBlockedByOneOrMoreTriggeredAbility extends Triggered
setTriggerPhrase("Whenever {this} blocks or becomes blocked by one or more " + (filter != null ? filter.getMessage() : "creatures") + ", ");
}
public BlocksOrBecomesBlockedByOneOrMoreTriggeredAbility(final BlocksOrBecomesBlockedByOneOrMoreTriggeredAbility ability) {
protected BlocksOrBecomesBlockedByOneOrMoreTriggeredAbility(final BlocksOrBecomesBlockedByOneOrMoreTriggeredAbility ability) {
super(ability);
this.filter = ability.filter;
this.rule = ability.rule;

View file

@ -27,7 +27,7 @@ public class BlocksOrBlockedAttachedTriggeredAbility extends TriggeredAbilityImp
this.attachmentType = attachmentType;
}
public BlocksOrBlockedAttachedTriggeredAbility(final BlocksOrBlockedAttachedTriggeredAbility ability) {
protected BlocksOrBlockedAttachedTriggeredAbility(final BlocksOrBlockedAttachedTriggeredAbility ability) {
super(ability);
this.attachmentType = ability.attachmentType;
}

View file

@ -31,7 +31,7 @@ public class BlocksOrBlockedByCreatureAttachedTriggeredAbility extends Triggered
this.selfTarget = selfTarget;
}
public BlocksOrBlockedByCreatureAttachedTriggeredAbility(final BlocksOrBlockedByCreatureAttachedTriggeredAbility ability) {
protected BlocksOrBlockedByCreatureAttachedTriggeredAbility(final BlocksOrBlockedByCreatureAttachedTriggeredAbility ability) {
super(ability);
this.attachmentType = ability.attachmentType;
this.selfTarget = ability.selfTarget;

View file

@ -36,7 +36,7 @@ public class BlocksOrBlockedByCreatureSourceTriggeredAbility extends TriggeredAb
setTriggerPhrase("Whenever {this} blocks or becomes blocked by " + CardUtil.addArticle(filter.getMessage()) + ", ");
}
public BlocksOrBlockedByCreatureSourceTriggeredAbility(final BlocksOrBlockedByCreatureSourceTriggeredAbility ability) {
protected BlocksOrBlockedByCreatureSourceTriggeredAbility(final BlocksOrBlockedByCreatureSourceTriggeredAbility ability) {
super(ability);
this.filter = ability.filter;
}

View file

@ -14,12 +14,13 @@ public class BlocksOrBlockedSourceTriggeredAbility extends TriggeredAbilityImpl
public BlocksOrBlockedSourceTriggeredAbility(Effect effect) {
this(effect, false);
}
public BlocksOrBlockedSourceTriggeredAbility(Effect effect, boolean optional) {
super(Zone.BATTLEFIELD, effect, optional);
setTriggerPhrase("Whenever {this} blocks or becomes blocked, ");
}
public BlocksOrBlockedSourceTriggeredAbility(final BlocksOrBlockedSourceTriggeredAbility ability) {
protected BlocksOrBlockedSourceTriggeredAbility(final BlocksOrBlockedSourceTriggeredAbility ability) {
super(ability);
}

View file

@ -7,7 +7,6 @@ import mage.game.Game;
import mage.game.events.GameEvent;
/**
*
* @author North
*/
public class BlocksSourceTriggeredAbility extends TriggeredAbilityImpl {
@ -21,7 +20,7 @@ public class BlocksSourceTriggeredAbility extends TriggeredAbilityImpl {
setTriggerPhrase("Whenever {this} blocks, ");
}
public BlocksSourceTriggeredAbility(final BlocksSourceTriggeredAbility ability) {
protected BlocksSourceTriggeredAbility(final BlocksSourceTriggeredAbility ability) {
super(ability);
}

View file

@ -20,7 +20,7 @@ public class CastCommanderAbility extends SpellAbility {
this.ruleText = spellTemplate.getRule(); // need to support custom rule texts like OverloadAbility
}
public CastCommanderAbility(final CastCommanderAbility ability) {
protected CastCommanderAbility(final CastCommanderAbility ability) {
super(ability);
this.ruleText = ability.ruleText;
}

View file

@ -15,7 +15,6 @@ import mage.game.Game;
import mage.players.Player;
/**
*
* @author BetaSteward_at_googlemail.com
*/
public class ChancellorAbility extends StaticAbility implements OpeningHandAction {
@ -28,7 +27,7 @@ public class ChancellorAbility extends StaticAbility implements OpeningHandActio
super(Zone.HAND, effect);
}
public ChancellorAbility(final ChancellorAbility ability) {
protected ChancellorAbility(final ChancellorAbility ability) {
super(ability);
}

View file

@ -21,7 +21,7 @@ public class ControlsPermanentsControllerTriggeredAbility extends StateTriggered
protected final ComparisonType type;
protected final int value;
public ControlsPermanentsControllerTriggeredAbility(FilterPermanent filter, Effect effect){
public ControlsPermanentsControllerTriggeredAbility(FilterPermanent filter, Effect effect) {
this(filter, ComparisonType.MORE_THAN, 0, effect);
}
@ -30,10 +30,10 @@ public class ControlsPermanentsControllerTriggeredAbility extends StateTriggered
this.filter = filter;
this.value = value;
this.type = type;
setTriggerPhrase("When you control " + filter.getMessage() + ", " );
setTriggerPhrase("When you control " + filter.getMessage() + ", ");
}
public ControlsPermanentsControllerTriggeredAbility(final ControlsPermanentsControllerTriggeredAbility ability) {
protected ControlsPermanentsControllerTriggeredAbility(final ControlsPermanentsControllerTriggeredAbility ability) {
super(ability);
this.filter = ability.filter;
this.type = ability.type;

View file

@ -11,7 +11,6 @@ import mage.game.stack.StackAbility;
import mage.game.stack.StackObject;
/**
*
* @author LevelX2
*/
public class CycleAllTriggeredAbility extends TriggeredAbilityImpl {
@ -21,7 +20,7 @@ public class CycleAllTriggeredAbility extends TriggeredAbilityImpl {
setTriggerPhrase("Whenever a player cycles a card, ");
}
public CycleAllTriggeredAbility(final CycleAllTriggeredAbility ability) {
protected CycleAllTriggeredAbility(final CycleAllTriggeredAbility ability) {
super(ability);
}

View file

@ -8,7 +8,6 @@ import mage.game.Game;
import mage.game.events.GameEvent;
/**
*
* @author fireshoes
*/
public class CycleOrDiscardControllerTriggeredAbility extends TriggeredAbilityImpl {
@ -22,7 +21,7 @@ public class CycleOrDiscardControllerTriggeredAbility extends TriggeredAbilityIm
setTriggerPhrase("Whenever you cycle or discard a card, ");
}
public CycleOrDiscardControllerTriggeredAbility(final CycleOrDiscardControllerTriggeredAbility ability) {
protected CycleOrDiscardControllerTriggeredAbility(final CycleOrDiscardControllerTriggeredAbility ability) {
super(ability);
}

View file

@ -47,7 +47,7 @@ public class DealCombatDamageControlledTriggeredAbility extends TriggeredAbility
+ (onlyOpponents ? "an opponent" : "a player") + ", ");
}
public DealCombatDamageControlledTriggeredAbility(final DealCombatDamageControlledTriggeredAbility ability) {
protected DealCombatDamageControlledTriggeredAbility(final DealCombatDamageControlledTriggeredAbility ability) {
super(ability);
this.setTargetPointer = ability.setTargetPointer;
this.onlyOpponents = ability.onlyOpponents;

View file

@ -23,7 +23,7 @@ public class DealsCombatDamageEquippedTriggeredAbility extends TriggeredAbilityI
setTriggerPhrase("Whenever equipped creature deals combat damage, ");
}
public DealsCombatDamageEquippedTriggeredAbility(final DealsCombatDamageEquippedTriggeredAbility ability) {
protected DealsCombatDamageEquippedTriggeredAbility(final DealsCombatDamageEquippedTriggeredAbility ability) {
super(ability);
}

View file

@ -28,7 +28,7 @@ public class DealsCombatDamageToACreatureTriggeredAbility extends TriggeredAbili
setTriggerPhrase("Whenever {this} deals combat damage to a creature, ");
}
public DealsCombatDamageToACreatureTriggeredAbility(final DealsCombatDamageToACreatureTriggeredAbility ability) {
protected DealsCombatDamageToACreatureTriggeredAbility(final DealsCombatDamageToACreatureTriggeredAbility ability) {
super(ability);
this.setTargetPointer = ability.setTargetPointer;
}

View file

@ -24,7 +24,7 @@ public class DealsCombatDamageTriggeredAbility extends TriggeredAbilityImpl {
setTriggerPhrase("Whenever {this} deals combat damage, ");
}
public DealsCombatDamageTriggeredAbility(final DealsCombatDamageTriggeredAbility ability) {
protected DealsCombatDamageTriggeredAbility(final DealsCombatDamageTriggeredAbility ability) {
super(ability);
this.usedInPhase = ability.usedInPhase;
}

View file

@ -18,7 +18,7 @@ public class DealsDamageAttachedTriggeredAbility extends TriggeredAbilityImpl {
setTriggerPhrase("Whenever enchanted creature deals damage, ");
}
public DealsDamageAttachedTriggeredAbility(final DealsDamageAttachedTriggeredAbility ability) {
protected DealsDamageAttachedTriggeredAbility(final DealsDamageAttachedTriggeredAbility ability) {
super(ability);
}

View file

@ -9,7 +9,6 @@ import mage.game.Game;
import mage.game.events.GameEvent;
/**
*
* @author LevelX2
*/
@ -20,7 +19,7 @@ public class DealsDamageGainLifeSourceTriggeredAbility extends TriggeredAbilityI
setTriggerPhrase("Whenever {this} deals damage, ");
}
public DealsDamageGainLifeSourceTriggeredAbility(final DealsDamageGainLifeSourceTriggeredAbility ability) {
protected DealsDamageGainLifeSourceTriggeredAbility(final DealsDamageGainLifeSourceTriggeredAbility ability) {
super(ability);
}
@ -28,10 +27,11 @@ public class DealsDamageGainLifeSourceTriggeredAbility extends TriggeredAbilityI
public DealsDamageGainLifeSourceTriggeredAbility copy() {
return new DealsDamageGainLifeSourceTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.DAMAGED_PERMANENT
|| event.getType() == GameEvent.EventType.DAMAGED_PLAYER;
|| event.getType() == GameEvent.EventType.DAMAGED_PLAYER;
}
@Override

View file

@ -41,10 +41,10 @@ public class DealsDamageToACreatureAllTriggeredAbility extends TriggeredAbilityI
this.setTargetPointer = setTargetPointer;
this.filterPermanent = filterPermanent;
setTriggerPhrase("Whenever " + filterPermanent.getMessage() + " deals "
+ (combatOnly ? "combat " : "") + "damage to a creature, ");
+ (combatOnly ? "combat " : "") + "damage to a creature, ");
}
public DealsDamageToACreatureAllTriggeredAbility(final DealsDamageToACreatureAllTriggeredAbility ability) {
protected DealsDamageToACreatureAllTriggeredAbility(final DealsDamageToACreatureAllTriggeredAbility ability) {
super(ability);
this.combatOnly = ability.combatOnly;
this.filterPermanent = ability.filterPermanent;

View file

@ -26,10 +26,10 @@ public class DealsDamageToACreatureAttachedTriggeredAbility extends TriggeredAbi
this.setTargetPointer = setTargetPointer;
this.attachedDescription = attachedDescription;
setTriggerPhrase("Whenever " + attachedDescription + " deals "
+ (combatOnly ? "combat " : "") + "damage to a creature, ");
+ (combatOnly ? "combat " : "") + "damage to a creature, ");
}
public DealsDamageToACreatureAttachedTriggeredAbility(final DealsDamageToACreatureAttachedTriggeredAbility ability) {
protected DealsDamageToACreatureAttachedTriggeredAbility(final DealsDamageToACreatureAttachedTriggeredAbility ability) {
super(ability);
this.combatOnly = ability.combatOnly;
this.setTargetPointer = ability.setTargetPointer;

View file

@ -33,7 +33,7 @@ public class DealsDamageToACreatureTriggeredAbility extends TriggeredAbilityImpl
setTriggerPhrase("Whenever {this} deals " + (combatOnly ? "combat " : "") + "damage to " + filter.getMessage() + ", ");
}
public DealsDamageToACreatureTriggeredAbility(final DealsDamageToACreatureTriggeredAbility ability) {
protected DealsDamageToACreatureTriggeredAbility(final DealsDamageToACreatureTriggeredAbility ability) {
super(ability);
this.setTargetPointer = ability.setTargetPointer;
this.combatOnly = ability.combatOnly;

View file

@ -47,7 +47,7 @@ public class DealsDamageToAPlayerAllTriggeredAbility extends TriggeredAbilityImp
+ (targetController == TargetController.OPPONENT ? "an opponent" : "a player") + ", ");
}
public DealsDamageToAPlayerAllTriggeredAbility(final DealsDamageToAPlayerAllTriggeredAbility ability) {
protected DealsDamageToAPlayerAllTriggeredAbility(final DealsDamageToAPlayerAllTriggeredAbility ability) {
super(ability);
this.setTargetPointer = ability.setTargetPointer;
this.filter = ability.filter;

View file

@ -41,7 +41,7 @@ public class DealsDamageToAPlayerAttachedTriggeredAbility extends TriggeredAbili
setTriggerPhrase(generateTriggerPhrase());
}
public DealsDamageToAPlayerAttachedTriggeredAbility(final DealsDamageToAPlayerAttachedTriggeredAbility ability) {
protected DealsDamageToAPlayerAttachedTriggeredAbility(final DealsDamageToAPlayerAttachedTriggeredAbility ability) {
super(ability);
this.setFixedTargetPointer = ability.setFixedTargetPointer;
this.attachedDescription = ability.attachedDescription;

View file

@ -32,7 +32,7 @@ public class DealsDamageToAPlayerTriggeredAbility extends TriggeredAbilityImpl {
setTriggerPhrase("Whenever {this} deals damage to a player" + (orPlaneswalker ? " or planeswalker" : "") + ", ");
}
public DealsDamageToAPlayerTriggeredAbility(final DealsDamageToAPlayerTriggeredAbility ability) {
protected DealsDamageToAPlayerTriggeredAbility(final DealsDamageToAPlayerTriggeredAbility ability) {
super(ability);
this.setTargetPointer = ability.setTargetPointer;
this.orPlaneswalker = ability.orPlaneswalker;

View file

@ -35,7 +35,7 @@ public class DealsDamageToOpponentTriggeredAbility extends TriggeredAbilityImpl
setTriggerPhrase("Whenever {this} deals " + (onlyCombat ? "combat " : "") + "damage to an opponent, ");
}
public DealsDamageToOpponentTriggeredAbility(final DealsDamageToOpponentTriggeredAbility ability) {
protected DealsDamageToOpponentTriggeredAbility(final DealsDamageToOpponentTriggeredAbility ability) {
super(ability);
this.onlyCombat = ability.onlyCombat;
this.setTargetPointer = ability.setTargetPointer;
@ -61,7 +61,7 @@ public class DealsDamageToOpponentTriggeredAbility extends TriggeredAbilityImpl
return false;
}
}
if(setTargetPointer) {
if (setTargetPointer) {
for (Effect effect : getEffects()) {
effect.setTargetPointer(new FixedTarget(event.getTargetId(), game));
effect.setValue("damage", event.getAmount());

View file

@ -36,7 +36,7 @@ public class DealtDamageAndDiedTriggeredAbility extends TriggeredAbilityImpl {
setTriggerPhrase("Whenever a " + filter.getMessage() + " dealt damage by {this} this turn dies, ");
}
public DealtDamageAndDiedTriggeredAbility(final DealtDamageAndDiedTriggeredAbility ability) {
protected DealtDamageAndDiedTriggeredAbility(final DealtDamageAndDiedTriggeredAbility ability) {
super(ability);
this.filter = ability.filter;
this.setTargetPointer = ability.setTargetPointer;

View file

@ -2,6 +2,7 @@
package mage.abilities.common;
import java.util.UUID;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.Effect;
import mage.constants.SetTargetPointer;
@ -13,7 +14,6 @@ import mage.game.permanent.Permanent;
import mage.target.targetpointer.FixedTarget;
/**
*
* @author LoneFox
*/
public class DealtDamageAttachedTriggeredAbility extends TriggeredAbilityImpl {
@ -30,7 +30,7 @@ public class DealtDamageAttachedTriggeredAbility extends TriggeredAbilityImpl {
setTriggerPhrase("Whenever enchanted creature is dealt damage, ");
}
public DealtDamageAttachedTriggeredAbility(final DealtDamageAttachedTriggeredAbility ability) {
protected DealtDamageAttachedTriggeredAbility(final DealtDamageAttachedTriggeredAbility ability) {
super(ability);
this.setTargetPointer = ability.setTargetPointer;
}
@ -49,10 +49,10 @@ public class DealtDamageAttachedTriggeredAbility extends TriggeredAbilityImpl {
public boolean checkTrigger(GameEvent event, Game game) {
Permanent enchantment = game.getPermanent(sourceId);
UUID targetId = event.getTargetId();
if(enchantment != null && enchantment.getAttachedTo() != null && targetId.equals(enchantment.getAttachedTo())) {
for(Effect effect : this.getEffects()) {
if (enchantment != null && enchantment.getAttachedTo() != null && targetId.equals(enchantment.getAttachedTo())) {
for (Effect effect : this.getEffects()) {
effect.setValue("damage", event.getAmount());
switch(setTargetPointer) {
switch (setTargetPointer) {
case PERMANENT:
effect.setTargetPointer(new FixedTarget(targetId, game));
break;

View file

@ -25,7 +25,7 @@ public class DealtDamageToSourceTriggeredAbility extends TriggeredAbilityImpl {
setTriggerPhrase("Whenever {this} is dealt damage, ");
}
public DealtDamageToSourceTriggeredAbility(final DealtDamageToSourceTriggeredAbility ability) {
protected DealtDamageToSourceTriggeredAbility(final DealtDamageToSourceTriggeredAbility ability) {
super(ability);
}

View file

@ -50,7 +50,7 @@ public class DiesAttachedTriggeredAbility extends TriggeredAbilityImpl {
setTriggerPhrase(generateTriggerPhrase());
}
public DiesAttachedTriggeredAbility(final DiesAttachedTriggeredAbility ability) {
protected DiesAttachedTriggeredAbility(final DiesAttachedTriggeredAbility ability) {
super(ability);
this.attachedDescription = ability.attachedDescription;
this.diesRuleText = ability.diesRuleText;
@ -130,9 +130,9 @@ public class DiesAttachedTriggeredAbility extends TriggeredAbilityImpl {
} else {
// set targetpointer to the creature that died
if (attachment != null
&& attachment.getAttachedTo() != null) {
&& attachment.getAttachedTo() != null) {
Permanent attachedTo = (Permanent) game.getLastKnownInformation(attachment.getAttachedTo(),
Zone.BATTLEFIELD, attachment.getAttachedToZoneChangeCounter());
Zone.BATTLEFIELD, attachment.getAttachedToZoneChangeCounter());
if (attachedTo != null) {
getEffects().setTargetPointer(new FixedTarget(attachedTo.getId()));
}

View file

@ -51,7 +51,7 @@ public class DiesCreatureTriggeredAbility extends TriggeredAbilityImpl {
setTriggerPhrase("Whenever " + filter.getMessage() + (filter.getMessage().startsWith("one or more") ? " die, " : " dies, "));
}
public DiesCreatureTriggeredAbility(final DiesCreatureTriggeredAbility ability) {
protected DiesCreatureTriggeredAbility(final DiesCreatureTriggeredAbility ability) {
super(ability);
this.filter = ability.filter;
this.setTargetPointer = ability.setTargetPointer;

View file

@ -21,7 +21,7 @@ public class DiesSourceTriggeredAbility extends ZoneChangeTriggeredAbility {
this(effect, false);
}
public DiesSourceTriggeredAbility(final DiesSourceTriggeredAbility ability) {
protected DiesSourceTriggeredAbility(final DiesSourceTriggeredAbility ability) {
super(ability);
}

View file

@ -9,7 +9,6 @@ import mage.game.events.GameEvent.EventType;
import mage.game.stack.StackObject;
/**
*
* @author Styxo
*/
public class DiscardedByOpponentTriggeredAbility extends TriggeredAbilityImpl {
@ -23,7 +22,7 @@ public class DiscardedByOpponentTriggeredAbility extends TriggeredAbilityImpl {
setTriggerPhrase("When a spell or ability an opponent controls causes you to discard this card, ");
}
public DiscardedByOpponentTriggeredAbility(final DiscardedByOpponentTriggeredAbility ability) {
protected DiscardedByOpponentTriggeredAbility(final DiscardedByOpponentTriggeredAbility ability) {
super(ability);
}

View file

@ -13,7 +13,6 @@ import mage.game.events.GameEvent;
import mage.target.targetpointer.FixedTarget;
/**
*
* @author jeffwadsworth
*/
public class DiscardsACardOpponentTriggeredAbility extends TriggeredAbilityImpl {
@ -30,7 +29,7 @@ public class DiscardsACardOpponentTriggeredAbility extends TriggeredAbilityImpl
setTriggerPhrase("Whenever an opponent discards a card, ");
}
public DiscardsACardOpponentTriggeredAbility(final DiscardsACardOpponentTriggeredAbility ability) {
protected DiscardsACardOpponentTriggeredAbility(final DiscardsACardOpponentTriggeredAbility ability) {
super(ability);
this.setTargetPointer = ability.setTargetPointer;
}

View file

@ -8,7 +8,6 @@ import mage.game.Game;
import mage.game.events.GameEvent;
/**
*
* @author North
*/
public class DrawCardControllerTriggeredAbility extends TriggeredAbilityImpl {
@ -22,7 +21,7 @@ public class DrawCardControllerTriggeredAbility extends TriggeredAbilityImpl {
setTriggerPhrase("Whenever you draw a card, ");
}
public DrawCardControllerTriggeredAbility(final DrawCardControllerTriggeredAbility ability) {
protected DrawCardControllerTriggeredAbility(final DrawCardControllerTriggeredAbility ability) {
super(ability);
}

View file

@ -20,7 +20,7 @@ public class DrawCardOpponentTriggeredAbility extends TriggeredAbilityImpl {
setTriggerPhrase("Whenever an opponent draws a card, ");
}
public DrawCardOpponentTriggeredAbility(final DrawCardOpponentTriggeredAbility ability) {
protected DrawCardOpponentTriggeredAbility(final DrawCardOpponentTriggeredAbility ability) {
super(ability);
this.setTargetPointer = ability.setTargetPointer;
}

View file

@ -18,7 +18,7 @@ public class EnchantedPlayerAttackedTriggeredAbility extends TriggeredAbilityImp
setTriggerPhrase("Whenever enchanted player is attacked, ");
}
public EnchantedPlayerAttackedTriggeredAbility(final EnchantedPlayerAttackedTriggeredAbility ability) {
protected EnchantedPlayerAttackedTriggeredAbility(final EnchantedPlayerAttackedTriggeredAbility ability) {
super(ability);
}

View file

@ -23,7 +23,7 @@ public class EndOfCombatTriggeredAbility extends TriggeredAbilityImpl {
setTriggerPhrase("At end of combat, ");
}
public EndOfCombatTriggeredAbility(final EndOfCombatTriggeredAbility ability) {
protected EndOfCombatTriggeredAbility(final EndOfCombatTriggeredAbility ability) {
super(ability);
this.rule = ability.rule;
}

View file

@ -61,7 +61,7 @@ public class EntersBattlefieldAllTriggeredAbility extends TriggeredAbilityImpl {
setTriggerPhrase(generateTriggerPhrase());
}
public EntersBattlefieldAllTriggeredAbility(final EntersBattlefieldAllTriggeredAbility ability) {
protected EntersBattlefieldAllTriggeredAbility(final EntersBattlefieldAllTriggeredAbility ability) {
super(ability);
this.filter = ability.filter;
this.rule = ability.rule;

View file

@ -13,7 +13,7 @@ import mage.watchers.common.PermanentWasCastWatcher;
/**
* An extension of triggered abilities that trigger when permanents enter the
* battlefield, but this time they either must be cast or must not be cast.
*
*
* @author alexander-novo
*/
public class EntersBattlefieldCastTriggeredAbility extends EntersBattlefieldAllTriggeredAbility {
@ -34,31 +34,31 @@ public class EntersBattlefieldCastTriggeredAbility extends EntersBattlefieldAllT
}
public EntersBattlefieldCastTriggeredAbility(Zone zone, Effect effect, FilterPermanent filter, boolean mustCast,
boolean optional) {
boolean optional) {
this(zone, effect, filter, mustCast, optional, SetTargetPointer.NONE, null, false);
}
public EntersBattlefieldCastTriggeredAbility(Zone zone, Effect effect, FilterPermanent filter, boolean mustCast,
boolean optional,
String rule) {
boolean optional,
String rule) {
this(zone, effect, filter, mustCast, optional, rule, false);
}
public EntersBattlefieldCastTriggeredAbility(Zone zone, Effect effect, FilterPermanent filter, boolean mustCast,
boolean optional,
String rule, boolean controlledText) {
boolean optional,
String rule, boolean controlledText) {
this(zone, effect, filter, mustCast, optional, SetTargetPointer.NONE, rule, controlledText);
}
public EntersBattlefieldCastTriggeredAbility(Zone zone, Effect effect, FilterPermanent filter, boolean mustCast,
boolean optional,
SetTargetPointer setTargetPointer, String rule) {
boolean optional,
SetTargetPointer setTargetPointer, String rule) {
this(zone, effect, filter, mustCast, optional, setTargetPointer, rule, false);
}
public EntersBattlefieldCastTriggeredAbility(Zone zone, Effect effect, FilterPermanent filter, boolean mustCast,
boolean optional,
SetTargetPointer setTargetPointer, String rule, boolean controlledText) {
boolean optional,
SetTargetPointer setTargetPointer, String rule, boolean controlledText) {
super(zone, effect, filter, optional, setTargetPointer, rule, controlledText);
this.mustCast = mustCast;
@ -73,7 +73,7 @@ public class EntersBattlefieldCastTriggeredAbility extends EntersBattlefieldAllT
this.setTriggerPhrase(triggerPhrase.toString());
}
public EntersBattlefieldCastTriggeredAbility(final EntersBattlefieldCastTriggeredAbility ability) {
protected EntersBattlefieldCastTriggeredAbility(final EntersBattlefieldCastTriggeredAbility ability) {
super(ability);
this.mustCast = ability.mustCast;

View file

@ -25,7 +25,7 @@ public class EntersBattlefieldFromGraveyardTriggeredAbility extends TriggeredAbi
setTriggerPhrase(generateTriggerPhrase());
}
public EntersBattlefieldFromGraveyardTriggeredAbility(final EntersBattlefieldFromGraveyardTriggeredAbility ability) {
protected EntersBattlefieldFromGraveyardTriggeredAbility(final EntersBattlefieldFromGraveyardTriggeredAbility ability) {
super(ability);
this.targetController = ability.targetController;
}

View file

@ -62,7 +62,7 @@ public class EntersBattlefieldOrAttacksAllTriggeredAbility extends TriggeredAbil
this.setTriggerPhrase(generateTriggerPhrase());
}
public EntersBattlefieldOrAttacksAllTriggeredAbility(final EntersBattlefieldOrAttacksAllTriggeredAbility ability) {
protected EntersBattlefieldOrAttacksAllTriggeredAbility(final EntersBattlefieldOrAttacksAllTriggeredAbility ability) {
super(ability);
this.filter = ability.filter;
this.rule = ability.rule;

View file

@ -8,7 +8,6 @@ import mage.game.Game;
import mage.game.events.GameEvent;
/**
*
* @author Styxo
*/
public class EntersBattlefieldOrAttacksSourceTriggeredAbility extends TriggeredAbilityImpl {
@ -22,7 +21,7 @@ public class EntersBattlefieldOrAttacksSourceTriggeredAbility extends TriggeredA
setTriggerPhrase("Whenever {this} enters the battlefield or attacks, ");
}
public EntersBattlefieldOrAttacksSourceTriggeredAbility(final EntersBattlefieldOrAttacksSourceTriggeredAbility ability) {
protected EntersBattlefieldOrAttacksSourceTriggeredAbility(final EntersBattlefieldOrAttacksSourceTriggeredAbility ability) {
super(ability);
}

View file

@ -26,7 +26,7 @@ public class EntersBattlefieldOrDiesSourceTriggeredAbility extends TriggeredAbil
(diesText ? "dies" : "is put into a graveyard from the battlefield") + ", ");
}
public EntersBattlefieldOrDiesSourceTriggeredAbility(final EntersBattlefieldOrDiesSourceTriggeredAbility ability) {
protected EntersBattlefieldOrDiesSourceTriggeredAbility(final EntersBattlefieldOrDiesSourceTriggeredAbility ability) {
super(ability);
this.diesText = ability.diesText;
}

View file

@ -20,7 +20,7 @@ public class EntersBattlefieldOrLeavesSourceTriggeredAbility extends TriggeredAb
setTriggerPhrase("When {this} enters or leaves the battlefield, ");
}
public EntersBattlefieldOrLeavesSourceTriggeredAbility(final EntersBattlefieldOrLeavesSourceTriggeredAbility ability) {
protected EntersBattlefieldOrLeavesSourceTriggeredAbility(final EntersBattlefieldOrLeavesSourceTriggeredAbility ability) {
super(ability);
}

Some files were not shown because too many files have changed in this diff Show more