mirror of
https://github.com/correl/mage.git
synced 2024-12-25 03:00:15 +00:00
* Forgotten Ancient - fixed AI game freeze, improved dialog logic (#5023);
This commit is contained in:
parent
238aa7abdc
commit
7ab73dec60
1 changed files with 45 additions and 40 deletions
|
@ -10,11 +10,7 @@ import mage.abilities.effects.OneShotEffect;
|
|||
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.TargetController;
|
||||
import mage.constants.Zone;
|
||||
import mage.constants.*;
|
||||
import mage.counters.CounterType;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.predicate.permanent.AnotherPredicate;
|
||||
|
@ -29,11 +25,11 @@ import java.util.List;
|
|||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Blinke
|
||||
*/
|
||||
public final class ForgottenAncient extends CardImpl {
|
||||
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("another creature");
|
||||
|
||||
static {
|
||||
filter.add(AnotherPredicate.instance);
|
||||
}
|
||||
|
@ -93,21 +89,30 @@ public final class ForgottenAncient extends CardImpl {
|
|||
}
|
||||
|
||||
int numCounters = sourcePermanent.getCounters(game).getCount(CounterType.P1P1);
|
||||
if (numCounters == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
List<CounterMovement> counterMovements = new ArrayList<>();
|
||||
|
||||
do {
|
||||
Target target = new TargetCreaturePermanent(1, 1, filter, true);
|
||||
if(numCounters == 0 || !target.choose(Outcome.Benefit, source.getControllerId(), source.getSourceId(), game)) {
|
||||
continue;
|
||||
if (!target.canChoose(source.getSourceId(), controller.getId(), game)) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (!target.choose(Outcome.BoostCreature, source.getControllerId(), source.getSourceId(), game)) {
|
||||
break;
|
||||
}
|
||||
|
||||
int amountToMove = controller.getAmount(0, numCounters, "How many counters do you want to move? " + '(' + numCounters + ')' + " counters remaining.", game);
|
||||
if(amountToMove > 0)
|
||||
{
|
||||
if (amountToMove == 0) {
|
||||
break;
|
||||
}
|
||||
|
||||
boolean previouslyChosen = false;
|
||||
for (CounterMovement cm : counterMovements) {
|
||||
if(cm.target.equals(target.getFirstTarget()))
|
||||
{
|
||||
if (cm.target.equals(target.getFirstTarget())) {
|
||||
cm.counters += amountToMove;
|
||||
previouslyChosen = true;
|
||||
}
|
||||
|
@ -120,8 +125,8 @@ public final class ForgottenAncient extends CardImpl {
|
|||
}
|
||||
|
||||
numCounters -= amountToMove;
|
||||
}
|
||||
} while(numCounters > 0 && controller.chooseUse(Outcome.Benefit, "Move additonal counters?", source, game));
|
||||
|
||||
} while (numCounters > 0 && controller.chooseUse(Outcome.Benefit, "Move additional counters?", source, game));
|
||||
|
||||
//Move all the counters for each chosen creature
|
||||
for (CounterMovement cm : counterMovements) {
|
||||
|
|
Loading…
Reference in a new issue