DMU: Enlist mechanic
while doing so i probably touch Johan with:
attacking doesn’t cause creatures you control to tap this combat if Johan is untapped.
and turning this and Vigilance into a static Ability
Enlist represents an optional cost to attack.
Enlist also like Exert are Optional Cost and not Replacement effects like i wanted to code them :/
there is one card that triggers when you Enlist a creature Because this trigger happens when you pay the cost and not when you the effect resolves, it probably needs new Cost Type
@tool4ever the rules:
702.154. Enlist 702.154a Enlist represents a static ability and a triggered ability. Enlist means “As this creature attacks, you may tap up to one untapped creature you control that you didn’t choose to attack with and that either has haste or has been under your control continuously since this turn began. When you do, this creature gets +X/+0 until end of turn, where X is the tapped creature’s power.” 702.154b Enlist’s static ability represents an optional cost to attack (see rule 508.1g). Its triggered ability is linked to that static ability (see rule 607.2h). 702.154c A creature “enlists” another creature when you pay the cost of the creature’s enlist ability by tapping the other creature. Note that it isn’t possible for a creature to enlist itself. 702.154d Multiple instances of enlist on a single creature function independently. The triggered ability represented by each instance of enlist triggers only once and only for the cost associated with that enlist ability.
Rule 607.2h is the important one:
607.2h If an object has both a static ability and one or more triggered abilities printed on it in the same paragraph, each of those triggered abilities is linked to the static ability. Each triggered ability refers only to actions taken as a result of the static ability. See rule 603.11.
603.11. Some objects have a static ability that’s linked to one or more triggered abilities. (See rule 607, “Linked Abilities.”) These objects combine the abilities into one paragraph, with the static ability first, followed by each triggered ability that’s linked to it. A very few objects have triggered abilities which are written with the trigger condition in the middle of the ability, rather than at the beginning. Example: An ability that reads “Reveal the first card you draw each turn. Whenever you reveal a basic land card this way, draw a card” is a static ability linked to a triggered ability.
@tool4ever i meant to built trigger internal like this:
or even have the SpellAbility and or Trigger be built at time when the StaticAbility is parsed, so the Trigger is only built once
S:Mode$ CantAttackUnless | ValidCard$ Card.Self | Trigger$ TrigCanNotBlock | Cost$ Exert<1/CARDNAME> | Description$ You may exert CARDNAME as it attacks. When you do, target creature can't block this turn.
SVar:TrigCanNotBlock:DB$ Pump | ValidTgts$ Creature | KW$ HIDDEN CARDNAME can't block. | TgtPrompt$ Select target creature. | IsCurse$ True | SpellDescription$ When you do, target creature can't block this turn.
if (stAb.hasParam("Trigger")) {
SpellAbility trig = AbilityFactory.getAbility(stAb.getParam("Trigger"), stAb); // i don't know if that is the right order right now, but you know what i mean
cost.getCostParts().get(0).setTrigger(trig);
}
if (trigger != null) {
// build the trigger internal
Map<String, String> mapParams = Maps.newHashMap();
if (mapParams.containsKey("SpellDescription")) {
mapParams.put("TriggerDescription", trigger.getParam("SpellDescription"));
}
mapParams.put("Mode", TriggerType.Immediate.name());
final Trigger immediateTrig = TriggerHandler.parseTrigger(mapParams, host, sa.isIntrinsic(), null);
immediateTrig.setSpawningAbility(sa.copy(trigger.getHost, trigger.getActivatingPlayer(), true)); // make the StaticAbility the Spawning one?
immediateTrig.setOverridingAbility(trigger); // need to copy?
// Instead of registering this, add to the delayed triggers as an immediate trigger type? Which means it'll fire as soon as possible
game.getTriggerHandler().registerDelayedTrigger(immediateTrig);
}
Thanks, I'll try to update it later
I could open another PR for easier commenting if you want?
Thanks, I'll try to update it later
I could open another PR for easier commenting if you want?
yeah a new MR for Exert and/or Enlist would be nice so i can collect my thoughts together