mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-15 18:28:00 +00:00
TriggerBecomesCrewed: new Trigger for NEO Mechs
This commit is contained in:
@@ -184,6 +184,10 @@ public class AnimateEffect extends AnimateEffectBase {
|
||||
c.addImprintedCards(AbilityUtils.getDefinedCards(source, animateImprinted, sa));
|
||||
}
|
||||
|
||||
if (sa.hasParam("Crew")) {
|
||||
c.becomesCrewed(sa);
|
||||
}
|
||||
|
||||
game.fireEvent(new GameEventCardStatsChanged(c));
|
||||
}
|
||||
|
||||
|
||||
@@ -5625,7 +5625,7 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
|
||||
foretoldThisTurn = false;
|
||||
}
|
||||
|
||||
public int timesCrewedThisTurn() {
|
||||
public int getTimesCrewedThisTurn() {
|
||||
return timesCrewedThisTurn;
|
||||
}
|
||||
|
||||
@@ -5637,6 +5637,14 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
|
||||
timesCrewedThisTurn = 0;
|
||||
}
|
||||
|
||||
public void becomesCrewed(SpellAbility sa) {
|
||||
timesCrewedThisTurn += 1;
|
||||
Map<AbilityKey, Object> runParams = AbilityKey.newMap();
|
||||
runParams.put(AbilityKey.Vehicle, this);
|
||||
runParams.put(AbilityKey.Crew, sa.getPaidList("TappedCards"));
|
||||
game.getTriggerHandler().runTrigger(TriggerType.BecomesCrewed, runParams, false);
|
||||
}
|
||||
|
||||
public final int getClassLevel() {
|
||||
return classLevel;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
package forge.game.trigger;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import forge.game.ability.AbilityKey;
|
||||
import forge.game.card.Card;
|
||||
import forge.game.spellability.SpellAbility;
|
||||
import forge.util.Localizer;
|
||||
|
||||
public class TriggerBecomesCrewed extends Trigger {
|
||||
|
||||
public TriggerBecomesCrewed(final Map<String, String> params, final Card host, final boolean intrinsic) {
|
||||
super(params, host, intrinsic);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean performTest(Map<AbilityKey, Object> runParams) {
|
||||
if (!matchesValidParam("ValidVehicle", runParams.get(AbilityKey.Vehicle))) {
|
||||
return false;
|
||||
}
|
||||
if (!matchesValidParam("ValidCrew", runParams.get(AbilityKey.Crew))) {
|
||||
return false;
|
||||
}
|
||||
if (hasParam("FirstTimeCrewed")) {
|
||||
Card v = (Card) runParams.get(AbilityKey.Vehicle);
|
||||
if (v.getTimesCrewedThisTurn() != 1) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTriggeringObjects(SpellAbility sa, Map<AbilityKey, Object> runParams) {
|
||||
sa.setTriggeringObjectsFrom(runParams, AbilityKey.Vehicle, AbilityKey.Crew);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getImportantStackObjects(SpellAbility sa) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(Localizer.getInstance().getMessage("lblVehicle")).append(": ").append(sa.getTriggeringObject(AbilityKey.Vehicle));
|
||||
sb.append(" ");
|
||||
sb.append(Localizer.getInstance().getMessage("lblCrew")).append(": ").append(sa.getTriggeringObject(AbilityKey.Crew));
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
@@ -21,12 +21,6 @@ public class TriggerCrewed extends Trigger {
|
||||
if (!matchesValidParam("ValidCrew", runParams.get(AbilityKey.Crew))) {
|
||||
return false;
|
||||
}
|
||||
if (hasParam("FirstTimeCrewed")) {
|
||||
Card v = (Card) runParams.get(AbilityKey.Vehicle);
|
||||
if (v.timesCrewedThisTurn() != 1) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -29,6 +29,7 @@ public enum TriggerType {
|
||||
BecomeMonarch(TriggerBecomeMonarch.class),
|
||||
BecomeMonstrous(TriggerBecomeMonstrous.class),
|
||||
BecomeRenowned(TriggerBecomeRenowned.class),
|
||||
BecomesCrewed(TriggerBecomesCrewed.class),
|
||||
BecomesTarget(TriggerBecomesTarget.class),
|
||||
BecomesTargetOnce(TriggerBecomesTargetOnce.class),
|
||||
BlockersDeclared(TriggerBlockersDeclared.class),
|
||||
|
||||
@@ -334,7 +334,6 @@ public class MagicStack /* extends MyObservable */ implements Iterable<SpellAbil
|
||||
|
||||
if (sp.hasParam("Crew")) {
|
||||
// Trigger crews!
|
||||
sp.getHostCard().setTimesCrewedThisTurn(sp.getHostCard().timesCrewedThisTurn() + 1);
|
||||
runParams.put(AbilityKey.Vehicle, sp.getHostCard());
|
||||
runParams.put(AbilityKey.Crew, sp.getPaidList("TappedCards"));
|
||||
game.getTriggerHandler().runTrigger(TriggerType.Crewed, runParams, false);
|
||||
|
||||
@@ -3,7 +3,7 @@ ManaCost:2 U
|
||||
Types:Artifact Vehicle
|
||||
PT:4/3
|
||||
K:Flying
|
||||
T:Mode$ Crewed | ValidVehicle$ Card.Self | FirstTimeCrewed$ True | Execute$ TrigClone | TriggerDescription$ Whenever CARDNAME becomes crewed for the first time each turn, until end of turn, CARDNAME becomes a copy of target nonlegendary creature that crewed it this turn, except it's 4/3, it's a Vehicle artifact in addition to its other types, and it has flying.
|
||||
T:Mode$ BecomesCrewed | ValidVehicle$ Card.Self | FirstTimeCrewed$ True | Execute$ TrigClone | TriggerDescription$ Whenever CARDNAME becomes crewed for the first time each turn, until end of turn, CARDNAME becomes a copy of target nonlegendary creature that crewed it this turn, except it's 4/3, it's a Vehicle artifact in addition to its other types, and it has flying.
|
||||
SVar:TrigClone:DB$ Clone | ValidTgts$ Creature.TriggeredCrew+nonLegendary | TgtPrompt$ Select target nonlegendary creature that crewed it this turn | Duration$ UntilEndOfTurn | SetPower$ 4 | SetToughness$ 3 | AddTypes$ Vehicle & Artifact | AddKeywords$ Flying
|
||||
K:Crew:1
|
||||
Oracle:Flying\nWhenever Mindlink Mech becomes crewed for the first time each turn, until end of turn, Mindlink Mech becomes a copy of target nonlegendary creature that crewed it this turn, except it's 4/3, it's a Vehicle artifact in addition to its other types, and it has flying.\nCrew 1
|
||||
|
||||
@@ -3,7 +3,7 @@ ManaCost:1 U
|
||||
Types:Artifact Vehicle
|
||||
PT:3/4
|
||||
K:Flying
|
||||
T:Mode$ Crewed | ValidVehicle$ Card.Self | Execute$ TrigAnimate | TriggerDescription$ Whenever CARDNAME becomes crewed, up to one other target Vehicle you control becomes an artifact creature until end of turn.
|
||||
T:Mode$ BecomesCrewed | ValidVehicle$ Card.Self | Execute$ TrigAnimate | TriggerDescription$ Whenever CARDNAME becomes crewed, up to one other target Vehicle you control becomes an artifact creature until end of turn.
|
||||
SVar:TrigAnimate:DB$ Animate | ValidTgts$ Vehicle.YouCtrl+Other | TgtPrompt$ Select up to one other target Vehicle you control | TargetMin$ 0 | TargetMax$ 1 | Types$ Creature,Artifact
|
||||
K:Crew:3
|
||||
Oracle:Flying
|
||||
|
||||
Reference in New Issue
Block a user