mirror of
https://github.com/correl/mage.git
synced 2024-12-26 03:00:11 +00:00
* Hushwing Gryff - Fixed a bug that the effect was wrongly implemented as replacement effect with potential to repalce other replacement effects.
This commit is contained in:
parent
609b5af2fe
commit
a7fc5b9583
4 changed files with 14 additions and 13 deletions
|
@ -31,7 +31,7 @@ import java.util.UUID;
|
|||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.ReplacementEffectImpl;
|
||||
import mage.abilities.effects.ContinuousRuleModifiyingEffectImpl;
|
||||
import mage.abilities.keyword.FlashAbility;
|
||||
import mage.abilities.keyword.FlyingAbility;
|
||||
import mage.cards.CardImpl;
|
||||
|
@ -41,6 +41,7 @@ import mage.constants.Outcome;
|
|||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.EntersTheBattlefieldEvent;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
|
@ -77,9 +78,10 @@ public class HushwingGryff extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
class HushwingGryffEffect extends ReplacementEffectImpl {
|
||||
class HushwingGryffEffect extends ContinuousRuleModifiyingEffectImpl {
|
||||
|
||||
HushwingGryffEffect() {
|
||||
super(Duration.WhileOnBattlefield, Outcome.Detriment, false);
|
||||
super(Duration.WhileOnBattlefield, Outcome.Detriment, false, false);
|
||||
staticText = "Creatures entering the battlefield don't cause abilities to trigger";
|
||||
}
|
||||
|
||||
|
@ -87,16 +89,15 @@ class HushwingGryffEffect extends ReplacementEffectImpl {
|
|||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
if (event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD) {
|
||||
Permanent p = game.getPermanent(event.getTargetId());
|
||||
if (p != null && p.getCardType().contains(CardType.CREATURE)) {
|
||||
Permanent permanent = ((EntersTheBattlefieldEvent)event).getTarget();
|
||||
if (permanent != null && permanent.getCardType().contains(CardType.CREATURE)) {
|
||||
// Because replacement events have to be executed
|
||||
// call replaceEvent here without calling the triggering event after
|
||||
game.getContinuousEffects().replaceEvent(event, game);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -636,9 +636,6 @@ public class ContinuousEffects implements Serializable {
|
|||
}
|
||||
|
||||
public boolean replaceEvent(GameEvent event, Game game) {
|
||||
if (preventedByRuleModification(event, game, false)) {
|
||||
return true;
|
||||
}
|
||||
boolean caught = false;
|
||||
HashMap<UUID, HashSet<UUID>> consumed = new HashMap<>();
|
||||
do {
|
||||
|
|
|
@ -537,6 +537,9 @@ public class GameState implements Serializable, Copyable<GameState> {
|
|||
}
|
||||
|
||||
public boolean replaceEvent(GameEvent event, Game game) {
|
||||
if (effects.preventedByRuleModification(event, game, false)) {
|
||||
return true;
|
||||
}
|
||||
return effects.replaceEvent(event, game);
|
||||
}
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ import mage.game.permanent.Permanent;
|
|||
*/
|
||||
public class EntersTheBattlefieldEvent extends GameEvent {
|
||||
|
||||
private Zone fromZone;
|
||||
private final Zone fromZone;
|
||||
private Permanent target;
|
||||
|
||||
public EntersTheBattlefieldEvent(Permanent target, UUID sourceId, UUID playerId, Zone fromZone) {
|
||||
|
|
Loading…
Reference in a new issue