Merge branch 'newBranch' into 'master'

Fix GenericChoice UI and Add Wild Opponent Quest preference options

Closes #1487

See merge request core-developers/forge!3205
This commit is contained in:
Anthony Calosa
2020-10-01 02:04:16 +00:00
10 changed files with 17 additions and 10 deletions

View File

@@ -183,7 +183,7 @@ public class PlayerControllerAi extends PlayerController {
@Override @Override
public List<SpellAbility> chooseSpellAbilitiesForEffect(List<SpellAbility> spells, SpellAbility sa, String title, public List<SpellAbility> chooseSpellAbilitiesForEffect(List<SpellAbility> spells, SpellAbility sa, String title,
int num, Map<String, Object> params) { int num, Map<String, Object> params, boolean generic) {
List<SpellAbility> remaining = Lists.newArrayList(spells); List<SpellAbility> remaining = Lists.newArrayList(spells);
List<SpellAbility> selecteds = Lists.newArrayList(); List<SpellAbility> selecteds = Lists.newArrayList();
SpellAbility selected; SpellAbility selected;

View File

@@ -68,7 +68,7 @@ public class ChooseGenericEffect extends SpellAbilityEffect {
if (sa.hasParam("AtRandom")) { if (sa.hasParam("AtRandom")) {
Aggregates.random(abilities, amount, chosenSAs); Aggregates.random(abilities, amount, chosenSAs);
} else { } else {
chosenSAs = p.getController().chooseSpellAbilitiesForEffect(abilities, sa, "Choose", amount, ImmutableMap.of()); chosenSAs = p.getController().chooseSpellAbilitiesForEffect(abilities, sa, "Choose", amount, ImmutableMap.of(), true);
} }
if (!chosenSAs.isEmpty()) { if (!chosenSAs.isEmpty()) {

View File

@@ -123,7 +123,7 @@ public abstract class PlayerController {
public final <T extends GameEntity> T chooseSingleEntityForEffect(FCollectionView<T> optionList, SpellAbility sa, String title, boolean isOptional, Map<String, Object> params) { return chooseSingleEntityForEffect(optionList, null, sa, title, isOptional, null, params); } public final <T extends GameEntity> T chooseSingleEntityForEffect(FCollectionView<T> optionList, SpellAbility sa, String title, boolean isOptional, Map<String, Object> params) { return chooseSingleEntityForEffect(optionList, null, sa, title, isOptional, null, params); }
public abstract <T extends GameEntity> T chooseSingleEntityForEffect(FCollectionView<T> optionList, DelayedReveal delayedReveal, SpellAbility sa, String title, boolean isOptional, Player relatedPlayer, Map<String, Object> params); public abstract <T extends GameEntity> T chooseSingleEntityForEffect(FCollectionView<T> optionList, DelayedReveal delayedReveal, SpellAbility sa, String title, boolean isOptional, Player relatedPlayer, Map<String, Object> params);
public abstract List<SpellAbility> chooseSpellAbilitiesForEffect(List<SpellAbility> spells, SpellAbility sa, String title, int num, Map<String, Object> params); public abstract List<SpellAbility> chooseSpellAbilitiesForEffect(List<SpellAbility> spells, SpellAbility sa, String title, int num, Map<String, Object> params, boolean generic);
public abstract SpellAbility chooseSingleSpellForEffect(List<SpellAbility> spells, SpellAbility sa, String title, public abstract SpellAbility chooseSingleSpellForEffect(List<SpellAbility> spells, SpellAbility sa, String title,
Map<String, Object> params); Map<String, Object> params);

View File

@@ -705,7 +705,7 @@ public class PlayerControllerForTests extends PlayerController {
@Override @Override
public List<SpellAbility> chooseSpellAbilitiesForEffect(List<SpellAbility> spells, SpellAbility sa, String title, public List<SpellAbility> chooseSpellAbilitiesForEffect(List<SpellAbility> spells, SpellAbility sa, String title,
int num, Map<String, Object> params) { int num, Map<String, Object> params, boolean generic) {
// TODO Auto-generated method stub // TODO Auto-generated method stub
return null; return null;
} }

View File

@@ -106,6 +106,10 @@ public class QuestPrefsScreen extends FScreen {
scroller.add(new PrefsOption(localizer.getMessage("lblColorBias"), QPref.STARTING_POOL_COLOR_BIAS, PrefsGroup.DIFFICULTY_ALL)); scroller.add(new PrefsOption(localizer.getMessage("lblColorBias"), QPref.STARTING_POOL_COLOR_BIAS, PrefsGroup.DIFFICULTY_ALL));
scroller.add(new PrefsOption(localizer.getMessage("lblPenaltyforLoss"), QPref.PENALTY_LOSS, PrefsGroup.DIFFICULTY_ALL)); scroller.add(new PrefsOption(localizer.getMessage("lblPenaltyforLoss"), QPref.PENALTY_LOSS, PrefsGroup.DIFFICULTY_ALL));
//wild opponents addon
scroller.add(new PrefsOption(localizer.getMessage("lblWildOpponentMultiplier"), QPref.WILD_OPPONENTS_MULTIPLIER, PrefsGroup.DIFFICULTY_ALL));
scroller.add(new PrefsOption(localizer.getMessage("lblWildOpponentNumber"), QPref.WILD_OPPONENTS_NUMBER, PrefsGroup.DIFFICULTY_ALL));
//Difficulty Adjustments (Easy) //Difficulty Adjustments (Easy)
scroller.add(new PrefsHeader(localizer.getMessage("lblDifficultyAdjustmentsEasy"), FSkinImage.QUEST_NOTES, PrefsGroup.DIFFICULTY_EASY)); scroller.add(new PrefsHeader(localizer.getMessage("lblDifficultyAdjustmentsEasy"), FSkinImage.QUEST_NOTES, PrefsGroup.DIFFICULTY_EASY));
scroller.add(new PrefsOption(localizer.getMessage("lblWinsForBooster"), QPref.WINS_BOOSTER_EASY, PrefsGroup.DIFFICULTY_EASY)); scroller.add(new PrefsOption(localizer.getMessage("lblWinsForBooster"), QPref.WINS_BOOSTER_EASY, PrefsGroup.DIFFICULTY_EASY));

Binary file not shown.

Before

Width:  |  Height:  |  Size: 236 KiB

After

Width:  |  Height:  |  Size: 240 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 358 KiB

After

Width:  |  Height:  |  Size: 203 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.1 KiB

After

Width:  |  Height:  |  Size: 110 KiB

View File

@@ -619,12 +619,14 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont
} }
@Override @Override
public List<SpellAbility> chooseSpellAbilitiesForEffect(List<SpellAbility> spells, SpellAbility sa, String title, int num, Map<String, Object> params) { public List<SpellAbility> chooseSpellAbilitiesForEffect(List<SpellAbility> spells, SpellAbility sa, String title, int num, Map<String, Object> params, boolean generic) {
List<SpellAbility> result = Lists.newArrayList(); List<SpellAbility> result = Lists.newArrayList();
// create a mapping between a spell's view and the spell itself // create a mapping between a spell's view and the spell itself
Map<SpellAbilityView, SpellAbility> spellViewCache = SpellAbilityView.getMap(spells); Map<SpellAbilityView, SpellAbility> spellViewCache = SpellAbilityView.getMap(spells);
List<SpellAbilityView> chosen = getGui().many(title, "", num, Lists.newArrayList(spellViewCache.keySet()), sa.getHostCard().getView()); //override generic
List<SpellAbilityView> chosen = generic ? getGui().getChoices(title, num, num, Lists.newArrayList(spellViewCache.keySet()))
: getGui().many(title, "", num, Lists.newArrayList(spellViewCache.keySet()), sa.getHostCard().getView());
for(SpellAbilityView view : chosen) { for(SpellAbilityView view : chosen) {
if (spellViewCache.containsKey(view)) { if (spellViewCache.containsKey(view)) {

View File

@@ -63,6 +63,11 @@ public abstract class ImageFetcher {
final String filename = ImageUtil.getImageKey(paperCard, backFace, true); final String filename = ImageUtil.getImageKey(paperCard, backFace, true);
destFile = new File(ForgeConstants.CACHE_CARD_PICS_DIR + "/" + filename + ".jpg"); destFile = new File(ForgeConstants.CACHE_CARD_PICS_DIR + "/" + filename + ".jpg");
//move priority of ftp image here
StringBuilder setDownload = new StringBuilder(ForgeConstants.URL_PIC_DOWNLOAD);
setDownload.append(ImageUtil.getDownloadUrl(paperCard, backFace));
downloadUrls.add(setDownload.toString());
int artIndex = 1; int artIndex = 1;
final Pattern pattern = Pattern.compile("^.:([^|]*\\|){2}(\\d+).*$"); final Pattern pattern = Pattern.compile("^.:([^|]*\\|){2}(\\d+).*$");
Matcher matcher = pattern.matcher(imageKey); Matcher matcher = pattern.matcher(imageKey);
@@ -89,10 +94,6 @@ public abstract class ImageFetcher {
editionMciCode, cardNum, suffix, langCode)); editionMciCode, cardNum, suffix, langCode));
} }
StringBuilder setDownload = new StringBuilder(ForgeConstants.URL_PIC_DOWNLOAD);
setDownload.append(ImageUtil.getDownloadUrl(paperCard, backFace));
downloadUrls.add(setDownload.toString());
} else if (prefix.equals(ImageKeys.TOKEN_PREFIX)) { } else if (prefix.equals(ImageKeys.TOKEN_PREFIX)) {
if (tokenImages == null) { if (tokenImages == null) {
tokenImages = new HashMap<>(); tokenImages = new HashMap<>();