implement [MH3] Volatile Stormdrake ; provide source Ability to canBeTargetedBy and HexproofBaseAbility::checkObject

This commit is contained in:
Susucre 2024-06-06 16:52:53 +02:00
parent 8ec4ffd9de
commit 2d625f0364
49 changed files with 399 additions and 171 deletions

View file

@ -85,8 +85,8 @@ public class TargetPermanentOrPlayer extends TargetImpl {
MageObject targetSource = game.getObject(source);
if (permanent != null) {
if (!isNotTarget()) {
if (!permanent.canBeTargetedBy(game.getObject(source.getId()), source.getControllerId(), game)
|| !permanent.canBeTargetedBy(game.getObject(source), source.getControllerId(), game)) {
if (!permanent.canBeTargetedBy(game.getObject(source.getId()), source.getControllerId(), source, game)
|| !permanent.canBeTargetedBy(game.getObject(source), source.getControllerId(), source, game)) {
return false;
}
}
@ -94,7 +94,7 @@ public class TargetPermanentOrPlayer extends TargetImpl {
}
if (player != null) {
if (!isNotTarget()) {
if (!player.canBeTargetedBy(targetSource, source.getControllerId(), game)
if (!player.canBeTargetedBy(targetSource, source.getControllerId(), source, game)
|| !filter.match(player, source.getControllerId(), source, game)) {
return false;
}
@ -126,7 +126,7 @@ public class TargetPermanentOrPlayer extends TargetImpl {
MageObject targetSource = game.getObject(source);
for (UUID playerId : game.getState().getPlayersInRange(sourceControllerId, game)) {
Player player = game.getPlayer(playerId);
if (player != null && player.canBeTargetedBy(targetSource, sourceControllerId, game) && filter.match(player, sourceControllerId, source, game)) {
if (player != null && player.canBeTargetedBy(targetSource, sourceControllerId, source, game) && filter.match(player, sourceControllerId, source, game)) {
count++;
if (count >= this.minNumberOfTargets) {
return true;
@ -134,7 +134,7 @@ public class TargetPermanentOrPlayer extends TargetImpl {
}
}
for (Permanent permanent : game.getBattlefield().getActivePermanents(filter.getPermanentFilter(), sourceControllerId, game)) {
if (permanent.canBeTargetedBy(targetSource, sourceControllerId, game) && filter.match(permanent, sourceControllerId, source, game)) {
if (permanent.canBeTargetedBy(targetSource, sourceControllerId, source, game) && filter.match(permanent, sourceControllerId, source, game)) {
count++;
if (count >= this.minNumberOfTargets) {
return true;
@ -183,12 +183,12 @@ public class TargetPermanentOrPlayer extends TargetImpl {
MageObject targetSource = game.getObject(source);
for (UUID playerId : game.getState().getPlayersInRange(sourceControllerId, game)) {
Player player = game.getPlayer(playerId);
if (player != null && (notTarget || player.canBeTargetedBy(targetSource, sourceControllerId, game)) && filter.match(player, sourceControllerId, source, game)) {
if (player != null && (notTarget || player.canBeTargetedBy(targetSource, sourceControllerId, source, game)) && filter.match(player, sourceControllerId, source, game)) {
possibleTargets.add(playerId);
}
}
for (Permanent permanent : game.getBattlefield().getActivePermanents(filter.getPermanentFilter(), sourceControllerId, game)) {
if ((notTarget || permanent.canBeTargetedBy(targetSource, sourceControllerId, game)) && filter.match(permanent, sourceControllerId, source, game)) {
if ((notTarget || permanent.canBeTargetedBy(targetSource, sourceControllerId, source, game)) && filter.match(permanent, sourceControllerId, source, game)) {
possibleTargets.add(permanent.getId());
}
}