mirror of
https://github.com/correl/mage.git
synced 2024-11-22 03:00:11 +00:00
fixed some NPE issues with player target choosing
This commit is contained in:
parent
a6c2daeb5e
commit
945b60c8d0
5 changed files with 8 additions and 8 deletions
|
@ -535,7 +535,7 @@ public class HumanPlayer extends PlayerImpl {
|
|||
updateGameStatePriority("choose(5)", game);
|
||||
prepareForResponse(game);
|
||||
if (!isExecutingMacro()) {
|
||||
game.fireSelectTargetEvent(getId(), new MessageToClient(target.getMessage(), getRelatedObjectName(source.getSourceId(), game)), targetIds, required, getOptions(target, options));
|
||||
game.fireSelectTargetEvent(getId(), new MessageToClient(target.getMessage(), getRelatedObjectName(source, game)), targetIds, required, getOptions(target, options));
|
||||
}
|
||||
waitForResponse(game);
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@ class DrafnasRestorationTarget extends TargetCardInGraveyard {
|
|||
Player targetPlayer = game.getPlayer(((StackObject) object).getStackAbility().getFirstTarget());
|
||||
if (targetPlayer != null) {
|
||||
for (Card card : targetPlayer.getGraveyard().getCards(filter, sourceControllerId, source, game)) {
|
||||
if (source.getSourceId() == null || isNotTarget() || !game.replaceEvent(new TargetEvent(card, source.getSourceId(), sourceControllerId))) {
|
||||
if (source == null || source.getSourceId() == null || isNotTarget() || !game.replaceEvent(new TargetEvent(card, source.getSourceId(), sourceControllerId))) {
|
||||
possibleTargets.add(card.getId());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -61,7 +61,7 @@ public class TargetCardInHand extends TargetCard {
|
|||
Player player = game.getPlayer(sourceControllerId);
|
||||
if (player != null) {
|
||||
for (Card card : player.getHand().getCards(filter, sourceControllerId, source, game)) {
|
||||
if (source.getSourceId() == null || isNotTarget() || !game.replaceEvent(new TargetEvent(card, source.getSourceId(), sourceControllerId))) {
|
||||
if (source == null || source.getSourceId() == null || isNotTarget() || !game.replaceEvent(new TargetEvent(card, source.getSourceId(), sourceControllerId))) {
|
||||
possibleTargets.add(card.getId());
|
||||
}
|
||||
}
|
||||
|
@ -75,7 +75,7 @@ public class TargetCardInHand extends TargetCard {
|
|||
Player player = game.getPlayer(sourceControllerId);
|
||||
if (player != null) {
|
||||
for (Card card : player.getHand().getCards(filter, sourceControllerId, source, game)) {
|
||||
if (source.getSourceId() == null || isNotTarget() || !game.replaceEvent(new TargetEvent(card, source.getSourceId(), sourceControllerId))) {
|
||||
if (source == null || source.getSourceId() == null || isNotTarget() || !game.replaceEvent(new TargetEvent(card, source.getSourceId(), sourceControllerId))) {
|
||||
possibleTargets++;
|
||||
if (possibleTargets >= this.minNumberOfTargets) {
|
||||
return true;
|
||||
|
|
|
@ -100,7 +100,7 @@ public class TargetCardInOpponentsGraveyard extends TargetCard {
|
|||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
for (Card card : player.getGraveyard().getCards(filter, sourceControllerId, source, game)) {
|
||||
if (source.getSourceId() == null || isNotTarget() || !game.replaceEvent(new TargetEvent(card, source.getSourceId(), sourceControllerId))) {
|
||||
if (source == null || source.getSourceId() == null || isNotTarget() || !game.replaceEvent(new TargetEvent(card, source.getSourceId(), sourceControllerId))) {
|
||||
possibleTargets++;
|
||||
if (possibleTargets >= this.minNumberOfTargets) {
|
||||
return true;
|
||||
|
@ -125,7 +125,7 @@ public class TargetCardInOpponentsGraveyard extends TargetCard {
|
|||
if (player != null) {
|
||||
Set<UUID> targetsInThisGraveyeard = new HashSet<>();
|
||||
for (Card card : player.getGraveyard().getCards(filter, sourceControllerId, source, game)) {
|
||||
if (source.getSourceId() == null || isNotTarget() || !game.replaceEvent(new TargetEvent(card, source.getSourceId(), sourceControllerId))) {
|
||||
if (source == null || source.getSourceId() == null || isNotTarget() || !game.replaceEvent(new TargetEvent(card, source.getSourceId(), sourceControllerId))) {
|
||||
targetsInThisGraveyeard.add(card.getId());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -76,7 +76,7 @@ public class TargetCardInYourGraveyard extends TargetCard {
|
|||
Set<UUID> possibleTargets = new HashSet<>();
|
||||
Player player = game.getPlayer(sourceControllerId);
|
||||
for (Card card : player.getGraveyard().getCards(filter, sourceControllerId, source, game)) {
|
||||
if (source.getSourceId() == null || isNotTarget() || !game.replaceEvent(new TargetEvent(card, source.getSourceId(), sourceControllerId))) {
|
||||
if (source == null || source.getSourceId() == null || isNotTarget() || !game.replaceEvent(new TargetEvent(card, source.getSourceId(), sourceControllerId))) {
|
||||
possibleTargets.add(card.getId());
|
||||
}
|
||||
}
|
||||
|
@ -116,7 +116,7 @@ public class TargetCardInYourGraveyard extends TargetCard {
|
|||
}
|
||||
int possibleTargets = 0;
|
||||
for (Card card : player.getGraveyard().getCards(filter, sourceControllerId, source, game)) {
|
||||
if (source.getSourceId() == null || isNotTarget() || !game.replaceEvent(new TargetEvent(card, source.getSourceId(), sourceControllerId))) {
|
||||
if (source == null || source.getSourceId() == null || isNotTarget() || !game.replaceEvent(new TargetEvent(card, source.getSourceId(), sourceControllerId))) {
|
||||
possibleTargets++;
|
||||
if (possibleTargets >= this.minNumberOfTargets) {
|
||||
return true;
|
||||
|
|
Loading…
Reference in a new issue