mirror of
https://github.com/correl/mage.git
synced 2024-12-26 11:09:27 +00:00
[NEO] updated vehicle crewed trigger to trigger on resolution rather than cost paid
This commit is contained in:
parent
9c7813490a
commit
5ba82fa698
2 changed files with 33 additions and 5 deletions
|
@ -1,7 +1,6 @@
|
|||
|
||||
package mage.cards.h;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
|
@ -23,6 +22,8 @@ import mage.game.permanent.Permanent;
|
|||
import mage.target.Target;
|
||||
import mage.target.common.TargetControlledPermanent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author JRHerlehy
|
||||
*/
|
||||
|
@ -100,7 +101,6 @@ class HeartOfKiranAlternateCrewCost extends CostImpl {
|
|||
if (paid) {
|
||||
game.fireEvent(GameEvent.getEvent(GameEvent.EventType.CREWED_VEHICLE, target.getFirstTarget(), source, controllerId));
|
||||
}
|
||||
game.fireEvent(GameEvent.getEvent(GameEvent.EventType.VEHICLE_CREWED, source.getSourceId(), source, controllerId));
|
||||
}
|
||||
|
||||
return paid;
|
||||
|
|
|
@ -6,6 +6,7 @@ import mage.abilities.common.CrewWithToughnessAbility;
|
|||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.costs.CostImpl;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.continuous.AddCardTypeSourceEffect;
|
||||
import mage.abilities.hint.HintUtils;
|
||||
import mage.abilities.icon.abilities.CrewAbilityIcon;
|
||||
|
@ -34,8 +35,8 @@ public class CrewAbility extends SimpleActivatedAbility {
|
|||
private final int value;
|
||||
|
||||
public CrewAbility(int value) {
|
||||
super(Zone.BATTLEFIELD, new AddCardTypeSourceEffect(Duration.EndOfTurn, CardType.ARTIFACT), new CrewCost(value));
|
||||
this.addEffect(new AddCardTypeSourceEffect(Duration.EndOfTurn, CardType.ARTIFACT, CardType.CREATURE));
|
||||
super(Zone.BATTLEFIELD, new AddCardTypeSourceEffect(Duration.EndOfTurn, CardType.ARTIFACT, CardType.CREATURE), new CrewCost(value));
|
||||
this.addEffect(new CrewEventEffect());
|
||||
this.addIcon(CrewAbilityIcon.instance);
|
||||
this.value = value;
|
||||
}
|
||||
|
@ -56,6 +57,34 @@ public class CrewAbility extends SimpleActivatedAbility {
|
|||
}
|
||||
}
|
||||
|
||||
class CrewEventEffect extends OneShotEffect {
|
||||
|
||||
CrewEventEffect() {
|
||||
super(Outcome.Benefit);
|
||||
}
|
||||
|
||||
private CrewEventEffect(final CrewEventEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CrewEventEffect copy() {
|
||||
return new CrewEventEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
if (source.getSourcePermanentIfItStillExists(game) != null) {
|
||||
game.fireEvent(GameEvent.getEvent(
|
||||
GameEvent.EventType.VEHICLE_CREWED,
|
||||
source.getSourceId(),
|
||||
source, source.getControllerId()
|
||||
));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
class CrewCost extends CostImpl {
|
||||
|
||||
private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("another untapped creature you control");
|
||||
|
@ -112,7 +141,6 @@ class CrewCost extends CostImpl {
|
|||
for (UUID targetId : target.getTargets()) {
|
||||
game.fireEvent(GameEvent.getEvent(GameEvent.EventType.CREWED_VEHICLE, targetId, source, controllerId));
|
||||
}
|
||||
game.fireEvent(GameEvent.getEvent(GameEvent.EventType.VEHICLE_CREWED, source.getSourceId(), source, controllerId));
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
|
|
Loading…
Reference in a new issue