* Mistbind Clique - Fixed that the tap ability was wrongly triggered as Mistbind Clique left the battlefield.

This commit is contained in:
LevelX2 2016-11-03 23:16:45 +01:00
parent a4e1c7aefd
commit 917d6500fa
3 changed files with 18 additions and 7 deletions

View file

@ -41,7 +41,7 @@ import mage.constants.Zone;
import mage.filter.common.FilterLandPermanent;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.ZoneChangeEvent;
import mage.game.permanent.Permanent;
import mage.target.TargetPlayer;
/**
@ -51,7 +51,7 @@ import mage.target.TargetPlayer;
public class MistbindClique extends CardImpl {
public MistbindClique(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{3}{U}");
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{U}");
this.subtype.add("Faerie");
this.subtype.add("Wizard");
@ -98,7 +98,7 @@ class MistbindCliqueAbility extends ZoneChangeTriggeredAbility {
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.ZONE_CHANGE;
return event.getType() == GameEvent.EventType.CREATURE_CHAMPIONED;
}
@Override
@ -106,8 +106,8 @@ class MistbindCliqueAbility extends ZoneChangeTriggeredAbility {
if (event.getSourceId() != null
&& event.getSourceId().equals(getSourceId())
&& !event.getSourceId().equals(event.getTargetId())) {
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
if (zEvent.getTarget() != null && zEvent.getTarget().hasSubtype("Faerie", game)) {
Permanent sacrificed = game.getPermanentOrLKIBattlefield(event.getTargetId());
if (sacrificed != null && sacrificed.hasSubtype("Faerie", game)) {
return true;
}
}

View file

@ -49,6 +49,7 @@ import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.filter.predicate.permanent.AnotherPredicate;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.common.TargetControlledPermanent;
@ -87,7 +88,8 @@ public class ChampionAbility extends StaticAbility {
* @param card
* @param subtypes subtypes to champion with, if empty all creatures can be
* used
* @param requiresCreature for cards that specifically require championing another creature
* @param requiresCreature for cards that specifically require championing
* another creature
*/
public ChampionAbility(Card card, String[] subtypes, boolean requiresCreature) {
super(Zone.BATTLEFIELD, null);
@ -121,7 +123,7 @@ public class ChampionAbility extends StaticAbility {
// When this permanent enters the battlefield, sacrifice it unless you exile another [object] you control.
Ability ability1 = new EntersBattlefieldTriggeredAbility(
new SacrificeSourceUnlessPaysEffect(new ChampionExileCost(filter, new StringBuilder(card.getName()).append(" championed permanents").toString())), false);
new SacrificeSourceUnlessPaysEffect(new ChampionExileCost(filter, card.getName() + " championed permanents")), false);
ability1.setRuleVisible(false);
addSubAbility(ability1);
@ -180,6 +182,9 @@ class ChampionExileCost extends CostImpl {
return false;
}
paid |= controller.moveCardToExileWithInfo(permanent, exileId, sourceObject.getIdName() + " championed permanents", sourceId, game, Zone.BATTLEFIELD, true);
if (paid) {
game.fireEvent(GameEvent.getEvent(GameEvent.EventType.CREATURE_CHAMPIONED, permanent.getId(), sourceId, controllerId));
}
}
}
}

View file

@ -117,6 +117,12 @@ public class GameEvent implements Serializable {
flag true = from comabat damage - other from non combat damage
*/
PLAY_LAND, LAND_PLAYED,
CREATURE_CHAMPIONED,
/* CREATURE_CHAMPIONED
targetId the id of the creature that was championed
sourceId sourceId of the creature using the champion ability
playerId the id of the controlling player
*/
CREW_VEHICLE,
/* CREW_VEHICLE
targetId the id of the creature that crewed a vehicle