mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 11:18:01 +00:00
setLife uses no gui
This commit is contained in:
@@ -1090,5 +1090,22 @@ public class AiController {
|
|||||||
} // smoothComputerManaCurve()
|
} // smoothComputerManaCurve()
|
||||||
|
|
||||||
|
|
||||||
|
public int chooseNumber(SpellAbility sa, String title,List<Integer> options, Player relatedPlayer) {
|
||||||
|
switch(sa.getApi())
|
||||||
|
{
|
||||||
|
case SetLife:
|
||||||
|
if (relatedPlayer.equals(sa.getSourceCard().getController())) {
|
||||||
|
return Collections.max(options);
|
||||||
|
} else if (relatedPlayer.isOpponentOf(sa.getSourceCard().getController())) {
|
||||||
|
return Collections.min(options);
|
||||||
|
} else {
|
||||||
|
return options.get(0);
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package forge.game.ability.effects;
|
package forge.game.ability.effects;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import forge.game.ability.AbilityUtils;
|
import forge.game.ability.AbilityUtils;
|
||||||
@@ -9,7 +8,6 @@ import forge.game.ability.SpellAbilityEffect;
|
|||||||
import forge.game.player.Player;
|
import forge.game.player.Player;
|
||||||
import forge.game.spellability.SpellAbility;
|
import forge.game.spellability.SpellAbility;
|
||||||
import forge.game.spellability.TargetRestrictions;
|
import forge.game.spellability.TargetRestrictions;
|
||||||
import forge.gui.GuiChoose;
|
|
||||||
|
|
||||||
public class LifeSetEffect extends SpellAbilityEffect {
|
public class LifeSetEffect extends SpellAbilityEffect {
|
||||||
|
|
||||||
@@ -36,18 +34,7 @@ public class LifeSetEffect extends SpellAbilityEffect {
|
|||||||
if (!redistribute) {
|
if (!redistribute) {
|
||||||
p.setLife(lifeAmount, sa.getSourceCard());
|
p.setLife(lifeAmount, sa.getSourceCard());
|
||||||
} else {
|
} else {
|
||||||
int life;
|
int life = sa.getActivatingPlayer().getController().chooseNumber(sa, "Life Total: " + p, lifetotals, p);
|
||||||
if (sa.getActivatingPlayer().isHuman()) {
|
|
||||||
life = GuiChoose.one("Life Total: " + p, lifetotals);
|
|
||||||
} else {//AI
|
|
||||||
if (p.equals(sa.getSourceCard().getController())) {
|
|
||||||
life = Collections.max(lifetotals);
|
|
||||||
} else if (p.isOpponentOf(sa.getSourceCard().getController())) {
|
|
||||||
life = Collections.min(lifetotals);
|
|
||||||
} else {
|
|
||||||
life = lifetotals.get(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
p.setLife(life, sa.getSourceCard());
|
p.setLife(life, sa.getSourceCard());
|
||||||
lifetotals.remove((Integer) life);
|
lifetotals.remove((Integer) life);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -180,6 +180,7 @@ public abstract class PlayerController {
|
|||||||
public abstract boolean payManaOptional(Card card, Cost cost, SpellAbility sa, String prompt, ManaPaymentPurpose purpose);
|
public abstract boolean payManaOptional(Card card, Cost cost, SpellAbility sa, String prompt, ManaPaymentPurpose purpose);
|
||||||
|
|
||||||
public abstract int chooseNumber(SpellAbility sa, String title, int min, int max);
|
public abstract int chooseNumber(SpellAbility sa, String title, int min, int max);
|
||||||
|
public abstract int chooseNumber(SpellAbility sa, String title, List<Integer> values, Player relatedPlayer);
|
||||||
|
|
||||||
public final boolean chooseBinary(SpellAbility sa, String question, BinaryChoiceType kindOfChoice) { return chooseBinary(sa, question, kindOfChoice, null); }
|
public final boolean chooseBinary(SpellAbility sa, String question, BinaryChoiceType kindOfChoice) { return chooseBinary(sa, question, kindOfChoice, null); }
|
||||||
public abstract boolean chooseBinary(SpellAbility sa, String question, BinaryChoiceType kindOfChoice, Boolean defaultChioce);
|
public abstract boolean chooseBinary(SpellAbility sa, String question, BinaryChoiceType kindOfChoice, Boolean defaultChioce);
|
||||||
|
|||||||
@@ -430,6 +430,10 @@ public class PlayerControllerAi extends PlayerController {
|
|||||||
return brains.chooseNumber(sa, title, min, max);
|
return brains.chooseNumber(sa, title, min, max);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int chooseNumber(SpellAbility sa, String title, List<Integer> options, Player relatedPlayer) {
|
||||||
|
return brains.chooseNumber(sa, title, options, relatedPlayer);
|
||||||
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see forge.game.player.PlayerController#chooseFlipResult(forge.Card, forge.game.player.Player, java.lang.String[], boolean)
|
* @see forge.game.player.PlayerController#chooseFlipResult(forge.Card, forge.game.player.Player, java.lang.String[], boolean)
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -393,6 +393,11 @@ public class PlayerControllerHuman extends PlayerController {
|
|||||||
return GuiChoose.one(title, choices).intValue();
|
return GuiChoose.one(title, choices).intValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int chooseNumber(SpellAbility sa, String title, List<Integer> choices, Player relatedPlayer) {
|
||||||
|
return GuiChoose.one(title, choices).intValue();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SpellAbility chooseSingleSpellForEffect(java.util.List<SpellAbility> spells, SpellAbility sa, String title) {
|
public SpellAbility chooseSingleSpellForEffect(java.util.List<SpellAbility> spells, SpellAbility sa, String title) {
|
||||||
// Human is supposed to read the message and understand from it what to choose
|
// Human is supposed to read the message and understand from it what to choose
|
||||||
|
|||||||
@@ -556,4 +556,10 @@ public class PlayerControllerForTests extends PlayerController {
|
|||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
return losses;
|
return losses;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int chooseNumber(SpellAbility sa, String title, List<Integer> values, Player relatedPlayer) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return Iterables.getFirst(values, Integer.valueOf(0));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user