forked from External/mage
Refactoring
We don't need to override basic methods to just call the basic method again.
This commit is contained in:
parent
b626bf6866
commit
a9f2c8c407
6 changed files with 4 additions and 25 deletions
|
|
@ -132,6 +132,6 @@ public class TargetSpell extends TargetObject {
|
|||
private boolean canBeChosen(StackObject stackObject, UUID sourceID, UUID sourceControllerId, Game game) {
|
||||
return stackObject instanceof Spell
|
||||
&& game.getState().getPlayersInRange(sourceControllerId, game).contains(stackObject.getControllerId())
|
||||
&& filter.match((Spell) stackObject, sourceID, sourceControllerId, game);
|
||||
&& filter.match(stackObject, sourceID, sourceControllerId, game);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,7 +28,6 @@
|
|||
package mage.target.common;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
|
|
|||
|
|
@ -56,16 +56,6 @@ public class TargetOpponent extends TargetPlayer {
|
|||
super(target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canChoose(UUID sourceId, UUID sourceControllerId, Game game) {
|
||||
return super.canChoose(sourceId, sourceControllerId, game);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canTarget(UUID id, Ability source, Game game) {
|
||||
return super.canTarget(id, source, game);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TargetOpponent copy() {
|
||||
return new TargetOpponent(this);
|
||||
|
|
|
|||
|
|
@ -28,7 +28,6 @@
|
|||
package mage.watchers;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.UUID;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
|
|
@ -43,7 +42,7 @@ public class Watchers extends HashMap<String, Watcher> {
|
|||
}
|
||||
|
||||
public Watchers(final Watchers watchers) {
|
||||
watchers.entrySet().stream().forEach((entry) -> this.put(entry.getKey(), entry.getValue().copy()));
|
||||
watchers.entrySet().forEach((entry) -> this.put(entry.getKey(), entry.getValue().copy()));
|
||||
}
|
||||
|
||||
public Watchers copy() {
|
||||
|
|
@ -63,7 +62,7 @@ public class Watchers extends HashMap<String, Watcher> {
|
|||
}
|
||||
|
||||
public void reset() {
|
||||
this.values().stream().forEach(Watcher::reset);
|
||||
this.values().forEach(Watcher::reset);
|
||||
}
|
||||
|
||||
public Watcher get(String key, UUID id) {
|
||||
|
|
|
|||
|
|
@ -66,11 +66,7 @@ public class CastFromGraveyardWatcher extends Watcher {
|
|||
if (event.getType() == GameEvent.EventType.SPELL_CAST && event.getZone().equals(Zone.GRAVEYARD)) {
|
||||
Spell spell = (Spell) game.getObject(event.getTargetId());
|
||||
if (spell != null) {
|
||||
HashSet<Integer> zcc = spellsCastFromGraveyard.get(spell.getSourceId());
|
||||
if (zcc == null) {
|
||||
zcc = new HashSet<>();
|
||||
spellsCastFromGraveyard.put(spell.getSourceId(), zcc);
|
||||
}
|
||||
HashSet<Integer> zcc = spellsCastFromGraveyard.computeIfAbsent(spell.getSourceId(), k -> new HashSet<>());
|
||||
zcc.add(spell.getZoneChangeCounter(game));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -64,9 +64,4 @@ public class FirstTimeStepWatcher extends Watcher {
|
|||
condition = true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
super.reset();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue