mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 12:18:00 +00:00
ComputerUtil: fixed chooseSomeType
PlayerControllerAi & MessageUtil: fixed output for chooseType
This commit is contained in:
@@ -29,6 +29,7 @@ import org.apache.commons.lang3.StringUtils;
|
|||||||
import com.google.common.base.Predicate;
|
import com.google.common.base.Predicate;
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import com.google.common.collect.Iterables;
|
import com.google.common.collect.Iterables;
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
import com.google.common.collect.Multimap;
|
import com.google.common.collect.Multimap;
|
||||||
|
|
||||||
import forge.ai.ability.ProtectAi;
|
import forge.ai.ability.ProtectAi;
|
||||||
@@ -1748,7 +1749,7 @@ public class ComputerUtil {
|
|||||||
}
|
}
|
||||||
} else if (kindOfType.equals("Creature")) {
|
} else if (kindOfType.equals("Creature")) {
|
||||||
if (logic != null) {
|
if (logic != null) {
|
||||||
List <String> valid = CardType.getAllCreatureTypes();
|
List <String> valid = Lists.newArrayList(CardType.getAllCreatureTypes());
|
||||||
valid.removeAll(invalidTypes);
|
valid.removeAll(invalidTypes);
|
||||||
|
|
||||||
if (logic.equals("MostProminentOnBattlefield")) {
|
if (logic.equals("MostProminentOnBattlefield")) {
|
||||||
@@ -1780,7 +1781,7 @@ public class ComputerUtil {
|
|||||||
if (logic != null) {
|
if (logic != null) {
|
||||||
if (logic.equals("MostProminentOppControls")) {
|
if (logic.equals("MostProminentOppControls")) {
|
||||||
CardCollection list = CardLists.filterControlledBy(game.getCardsIn(ZoneType.Battlefield), ai.getOpponents());
|
CardCollection list = CardLists.filterControlledBy(game.getCardsIn(ZoneType.Battlefield), ai.getOpponents());
|
||||||
List<String> valid = CardType.getBasicTypes();
|
List<String> valid = Lists.newArrayList(CardType.getBasicTypes());
|
||||||
valid.removeAll(invalidTypes);
|
valid.removeAll(invalidTypes);
|
||||||
|
|
||||||
chosen = ComputerUtilCard.getMostProminentType(list, valid);
|
chosen = ComputerUtilCard.getMostProminentType(list, valid);
|
||||||
|
|||||||
@@ -353,7 +353,7 @@ public class PlayerControllerAi extends PlayerController {
|
|||||||
chosen = validTypes.get(0);
|
chosen = validTypes.get(0);
|
||||||
Log.warn("AI has no idea how to choose " + kindOfType +", defaulting to 1st element: chosen");
|
Log.warn("AI has no idea how to choose " + kindOfType +", defaulting to 1st element: chosen");
|
||||||
}
|
}
|
||||||
game.getAction().nofityOfValue(sa, null, "Computer picked: " + chosen, player);
|
game.getAction().nofityOfValue(sa, player, chosen, player);
|
||||||
return chosen;
|
return chosen;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ public class MessageUtil {
|
|||||||
if (sa == null || sa.getApi() == null || sa.getHostCard() == null) {
|
if (sa == null || sa.getApi() == null || sa.getHostCard() == null) {
|
||||||
return ("Result: " + value);
|
return ("Result: " + value);
|
||||||
}
|
}
|
||||||
|
String choser = StringUtils.capitalize(mayBeYou(player, target));
|
||||||
switch(sa.getApi()) {
|
switch(sa.getApi()) {
|
||||||
case ChooseDirection:
|
case ChooseDirection:
|
||||||
return value;
|
return value;
|
||||||
@@ -40,13 +41,14 @@ public class MessageUtil {
|
|||||||
}
|
}
|
||||||
final boolean random = sa.hasParam("Random");
|
final boolean random = sa.hasParam("Random");
|
||||||
return String.format(random ? "Randomly chosen number for %s is %s" : "%s chooses number: %s", mayBeYou(player, target), value);
|
return String.format(random ? "Randomly chosen number for %s is %s" : "%s chooses number: %s", mayBeYou(player, target), value);
|
||||||
|
case ChooseType:
|
||||||
|
return String.format("%s choose %s for effect of %s", choser, value, sa.getHostCard().getName());
|
||||||
case FlipACoin:
|
case FlipACoin:
|
||||||
String flipper = StringUtils.capitalize(mayBeYou(player, target));
|
String flipper = StringUtils.capitalize(mayBeYou(player, target));
|
||||||
return sa.hasParam("NoCall")
|
return sa.hasParam("NoCall")
|
||||||
? String.format("%s flip comes up %s", Lang.getPossesive(flipper), value)
|
? String.format("%s flip comes up %s", Lang.getPossesive(flipper), value)
|
||||||
: String.format("%s %s the flip", flipper, Lang.joinVerb(flipper, value));
|
: String.format("%s %s the flip", flipper, Lang.joinVerb(flipper, value));
|
||||||
case Protection:
|
case Protection:
|
||||||
String choser = StringUtils.capitalize(mayBeYou(player, target));
|
|
||||||
return String.format("%s %s protection from %s", choser, Lang.joinVerb(choser, "choose"), value);
|
return String.format("%s %s protection from %s", choser, Lang.joinVerb(choser, "choose"), value);
|
||||||
case Vote:
|
case Vote:
|
||||||
String chooser = StringUtils.capitalize(mayBeYou(player, target));
|
String chooser = StringUtils.capitalize(mayBeYou(player, target));
|
||||||
|
|||||||
Reference in New Issue
Block a user