Fixed that some cards doesn't trigger counter add events;

This commit is contained in:
Oleg Agafonov 2019-04-30 19:21:43 +04:00
parent 07faf872ea
commit 9273dd1ea0
5 changed files with 25 additions and 33 deletions

View file

@ -1,7 +1,5 @@
package mage.cards.c;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
@ -22,14 +20,15 @@ import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import java.util.UUID;
/**
*
* @author LevelX2
*/
public final class CrovaxTheCursed extends CardImpl {
public CrovaxTheCursed(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{B}{B}");
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{B}{B}");
addSuperType(SuperType.LEGENDARY);
this.subtype.add(SubType.VAMPIRE);
this.power = new MageInt(0);
@ -82,7 +81,7 @@ class CrovaxTheCursedEffect extends OneShotEffect {
if (creatures > 0 && controller.chooseUse(outcome, "Sacrifice a creature?", source, game)) {
if (new SacrificeControllerEffect(StaticFilters.FILTER_PERMANENT_CREATURES, 1, "").apply(game, source)) {
if (sourceObject != null) {
sourceObject.getCounters(game).addCounter(CounterType.P1P1.createInstance());
sourceObject.addCounters(CounterType.P1P1.createInstance(), source, game);
game.informPlayers(controller.getLogName() + " puts a +1/+1 counter on " + sourceObject.getName());
}
}

View file

@ -1,7 +1,5 @@
package mage.cards.e;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
@ -9,11 +7,7 @@ import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.Outcome;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.constants.*;
import mage.counters.CounterType;
import mage.filter.common.FilterCreatureCard;
import mage.game.Game;
@ -21,14 +15,15 @@ import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.common.TargetCardInGraveyard;
import java.util.UUID;
/**
*
* @author L_J
*/
public final class EntrailsFeaster extends CardImpl {
public EntrailsFeaster(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{B}");
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{B}");
this.subtype.add(SubType.ZOMBIE);
this.subtype.add(SubType.CAT);
this.power = new MageInt(1);
@ -81,7 +76,7 @@ class EntrailsFeasterEffect extends OneShotEffect {
if (cardChosen != null) {
controller.moveCardsToExile(cardChosen, source, game, true, null, "");
if (sourceObject != null) {
sourceObject.getCounters(game).addCounter(CounterType.P1P1.createInstance());
sourceObject.addCounters(CounterType.P1P1.createInstance(), source, game);
game.informPlayers(controller.getLogName() + " puts a +1/+1 counter on " + sourceObject.getLogName());
}
}

View file

@ -1,9 +1,5 @@
package mage.cards.n;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.DiscardCardCost;
@ -27,14 +23,17 @@ import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.common.TargetCreaturePermanent;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
/**
*
* @author L_J
*/
public final class NaturesBlessing extends CardImpl {
public NaturesBlessing(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{2}{G}{W}");
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{G}{W}");
// {G}{W}, Discard a card: Put a +1/+1 counter on target creature or that creature gains banding, first strike, or trample.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new NaturesBlessingEffect(), new ManaCostsImpl("{G}{W}"));
@ -102,7 +101,7 @@ class NaturesBlessingEffect extends OneShotEffect {
if (gainedAbility != null) {
game.addEffect(new GainAbilityTargetEffect(gainedAbility, Duration.Custom), source);
} else {
targetPermanent.getCounters(game).addCounter(CounterType.P1P1.createInstance());
targetPermanent.addCounters(CounterType.P1P1.createInstance(), source, game);
game.informPlayers(controller.getLogName() + " puts a +1/+1 counter on " + targetPermanent.getLogName());
}
return true;

View file

@ -1,9 +1,5 @@
package mage.cards.o;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
@ -27,8 +23,11 @@ import mage.target.Target;
import mage.target.common.TargetCreaturePermanent;
import mage.util.CardUtil;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
/**
*
* @author MarcoMarin
*/
public final class Oubliette extends CardImpl {
@ -137,7 +136,7 @@ class OublietteReturnEffect extends OneShotEffect {
if (counters != null) {
for (Counter counter : counters.values()) {
if (counter != null) {
newPermanent.getCounters(game).addCounter(counter);
newPermanent.getCounters(game).addCounter(counter); // it's restore counters, not add (e.g. without add events)
}
}
}

View file

@ -1,8 +1,5 @@
package mage.cards.t;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.LeavesBattlefieldTriggeredAbility;
import mage.abilities.common.SimpleActivatedAbility;
@ -32,8 +29,11 @@ import mage.target.Target;
import mage.target.common.TargetCreaturePermanent;
import mage.util.CardUtil;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
/**
*
* @author MarcoMarin
*/
public final class TawnossCoffin extends CardImpl {
@ -194,7 +194,7 @@ class TawnossCoffinReturnEffect extends OneShotEffect {
if (notedCounters != null) {
for (Counter c : notedCounters.values()) { //would be nice if could just use that copy function to set the whole field
if (c != null) {
newPermanent.getCounters(game).addCounter(c);
newPermanent.getCounters(game).addCounter(c); // it's restore counters, not add (e.g. without add events)
}
}
}