forked from External/mage
fixed Liliana Of The Veil npe when targeting tokens + added choose pile dialog
This commit is contained in:
parent
f14559d71d
commit
6205ebaeb9
18 changed files with 511 additions and 199 deletions
|
|
@ -30,10 +30,8 @@ package mage.game.events;
|
|||
|
||||
import java.io.Serializable;
|
||||
import java.util.*;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.ActivatedAbility;
|
||||
import mage.abilities.TriggeredAbilities;
|
||||
import mage.abilities.TriggeredAbility;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.Cards;
|
||||
|
|
@ -46,7 +44,7 @@ import mage.game.permanent.Permanent;
|
|||
public class PlayerQueryEvent extends EventObject implements ExternalEvent, Serializable {
|
||||
|
||||
public enum QueryType {
|
||||
ASK, CHOOSE, CHOOSE_ABILITY, CHOOSE_MODE, PICK_TARGET, PICK_ABILITY, SELECT, PLAY_MANA, PLAY_X_MANA, AMOUNT, LOOK, PICK_CARD, CONSTRUCT
|
||||
ASK, CHOOSE, CHOOSE_ABILITY, CHOOSE_MODE, PICK_TARGET, PICK_ABILITY, SELECT, PLAY_MANA, PLAY_X_MANA, AMOUNT, LOOK, PICK_CARD, CONSTRUCT, CHOOSE_PILE
|
||||
}
|
||||
|
||||
private String message;
|
||||
|
|
@ -63,6 +61,9 @@ public class PlayerQueryEvent extends EventObject implements ExternalEvent, Seri
|
|||
private int max;
|
||||
private Map<String, Serializable> options;
|
||||
private Map<UUID, String> modes;
|
||||
private List<? extends Card> pile1;
|
||||
private List<? extends Card> pile2;
|
||||
|
||||
|
||||
private PlayerQueryEvent(UUID playerId, String message, Collection<? extends Ability> abilities, Set<String> choices, Set<UUID> targets, Cards cards, QueryType queryType, int min, int max, boolean required, Map<String, Serializable> options) {
|
||||
this(playerId, message, abilities, choices, targets, cards, queryType, min, max, required);
|
||||
|
|
@ -116,6 +117,15 @@ public class PlayerQueryEvent extends EventObject implements ExternalEvent, Seri
|
|||
this.playerId = playerId;
|
||||
this.modes = modes;
|
||||
}
|
||||
|
||||
private PlayerQueryEvent(UUID playerId, String message, List<? extends Card> pile1, List<? extends Card> pile2) {
|
||||
super(playerId);
|
||||
this.queryType = QueryType.CHOOSE_PILE;
|
||||
this.message = message;
|
||||
this.playerId = playerId;
|
||||
this.pile1 = pile1;
|
||||
this.pile2 = pile2;
|
||||
}
|
||||
|
||||
public static PlayerQueryEvent askEvent(UUID playerId, String message) {
|
||||
return new PlayerQueryEvent(playerId, message, null, null, null, null, QueryType.ASK, 0, 0, false);
|
||||
|
|
@ -125,7 +135,11 @@ public class PlayerQueryEvent extends EventObject implements ExternalEvent, Seri
|
|||
return new PlayerQueryEvent(playerId, message, choices, null, null, null, QueryType.CHOOSE_ABILITY, 0, 0, false);
|
||||
}
|
||||
|
||||
public static PlayerQueryEvent chooseModeEvent(UUID playerId, String message, Map<UUID, String> modes) {
|
||||
public static PlayerQueryEvent choosePileEvent(UUID playerId, String message, List<? extends Card> pile1, List<? extends Card> pile2) {
|
||||
return new PlayerQueryEvent(playerId, message, pile1, pile2);
|
||||
}
|
||||
|
||||
public static PlayerQueryEvent chooseModeEvent(UUID playerId, String message, Map<UUID, String> modes) {
|
||||
return new PlayerQueryEvent(playerId, message, modes);
|
||||
}
|
||||
|
||||
|
|
@ -237,4 +251,13 @@ public class PlayerQueryEvent extends EventObject implements ExternalEvent, Seri
|
|||
public Map<UUID, String> getModes() {
|
||||
return modes;
|
||||
}
|
||||
|
||||
public List<? extends Card> getPile1() {
|
||||
return pile1;
|
||||
}
|
||||
|
||||
public List<? extends Card> getPile2() {
|
||||
return pile2;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue