mirror of
https://github.com/magefree/mage.git
synced 2026-01-09 04:12:14 -08:00
Add finality counters (#11379)
* [LCI] Implement Soulcoil Viper * add finality counter test * fix bug, add extra test * [LCI] Implement Uchbenbak, the Great Mistake
This commit is contained in:
parent
6a33c68bb2
commit
595955a3cc
7 changed files with 280 additions and 1 deletions
|
|
@ -0,0 +1,57 @@
|
|||
package mage.abilities.effects.keyword;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.ReplacementEffectImpl;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
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.permanent.Permanent;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public class FinalityCounterEffect extends ReplacementEffectImpl {
|
||||
|
||||
public FinalityCounterEffect() {
|
||||
super(Duration.Custom, Outcome.Tap);
|
||||
this.staticText = "If a creature with a finality counter on it would die, exile it instead.";
|
||||
}
|
||||
|
||||
private FinalityCounterEffect(final FinalityCounterEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FinalityCounterEffect copy() {
|
||||
return new FinalityCounterEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||
((ZoneChangeEvent) event).setToZone(Zone.EXILED);
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checksEventType(GameEvent event, Game game) {
|
||||
return event.getType() == GameEvent.EventType.ZONE_CHANGE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
if (!((ZoneChangeEvent) event).isDiesEvent()) {
|
||||
return false;
|
||||
}
|
||||
Permanent permanent = game.getPermanent(event.getTargetId());
|
||||
return permanent != null && permanent.getCounters(game).getCount(CounterType.FINALITY) > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -73,6 +73,7 @@ public enum CounterType {
|
|||
FEATHER("feather"),
|
||||
FETCH("fetch"),
|
||||
FILIBUSTER("filibuster"),
|
||||
FINALITY("finality"),
|
||||
FIRST_STRIKE("first strike"),
|
||||
FLAME("flame"),
|
||||
FLOOD("flood"),
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ import mage.abilities.effects.Effect;
|
|||
import mage.abilities.effects.PreventionEffectData;
|
||||
import mage.abilities.effects.common.CopyEffect;
|
||||
import mage.abilities.effects.common.InfoEffect;
|
||||
import mage.abilities.effects.keyword.FinalityCounterEffect;
|
||||
import mage.abilities.effects.keyword.ShieldCounterEffect;
|
||||
import mage.abilities.effects.keyword.StunCounterEffect;
|
||||
import mage.abilities.keyword.*;
|
||||
|
|
@ -1182,6 +1183,9 @@ public abstract class GameImpl implements Game {
|
|||
// Apply stun counter mechanic
|
||||
state.addAbility(new SimpleStaticAbility(Zone.ALL, new StunCounterEffect()), null);
|
||||
|
||||
// Apply finality counter mechanic
|
||||
state.addAbility(new SimpleStaticAbility(Zone.ALL, new FinalityCounterEffect()), null);
|
||||
|
||||
// Handle companions
|
||||
Map<Player, Card> playerCompanionMap = new HashMap<>();
|
||||
for (Player player : state.getPlayers().values()) {
|
||||
|
|
@ -1993,7 +1997,7 @@ public abstract class GameImpl implements Game {
|
|||
}
|
||||
if (copyFromPermanent.isPrototyped()) {
|
||||
Abilities<Ability> abilities = copyFromPermanent.getAbilities();
|
||||
for (Ability ability : abilities){
|
||||
for (Ability ability : abilities) {
|
||||
if (ability instanceof PrototypeAbility) {
|
||||
((PrototypeAbility) ability).prototypePermanent(newBluePrint, this);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue