mirror of
https://github.com/correl/mage.git
synced 2025-04-01 19:07:57 -09:00
Fixed in setting priority.
This commit is contained in:
parent
7690899fab
commit
a6c3e03885
2 changed files with 22 additions and 0 deletions
Mage.Server.Plugins/Mage.Player.Human/src/mage/player/human
Mage.Server/plugins
|
@ -139,6 +139,7 @@ public class HumanPlayer extends PlayerImpl<HumanPlayer> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean chooseMulligan(Game game) {
|
public boolean chooseMulligan(Game game) {
|
||||||
|
game.getState().setPriorityPlayerId(getId());
|
||||||
game.fireAskPlayerEvent(playerId, "Do you want to take a mulligan?");
|
game.fireAskPlayerEvent(playerId, "Do you want to take a mulligan?");
|
||||||
waitForBooleanResponse();
|
waitForBooleanResponse();
|
||||||
if (!abort)
|
if (!abort)
|
||||||
|
@ -148,6 +149,7 @@ public class HumanPlayer extends PlayerImpl<HumanPlayer> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean chooseUse(Outcome outcome, String message, Game game) {
|
public boolean chooseUse(Outcome outcome, String message, Game game) {
|
||||||
|
game.getState().setPriorityPlayerId(getId());
|
||||||
game.fireAskPlayerEvent(playerId, message);
|
game.fireAskPlayerEvent(playerId, message);
|
||||||
waitForBooleanResponse();
|
waitForBooleanResponse();
|
||||||
if (!abort)
|
if (!abort)
|
||||||
|
@ -157,6 +159,7 @@ public class HumanPlayer extends PlayerImpl<HumanPlayer> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int chooseEffect(List<ReplacementEffect> rEffects, Game game) {
|
public int chooseEffect(List<ReplacementEffect> rEffects, Game game) {
|
||||||
|
game.getState().setPriorityPlayerId(getId());
|
||||||
replacementEffectChoice.getChoices().clear();
|
replacementEffectChoice.getChoices().clear();
|
||||||
for (ReplacementEffect effect: rEffects) {
|
for (ReplacementEffect effect: rEffects) {
|
||||||
replacementEffectChoice.getChoices().add(effect.getText(null));
|
replacementEffectChoice.getChoices().add(effect.getText(null));
|
||||||
|
@ -179,6 +182,7 @@ public class HumanPlayer extends PlayerImpl<HumanPlayer> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean choose(Outcome outcome, Choice choice, Game game) {
|
public boolean choose(Outcome outcome, Choice choice, Game game) {
|
||||||
|
game.getState().setPriorityPlayerId(getId());
|
||||||
while (!abort) {
|
while (!abort) {
|
||||||
game.fireChooseEvent(playerId, choice);
|
game.fireChooseEvent(playerId, choice);
|
||||||
waitForResponse();
|
waitForResponse();
|
||||||
|
@ -199,6 +203,7 @@ public class HumanPlayer extends PlayerImpl<HumanPlayer> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean choose(Outcome outcome, Target target, Game game, Map<String, Serializable> options) {
|
public boolean choose(Outcome outcome, Target target, Game game, Map<String, Serializable> options) {
|
||||||
|
game.getState().setPriorityPlayerId(getId());
|
||||||
while (!abort) {
|
while (!abort) {
|
||||||
game.fireSelectTargetEvent(playerId, target.getMessage(), target.possibleTargets(null, playerId, game), target.isRequired(), options);
|
game.fireSelectTargetEvent(playerId, target.getMessage(), target.possibleTargets(null, playerId, game), target.isRequired(), options);
|
||||||
waitForResponse();
|
waitForResponse();
|
||||||
|
@ -222,6 +227,7 @@ public class HumanPlayer extends PlayerImpl<HumanPlayer> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean chooseTarget(Outcome outcome, Target target, Ability source, Game game) {
|
public boolean chooseTarget(Outcome outcome, Target target, Ability source, Game game) {
|
||||||
|
game.getState().setPriorityPlayerId(getId());
|
||||||
while (!abort) {
|
while (!abort) {
|
||||||
game.fireSelectTargetEvent(playerId, target.getMessage(), target.possibleTargets(source==null?null:source.getId(), playerId, game), target.isRequired(), null);
|
game.fireSelectTargetEvent(playerId, target.getMessage(), target.possibleTargets(source==null?null:source.getId(), playerId, game), target.isRequired(), null);
|
||||||
waitForResponse();
|
waitForResponse();
|
||||||
|
@ -245,6 +251,7 @@ public class HumanPlayer extends PlayerImpl<HumanPlayer> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean choose(Outcome outcome, Cards cards, TargetCard target, Game game) {
|
public boolean choose(Outcome outcome, Cards cards, TargetCard target, Game game) {
|
||||||
|
game.getState().setPriorityPlayerId(getId());
|
||||||
while (!abort) {
|
while (!abort) {
|
||||||
boolean required = target.isRequired();
|
boolean required = target.isRequired();
|
||||||
// if there is no cards to select from, then add possibility to cancel choosing action
|
// if there is no cards to select from, then add possibility to cancel choosing action
|
||||||
|
@ -270,6 +277,7 @@ public class HumanPlayer extends PlayerImpl<HumanPlayer> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean chooseTarget(Outcome outcome, Cards cards, TargetCard target, Ability source, Game game) {
|
public boolean chooseTarget(Outcome outcome, Cards cards, TargetCard target, Ability source, Game game) {
|
||||||
|
game.getState().setPriorityPlayerId(getId());
|
||||||
while (!abort) {
|
while (!abort) {
|
||||||
game.fireSelectTargetEvent(playerId, target.getMessage(), cards, target.isRequired());
|
game.fireSelectTargetEvent(playerId, target.getMessage(), cards, target.isRequired());
|
||||||
waitForResponse();
|
waitForResponse();
|
||||||
|
@ -287,6 +295,7 @@ public class HumanPlayer extends PlayerImpl<HumanPlayer> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean chooseTargetAmount(Outcome outcome, TargetAmount target, Ability source, Game game) {
|
public boolean chooseTargetAmount(Outcome outcome, TargetAmount target, Ability source, Game game) {
|
||||||
|
game.getState().setPriorityPlayerId(getId());
|
||||||
while (!abort) {
|
while (!abort) {
|
||||||
game.fireSelectTargetEvent(playerId, target.getMessage() + "\n Amount remaining:" + target.getAmountRemaining(), target.possibleTargets(source==null?null:source.getId(), playerId, game), target.isRequired(), null);
|
game.fireSelectTargetEvent(playerId, target.getMessage() + "\n Amount remaining:" + target.getAmountRemaining(), target.possibleTargets(source==null?null:source.getId(), playerId, game), target.isRequired(), null);
|
||||||
waitForResponse();
|
waitForResponse();
|
||||||
|
@ -346,6 +355,7 @@ public class HumanPlayer extends PlayerImpl<HumanPlayer> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TriggeredAbility chooseTriggeredAbility(TriggeredAbilities abilities, Game game) {
|
public TriggeredAbility chooseTriggeredAbility(TriggeredAbilities abilities, Game game) {
|
||||||
|
game.getState().setPriorityPlayerId(getId());
|
||||||
while (!abort) {
|
while (!abort) {
|
||||||
game.fireSelectTargetEvent(playerId, "Pick triggered ability", abilities, true);
|
game.fireSelectTargetEvent(playerId, "Pick triggered ability", abilities, true);
|
||||||
waitForResponse();
|
waitForResponse();
|
||||||
|
@ -361,6 +371,7 @@ public class HumanPlayer extends PlayerImpl<HumanPlayer> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean playMana(ManaCost unpaid, Game game) {
|
public boolean playMana(ManaCost unpaid, Game game) {
|
||||||
|
game.getState().setPriorityPlayerId(getId());
|
||||||
game.firePlayManaEvent(playerId, "Pay " + unpaid.getText());
|
game.firePlayManaEvent(playerId, "Pay " + unpaid.getText());
|
||||||
waitForResponse();
|
waitForResponse();
|
||||||
if (response.getBoolean() != null) {
|
if (response.getBoolean() != null) {
|
||||||
|
@ -386,6 +397,7 @@ public class HumanPlayer extends PlayerImpl<HumanPlayer> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean playXMana(VariableManaCost cost, ManaCosts<ManaCost> costs, Game game) {
|
public boolean playXMana(VariableManaCost cost, ManaCosts<ManaCost> costs, Game game) {
|
||||||
|
game.getState().setPriorityPlayerId(getId());
|
||||||
game.firePlayXManaEvent(playerId, "Pay {X}: {X}=" + cost.getAmount());
|
game.firePlayXManaEvent(playerId, "Pay {X}: {X}=" + cost.getAmount());
|
||||||
waitForResponse();
|
waitForResponse();
|
||||||
if (response.getBoolean() != null) {
|
if (response.getBoolean() != null) {
|
||||||
|
@ -399,6 +411,7 @@ public class HumanPlayer extends PlayerImpl<HumanPlayer> {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void playManaAbilities(Game game) {
|
protected void playManaAbilities(Game game) {
|
||||||
|
game.getState().setPriorityPlayerId(getId());
|
||||||
MageObject object = game.getObject(response.getUUID());
|
MageObject object = game.getObject(response.getUUID());
|
||||||
if (object == null) return;
|
if (object == null) return;
|
||||||
Map<UUID, ActivatedAbility> useableAbilities;
|
Map<UUID, ActivatedAbility> useableAbilities;
|
||||||
|
@ -426,6 +439,7 @@ public class HumanPlayer extends PlayerImpl<HumanPlayer> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void selectAttackers(Game game) {
|
public void selectAttackers(Game game) {
|
||||||
|
game.getState().setPriorityPlayerId(getId());
|
||||||
while (!abort) {
|
while (!abort) {
|
||||||
targetCombat.getTargets().clear();
|
targetCombat.getTargets().clear();
|
||||||
game.fireSelectEvent(playerId, "Select attackers");
|
game.fireSelectEvent(playerId, "Select attackers");
|
||||||
|
@ -457,6 +471,7 @@ public class HumanPlayer extends PlayerImpl<HumanPlayer> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void selectBlockers(Game game) {
|
public void selectBlockers(Game game) {
|
||||||
|
game.getState().setPriorityPlayerId(getId());
|
||||||
while (!abort) {
|
while (!abort) {
|
||||||
targetCombat.getTargets().clear();
|
targetCombat.getTargets().clear();
|
||||||
game.fireSelectEvent(playerId, "Select blockers");
|
game.fireSelectEvent(playerId, "Select blockers");
|
||||||
|
@ -473,6 +488,7 @@ public class HumanPlayer extends PlayerImpl<HumanPlayer> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public UUID chooseAttackerOrder(List<Permanent> attackers, Game game) {
|
public UUID chooseAttackerOrder(List<Permanent> attackers, Game game) {
|
||||||
|
game.getState().setPriorityPlayerId(getId());
|
||||||
while (!abort) {
|
while (!abort) {
|
||||||
game.fireSelectTargetEvent(playerId, "Pick attacker", attackers, true);
|
game.fireSelectTargetEvent(playerId, "Pick attacker", attackers, true);
|
||||||
waitForResponse();
|
waitForResponse();
|
||||||
|
@ -489,6 +505,7 @@ public class HumanPlayer extends PlayerImpl<HumanPlayer> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public UUID chooseBlockerOrder(List<Permanent> blockers, Game game) {
|
public UUID chooseBlockerOrder(List<Permanent> blockers, Game game) {
|
||||||
|
game.getState().setPriorityPlayerId(getId());
|
||||||
while (!abort) {
|
while (!abort) {
|
||||||
game.fireSelectTargetEvent(playerId, "Pick blocker", blockers, true);
|
game.fireSelectTargetEvent(playerId, "Pick blocker", blockers, true);
|
||||||
waitForResponse();
|
waitForResponse();
|
||||||
|
@ -503,6 +520,7 @@ public class HumanPlayer extends PlayerImpl<HumanPlayer> {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void selectCombatGroup(UUID blockerId, Game game) {
|
protected void selectCombatGroup(UUID blockerId, Game game) {
|
||||||
|
game.getState().setPriorityPlayerId(getId());
|
||||||
TargetAttackingCreature target = new TargetAttackingCreature();
|
TargetAttackingCreature target = new TargetAttackingCreature();
|
||||||
game.fireSelectTargetEvent(playerId, "Select attacker to block", target.possibleTargets(null, playerId, game), target.isRequired(), null);
|
game.fireSelectTargetEvent(playerId, "Select attacker to block", target.possibleTargets(null, playerId, game), target.isRequired(), null);
|
||||||
waitForResponse();
|
waitForResponse();
|
||||||
|
@ -515,6 +533,7 @@ public class HumanPlayer extends PlayerImpl<HumanPlayer> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void assignDamage(int damage, List<UUID> targets, String singleTargetName, UUID sourceId, Game game) {
|
public void assignDamage(int damage, List<UUID> targets, String singleTargetName, UUID sourceId, Game game) {
|
||||||
|
game.getState().setPriorityPlayerId(getId());
|
||||||
int remainingDamage = damage;
|
int remainingDamage = damage;
|
||||||
while (remainingDamage > 0) {
|
while (remainingDamage > 0) {
|
||||||
Target target = new TargetCreatureOrPlayer();
|
Target target = new TargetCreatureOrPlayer();
|
||||||
|
@ -540,6 +559,7 @@ public class HumanPlayer extends PlayerImpl<HumanPlayer> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getAmount(int min, int max, String message, Game game) {
|
public int getAmount(int min, int max, String message, Game game) {
|
||||||
|
game.getState().setPriorityPlayerId(getId());
|
||||||
game.fireGetAmountEvent(playerId, message, min, max);
|
game.fireGetAmountEvent(playerId, message, min, max);
|
||||||
waitForIntegerResponse();
|
waitForIntegerResponse();
|
||||||
return response.getInteger();
|
return response.getInteger();
|
||||||
|
@ -571,6 +591,7 @@ public class HumanPlayer extends PlayerImpl<HumanPlayer> {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void activateAbility(Map<UUID, ? extends ActivatedAbility> abilities, Game game) {
|
protected void activateAbility(Map<UUID, ? extends ActivatedAbility> abilities, Game game) {
|
||||||
|
game.getState().setPriorityPlayerId(getId());
|
||||||
if (abilities.size() == 1) {
|
if (abilities.size() == 1) {
|
||||||
ActivatedAbility ability = abilities.values().iterator().next();
|
ActivatedAbility ability = abilities.values().iterator().next();
|
||||||
if (ability.getTargets().size() != 0 || !(ability.getCosts().size() == 1 && ability.getCosts().get(0) instanceof SacrificeSourceCost)) {
|
if (ability.getTargets().size() != 0 || !(ability.getCosts().size() == 1 && ability.getCosts().get(0) instanceof SacrificeSourceCost)) {
|
||||||
|
@ -588,6 +609,7 @@ public class HumanPlayer extends PlayerImpl<HumanPlayer> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Mode chooseMode(Modes modes, Ability source, Game game) {
|
public Mode chooseMode(Modes modes, Ability source, Game game) {
|
||||||
|
game.getState().setPriorityPlayerId(getId());
|
||||||
if (modes.size() > 1) {
|
if (modes.size() > 1) {
|
||||||
MageObject obj = game.getObject(source.getSourceId());
|
MageObject obj = game.getObject(source.getSourceId());
|
||||||
Map<UUID, String> modeMap = new HashMap<UUID, String>();
|
Map<UUID, String> modeMap = new HashMap<UUID, String>();
|
||||||
|
|
Binary file not shown.
Loading…
Add table
Reference in a new issue