mirror of
https://github.com/magefree/mage.git
synced 2025-12-26 13:32:06 -08:00
[MIC] Implemented Sigardian Zealot
This commit is contained in:
parent
6a174d58cf
commit
244cacfe3b
4 changed files with 174 additions and 34 deletions
|
|
@ -0,0 +1,53 @@
|
|||
package mage.target.common;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.TargetPermanent;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public class TargetCreaturesWithDifferentPowers extends TargetPermanent {
|
||||
|
||||
private static final FilterPermanent filter
|
||||
= new FilterCreaturePermanent("creatures with different powers");
|
||||
|
||||
public TargetCreaturesWithDifferentPowers() {
|
||||
super(0, Integer.MAX_VALUE, filter, false);
|
||||
}
|
||||
|
||||
private TargetCreaturesWithDifferentPowers(final TargetCreaturesWithDifferentPowers target) {
|
||||
super(target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TargetCreaturesWithDifferentPowers copy() {
|
||||
return new TargetCreaturesWithDifferentPowers(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canTarget(UUID controllerId, UUID id, Ability source, Game game) {
|
||||
if (!super.canTarget(controllerId, id, source, game)) {
|
||||
return false;
|
||||
}
|
||||
Permanent creature = game.getPermanent(id);
|
||||
if (creature == null) {
|
||||
return false;
|
||||
}
|
||||
return this.getTargets()
|
||||
.stream()
|
||||
.map(game::getPermanent)
|
||||
.filter(Objects::nonNull)
|
||||
.map(MageObject::getPower)
|
||||
.mapToInt(MageInt::getValue)
|
||||
.noneMatch(p -> creature.getPower().getValue() == p);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue