replace public fields with encapsulation

This commit is contained in:
Ingmar Goudt 2019-03-03 09:51:14 +01:00
parent d1e319787c
commit 8319fbf9ad
26 changed files with 544 additions and 327 deletions

View file

@ -98,7 +98,7 @@ class ScoutsWarningAsThoughEffect extends AsThoughEffectImpl {
class ScoutsWarningWatcher extends Watcher {
public List<String> activeScoutsWarningSpells = new ArrayList<>();
private List<String> activeScoutsWarningSpells = new ArrayList<>();
public ScoutsWarningWatcher() {
super(ScoutsWarningWatcher.class.getSimpleName(), WatcherScope.PLAYER);
@ -116,10 +116,10 @@ class ScoutsWarningWatcher extends Watcher {
@Override
public void watch(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.SPELL_CAST) {
if (!activeScoutsWarningSpells.isEmpty() && event.getPlayerId().equals(getControllerId())) {
if (!getActiveScoutsWarningSpells().isEmpty() && event.getPlayerId().equals(getControllerId())) {
Spell spell = game.getStack().getSpell(event.getTargetId());
if (spell != null && spell.isCreature()) {
activeScoutsWarningSpells.clear();
getActiveScoutsWarningSpells().clear();
}
}
}
@ -127,18 +127,25 @@ class ScoutsWarningWatcher extends Watcher {
public void addScoutsWarningSpell(UUID sourceId, int zoneChangeCounter) {
String spellKey = sourceId.toString() + '_' + zoneChangeCounter;
activeScoutsWarningSpells.add(spellKey);
getActiveScoutsWarningSpells().add(spellKey);
}
public boolean isScoutsWarningSpellActive(UUID sourceId, int zoneChangeCounter) {
String spellKey = sourceId.toString() + '_' + zoneChangeCounter;
return activeScoutsWarningSpells.contains(spellKey);
return getActiveScoutsWarningSpells().contains(spellKey);
}
@Override
public void reset() {
super.reset();
activeScoutsWarningSpells.clear();
getActiveScoutsWarningSpells().clear();
}
public List<String> getActiveScoutsWarningSpells() {
return activeScoutsWarningSpells;
}
public void setActiveScoutsWarningSpells(List<String> activeScoutsWarningSpells) {
this.activeScoutsWarningSpells = activeScoutsWarningSpells;
}
}

View file

@ -41,7 +41,7 @@ public final class TemurCharm extends CardImpl {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{G}{U}{R}");
// Choose one -
// <strong><EFBFBD></strong> Target creature you control gets +1/+1 until end of turn. That creature fights target creature you don't control.
// Target creature you control gets +1/+1 until end of turn. That creature fights target creature you don't control.
Effect effect = new BoostTargetEffect(1, 1, Duration.EndOfTurn);
this.getSpellAbility().addEffect(effect);
effect = new FightTargetsEffect();
@ -51,20 +51,20 @@ public final class TemurCharm extends CardImpl {
Target target = new TargetCreaturePermanent(filter);
this.getSpellAbility().addTarget(target);
// <strong><EFBFBD></strong> Counter target spell unless its controller pays {3}.
// Counter target spell unless its controller pays {3}.
Mode mode = new Mode();
mode.addEffect(new CounterUnlessPaysEffect(new GenericManaCost(3)));
mode.addTarget(new TargetSpell());
this.getSpellAbility().addMode(mode);
// <strong><EFBFBD></strong> Creatures with power 3 or less can't block this turn.
// Creatures with power 3 or less can't block this turn.
mode = new Mode();
mode.addEffect(new CantBlockAllEffect(filterCantBlock, Duration.EndOfTurn));
this.getSpellAbility().addMode(mode);
}
public TemurCharm(final TemurCharm card) {
private TemurCharm(final TemurCharm card) {
super(card);
}