mirror of
https://github.com/magefree/mage.git
synced 2025-12-21 02:52:02 -08:00
...
This commit is contained in:
parent
ac69e684ad
commit
d74f9ffe5d
1 changed files with 41 additions and 17 deletions
|
|
@ -52,6 +52,7 @@ import mage.filter.common.FilterCreatureForCombat;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
import mage.target.Target;
|
import mage.target.Target;
|
||||||
|
import mage.target.TargetAmount;
|
||||||
import mage.target.TargetCard;
|
import mage.target.TargetCard;
|
||||||
import mage.target.TargetPermanent;
|
import mage.target.TargetPermanent;
|
||||||
import mage.target.common.TargetAttackingCreature;
|
import mage.target.common.TargetAttackingCreature;
|
||||||
|
|
@ -160,20 +161,57 @@ public class HumanPlayer extends PlayerImpl {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean chooseTarget(Cards cards, TargetCard target, Game game) {
|
||||||
|
game.fireSelectTargetEvent(playerId, target.getMessage(), cards, target.isRequired());
|
||||||
|
while (!abort) {
|
||||||
|
waitForResponse();
|
||||||
|
if (response.getUUID() != null) {
|
||||||
|
if (target.canTarget(response.getUUID(), cards, game)) {
|
||||||
|
target.addTarget(response.getUUID(), game);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
} else if (!target.isRequired()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean chooseTargetAmount(Outcome outcome, TargetAmount target, Game game) {
|
||||||
|
game.fireSelectTargetEvent(playerId, target.getMessage() + "\n Amount remaining:" + target.getAmountRemaining(), target.isRequired());
|
||||||
|
while (!abort) {
|
||||||
|
waitForResponse();
|
||||||
|
if (response.getUUID() != null) {
|
||||||
|
if (target.canTarget(response.getUUID(), game)) {
|
||||||
|
UUID targetId = response.getUUID();
|
||||||
|
int amountSelected = getAmount(1, target.getAmountRemaining(), "Select amount", game);
|
||||||
|
target.addTarget(targetId, amountSelected, game);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
} else if (!target.isRequired()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void priority(Game game) {
|
public void priority(Game game) {
|
||||||
passed = false;
|
passed = false;
|
||||||
if (!abort) {
|
if (!abort) {
|
||||||
if (passedTurn && game.getStack().isEmpty()) {
|
if (passedTurn && game.getStack().isEmpty()) {
|
||||||
passed = true;
|
pass();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
game.firePriorityEvent(playerId);
|
game.firePriorityEvent(playerId);
|
||||||
waitForResponse();
|
waitForResponse();
|
||||||
if (response.getBoolean() != null) {
|
if (response.getBoolean() != null) {
|
||||||
passed = true;
|
pass();
|
||||||
} else if (response.getInteger() != null) {
|
} else if (response.getInteger() != null) {
|
||||||
passed = true;
|
pass();
|
||||||
passedTurn = true;
|
passedTurn = true;
|
||||||
} else if (response.getString() != null && response.getString().equals("special")) {
|
} else if (response.getString() != null && response.getString().equals("special")) {
|
||||||
specialAction(game);
|
specialAction(game);
|
||||||
|
|
@ -200,20 +238,6 @@ public class HumanPlayer extends PlayerImpl {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean searchCards(Cards cards, TargetCard target, Game game) {
|
|
||||||
while (!abort && !target.doneChosing()) {
|
|
||||||
game.fireSelectTargetEvent(playerId, target.getMessage(), cards, target.isRequired());
|
|
||||||
waitForResponse();
|
|
||||||
if (response.getUUID() != null && cards.containsKey(response.getUUID())) {
|
|
||||||
target.addTarget(response.getUUID(), game);
|
|
||||||
} else if (!target.isRequired()) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return target.isChosen();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TriggeredAbility chooseTriggeredAbility(TriggeredAbilities abilities, Game game) {
|
public TriggeredAbility chooseTriggeredAbility(TriggeredAbilities abilities, Game game) {
|
||||||
while (!abort) {
|
while (!abort) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue