mirror of
https://github.com/magefree/mage.git
synced 2025-12-20 02:30:08 -08:00
other: added announceX testable dialogs in cheat menu (part of #10330)
This commit is contained in:
parent
66db821437
commit
fa20361e2e
3 changed files with 68 additions and 3 deletions
|
|
@ -0,0 +1,65 @@
|
|||
package mage.utils.testers;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Part of testable game dialogs
|
||||
* <p>
|
||||
* Supported methods:
|
||||
* - player.announceX()
|
||||
*
|
||||
* @author JayDi85
|
||||
*/
|
||||
class AnnounceXTestableDialog extends BaseTestableDialog {
|
||||
|
||||
boolean isYou; // who choose - you or opponent
|
||||
boolean isMana; // reason - for mana payment or another value
|
||||
int min;
|
||||
int max;
|
||||
|
||||
public AnnounceXTestableDialog(boolean isYou, boolean isMana, int min, int max) {
|
||||
super(String.format("player.announceX(%s)", isYou ? "you" : "AI"),
|
||||
String.format("%s from %d to %d", isMana ? "mana" : "cost", min, max), "");
|
||||
this.isYou = isYou;
|
||||
this.isMana = isMana;
|
||||
this.min = min;
|
||||
this.max = max;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> showDialog(Player player, Ability source, Game game, Player opponent) {
|
||||
Player choosingPlayer = this.isYou ? player : opponent;
|
||||
String message = "<font color=green>message</font> with html";
|
||||
int chooseRes;
|
||||
chooseRes = choosingPlayer.announceX(this.min, this.max, message, game, source, this.isMana);
|
||||
List<String> result = new ArrayList<>();
|
||||
result.add(getGroup() + " - " + this.getName() + " selected " + chooseRes);
|
||||
return result;
|
||||
}
|
||||
|
||||
static public void register(TestableDialogsRunner runner) {
|
||||
List<Boolean> isYous = Arrays.asList(false, true);
|
||||
List<Boolean> isManas = Arrays.asList(false, true);
|
||||
for (boolean isYou : isYous) {
|
||||
for (boolean isMana : isManas) {
|
||||
runner.registerDialog(new AnnounceXTestableDialog(isYou, isMana, 0, 0));
|
||||
runner.registerDialog(new AnnounceXTestableDialog(isYou, isMana, 0, 1));
|
||||
runner.registerDialog(new AnnounceXTestableDialog(isYou, isMana, 0, 3));
|
||||
runner.registerDialog(new AnnounceXTestableDialog(isYou, isMana, 0, 50));
|
||||
runner.registerDialog(new AnnounceXTestableDialog(isYou, isMana, 0, 500));
|
||||
runner.registerDialog(new AnnounceXTestableDialog(isYou, isMana, 1, 1));
|
||||
runner.registerDialog(new AnnounceXTestableDialog(isYou, isMana, 1, 3));
|
||||
runner.registerDialog(new AnnounceXTestableDialog(isYou, isMana, 1, 50));
|
||||
runner.registerDialog(new AnnounceXTestableDialog(isYou, isMana, 3, 3));
|
||||
runner.registerDialog(new AnnounceXTestableDialog(isYou, isMana, 3, 10));
|
||||
runner.registerDialog(new AnnounceXTestableDialog(isYou, isMana, 10, 10));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -32,7 +32,7 @@ class ChooseTargetTestableDialog extends BaseTestableDialog {
|
|||
public ChooseTargetTestableDialog(boolean isPlayerChoice, boolean isTargetChoice, boolean notTarget, boolean isYou, String name, Target target) {
|
||||
super(String.format("%s%s(%s, %s)",
|
||||
isPlayerChoice ? "player.choose" : "target.choose",
|
||||
isTargetChoice ? "target" : "", // chooseTarget or choose
|
||||
isTargetChoice ? "Target" : "", // chooseTarget or choose
|
||||
isYou ? "you" : "AI",
|
||||
notTarget ? "not target" : "target"), name, target.toString());
|
||||
this.isPlayerChoice = isPlayerChoice;
|
||||
|
|
|
|||
|
|
@ -29,8 +29,7 @@ import java.util.stream.Collectors;
|
|||
* [x] chooseTargetAmount
|
||||
* [x] chooseUse
|
||||
* [x] choosePile
|
||||
* [ ] announceXMana // TODO: implement
|
||||
* [ ] announceXCost // TODO: implement
|
||||
* [x] announceX
|
||||
* [ ] getAmount // TODO: implement
|
||||
* [ ] getMultiAmountWithIndividualConstraints // TODO: implement
|
||||
* <p>
|
||||
|
|
@ -74,6 +73,7 @@ public class TestableDialogsRunner {
|
|||
ChooseChoiceTestableDialog.register(this);
|
||||
ChoosePileTestableDialog.register(this);
|
||||
ChooseAmountTestableDialog.register(this);
|
||||
AnnounceXTestableDialog.register(this);
|
||||
}
|
||||
|
||||
void registerDialog(TestableDialog dialog) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue