* Fixed a bug of DiesThisOrAnotherCreatureTriggeredAbility that caused that some triggerd effects did not work (e.g. Xathrid Necromancer dying together with other creatures).

This commit is contained in:
LevelX2 2015-04-25 20:50:31 +02:00
parent 159e36eabe
commit 4e0929e3f2
4 changed files with 100 additions and 4 deletions

View file

@ -27,6 +27,7 @@
*/
package mage.abilities.common;
import mage.MageObject;
import mage.constants.Zone;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.Effect;
@ -66,7 +67,12 @@ public class DiesThisOrAnotherCreatureTriggeredAbility extends TriggeredAbilityI
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.ZONE_CHANGE;
}
@Override
public boolean isInUseableZone(Game game, MageObject source, GameEvent event) {
return game.getState().getZone(getSourceId()) == Zone.BATTLEFIELD || game.getLastKnownInformation(getSourceId(), Zone.BATTLEFIELD) != null;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;

View file

@ -173,10 +173,10 @@ public class ContinuousEffectsList<T extends ContinuousEffect> extends ArrayList
public void removeEffects(UUID effectIdToRemove, Set<Ability> abilitiesToRemove) {
HashSet<Ability> abilities = effectAbilityMap.get(effectIdToRemove);
if (abilitiesToRemove != null) {
if (abilitiesToRemove != null && abilities != null) {
abilities.removeAll(abilitiesToRemove);
}
if (abilities.isEmpty()) {
if (abilities == null || abilities.isEmpty()) {
for (Iterator<T> iterator = this.iterator(); iterator.hasNext();) {
ContinuousEffect effect = iterator.next();
if (effect.getId().equals(effectIdToRemove)) {