mirror of
https://github.com/correl/mage.git
synced 2024-11-15 03:00:16 +00:00
Refactor: Remove unused sourceID param from contains method
This commit is contained in:
parent
fdcc4e4458
commit
3192a191a4
9 changed files with 12 additions and 13 deletions
|
@ -68,6 +68,6 @@ enum ArcticFoxesCondition implements Condition {
|
|||
if (defenderId == null) {
|
||||
return false;
|
||||
}
|
||||
return game.getBattlefield().contains(filter, source.getSourceId(), defenderId, source, game, 1);
|
||||
return game.getBattlefield().contains(filter, defenderId, source, game, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -158,7 +158,7 @@ class CityInABottleStateTriggeredAbility extends StateTriggeredAbility {
|
|||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
return game.getBattlefield().contains(filter, this.getSourceId(), this.getControllerId(), this, game, 1);
|
||||
return game.getBattlefield().contains(filter, this.getControllerId(), this, game, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -58,7 +58,7 @@ class HasLowestCMCAmongstNonlandPermanentsPredicate implements ObjectSourcePlaye
|
|||
public boolean apply(ObjectSourcePlayer<Permanent> input, Game game) {
|
||||
FilterPermanent filter = new FilterNonlandPermanent();
|
||||
filter.add(new ManaValuePredicate(ComparisonType.FEWER_THAN, input.getObject().getManaValue()));
|
||||
return !game.getBattlefield().contains(filter, input.getSourceId(), input.getPlayerId(), input.getSource(), game, 1);
|
||||
return !game.getBattlefield().contains(filter, input.getPlayerId(), input.getSource(), game, 1);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -101,7 +101,7 @@ class HeraldOfLeshracCumulativeCost extends CostImpl {
|
|||
|
||||
@Override
|
||||
public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) {
|
||||
return game.getBattlefield().contains(filter, source.getSourceId(), controllerId, source, game, 1);
|
||||
return game.getBattlefield().contains(filter, controllerId, source, game, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -81,6 +81,6 @@ enum SeasingerPredicate implements ObjectSourcePlayerPredicate<Permanent> {
|
|||
|
||||
@Override
|
||||
public boolean apply(ObjectSourcePlayer<Permanent> input, Game game) {
|
||||
return game.getBattlefield().contains(filter, input.getSourceId(), input.getObject().getControllerId(), input.getSource(), game, 1);
|
||||
return game.getBattlefield().contains(filter, input.getObject().getControllerId(), input.getSource(), game, 1);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -124,7 +124,7 @@ class WeddingRingTriggeredAbility extends TriggeredAbilityImpl {
|
|||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (!game.isActivePlayer(event.getPlayerId())
|
||||
|| !game.getOpponents(getControllerId()).contains(event.getPlayerId())
|
||||
|| !game.getBattlefield().contains(filter, getSourceId(), event.getPlayerId(), this, game, 1)) {
|
||||
|| !game.getBattlefield().contains(filter, event.getPlayerId(), this, game, 1)) {
|
||||
return false;
|
||||
}
|
||||
this.getEffects().clear();
|
||||
|
|
|
@ -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":
|
||||
|
|
|
@ -2583,7 +2583,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) {
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue