Merge pull request #9117 from DeepCrimson/removeUnusedParamFromContainsMethod

Refactor: Remove unused `sourceID` param from `contains` method
This commit is contained in:
Oleg Agafonov 2022-06-17 08:40:57 +04:00 committed by GitHub
commit 4e20c4c475
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 12 additions and 13 deletions

View file

@ -64,7 +64,7 @@ class LandwalkEffect extends RestrictionEffect {
@Override
public boolean canBeBlocked(Permanent attacker, Permanent blocker, Ability source, Game game, boolean canUseChooseDialogs) {
if (game.getBattlefield().contains(filter, source.getSourceId(), blocker.getControllerId(), source, game, 1)
if (game.getBattlefield().contains(filter, blocker.getControllerId(), source, game, 1)
&& null == game.getContinuousEffects().asThough(blocker.getId(), AsThoughEffectType.BLOCK_LANDWALK, null, blocker.getControllerId(), game)) {
switch (filter.getMessage()) {
case "plains":

View file

@ -2555,7 +2555,7 @@ public abstract class GameImpl implements Game {
filterLegendName.add(SuperType.LEGENDARY.getPredicate());
filterLegendName.add(new NamePredicate(legend.getName()));
filterLegendName.add(new ControllerIdPredicate(legend.getControllerId()));
if (getBattlefield().contains(filterLegendName, null, legend.getControllerId(), null, this, 2)) {
if (getBattlefield().contains(filterLegendName, legend.getControllerId(), null, this, 2)) {
if (!replaceEvent(GameEvent.getEvent(GameEvent.EventType.DESTROY_PERMANENT_BY_LEGENDARY_RULE, legend.getId(), legend.getControllerId()))) {
Player controller = this.getPlayer(legend.getControllerId());
if (controller != null) {

View file

@ -120,7 +120,7 @@ public class Battlefield implements Serializable {
}
public boolean contains(FilterPermanent filter, Ability source, Game game, int num) {
return contains(filter, source.getSourceId(), source.getControllerId(), source, game, num);
return contains(filter, source.getControllerId(), source, game, num);
}
/**
@ -129,14 +129,13 @@ public class Battlefield implements Serializable {
* matches the supplied filter.
*
* @param filter
* @param sourceId can be null for default SBA checks like legendary rule
* @param sourcePlayerId
* @param source
* @param game
* @param num
* @return boolean
*/
public boolean contains(FilterPermanent filter, UUID sourceId, UUID sourcePlayerId, Ability source, Game game, int num) {
public boolean contains(FilterPermanent filter, UUID sourcePlayerId, Ability source, Game game, int num) {
if (game.getRangeOfInfluence() == RangeOfInfluence.ALL) {
return field.values().stream()
.filter(permanent -> filter.match(permanent, sourcePlayerId, source, game)