mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 04:08:01 +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.collect.ImmutableList;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Multimap;
|
||||
|
||||
import forge.ai.ability.ProtectAi;
|
||||
@@ -1748,7 +1749,7 @@ public class ComputerUtil {
|
||||
}
|
||||
} else if (kindOfType.equals("Creature")) {
|
||||
if (logic != null) {
|
||||
List <String> valid = CardType.getAllCreatureTypes();
|
||||
List <String> valid = Lists.newArrayList(CardType.getAllCreatureTypes());
|
||||
valid.removeAll(invalidTypes);
|
||||
|
||||
if (logic.equals("MostProminentOnBattlefield")) {
|
||||
@@ -1780,7 +1781,7 @@ public class ComputerUtil {
|
||||
if (logic != null) {
|
||||
if (logic.equals("MostProminentOppControls")) {
|
||||
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);
|
||||
|
||||
chosen = ComputerUtilCard.getMostProminentType(list, valid);
|
||||
|
||||
@@ -353,7 +353,7 @@ public class PlayerControllerAi extends PlayerController {
|
||||
chosen = validTypes.get(0);
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@ public class MessageUtil {
|
||||
if (sa == null || sa.getApi() == null || sa.getHostCard() == null) {
|
||||
return ("Result: " + value);
|
||||
}
|
||||
String choser = StringUtils.capitalize(mayBeYou(player, target));
|
||||
switch(sa.getApi()) {
|
||||
case ChooseDirection:
|
||||
return value;
|
||||
@@ -40,13 +41,14 @@ public class MessageUtil {
|
||||
}
|
||||
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);
|
||||
case ChooseType:
|
||||
return String.format("%s choose %s for effect of %s", choser, value, sa.getHostCard().getName());
|
||||
case FlipACoin:
|
||||
String flipper = StringUtils.capitalize(mayBeYou(player, target));
|
||||
return sa.hasParam("NoCall")
|
||||
? String.format("%s flip comes up %s", Lang.getPossesive(flipper), value)
|
||||
: String.format("%s %s the flip", flipper, Lang.joinVerb(flipper, value));
|
||||
case Protection:
|
||||
String choser = StringUtils.capitalize(mayBeYou(player, target));
|
||||
return String.format("%s %s protection from %s", choser, Lang.joinVerb(choser, "choose"), value);
|
||||
case Vote:
|
||||
String chooser = StringUtils.capitalize(mayBeYou(player, target));
|
||||
|
||||
Reference in New Issue
Block a user