Merge pull request #9116 from DeepCrimson/removeUnusedParamFromContainsControlled

Refactor: Remove unused sourceID param from `containsControlled` method
This commit is contained in:
Oleg Agafonov 2022-06-17 08:41:25 +04:00 committed by GitHub
commit 6bf9f45cd5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 5 deletions

View file

@ -79,7 +79,7 @@ class RemorselessPunishmentEffect extends OneShotEffect {
return;
}
}
if (game.getBattlefield().containsControlled(filter, source.getSourceId(), opponent.getId(), source, game, 1)) {
if (game.getBattlefield().containsControlled(filter, opponent.getId(), source, game, 1)) {
if (opponent.chooseUse(outcome, "Choose your " + iteration + " punishment.", null, "Sacrifice a creature or planeswalker", "Lose 5 life", source, game)) {
TargetPermanent target = new TargetPermanent(1, 1, filter, true);
if (target.choose(Outcome.Sacrifice, opponent.getId(), source.getId(), source, game)) {

View file

@ -93,7 +93,7 @@ public class Battlefield implements Serializable {
}
public boolean containsControlled(FilterPermanent filter, Ability source, Game game, int num) {
return containsControlled(filter, source.getSourceId(), source.getControllerId(), source, game, num);
return containsControlled(filter, source.getControllerId(), source, game, num);
}
/**
@ -102,21 +102,19 @@ public class Battlefield implements Serializable {
* ignores the range of influence.
*
* @param filter
* @param sourceId
* @param controllerId controller and source can be different (from different players)
* @param source
* @param game
* @param num
* @return boolean
*/
public boolean containsControlled(FilterPermanent filter, UUID sourceId, UUID controllerId, Ability source, Game game, int num) {
public boolean containsControlled(FilterPermanent filter, UUID controllerId, Ability source, Game game, int num) {
return field.values()
.stream()
.filter(permanent -> permanent.isControlledBy(controllerId)
&& filter.match(permanent, controllerId, source, game)
&& permanent.isPhasedIn())
.count() >= num;
}
public boolean contains(FilterPermanent filter, Ability source, Game game, int num) {