mirror of
https://github.com/correl/mage.git
synced 2024-12-25 11:11:16 +00:00
Reworked Rakshasa Vizier triggered ability to only trigger once (fixes #5475)
This commit is contained in:
parent
e45dda28a9
commit
ce10d20517
1 changed files with 22 additions and 18 deletions
|
@ -1,7 +1,6 @@
|
||||||
|
|
||||||
package mage.cards.r;
|
package mage.cards.r;
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.abilities.TriggeredAbilityImpl;
|
import mage.abilities.TriggeredAbilityImpl;
|
||||||
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
|
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
|
||||||
|
@ -14,29 +13,28 @@ import mage.constants.Zone;
|
||||||
import mage.counters.CounterType;
|
import mage.counters.CounterType;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.events.GameEvent;
|
import mage.game.events.GameEvent;
|
||||||
import mage.game.events.ZoneChangeEvent;
|
import mage.game.events.ZoneChangeGroupEvent;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author LevelX2
|
* @author LevelX2
|
||||||
*/
|
*/
|
||||||
public final class RakshasaVizier extends CardImpl {
|
public final class RakshasaVizier extends CardImpl {
|
||||||
|
|
||||||
public RakshasaVizier(UUID ownerId, CardSetInfo setInfo) {
|
public RakshasaVizier(UUID ownerId, CardSetInfo setInfo) {
|
||||||
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{B}{G}{U}");
|
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{B}{G}{U}");
|
||||||
|
|
||||||
this.subtype.add(SubType.CAT);
|
this.subtype.add(SubType.CAT);
|
||||||
this.subtype.add(SubType.DEMON);
|
this.subtype.add(SubType.DEMON);
|
||||||
|
|
||||||
|
|
||||||
this.power = new MageInt(4);
|
this.power = new MageInt(4);
|
||||||
this.toughness = new MageInt(4);
|
this.toughness = new MageInt(4);
|
||||||
|
|
||||||
// Whenever one or more cards are put into exile from your graveyard, put that many +1/+1 counters on Rakshasa Vizier.
|
// Whenever one or more cards are put into exile from your graveyard, put that many +1/+1 counters on Rakshasa Vizier.
|
||||||
// TODO: Handle effects that move more than one card with one trigger (e.g. if opponent want to counter a trigger, he has now to counter multiple instead of one).
|
|
||||||
this.addAbility(new RakshasaVizierTriggeredAbility());
|
this.addAbility(new RakshasaVizierTriggeredAbility());
|
||||||
}
|
}
|
||||||
|
|
||||||
public RakshasaVizier(final RakshasaVizier card) {
|
private RakshasaVizier(final RakshasaVizier card) {
|
||||||
super(card);
|
super(card);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,29 +46,35 @@ public final class RakshasaVizier extends CardImpl {
|
||||||
|
|
||||||
class RakshasaVizierTriggeredAbility extends TriggeredAbilityImpl {
|
class RakshasaVizierTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
|
|
||||||
public RakshasaVizierTriggeredAbility() {
|
RakshasaVizierTriggeredAbility() {
|
||||||
super(Zone.BATTLEFIELD, new AddCountersSourceEffect(CounterType.P1P1.createInstance()), false);
|
super(Zone.BATTLEFIELD, new AddCountersSourceEffect(CounterType.P1P1.createInstance()), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public RakshasaVizierTriggeredAbility(final RakshasaVizierTriggeredAbility ability) {
|
private RakshasaVizierTriggeredAbility(final RakshasaVizierTriggeredAbility ability) {
|
||||||
super(ability);
|
super(ability);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean checkEventType(GameEvent event, Game game) {
|
public boolean checkEventType(GameEvent event, Game game) {
|
||||||
return event.getType() == GameEvent.EventType.ZONE_CHANGE;
|
return event.getType() == GameEvent.EventType.ZONE_CHANGE_GROUP;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean checkTrigger(GameEvent event, Game game) {
|
public boolean checkTrigger(GameEvent event, Game game) {
|
||||||
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
|
ZoneChangeGroupEvent zEvent = (ZoneChangeGroupEvent) event;
|
||||||
if (zEvent.getFromZone() == Zone.GRAVEYARD
|
if (zEvent != null
|
||||||
&& zEvent.getToZone() == Zone.EXILED) {
|
&& Zone.GRAVEYARD == zEvent.getFromZone()
|
||||||
Card card = game.getCard(event.getTargetId());
|
&& Zone.EXILED != zEvent.getToZone()
|
||||||
|
&& zEvent.getCards() != null) {
|
||||||
|
int cardCount = 0;
|
||||||
|
for (Card card : zEvent.getCards()) {
|
||||||
if (card != null && card.isOwnedBy(getControllerId())) {
|
if (card != null && card.isOwnedBy(getControllerId())) {
|
||||||
return true;
|
cardCount++;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
this.getEffects().clear();
|
||||||
|
this.getEffects().add(new AddCountersSourceEffect(CounterType.P1P1.createInstance(cardCount)));
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue