* Haktos the Unscarred - Fixed some problems with the protection ability not working correctly.

This commit is contained in:
LevelX2 2020-01-14 00:34:48 +01:00
parent cf072f0b1a
commit 42265d78d8
3 changed files with 16 additions and 15 deletions

View file

@ -1,5 +1,6 @@
package mage.cards.h;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.AsEntersBattlefieldAbility;
@ -13,16 +14,14 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.filter.FilterCard;
import mage.filter.predicate.ObjectPlayerPredicate;
import mage.filter.predicate.ObjectSourcePlayer;
import mage.filter.predicate.ObjectSourcePlayerPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.util.CardUtil;
import mage.util.RandomUtil;
import java.util.UUID;
/**
* @author TheElk801
*/
@ -96,13 +95,13 @@ class HaktosTheUnscarredChooseEffect extends OneShotEffect {
}
int number = 2 + RandomUtil.nextInt(3);
game.informPlayers(permanent.getLogName() + ": " + controller.getLogName() + " has chosen " + number + " at random");
game.getState().setValue(permanent.getId() + "" + permanent.getZoneChangeCounter(game) + "_haktos_number", number);
game.getState().setValue(permanent.getId() + "" + (permanent.getZoneChangeCounter(game) + 1) + "_haktos_number", number);
permanent.addInfo("chosen number", CardUtil.addToolTipMarkTags("Chosen number: " + number), game);
return true;
}
}
enum HaktosTheUnscarredPredicate implements ObjectPlayerPredicate<ObjectSourcePlayer<Card>> {
enum HaktosTheUnscarredPredicate implements ObjectSourcePlayerPredicate<ObjectSourcePlayer<Card>> {
instance;
@Override
@ -114,4 +113,4 @@ enum HaktosTheUnscarredPredicate implements ObjectPlayerPredicate<ObjectSourcePl
int num = (int) obj;
return input.getObject().getConvertedManaCost() != num;
}
}
}

View file

@ -1,4 +1,3 @@
package mage.abilities.keyword;
import java.util.ArrayList;
@ -81,8 +80,10 @@ public class ProtectionAbility extends StaticAbility {
}
if (filter instanceof FilterCard) {
if (source instanceof Card) {
return !filter.match(source, game);
if (source instanceof Permanent) {
return !((FilterCard) filter).match((Card) source, getSourceId(), ((Permanent) source).getControllerId(), game);
} else if (source instanceof Card) {
return !((FilterCard) filter).match((Card) source, getSourceId(), ((Card) source).getOwnerId(), game);
}
return true;
}
@ -120,7 +121,9 @@ public class ProtectionAbility extends StaticAbility {
return removeAuras;
}
public List<ObjectColor> getColors() { return colors; }
public List<ObjectColor> getColors() {
return colors;
}
public UUID getAuraIdNotToBeRemoved() {
return auraIdNotToBeRemoved;

View file

@ -1,15 +1,14 @@
package mage.filter;
import mage.cards.Card;
import mage.constants.TargetController;
import mage.filter.predicate.*;
import mage.game.Game;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import java.util.UUID;
import java.util.stream.Collectors;
import mage.cards.Card;
import mage.constants.TargetController;
import mage.filter.predicate.*;
import mage.game.Game;
/**
* @author BetaSteward_at_googlemail.com