mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 11:48:02 +00:00
Triggers: someone has mindlessly copy-pasted method 'getCopy'. I've implemented it in base class (using reflection to get the right instance) and as mindlessly removed the duplicated code
This commit is contained in:
@@ -722,33 +722,11 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
* @return a {@link forge.card.trigger.Trigger} object.
|
||||
*/
|
||||
public final Trigger addTrigger(final Trigger t) {
|
||||
final Trigger newtrig = t.getCopy();
|
||||
newtrig.setHostCard(this);
|
||||
final Trigger newtrig = t.getCopyForHostCard(this);
|
||||
this.getCharacteristics().getTriggers().add(newtrig);
|
||||
return newtrig;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* addTrigger.
|
||||
* </p>
|
||||
*
|
||||
* @param t
|
||||
* a {@link forge.card.trigger.Trigger} object.
|
||||
*
|
||||
* @param state
|
||||
* a {@link forge.CardCharacteristicName} object.
|
||||
*
|
||||
* @return a {@link forge.card.trigger.Trigger} object.
|
||||
*/
|
||||
public final Trigger addTrigger(final Trigger t, final CardCharacteristicName state) {
|
||||
final Trigger newtrig = t.getCopy();
|
||||
newtrig.setHostCard(this);
|
||||
CardCharacteristics stateCharacteristics = this.getState(state);
|
||||
stateCharacteristics.getTriggers().add(newtrig);
|
||||
return newtrig;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* moveTrigger.
|
||||
@@ -833,9 +811,7 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
final List<Trigger> copyList = new CopyOnWriteArrayList<Trigger>();
|
||||
for (final Trigger t : trigs) {
|
||||
if (t.isIntrinsic()) {
|
||||
final Trigger newtrig = t.getCopy();
|
||||
newtrig.setHostCard(this);
|
||||
copyList.add(newtrig);
|
||||
copyList.add(t.getCopyForHostCard(this));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -386,15 +386,6 @@ public abstract class Trigger extends TriggerReplacementBase {
|
||||
*/
|
||||
public abstract boolean performTest(java.util.Map<String, Object> runParams2);
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* getCopy.
|
||||
* </p>
|
||||
*
|
||||
* @return a {@link forge.card.trigger.Trigger} object.
|
||||
*/
|
||||
public abstract Trigger getCopy();
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* setTriggeringObjects.
|
||||
@@ -523,18 +514,22 @@ public abstract class Trigger extends TriggerReplacementBase {
|
||||
void setMode(TriggerType triggerType) {
|
||||
mode = triggerType;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* TODO: Write javadoc for this method.
|
||||
* @param triggerAlways
|
||||
* @return
|
||||
*/
|
||||
public void copyFieldsTo(Trigger copy) {
|
||||
public final Trigger getCopyForHostCard(Card newHost) {
|
||||
TriggerType tt = TriggerType.getTypeFor(this);
|
||||
Trigger copy = tt.createTrigger(mapParams, newHost, isIntrinsic);
|
||||
|
||||
if (this.getOverridingAbility() != null) {
|
||||
copy.setOverridingAbility(this.getOverridingAbility());
|
||||
}
|
||||
|
||||
copy.setName(this.getName());
|
||||
copy.setID(this.getId());
|
||||
copy.setMode(this.getMode());
|
||||
copy.setTriggerPhases(this.validPhases);
|
||||
copy.setActiveZone(validHostZones);
|
||||
return copy;
|
||||
}
|
||||
|
||||
public boolean isStatic() {
|
||||
|
||||
@@ -54,18 +54,6 @@ public class TriggerAlways extends Trigger {
|
||||
return true;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final Trigger getCopy() {
|
||||
final Trigger copy = new TriggerAlways(this.mapParams, this.getHostCard(), this.isIntrinsic());
|
||||
if (this.getOverridingAbility() != null) {
|
||||
copy.setOverridingAbility(this.getOverridingAbility());
|
||||
}
|
||||
|
||||
copyFieldsTo(copy);
|
||||
return copy;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public void setTriggeringObjects(final SpellAbility sa) {
|
||||
|
||||
@@ -68,17 +68,6 @@ public class TriggerAttached extends Trigger {
|
||||
return true;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final Trigger getCopy() {
|
||||
final Trigger copy = new TriggerAttached(this.mapParams, this.getHostCard(), this.isIntrinsic());
|
||||
if (this.getOverridingAbility() != null) {
|
||||
copy.setOverridingAbility(this.getOverridingAbility());
|
||||
}
|
||||
|
||||
copyFieldsTo(copy);
|
||||
return copy;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
|
||||
@@ -67,18 +67,6 @@ public class TriggerAttackerBlocked extends Trigger {
|
||||
return true;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final Trigger getCopy() {
|
||||
final Trigger copy = new TriggerAttackerBlocked(this.mapParams, this.getHostCard(), this.isIntrinsic());
|
||||
if (this.getOverridingAbility() != null) {
|
||||
copy.setOverridingAbility(this.getOverridingAbility());
|
||||
}
|
||||
|
||||
copyFieldsTo(copy);
|
||||
return copy;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final void setTriggeringObjects(final SpellAbility sa) {
|
||||
|
||||
@@ -66,18 +66,6 @@ public class TriggerAttackerUnblocked extends Trigger {
|
||||
return true;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final Trigger getCopy() {
|
||||
final Trigger copy = new TriggerAttackerUnblocked(this.mapParams, this.getHostCard(), this.isIntrinsic());
|
||||
if (this.getOverridingAbility() != null) {
|
||||
copy.setOverridingAbility(this.getOverridingAbility());
|
||||
}
|
||||
|
||||
copyFieldsTo(copy);
|
||||
return copy;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final void setTriggeringObjects(final SpellAbility sa) {
|
||||
|
||||
@@ -62,19 +62,6 @@ public class TriggerAttackersDeclared extends Trigger {
|
||||
return true;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final Trigger getCopy() {
|
||||
final Trigger copy = new TriggerAttackersDeclared(this.mapParams, this.getHostCard(), this.isIntrinsic());
|
||||
|
||||
if (this.getOverridingAbility() != null) {
|
||||
copy.setOverridingAbility(this.getOverridingAbility());
|
||||
}
|
||||
|
||||
copyFieldsTo(copy);
|
||||
return copy;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final void setTriggeringObjects(final SpellAbility sa) {
|
||||
|
||||
@@ -95,18 +95,6 @@ public class TriggerAttacks extends Trigger {
|
||||
return true;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final Trigger getCopy() {
|
||||
final Trigger copy = new TriggerAttacks(this.mapParams, this.getHostCard(), this.isIntrinsic());
|
||||
if (this.getOverridingAbility() != null) {
|
||||
copy.setOverridingAbility(this.getOverridingAbility());
|
||||
}
|
||||
|
||||
copyFieldsTo(copy);
|
||||
return copy;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final void setTriggeringObjects(final SpellAbility sa) {
|
||||
|
||||
@@ -80,18 +80,6 @@ public class TriggerBecomesTarget extends Trigger {
|
||||
return true;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final Trigger getCopy() {
|
||||
final Trigger copy = new TriggerBecomesTarget(this.mapParams, this.getHostCard(), this.isIntrinsic());
|
||||
if (this.getOverridingAbility() != null) {
|
||||
copy.setOverridingAbility(this.getOverridingAbility());
|
||||
}
|
||||
|
||||
copyFieldsTo(copy);
|
||||
return copy;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final void setTriggeringObjects(final SpellAbility sa) {
|
||||
|
||||
@@ -67,18 +67,6 @@ public class TriggerBlocks extends Trigger {
|
||||
return true;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final Trigger getCopy() {
|
||||
final Trigger copy = new TriggerBlocks(this.mapParams, this.getHostCard(), this.isIntrinsic());
|
||||
if (this.getOverridingAbility() != null) {
|
||||
copy.setOverridingAbility(this.getOverridingAbility());
|
||||
}
|
||||
|
||||
copyFieldsTo(copy);
|
||||
return copy;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final void setTriggeringObjects(final SpellAbility sa) {
|
||||
|
||||
@@ -62,18 +62,6 @@ public class TriggerChampioned extends Trigger {
|
||||
return true;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final Trigger getCopy() {
|
||||
final Trigger copy = new TriggerChampioned(this.mapParams, this.getHostCard(), this.isIntrinsic());
|
||||
if (this.getOverridingAbility() != null) {
|
||||
copy.setOverridingAbility(this.getOverridingAbility());
|
||||
}
|
||||
|
||||
copyFieldsTo(copy);
|
||||
return copy;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final void setTriggeringObjects(final SpellAbility sa) {
|
||||
|
||||
@@ -61,18 +61,6 @@ public class TriggerChangesController extends Trigger {
|
||||
return true;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final Trigger getCopy() {
|
||||
final Trigger copy = new TriggerChangesZone(this.mapParams, this.getHostCard(), this.isIntrinsic());
|
||||
if (this.getOverridingAbility() != null) {
|
||||
copy.setOverridingAbility(this.getOverridingAbility());
|
||||
}
|
||||
|
||||
copyFieldsTo(copy);
|
||||
return copy;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final void setTriggeringObjects(final SpellAbility sa) {
|
||||
|
||||
@@ -98,18 +98,6 @@ public class TriggerChangesZone extends Trigger {
|
||||
return true;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final Trigger getCopy() {
|
||||
final Trigger copy = new TriggerChangesZone(this.mapParams, this.getHostCard(), this.isIntrinsic());
|
||||
if (this.getOverridingAbility() != null) {
|
||||
copy.setOverridingAbility(this.getOverridingAbility());
|
||||
}
|
||||
|
||||
copyFieldsTo(copy);
|
||||
return copy;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final void setTriggeringObjects(final SpellAbility sa) {
|
||||
|
||||
@@ -67,18 +67,6 @@ public class TriggerClashed extends Trigger {
|
||||
return true;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final Trigger getCopy() {
|
||||
final Trigger copy = new TriggerClashed(this.mapParams, this.getHostCard(), this.isIntrinsic());
|
||||
if (this.getOverridingAbility() != null) {
|
||||
copy.setOverridingAbility(this.getOverridingAbility());
|
||||
}
|
||||
|
||||
copyFieldsTo(copy);
|
||||
return copy;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public void setTriggeringObjects(final SpellAbility sa) {
|
||||
|
||||
@@ -77,18 +77,6 @@ public class TriggerCombatDamageDoneOnce extends Trigger {
|
||||
return true;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final Trigger getCopy() {
|
||||
final Trigger copy = new TriggerCombatDamageDoneOnce(this.mapParams, this.getHostCard(), this.isIntrinsic());
|
||||
if (this.getOverridingAbility() != null) {
|
||||
copy.setOverridingAbility(this.getOverridingAbility());
|
||||
}
|
||||
|
||||
copyFieldsTo(copy);
|
||||
return copy;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final void setTriggeringObjects(final SpellAbility sa) {
|
||||
|
||||
@@ -70,18 +70,6 @@ public class TriggerCounterAdded extends Trigger {
|
||||
return true;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final Trigger getCopy() {
|
||||
final Trigger copy = new TriggerCounterAdded(this.mapParams, this.getHostCard(), this.isIntrinsic());
|
||||
if (this.getOverridingAbility() != null) {
|
||||
copy.setOverridingAbility(this.getOverridingAbility());
|
||||
}
|
||||
|
||||
copyFieldsTo(copy);
|
||||
return copy;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final void setTriggeringObjects(final SpellAbility sa) {
|
||||
|
||||
@@ -70,18 +70,6 @@ public class TriggerCounterRemoved extends Trigger {
|
||||
return true;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final Trigger getCopy() {
|
||||
final Trigger copy = new TriggerCounterRemoved(this.mapParams, this.getHostCard(), this.isIntrinsic());
|
||||
if (this.getOverridingAbility() != null) {
|
||||
copy.setOverridingAbility(this.getOverridingAbility());
|
||||
}
|
||||
|
||||
copyFieldsTo(copy);
|
||||
return copy;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final void setTriggeringObjects(final SpellAbility sa) {
|
||||
|
||||
@@ -75,18 +75,6 @@ public class TriggerCountered extends Trigger {
|
||||
return true;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final Trigger getCopy() {
|
||||
final Trigger copy = new TriggerCountered(this.mapParams, this.getHostCard(), this.isIntrinsic());
|
||||
if (this.getOverridingAbility() != null) {
|
||||
copy.setOverridingAbility(this.getOverridingAbility());
|
||||
}
|
||||
|
||||
copyFieldsTo(copy);
|
||||
return copy;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final void setTriggeringObjects(final SpellAbility sa) {
|
||||
|
||||
@@ -46,18 +46,6 @@ public class TriggerCycled extends Trigger {
|
||||
super(params, host, intrinsic);
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final Trigger getCopy() {
|
||||
final Trigger copy = new TriggerCycled(this.mapParams, this.getHostCard(), this.isIntrinsic());
|
||||
if (this.getOverridingAbility() != null) {
|
||||
copy.setOverridingAbility(this.getOverridingAbility());
|
||||
}
|
||||
|
||||
copyFieldsTo(copy);
|
||||
return copy;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final void setTriggeringObjects(final SpellAbility sa) {
|
||||
|
||||
@@ -98,18 +98,6 @@ public class TriggerDamageDone extends Trigger {
|
||||
return true;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final Trigger getCopy() {
|
||||
final Trigger copy = new TriggerDamageDone(this.mapParams, this.getHostCard(), this.isIntrinsic());
|
||||
if (this.getOverridingAbility() != null) {
|
||||
copy.setOverridingAbility(this.getOverridingAbility());
|
||||
}
|
||||
|
||||
copyFieldsTo(copy);
|
||||
return copy;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final void setTriggeringObjects(final SpellAbility sa) {
|
||||
|
||||
@@ -64,18 +64,6 @@ public class TriggerDestroyed extends Trigger {
|
||||
return true;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final Trigger getCopy() {
|
||||
final Trigger copy = new TriggerDestroyed(this.mapParams, this.getHostCard(), this.isIntrinsic());
|
||||
if (this.getOverridingAbility() != null) {
|
||||
copy.setOverridingAbility(this.getOverridingAbility());
|
||||
}
|
||||
|
||||
copyFieldsTo(copy);
|
||||
return copy;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final void setTriggeringObjects(final SpellAbility sa) {
|
||||
|
||||
@@ -59,18 +59,6 @@ public class TriggerDevoured extends Trigger {
|
||||
return true;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final Trigger getCopy() {
|
||||
final Trigger copy = new TriggerDevoured(this.mapParams, this.getHostCard(), this.isIntrinsic());
|
||||
if (this.getOverridingAbility() != null) {
|
||||
copy.setOverridingAbility(this.getOverridingAbility());
|
||||
}
|
||||
|
||||
copyFieldsTo(copy);
|
||||
return copy;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final void setTriggeringObjects(final SpellAbility sa) {
|
||||
|
||||
@@ -75,17 +75,6 @@ public class TriggerDiscarded extends Trigger {
|
||||
return true;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final Trigger getCopy() {
|
||||
final Trigger copy = new TriggerDiscarded(this.mapParams, this.getHostCard(), this.isIntrinsic());
|
||||
if (this.getOverridingAbility() != null) {
|
||||
copy.setOverridingAbility(this.getOverridingAbility());
|
||||
}
|
||||
|
||||
copyFieldsTo(copy);
|
||||
return copy;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
|
||||
@@ -67,18 +67,6 @@ public class TriggerDrawn extends Trigger {
|
||||
return true;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final Trigger getCopy() {
|
||||
final Trigger copy = new TriggerDrawn(this.mapParams, this.getHostCard(), this.isIntrinsic());
|
||||
if (this.getOverridingAbility() != null) {
|
||||
copy.setOverridingAbility(this.getOverridingAbility());
|
||||
}
|
||||
|
||||
copyFieldsTo(copy);
|
||||
return copy;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final void setTriggeringObjects(final SpellAbility sa) {
|
||||
|
||||
@@ -59,18 +59,6 @@ public class TriggerEvolved extends Trigger {
|
||||
return true;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final Trigger getCopy() {
|
||||
final Trigger copy = new TriggerEvolved(this.mapParams, this.getHostCard(), this.isIntrinsic());
|
||||
if (this.getOverridingAbility() != null) {
|
||||
copy.setOverridingAbility(this.getOverridingAbility());
|
||||
}
|
||||
|
||||
copyFieldsTo(copy);
|
||||
return copy;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final void setTriggeringObjects(final SpellAbility sa) {
|
||||
|
||||
@@ -66,18 +66,6 @@ public class TriggerFlipped extends Trigger {
|
||||
return true;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final Trigger getCopy() {
|
||||
final Trigger copy = new TriggerFlipped(this.mapParams, this.getHostCard(), this.isIntrinsic());
|
||||
if (this.getOverridingAbility() != null) {
|
||||
copy.setOverridingAbility(this.getOverridingAbility());
|
||||
}
|
||||
|
||||
copyFieldsTo(copy);
|
||||
return copy;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final void setTriggeringObjects(final SpellAbility sa) {
|
||||
|
||||
@@ -32,25 +32,6 @@ import forge.card.spellability.SpellAbility;
|
||||
*/
|
||||
public class TriggerLandPlayed extends Trigger {
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Constructor for Trigger_LandPlayed.
|
||||
* </p>
|
||||
*
|
||||
* @param n
|
||||
* a {@link java.lang.String} object.
|
||||
* @param params
|
||||
* a {@link java.util.HashMap} object.
|
||||
* @param host
|
||||
* a {@link forge.Card} object.
|
||||
* @param intrinsic
|
||||
* the intrinsic
|
||||
*/
|
||||
public TriggerLandPlayed(final String n, final java.util.Map<String, String> params, final Card host,
|
||||
final boolean intrinsic) {
|
||||
super(n, params, host, intrinsic);
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Constructor for Trigger_LandPlayed.
|
||||
@@ -67,20 +48,6 @@ public class TriggerLandPlayed extends Trigger {
|
||||
super(params, host, intrinsic);
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final Trigger getCopy() {
|
||||
final Trigger copy = new TriggerLandPlayed(this.getName(), this.mapParams, this.getHostCard(),
|
||||
this.isIntrinsic());
|
||||
|
||||
if (this.getOverridingAbility() != null) {
|
||||
copy.setOverridingAbility(this.getOverridingAbility());
|
||||
}
|
||||
|
||||
copyFieldsTo(copy);
|
||||
return copy;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final void setTriggeringObjects(final SpellAbility sa) {
|
||||
|
||||
@@ -59,17 +59,6 @@ public class TriggerLifeGained extends Trigger {
|
||||
return true;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final Trigger getCopy() {
|
||||
final Trigger copy = new TriggerLifeGained(this.mapParams, this.getHostCard(), this.isIntrinsic());
|
||||
if (this.getOverridingAbility() != null) {
|
||||
copy.setOverridingAbility(this.getOverridingAbility());
|
||||
}
|
||||
|
||||
copyFieldsTo(copy);
|
||||
return copy;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
|
||||
@@ -59,18 +59,6 @@ public class TriggerLifeLost extends Trigger {
|
||||
return true;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final Trigger getCopy() {
|
||||
final Trigger copy = new TriggerLifeLost(this.mapParams, this.getHostCard(), this.isIntrinsic());
|
||||
if (this.getOverridingAbility() != null) {
|
||||
copy.setOverridingAbility(this.getOverridingAbility());
|
||||
}
|
||||
|
||||
copyFieldsTo(copy);
|
||||
return copy;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final void setTriggeringObjects(final SpellAbility sa) {
|
||||
|
||||
@@ -37,18 +37,6 @@ public class TriggerLosesGame extends Trigger {
|
||||
return true;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final Trigger getCopy() {
|
||||
final Trigger copy = new TriggerLosesGame(this.mapParams, this.getHostCard(), this.isIntrinsic());
|
||||
if (this.getOverridingAbility() != null) {
|
||||
copy.setOverridingAbility(this.getOverridingAbility());
|
||||
}
|
||||
|
||||
copyFieldsTo(copy);
|
||||
return copy;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final void setTriggeringObjects(final SpellAbility sa) {
|
||||
|
||||
@@ -52,18 +52,6 @@ public class TriggerNewGame extends Trigger {
|
||||
return true;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final Trigger getCopy() {
|
||||
final Trigger copy = new TriggerNewGame(this.mapParams, this.getHostCard(), this.isIntrinsic());
|
||||
if (this.getOverridingAbility() != null) {
|
||||
copy.setOverridingAbility(this.getOverridingAbility());
|
||||
}
|
||||
|
||||
copyFieldsTo(copy);
|
||||
return copy;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final void setTriggeringObjects(final SpellAbility sa) {
|
||||
|
||||
@@ -58,18 +58,6 @@ public class TriggerPhase extends Trigger {
|
||||
return true;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final Trigger getCopy() {
|
||||
final Trigger copy = new TriggerPhase(this.mapParams, this.getHostCard(), this.isIntrinsic());
|
||||
if (this.getOverridingAbility() != null) {
|
||||
copy.setOverridingAbility(this.getOverridingAbility());
|
||||
}
|
||||
|
||||
copyFieldsTo(copy);
|
||||
return copy;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final void setTriggeringObjects(final SpellAbility sa) {
|
||||
|
||||
@@ -50,20 +50,6 @@ public class TriggerPlanarDice extends Trigger {
|
||||
return true;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see forge.card.trigger.Trigger#getCopy()
|
||||
*/
|
||||
@Override
|
||||
public Trigger getCopy() {
|
||||
final Trigger copy = new TriggerPlanarDice(this.mapParams, this.getHostCard(), this.isIntrinsic());
|
||||
if (this.getOverridingAbility() != null) {
|
||||
copy.setOverridingAbility(this.getOverridingAbility());
|
||||
}
|
||||
|
||||
copyFieldsTo(copy);
|
||||
return copy;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see forge.card.trigger.Trigger#setTriggeringObjects(forge.card.spellability.SpellAbility)
|
||||
*/
|
||||
|
||||
@@ -47,19 +47,6 @@ public class TriggerPlaneswalkedFrom extends Trigger {
|
||||
return true;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see forge.card.trigger.Trigger#getCopy()
|
||||
*/
|
||||
@Override
|
||||
public Trigger getCopy() {
|
||||
final Trigger copy = new TriggerPlaneswalkedFrom(this.mapParams, this.getHostCard(), this.isIntrinsic());
|
||||
if (this.getOverridingAbility() != null) {
|
||||
copy.setOverridingAbility(this.getOverridingAbility());
|
||||
}
|
||||
|
||||
copyFieldsTo(copy);
|
||||
return copy;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see forge.card.trigger.Trigger#setTriggeringObjects(forge.card.spellability.SpellAbility)
|
||||
|
||||
@@ -47,20 +47,6 @@ public class TriggerPlaneswalkedTo extends Trigger {
|
||||
return true;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see forge.card.trigger.Trigger#getCopy()
|
||||
*/
|
||||
@Override
|
||||
public Trigger getCopy() {
|
||||
final Trigger copy = new TriggerPlaneswalkedTo(this.mapParams, this.getHostCard(), this.isIntrinsic());
|
||||
if (this.getOverridingAbility() != null) {
|
||||
copy.setOverridingAbility(this.getOverridingAbility());
|
||||
}
|
||||
|
||||
copyFieldsTo(copy);
|
||||
return copy;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see forge.card.trigger.Trigger#setTriggeringObjects(forge.card.spellability.SpellAbility)
|
||||
*/
|
||||
|
||||
@@ -65,17 +65,6 @@ public class TriggerSacrificed extends Trigger {
|
||||
return true;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final Trigger getCopy() {
|
||||
final Trigger copy = new TriggerSacrificed(this.mapParams, this.getHostCard(), this.isIntrinsic());
|
||||
if (this.getOverridingAbility() != null) {
|
||||
copy.setOverridingAbility(this.getOverridingAbility());
|
||||
}
|
||||
|
||||
copyFieldsTo(copy);
|
||||
return copy;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
|
||||
@@ -59,17 +59,6 @@ public class TriggerSetInMotion extends Trigger {
|
||||
return true;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final Trigger getCopy() {
|
||||
final Trigger copy = new TriggerSetInMotion(this.mapParams, this.getHostCard(), this.isIntrinsic());
|
||||
if (this.getOverridingAbility() != null) {
|
||||
copy.setOverridingAbility(this.getOverridingAbility());
|
||||
}
|
||||
|
||||
copyFieldsTo(copy);
|
||||
return copy;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
|
||||
@@ -59,17 +59,6 @@ public class TriggerShuffled extends Trigger {
|
||||
return true;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final Trigger getCopy() {
|
||||
final Trigger copy = new TriggerShuffled(this.mapParams, this.getHostCard(), this.isIntrinsic());
|
||||
if (this.getOverridingAbility() != null) {
|
||||
copy.setOverridingAbility(this.getOverridingAbility());
|
||||
}
|
||||
|
||||
copyFieldsTo(copy);
|
||||
return copy;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
|
||||
@@ -185,18 +185,6 @@ public class TriggerSpellAbilityCast extends Trigger {
|
||||
return true;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final Trigger getCopy() {
|
||||
final Trigger copy = new TriggerSpellAbilityCast(this.mapParams, this.getHostCard(), this.isIntrinsic());
|
||||
if (this.getOverridingAbility() != null) {
|
||||
copy.setOverridingAbility(this.getOverridingAbility());
|
||||
}
|
||||
|
||||
copyFieldsTo(copy);
|
||||
return copy;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final void setTriggeringObjects(final SpellAbility sa) {
|
||||
|
||||
@@ -63,17 +63,6 @@ public class TriggerTaps extends Trigger {
|
||||
return true;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final Trigger getCopy() {
|
||||
final Trigger copy = new TriggerTaps(this.mapParams, this.getHostCard(), this.isIntrinsic());
|
||||
if (this.getOverridingAbility() != null) {
|
||||
copy.setOverridingAbility(this.getOverridingAbility());
|
||||
}
|
||||
|
||||
copyFieldsTo(copy);
|
||||
return copy;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
|
||||
@@ -61,17 +61,6 @@ public class TriggerTapsForMana extends Trigger {
|
||||
return true;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final Trigger getCopy() {
|
||||
final Trigger copy = new TriggerTapsForMana(this.mapParams, this.getHostCard(), this.isIntrinsic());
|
||||
if (this.getOverridingAbility() != null) {
|
||||
copy.setOverridingAbility(this.getOverridingAbility());
|
||||
}
|
||||
|
||||
copyFieldsTo(copy);
|
||||
return copy;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
|
||||
@@ -54,20 +54,6 @@ public class TriggerTransformed extends Trigger {
|
||||
return true;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see forge.card.trigger.Trigger#getCopy()
|
||||
*/
|
||||
@Override
|
||||
public final Trigger getCopy() {
|
||||
final Trigger copy = new TriggerTransformed(this.mapParams, this.getHostCard(), this.isIntrinsic());
|
||||
|
||||
if (this.getOverridingAbility() != null) {
|
||||
copy.setOverridingAbility(this.getOverridingAbility());
|
||||
}
|
||||
|
||||
copyFieldsTo(copy);
|
||||
return copy;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see forge.card.trigger.Trigger#setTriggeringObjects(forge.card.spellability.SpellAbility)
|
||||
|
||||
@@ -59,18 +59,6 @@ public class TriggerTurnFaceUp extends Trigger {
|
||||
return true;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final Trigger getCopy() {
|
||||
final Trigger copy = new TriggerTurnFaceUp(this.mapParams, this.getHostCard(), this.isIntrinsic());
|
||||
if (this.getOverridingAbility() != null) {
|
||||
copy.setOverridingAbility(this.getOverridingAbility());
|
||||
}
|
||||
|
||||
copyFieldsTo(copy);
|
||||
return copy;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final void setTriggeringObjects(final SpellAbility sa) {
|
||||
|
||||
@@ -81,6 +81,16 @@ public enum TriggerType {
|
||||
|
||||
throw new RuntimeException("Element " + value + " not found in TriggerType enum");
|
||||
}
|
||||
|
||||
public static TriggerType getTypeFor(Trigger t) {
|
||||
final Class<? extends Trigger> cls = t.getClass();
|
||||
for (final TriggerType v : TriggerType.values()) {
|
||||
if (v.classTrigger.equals(cls)) {
|
||||
return v;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO: Write javadoc for this method.
|
||||
|
||||
@@ -69,18 +69,6 @@ public class TriggerUnequip extends Trigger {
|
||||
return true;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final Trigger getCopy() {
|
||||
final Trigger copy = new TriggerUnequip(this.mapParams, this.getHostCard(), this.isIntrinsic());
|
||||
if (this.getOverridingAbility() != null) {
|
||||
copy.setOverridingAbility(this.getOverridingAbility());
|
||||
}
|
||||
|
||||
copyFieldsTo(copy);
|
||||
return copy;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final void setTriggeringObjects(final SpellAbility sa) {
|
||||
|
||||
@@ -63,18 +63,6 @@ public class TriggerUntaps extends Trigger {
|
||||
return true;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final Trigger getCopy() {
|
||||
final Trigger copy = new TriggerUntaps(this.mapParams, this.getHostCard(), this.isIntrinsic());
|
||||
if (this.getOverridingAbility() != null) {
|
||||
copy.setOverridingAbility(this.getOverridingAbility());
|
||||
}
|
||||
|
||||
copyFieldsTo(copy);
|
||||
return copy;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final void setTriggeringObjects(final SpellAbility sa) {
|
||||
|
||||
Reference in New Issue
Block a user