mirror of
https://github.com/correl/mage.git
synced 2024-12-25 03:00:15 +00:00
Sonar fixes
remove the deprecated GameState.getWatchers()
This commit is contained in:
parent
90bf7bd18c
commit
63718e7a6e
28 changed files with 70 additions and 72 deletions
|
@ -146,7 +146,7 @@ public class HumanPlayer extends PlayerImpl {
|
|||
|
||||
protected boolean pullResponseFromQueue(Game game) {
|
||||
if (actionQueue.isEmpty() && actionIterations > 0 && !actionQueueSaved.isEmpty()) {
|
||||
actionQueue = new LinkedList(actionQueueSaved);
|
||||
actionQueue = new LinkedList<>(actionQueueSaved);
|
||||
actionIterations--;
|
||||
// logger.info("MACRO iteration: " + actionIterations);
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ import mage.target.common.TargetCreaturePermanent;
|
|||
*/
|
||||
public final class AbunaAcolyte extends CardImpl {
|
||||
|
||||
final static FilterCreaturePermanent filter = new FilterCreaturePermanent("artifact creature");
|
||||
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("artifact creature");
|
||||
|
||||
static {
|
||||
filter.add(new CardTypePredicate(CardType.ARTIFACT));
|
||||
|
@ -45,7 +45,7 @@ public final class AbunaAcolyte extends CardImpl {
|
|||
this.addAbility(ability2);
|
||||
}
|
||||
|
||||
public AbunaAcolyte(final AbunaAcolyte card) {
|
||||
private AbunaAcolyte(final AbunaAcolyte card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ import mage.target.common.TargetAttackingCreature;
|
|||
*/
|
||||
public final class AccursedHorde extends CardImpl {
|
||||
|
||||
private final static FilterAttackingCreature filter = new FilterAttackingCreature("attacking Zombie");
|
||||
private static final FilterAttackingCreature filter = new FilterAttackingCreature("attacking Zombie");
|
||||
|
||||
static {
|
||||
filter.add(new SubtypePredicate(SubType.ZOMBIE));
|
||||
|
@ -43,7 +43,7 @@ public final class AccursedHorde extends CardImpl {
|
|||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
public AccursedHorde(final AccursedHorde card) {
|
||||
private AccursedHorde(final AccursedHorde card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ class DamagedByPiratesWatcher extends Watcher {
|
|||
super(DamagedByPiratesWatcher.class.getSimpleName(), WatcherScope.GAME);
|
||||
}
|
||||
|
||||
public DamagedByPiratesWatcher(final DamagedByPiratesWatcher watcher) {
|
||||
private DamagedByPiratesWatcher(final DamagedByPiratesWatcher watcher) {
|
||||
super(watcher);
|
||||
for (UUID playerId : watcher.damageSourceIds.keySet()) {
|
||||
Set<UUID> creatures = new HashSet<>();
|
||||
|
@ -106,7 +106,7 @@ class DamagedByPiratesWatcher extends Watcher {
|
|||
}
|
||||
}
|
||||
|
||||
public boolean damagedByEnoughPirates(UUID sourceId, Game game) {
|
||||
public boolean damagedByEnoughPirates(UUID sourceId) {
|
||||
return damageSourceIds.keySet().contains(sourceId) && damageSourceIds.get(sourceId).size() > 2;
|
||||
}
|
||||
|
||||
|
@ -119,14 +119,11 @@ class DamagedByPiratesWatcher extends Watcher {
|
|||
|
||||
class ControllerDealtDamageByPiratesPredicate implements Predicate<Permanent> {
|
||||
|
||||
public ControllerDealtDamageByPiratesPredicate() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Permanent input, Game game) {
|
||||
DamagedByPiratesWatcher watcher = game.getState().getWatcher(DamagedByPiratesWatcher.class);
|
||||
if (watcher != null) {
|
||||
return watcher.damagedByEnoughPirates(input.getControllerId(), game);
|
||||
return watcher.damagedByEnoughPirates(input.getControllerId());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ import mage.filter.common.FilterControlledArtifactPermanent;
|
|||
*/
|
||||
public final class AeronautTinkerer extends CardImpl {
|
||||
|
||||
final static private String rule = "{this} has flying as long as you control an artifact";
|
||||
private static final String rule = "{this} has flying as long as you control an artifact";
|
||||
|
||||
public AeronautTinkerer(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{U}");
|
||||
|
@ -38,7 +38,7 @@ public final class AeronautTinkerer extends CardImpl {
|
|||
|
||||
}
|
||||
|
||||
public AeronautTinkerer(final AeronautTinkerer card) {
|
||||
private AeronautTinkerer(final AeronautTinkerer card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ import mage.target.TargetPermanent;
|
|||
*/
|
||||
public final class AetherMeltdown extends CardImpl {
|
||||
|
||||
private final static FilterPermanent filter = new FilterPermanent("creature or vehicle");
|
||||
private static final FilterPermanent filter = new FilterPermanent("creature or vehicle");
|
||||
|
||||
static {
|
||||
filter.add(Predicates.or(new CardTypePredicate(CardType.CREATURE), new SubtypePredicate(SubType.VEHICLE)));
|
||||
|
@ -53,7 +53,7 @@ public final class AetherMeltdown extends CardImpl {
|
|||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect));
|
||||
}
|
||||
|
||||
public AetherMeltdown(final AetherMeltdown card) {
|
||||
private AetherMeltdown(final AetherMeltdown card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ public final class AetherStorm extends CardImpl {
|
|||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
public AetherStorm(final AetherStorm card) {
|
||||
private AetherStorm(final AetherStorm card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
|
@ -53,7 +53,7 @@ class AetherStormReplacementEffect extends ContinuousRuleModifyingEffectImpl {
|
|||
staticText = "Creature spells can't be cast.";
|
||||
}
|
||||
|
||||
public AetherStormReplacementEffect(final AetherStormReplacementEffect effect) {
|
||||
private AetherStormReplacementEffect(final AetherStormReplacementEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
|
@ -75,10 +75,7 @@ class AetherStormReplacementEffect extends ContinuousRuleModifyingEffectImpl {
|
|||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
Card card = game.getCard(event.getSourceId());
|
||||
if (card != null && card.isCreature()) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return card != null && card.isCreature();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ import mage.filter.predicate.mageobject.NamePredicate;
|
|||
*/
|
||||
public final class AjanisAid extends CardImpl {
|
||||
|
||||
private final static FilterCard filter = new FilterCard("Ajani, Valiant Protector");
|
||||
private static final FilterCard filter = new FilterCard("Ajani, Valiant Protector");
|
||||
|
||||
static {
|
||||
filter.add(new NamePredicate("Ajani, Valiant Protector"));
|
||||
|
@ -42,7 +42,7 @@ public final class AjanisAid extends CardImpl {
|
|||
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new SacrificeSourceCost()));
|
||||
}
|
||||
|
||||
public AjanisAid(final AjanisAid card) {
|
||||
private AjanisAid(final AjanisAid card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
|
||||
package mage.cards.a;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.ObjectColor;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
|
@ -17,17 +16,18 @@ import mage.players.Player;
|
|||
import mage.target.Target;
|
||||
import mage.target.common.TargetCardInYourGraveyard;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public final class AllSunsDawn extends CardImpl {
|
||||
|
||||
private final static FilterCard filterGreen = new FilterCard("green card from your graveyard");
|
||||
private final static FilterCard filterRed = new FilterCard("red card from your graveyard");
|
||||
private final static FilterCard filterBlue = new FilterCard("blue card from your graveyard");
|
||||
private final static FilterCard filterBlack = new FilterCard("black card from your graveyard");
|
||||
private final static FilterCard filterWhite = new FilterCard("white card from your graveyard");
|
||||
private static final FilterCard filterGreen = new FilterCard("green card from your graveyard");
|
||||
private static final FilterCard filterRed = new FilterCard("red card from your graveyard");
|
||||
private static final FilterCard filterBlue = new FilterCard("blue card from your graveyard");
|
||||
private static final FilterCard filterBlack = new FilterCard("black card from your graveyard");
|
||||
private static final FilterCard filterWhite = new FilterCard("white card from your graveyard");
|
||||
|
||||
static {
|
||||
filterGreen.add(new ColorPredicate(ObjectColor.GREEN));
|
||||
|
@ -38,7 +38,7 @@ public final class AllSunsDawn extends CardImpl {
|
|||
}
|
||||
|
||||
public AllSunsDawn(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{4}{G}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{4}{G}");
|
||||
|
||||
// For each color, return up to one target card of that color from your graveyard to your hand.
|
||||
this.getSpellAbility().addEffect(new AllSunsDawnEffect());
|
||||
|
@ -51,7 +51,7 @@ public final class AllSunsDawn extends CardImpl {
|
|||
this.getSpellAbility().addEffect(ExileSpellEffect.getInstance());
|
||||
}
|
||||
|
||||
public AllSunsDawn(final AllSunsDawn card) {
|
||||
private AllSunsDawn(final AllSunsDawn card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
|
@ -68,7 +68,7 @@ class AllSunsDawnEffect extends OneShotEffect {
|
|||
this.staticText = "For each color, return up to one target card of that color from your graveyard to your hand";
|
||||
}
|
||||
|
||||
public AllSunsDawnEffect(final AllSunsDawnEffect effect) {
|
||||
private AllSunsDawnEffect(final AllSunsDawnEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
|
@ -89,8 +89,7 @@ class AllSunsDawnEffect extends OneShotEffect {
|
|||
cardsToHand.add(card);
|
||||
}
|
||||
}
|
||||
controller.moveCards(cardsToHand, Zone.HAND, source, game);
|
||||
return true;
|
||||
return controller.moveCards(cardsToHand, Zone.HAND, source, game);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -51,13 +51,13 @@ public final class ArchiveTrap extends CardImpl {
|
|||
|
||||
class ArchiveTrapWatcher extends Watcher {
|
||||
|
||||
Set<UUID> playerIds = new HashSet<>();
|
||||
private Set<UUID> playerIds = new HashSet<>();
|
||||
|
||||
public ArchiveTrapWatcher() {
|
||||
super(ArchiveTrapWatcher.class.getSimpleName(), WatcherScope.GAME);
|
||||
}
|
||||
|
||||
public ArchiveTrapWatcher(final ArchiveTrapWatcher watcher) {
|
||||
private ArchiveTrapWatcher(final ArchiveTrapWatcher watcher) {
|
||||
super(watcher);
|
||||
this.playerIds.addAll(watcher.playerIds);
|
||||
}
|
||||
|
|
|
@ -70,13 +70,13 @@ class AwakenTheErstwhileEffect extends OneShotEffect {
|
|||
}
|
||||
|
||||
// create tokens
|
||||
for (UUID playerId : cardsAmount.keySet()) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
int tokensCount = cardsAmount.get(playerId);
|
||||
cardsAmount.entrySet().forEach(discardedHand -> {
|
||||
Player player = game.getPlayer(discardedHand.getKey());
|
||||
int tokensCount = discardedHand.getValue();
|
||||
if (player != null && tokensCount > 0) {
|
||||
new ZombieToken().putOntoBattlefield(tokensCount, game, source.getSourceId(), player.getId());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@ enum BlazingEffigyCount implements DynamicValue {
|
|||
|
||||
@Override
|
||||
public int calculate(Game game, Ability sourceAbility, Effect effect) {
|
||||
BlazingEffigyWatcher watcher = (BlazingEffigyWatcher) game.getState().getWatchers().get(BlazingEffigyWatcher.class.getSimpleName());
|
||||
BlazingEffigyWatcher watcher = game.getState().getWatcher(BlazingEffigyWatcher.class);
|
||||
if (watcher == null) {
|
||||
return 3;
|
||||
}
|
||||
|
|
|
@ -71,8 +71,7 @@ public final class ConduitOfRuin extends CardImpl {
|
|||
|
||||
class ConduitOfRuinWatcher extends Watcher {
|
||||
|
||||
Map<UUID, Integer> playerCreatureSpells;
|
||||
int spellCount = 0;
|
||||
private Map<UUID, Integer> playerCreatureSpells;
|
||||
|
||||
public ConduitOfRuinWatcher() {
|
||||
super(ConduitOfRuinWatcher.class.getSimpleName(), WatcherScope.GAME);
|
||||
|
|
|
@ -69,7 +69,7 @@ enum CustodiSoulcallerAdjuster implements TargetAdjuster {
|
|||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
ability.getTargets().clear();
|
||||
CustodiSoulcallerWatcher watcher = (CustodiSoulcallerWatcher) game.getState().getWatchers().get(CustodiSoulcallerWatcher.class.getSimpleName());
|
||||
CustodiSoulcallerWatcher watcher = game.getState().getWatcher(CustodiSoulcallerWatcher.class);
|
||||
Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(ability.getSourceId());
|
||||
if (watcher != null) {
|
||||
int xValue = watcher.getNumberOfAttackedPlayers(sourcePermanent.getControllerId());
|
||||
|
|
|
@ -59,7 +59,7 @@ class FaithsRewardEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
FaithsRewardWatcher watcher = game.getState().getWatcher(FaithsRewardWatcher.class);
|
||||
if (watcher != null) {
|
||||
for (UUID id : watcher.cards) {
|
||||
for (UUID id : watcher.getCards()) {
|
||||
Card c = game.getCard(id);
|
||||
if (c != null && c.isOwnedBy(source.getControllerId()) && game.getState().getZone(id) == Zone.GRAVEYARD) {
|
||||
c.moveToZone(Zone.BATTLEFIELD, source.getSourceId(), game, false);
|
||||
|
@ -77,7 +77,7 @@ class FaithsRewardEffect extends OneShotEffect {
|
|||
}
|
||||
|
||||
class FaithsRewardWatcher extends Watcher {
|
||||
List<UUID> cards = new ArrayList<>();
|
||||
private List<UUID> cards = new ArrayList<>();
|
||||
|
||||
public FaithsRewardWatcher() {
|
||||
super(FaithsRewardWatcher.class, WatcherScope.GAME);
|
||||
|
@ -95,6 +95,10 @@ class FaithsRewardWatcher extends Watcher {
|
|||
}
|
||||
}
|
||||
|
||||
public List<UUID> getCards(){
|
||||
return cards;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FaithsRewardWatcher copy() {
|
||||
return new FaithsRewardWatcher(this);
|
||||
|
|
|
@ -48,7 +48,7 @@ public final class GeneratorServant extends CardImpl {
|
|||
this.addAbility(new SimpleStaticAbility(Zone.ALL, new GeneratorServantHasteEffect()), new GeneratorServantWatcher());
|
||||
}
|
||||
|
||||
public GeneratorServant(final GeneratorServant card) {
|
||||
private GeneratorServant(final GeneratorServant card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
|
@ -60,13 +60,13 @@ public final class GeneratorServant extends CardImpl {
|
|||
|
||||
class GeneratorServantWatcher extends Watcher {
|
||||
|
||||
public List<UUID> creatures = new ArrayList<>();
|
||||
private List<UUID> creatures = new ArrayList<>();
|
||||
|
||||
public GeneratorServantWatcher() {
|
||||
super(GeneratorServantWatcher.class, WatcherScope.CARD);
|
||||
}
|
||||
|
||||
public GeneratorServantWatcher(final GeneratorServantWatcher watcher) {
|
||||
private GeneratorServantWatcher(final GeneratorServantWatcher watcher) {
|
||||
super(watcher);
|
||||
this.creatures.addAll(watcher.creatures);
|
||||
}
|
||||
|
@ -95,6 +95,10 @@ class GeneratorServantWatcher extends Watcher {
|
|||
creatures.clear();
|
||||
}
|
||||
|
||||
public boolean creatureCastWithServantsMana(UUID permanentId){
|
||||
return creatures.contains(permanentId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class GeneratorServantHasteEffect extends ContinuousEffectImpl {
|
||||
|
@ -117,7 +121,7 @@ class GeneratorServantHasteEffect extends ContinuousEffectImpl {
|
|||
GeneratorServantWatcher watcher = game.getState().getWatcher(GeneratorServantWatcher.class, source.getSourceId());
|
||||
if (watcher != null) {
|
||||
for (Permanent perm : game.getBattlefield().getAllActivePermanents()) {
|
||||
if (watcher.creatures.contains(perm.getId())) {
|
||||
if (watcher.creatureCastWithServantsMana(perm.getId())) {
|
||||
perm.addAbility(HasteAbility.getInstance(), source.getSourceId(), game);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -130,7 +130,7 @@ class GisaAndGeralfCastFromGraveyardEffect extends AsThoughEffectImpl {
|
|||
|
||||
class GisaAndGeralfWatcher extends Watcher {
|
||||
|
||||
boolean abilityUsed = false;
|
||||
private boolean abilityUsed = false;
|
||||
|
||||
GisaAndGeralfWatcher() {
|
||||
super("GisaAndGeralfWatcher", WatcherScope.CARD);
|
||||
|
|
|
@ -84,7 +84,7 @@ class GlyphOfDelusionSecondTarget extends TargetPermanent {
|
|||
public Set<UUID> possibleTargets(UUID sourceId, UUID sourceControllerId, Game game) {
|
||||
Set<UUID> possibleTargets = new HashSet<>();
|
||||
if (firstTarget != null) {
|
||||
BlockedAttackerWatcher watcher = (BlockedAttackerWatcher) game.getState().getWatchers().get(BlockedAttackerWatcher.class.getSimpleName());
|
||||
BlockedAttackerWatcher watcher = game.getState().getWatcher(BlockedAttackerWatcher.class);
|
||||
if (watcher != null) {
|
||||
MageObject targetSource = game.getObject(sourceId);
|
||||
if (targetSource != null) {
|
||||
|
|
|
@ -86,7 +86,7 @@ class GlyphOfReincarnationEffect extends OneShotEffect {
|
|||
Player controller = game.getPlayer(source.getControllerId());
|
||||
Permanent targetWall = game.getPermanentOrLKIBattlefield(source.getFirstTarget());
|
||||
if (controller != null && targetWall != null) {
|
||||
BlockedAttackerWatcher watcher = (BlockedAttackerWatcher) game.getState().getWatchers().get(BlockedAttackerWatcher.class.getSimpleName());
|
||||
BlockedAttackerWatcher watcher = game.getState().getWatcher(BlockedAttackerWatcher.class);
|
||||
if (watcher != null) {
|
||||
Map<UUID, Player> destroyed = new HashMap<>();
|
||||
for (Permanent creature : game.getBattlefield().getActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, source.getControllerId(), source.getSourceId(), game)) {
|
||||
|
|
|
@ -74,7 +74,7 @@ class IchneumonDruidAbility extends TriggeredAbilityImpl {
|
|||
if (!event.getPlayerId().equals(controllerId)) {
|
||||
Spell spell = game.getStack().getSpell(event.getTargetId());
|
||||
if (spell != null && spell.isInstant()) {
|
||||
IchneumonDruidWatcher watcher = (IchneumonDruidWatcher) game.getState().getWatchers().get(IchneumonDruidWatcher.class.getSimpleName());
|
||||
IchneumonDruidWatcher watcher = game.getState().getWatcher(IchneumonDruidWatcher.class);
|
||||
if (watcher != null && watcher.moreThanTwoInstantsCast(event.getPlayerId(), game)) {
|
||||
for (Effect effect : getEffects()) {
|
||||
effect.setTargetPointer(new FixedTarget(event.getPlayerId()));
|
||||
|
|
|
@ -56,7 +56,7 @@ public final class MetamorphicAlteration extends CardImpl {
|
|||
|
||||
class ChooseACreature extends OneShotEffect {
|
||||
|
||||
public static String INFO_KEY = "CHOSEN_CREATURE";
|
||||
public static final String INFO_KEY = "CHOSEN_CREATURE";
|
||||
|
||||
public ChooseACreature() {
|
||||
super(Outcome.Copy);
|
||||
|
|
|
@ -63,7 +63,7 @@ public final class OpalPalace extends CardImpl {
|
|||
|
||||
class OpalPalaceWatcher extends Watcher {
|
||||
|
||||
public List<UUID> commanderId = new ArrayList<>();
|
||||
private List<UUID> commanderId = new ArrayList<>();
|
||||
private final String originalId;
|
||||
|
||||
public OpalPalaceWatcher(String originalId) {
|
||||
|
@ -71,12 +71,16 @@ class OpalPalaceWatcher extends Watcher {
|
|||
this.originalId = originalId;
|
||||
}
|
||||
|
||||
public OpalPalaceWatcher(final OpalPalaceWatcher watcher) {
|
||||
private OpalPalaceWatcher(final OpalPalaceWatcher watcher) {
|
||||
super(watcher);
|
||||
this.commanderId.addAll(watcher.commanderId);
|
||||
this.originalId = watcher.originalId;
|
||||
}
|
||||
|
||||
public boolean manaUsedToCastCommander(UUID id){
|
||||
return commanderId.contains(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public OpalPalaceWatcher copy() {
|
||||
return new OpalPalaceWatcher(this);
|
||||
|
@ -119,7 +123,7 @@ class OpalPalaceEntersBattlefieldEffect extends ReplacementEffectImpl {
|
|||
staticText = "If you spend this mana to cast your commander, it enters the battlefield with a number of +1/+1 counters on it equal to the number of times it's been cast from the command zone this game";
|
||||
}
|
||||
|
||||
public OpalPalaceEntersBattlefieldEffect(OpalPalaceEntersBattlefieldEffect effect) {
|
||||
private OpalPalaceEntersBattlefieldEffect(OpalPalaceEntersBattlefieldEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
|
@ -132,7 +136,7 @@ class OpalPalaceEntersBattlefieldEffect extends ReplacementEffectImpl {
|
|||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
OpalPalaceWatcher watcher = game.getState().getWatcher(OpalPalaceWatcher.class, source.getSourceId());
|
||||
return watcher != null
|
||||
&& watcher.commanderId.contains(event.getTargetId());
|
||||
&& watcher.manaUsedToCastCommander(event.getTargetId());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -97,13 +97,13 @@ class QuickenAsThoughEffect extends AsThoughEffectImpl {
|
|||
|
||||
class QuickenWatcher extends Watcher {
|
||||
|
||||
public List<String> activeQuickenSpells = new ArrayList<>();
|
||||
private List<String> activeQuickenSpells = new ArrayList<>();
|
||||
|
||||
public QuickenWatcher() {
|
||||
super(QuickenWatcher.class, WatcherScope.GAME);
|
||||
}
|
||||
|
||||
public QuickenWatcher(final QuickenWatcher watcher) {
|
||||
private QuickenWatcher(final QuickenWatcher watcher) {
|
||||
super(watcher);
|
||||
}
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ enum TimeToReflectAdjuster implements TargetAdjuster {
|
|||
public void adjustTargets(Ability ability, Game game) {
|
||||
List<PermanentIdPredicate> creaturesThatBlockedOrWereBlockedByAZombie = new ArrayList<>();
|
||||
FilterCreaturePermanent filter = new FilterCreaturePermanent("creature that blocked or was blocked by a Zombie this turn.").copy();
|
||||
BlockedOrWasBlockedByAZombieWatcher watcher = (BlockedOrWasBlockedByAZombieWatcher) game.getState().getWatchers().get(BlockedOrWasBlockedByAZombieWatcher.class.getSimpleName());
|
||||
BlockedOrWasBlockedByAZombieWatcher watcher = game.getState().getWatcher(BlockedOrWasBlockedByAZombieWatcher.class);
|
||||
if (watcher != null) {
|
||||
for (MageObjectReference mor : watcher.getBlockedThisTurnCreatures()) {
|
||||
Permanent permanent = mor.getPermanent(game);
|
||||
|
|
|
@ -92,7 +92,6 @@ class TreasureNabberAbility extends TriggeredAbilityImpl {
|
|||
class TreasureNabberEffect extends ContinuousEffectImpl {
|
||||
|
||||
protected FixedTargets fixedTargets;
|
||||
protected int startingTurn;
|
||||
|
||||
TreasureNabberEffect() {
|
||||
super(Duration.Custom, Layer.ControlChangingEffects_2, SubLayer.NA, Outcome.GainControl);
|
||||
|
|
|
@ -76,8 +76,8 @@ class VizierOfDefermentEffect extends OneShotEffect {
|
|||
Permanent permanent = game.getPermanent(source.getFirstTarget());
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId());
|
||||
AttackedThisTurnWatcher watcherAttacked = (AttackedThisTurnWatcher) game.getState().getWatchers().get(AttackedThisTurnWatcher.class.getSimpleName());
|
||||
BlockedThisTurnWatcher watcherBlocked = (BlockedThisTurnWatcher) game.getState().getWatchers().get(BlockedThisTurnWatcher.class.getSimpleName());
|
||||
AttackedThisTurnWatcher watcherAttacked = game.getState().getWatcher(AttackedThisTurnWatcher.class);
|
||||
BlockedThisTurnWatcher watcherBlocked = game.getState().getWatcher(BlockedThisTurnWatcher.class);
|
||||
boolean attackedOrBlocked = false;
|
||||
if (watcherAttacked != null && watcherAttacked.checkIfAttacked(permanent, game)) {
|
||||
attackedOrBlocked = true;
|
||||
|
|
|
@ -531,11 +531,6 @@ public class GameState implements Serializable, Copyable<GameState> {
|
|||
return this.turnMods;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public Watchers getWatchers() {
|
||||
return this.watchers;
|
||||
}
|
||||
|
||||
public <T extends Watcher> T getWatcher(Class<T> watcherClass) {
|
||||
return watcherClass.cast(watchers.get(watcherClass.getSimpleName()));
|
||||
}
|
||||
|
|
|
@ -60,7 +60,7 @@ public abstract class GameTinyLeadersImpl extends GameImpl {
|
|||
// ability.addEffect(new CommanderManaReplacementEffect(player.getId(), CardUtil.getColorIdentity(commander)));
|
||||
getState().setValue(commander.getId() + "_castCount", 0);
|
||||
CommanderInfoWatcher watcher = new CommanderInfoWatcher(commander.getId(), false);
|
||||
getState().getWatchers().add(watcher);
|
||||
getState().addWatcher(watcher);
|
||||
watcher.addCardInfoToCommander(this);
|
||||
} else {
|
||||
throw new UnknownError("Commander card could not be created. Name: [" + player.getMatchPlayer().getDeck().getName() + ']');
|
||||
|
|
Loading…
Reference in a new issue