Add missing files from last commit

This commit is contained in:
Alex W. Jackson 2022-09-03 06:04:31 -04:00
parent ce610be087
commit fbccdd3088
4 changed files with 199 additions and 0 deletions

View file

@ -0,0 +1,33 @@
package mage.filter.predicate.permanent;
import mage.filter.predicate.ObjectSourcePlayer;
import mage.filter.predicate.ObjectSourcePlayerPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import java.util.UUID;
public enum AttachedOrShareCreatureTypePredicate implements ObjectSourcePlayerPredicate<Permanent> {
instance;
@Override
public boolean apply(ObjectSourcePlayer<Permanent> input, Game game) {
Permanent attachment = input.getSource().getSourcePermanentOrLKI(game);
if (attachment == null) {
return false;
}
UUID attachedId = attachment.getAttachedTo();
if (attachedId == null) {
return false;
}
Permanent otherPermanent = input.getObject();
if (attachedId.equals(otherPermanent.getId())) {
return true;
}
Permanent attachedPermanent = game.getPermanentOrLKIBattlefield(attachedId);
if (attachedPermanent == null) {
return false;
}
return attachedPermanent.shareCreatureTypes(game, otherPermanent);
}
}