mirror of
https://github.com/magefree/mage.git
synced 2025-12-25 13:02:06 -08:00
* Fixed that effects with "as long as Intet remains on the battlefield" condition were reapplied as the card returned to battlefield.
Some other minor fixes.
This commit is contained in:
parent
044b254155
commit
3beaec4525
15 changed files with 102 additions and 26 deletions
|
|
@ -0,0 +1,40 @@
|
|||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package mage.abilities.condition.common;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.condition.Condition;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class SourceRemainsInZoneCondition implements Condition {
|
||||
|
||||
private final Zone zone;
|
||||
private int timesChangedZones = -1;
|
||||
|
||||
public SourceRemainsInZoneCondition(Zone zone) {
|
||||
this.zone = zone;
|
||||
this.timesChangedZones = -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
if (timesChangedZones == -1) { // Only changed on first execution
|
||||
timesChangedZones = game.getState().getZoneChangeCounter(source.getSourceId());
|
||||
}
|
||||
return (timesChangedZones == game.getState().getZoneChangeCounter(source.getSourceId())
|
||||
&& zone.equals(game.getState().getZone(source.getSourceId())));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "for as long as {this} remains on the " + zone.toString();
|
||||
}
|
||||
}
|
||||
|
|
@ -177,6 +177,7 @@ public class ConditionalContinuousEffect extends ContinuousEffectImpl {
|
|||
|
||||
/**
|
||||
* Return all effects list, for tests only
|
||||
* @return
|
||||
*/
|
||||
public List<ContinuousEffect> getAllEffects() {
|
||||
List<ContinuousEffect> res = new ArrayList<>();
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ public class GameState implements Serializable, Copyable<GameState> {
|
|||
private Map<UUID, Integer> zoneChangeCounter = new HashMap<>();
|
||||
private Map<UUID, Card> copiedCards = new HashMap<>();
|
||||
private int permanentOrderNumber;
|
||||
private Map<UUID, FilterCreaturePermanent> usePowerInsteadOfToughnessForDamageLethalityFilters = new HashMap<>();
|
||||
private final Map<UUID, FilterCreaturePermanent> usePowerInsteadOfToughnessForDamageLethalityFilters = new HashMap<>();
|
||||
private final Set<MageObjectReference> commandersToStay = new HashSet<>();
|
||||
|
||||
private int applyEffectsCounter; // Upcounting number of each applyEffects execution
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue