mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 11:48:02 +00:00
trigger does not really need a name
This commit is contained in:
@@ -780,25 +780,6 @@ public class Card extends GameEntity implements Comparable<Card> {
|
|||||||
return this.getCharacteristics().getTriggers();
|
return this.getCharacteristics().getTriggers();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* getNamedTrigger.
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @param name
|
|
||||||
* a {@link java.lang.String} object.
|
|
||||||
* @return a {@link forge.card.trigger.Trigger} object.
|
|
||||||
*/
|
|
||||||
public final Trigger getNamedTrigger(final String name) {
|
|
||||||
for (final Trigger t : this.getCharacteristics().getTriggers()) {
|
|
||||||
if ((t.getName() != null) && t.getName().equals(name)) {
|
|
||||||
return t;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* Setter for the field <code>triggers</code>.
|
* Setter for the field <code>triggers</code>.
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ import forge.game.zone.ZoneType;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* Abstract Trigger class.
|
* Abstract Trigger class. Constructed by reflection only
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @author Forge
|
* @author Forge
|
||||||
@@ -58,32 +58,6 @@ public abstract class Trigger extends TriggerReplacementBase {
|
|||||||
/** The ID. */
|
/** The ID. */
|
||||||
private int id = Trigger.nextID++;
|
private int id = Trigger.nextID++;
|
||||||
|
|
||||||
/** The name. */
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* Getter for the field <code>name</code>.
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @return a {@link java.lang.String} object.
|
|
||||||
*/
|
|
||||||
public final String getName() {
|
|
||||||
return this.name;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* Setter for the field <code>name</code>.
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @param n
|
|
||||||
* a {@link java.lang.String} object.
|
|
||||||
*/
|
|
||||||
public final void setName(final String n) {
|
|
||||||
this.name = n;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* setID.
|
* setID.
|
||||||
@@ -143,33 +117,10 @@ public abstract class Trigger extends TriggerReplacementBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** The is intrinsic. */
|
/** The is intrinsic. */
|
||||||
private boolean isIntrinsic;
|
private final boolean intrinsic;
|
||||||
|
|
||||||
private List<PhaseType> validPhases;
|
private List<PhaseType> validPhases;
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* Constructor for Trigger.
|
|
||||||
* </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 Trigger(final String n, final Map<String, String> params, final Card host, final boolean intrinsic) {
|
|
||||||
this.name = n;
|
|
||||||
this.setRunParams(new HashMap<String, Object>());
|
|
||||||
this.mapParams.putAll(params);
|
|
||||||
this.setHostCard(host);
|
|
||||||
|
|
||||||
this.setIntrinsic(intrinsic);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* Constructor for Trigger.
|
* Constructor for Trigger.
|
||||||
@@ -187,7 +138,7 @@ public abstract class Trigger extends TriggerReplacementBase {
|
|||||||
this.mapParams.putAll(params);
|
this.mapParams.putAll(params);
|
||||||
this.setHostCard(host);
|
this.setHostCard(host);
|
||||||
|
|
||||||
this.setIntrinsic(intrinsic);
|
this.intrinsic = intrinsic;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -424,18 +375,9 @@ public abstract class Trigger extends TriggerReplacementBase {
|
|||||||
* @return the isIntrinsic
|
* @return the isIntrinsic
|
||||||
*/
|
*/
|
||||||
public boolean isIntrinsic() {
|
public boolean isIntrinsic() {
|
||||||
return this.isIntrinsic;
|
return this.intrinsic;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the intrinsic.
|
|
||||||
*
|
|
||||||
* @param isIntrinsic0
|
|
||||||
* the isIntrinsic to set
|
|
||||||
*/
|
|
||||||
public void setIntrinsic(final boolean isIntrinsic0) {
|
|
||||||
this.isIntrinsic = isIntrinsic0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the run params.
|
* Gets the run params.
|
||||||
@@ -518,13 +460,12 @@ public abstract class Trigger extends TriggerReplacementBase {
|
|||||||
|
|
||||||
public final Trigger getCopyForHostCard(Card newHost) {
|
public final Trigger getCopyForHostCard(Card newHost) {
|
||||||
TriggerType tt = TriggerType.getTypeFor(this);
|
TriggerType tt = TriggerType.getTypeFor(this);
|
||||||
Trigger copy = tt.createTrigger(mapParams, newHost, isIntrinsic);
|
Trigger copy = tt.createTrigger(mapParams, newHost, intrinsic);
|
||||||
|
|
||||||
if (this.getOverridingAbility() != null) {
|
if (this.getOverridingAbility() != null) {
|
||||||
copy.setOverridingAbility(this.getOverridingAbility());
|
copy.setOverridingAbility(this.getOverridingAbility());
|
||||||
}
|
}
|
||||||
|
|
||||||
copy.setName(this.getName());
|
|
||||||
copy.setID(this.getId());
|
copy.setID(this.getId());
|
||||||
copy.setMode(this.getMode());
|
copy.setMode(this.getMode());
|
||||||
copy.setTriggerPhases(this.validPhases);
|
copy.setTriggerPhases(this.validPhases);
|
||||||
|
|||||||
@@ -101,13 +101,6 @@ public class TriggerHandler {
|
|||||||
this.suppressedModes.remove(mode);
|
this.suppressedModes.remove(mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Trigger parseTrigger(final String name, final String trigParse, final Card host,
|
|
||||||
final boolean intrinsic) {
|
|
||||||
final Trigger ret = TriggerHandler.parseTrigger(trigParse, host, intrinsic);
|
|
||||||
ret.setName(name);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Trigger parseTrigger(final String trigParse, final Card host, final boolean intrinsic) {
|
public static Trigger parseTrigger(final String trigParse, final Card host, final boolean intrinsic) {
|
||||||
final HashMap<String, String> mapParams = TriggerHandler.parseParams(trigParse);
|
final HashMap<String, String> mapParams = TriggerHandler.parseParams(trigParse);
|
||||||
return TriggerHandler.parseTrigger(mapParams, host, intrinsic);
|
return TriggerHandler.parseTrigger(mapParams, host, intrinsic);
|
||||||
|
|||||||
Reference in New Issue
Block a user