mirror of
https://github.com/correl/mage.git
synced 2024-12-24 11:50:45 +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;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
|
||||
|
@ -14,29 +13,28 @@ import mage.constants.Zone;
|
|||
import mage.counters.CounterType;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.ZoneChangeEvent;
|
||||
import mage.game.events.ZoneChangeGroupEvent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public final class RakshasaVizier extends CardImpl {
|
||||
|
||||
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.DEMON);
|
||||
|
||||
|
||||
this.power = 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.
|
||||
// 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());
|
||||
}
|
||||
|
||||
public RakshasaVizier(final RakshasaVizier card) {
|
||||
private RakshasaVizier(final RakshasaVizier card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
|
@ -48,29 +46,35 @@ public final class RakshasaVizier extends CardImpl {
|
|||
|
||||
class RakshasaVizierTriggeredAbility extends TriggeredAbilityImpl {
|
||||
|
||||
public RakshasaVizierTriggeredAbility() {
|
||||
RakshasaVizierTriggeredAbility() {
|
||||
super(Zone.BATTLEFIELD, new AddCountersSourceEffect(CounterType.P1P1.createInstance()), false);
|
||||
}
|
||||
|
||||
public RakshasaVizierTriggeredAbility(final RakshasaVizierTriggeredAbility ability) {
|
||||
private RakshasaVizierTriggeredAbility(final RakshasaVizierTriggeredAbility ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkEventType(GameEvent event, Game game) {
|
||||
return event.getType() == GameEvent.EventType.ZONE_CHANGE;
|
||||
return event.getType() == GameEvent.EventType.ZONE_CHANGE_GROUP;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
|
||||
if (zEvent.getFromZone() == Zone.GRAVEYARD
|
||||
&& zEvent.getToZone() == Zone.EXILED) {
|
||||
Card card = game.getCard(event.getTargetId());
|
||||
if (card != null && card.isOwnedBy(getControllerId())) {
|
||||
return true;
|
||||
ZoneChangeGroupEvent zEvent = (ZoneChangeGroupEvent) event;
|
||||
if (zEvent != null
|
||||
&& Zone.GRAVEYARD == zEvent.getFromZone()
|
||||
&& Zone.EXILED != zEvent.getToZone()
|
||||
&& zEvent.getCards() != null) {
|
||||
int cardCount = 0;
|
||||
for (Card card : zEvent.getCards()) {
|
||||
if (card != null && card.isOwnedBy(getControllerId())) {
|
||||
cardCount++;
|
||||
}
|
||||
}
|
||||
|
||||
this.getEffects().clear();
|
||||
this.getEffects().add(new AddCountersSourceEffect(CounterType.P1P1.createInstance(cardCount)));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue