mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 04:08:01 +00:00
Update TriggerLifeGained: better format
This commit is contained in:
@@ -20,13 +20,14 @@ package forge.game.trigger;
|
|||||||
import forge.game.card.Card;
|
import forge.game.card.Card;
|
||||||
import forge.game.spellability.SpellAbility;
|
import forge.game.spellability.SpellAbility;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* Trigger_LifeGained class.
|
* Trigger_LifeGained class.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @author Forge
|
* @author Forge
|
||||||
* @version $Id$
|
|
||||||
*/
|
*/
|
||||||
public class TriggerLifeGained extends Trigger {
|
public class TriggerLifeGained extends Trigger {
|
||||||
|
|
||||||
@@ -36,32 +37,30 @@ public class TriggerLifeGained extends Trigger {
|
|||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @param params
|
* @param params
|
||||||
* a {@link java.util.HashMap} object.
|
* a {@link java.util.Map} object.
|
||||||
* @param host
|
* @param host
|
||||||
* a {@link forge.game.card.Card} object.
|
* a {@link forge.game.card.Card} object.
|
||||||
* @param intrinsic
|
* @param intrinsic
|
||||||
* the intrinsic
|
* the intrinsic
|
||||||
*/
|
*/
|
||||||
public TriggerLifeGained(final java.util.Map<String, String> params, final Card host, final boolean intrinsic) {
|
public TriggerLifeGained(final Map<String, String> params, final Card host, final boolean intrinsic) {
|
||||||
super(params, host, intrinsic);
|
super(params, host, intrinsic);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@Override
|
@Override
|
||||||
public final boolean performTest(final java.util.Map<String, Object> runParams2) {
|
public final boolean performTest(final Map<String, Object> runParams2) {
|
||||||
if (this.mapParams.containsKey("ValidPlayer")) {
|
if (hasParam("ValidPlayer")) {
|
||||||
if (!matchesValid(runParams2.get("Player"), this.mapParams.get("ValidPlayer").split(","),
|
if (!matchesValid(runParams2.get("Player"), getParam("ValidPlayer").split(","), getHostCard())) {
|
||||||
this.getHostCard())) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (this.mapParams.containsKey("ValidSource")) {
|
if (hasParam("ValidSource")) {
|
||||||
if (!matchesValid(runParams2.get("Source"), this.mapParams.get("ValidSource").split(","),
|
if (!matchesValid(runParams2.get("Source"), getParam("ValidSource").split(","), getHostCard())) {
|
||||||
this.getHostCard())) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (this.mapParams.containsKey("Spell")) {
|
if (hasParam("Spell")) {
|
||||||
final SpellAbility spellAbility = (SpellAbility) runParams2.get("SourceSA");
|
final SpellAbility spellAbility = (SpellAbility) runParams2.get("SourceSA");
|
||||||
if (spellAbility == null || !spellAbility.getRootAbility().isSpell()) {
|
if (spellAbility == null || !spellAbility.getRootAbility().isSpell()) {
|
||||||
return false;
|
return false;
|
||||||
@@ -71,12 +70,11 @@ public class TriggerLifeGained extends Trigger {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@Override
|
@Override
|
||||||
public final void setTriggeringObjects(final SpellAbility sa) {
|
public final void setTriggeringObjects(final SpellAbility sa) {
|
||||||
sa.setTriggeringObject("LifeAmount", this.getRunParams().get("LifeAmount"));
|
sa.setTriggeringObject("LifeAmount", getRunParams().get("LifeAmount"));
|
||||||
sa.setTriggeringObject("Player", this.getRunParams().get("Player"));
|
sa.setTriggeringObject("Player", getRunParams().get("Player"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user