Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -998,9 +998,8 @@ public void resetOnceResolved() {
public String yieldKey() {
if (getHostCard() != null) {
return getHostCard().toString() + ": " + toUnsuppressedString();
} else {
return toUnsuppressedString();
}
return toUnsuppressedString();
}

public String getStackDescription() {
Expand Down
46 changes: 21 additions & 25 deletions forge-game/src/main/java/forge/game/trigger/Trigger.java
Original file line number Diff line number Diff line change
Expand Up @@ -120,33 +120,29 @@ public final String toString() {
}

public String toString(boolean active) {
if (hasParam("TriggerDescription") && !this.isSuppressed()) {
StringBuilder sb = new StringBuilder();
ITranslatable nameSource = getHostName(this);
String desc = getParam("TriggerDescription");
if (!desc.contains("ABILITY")) {
desc = CardTranslation.translateSingleDescriptionText(getParam("TriggerDescription"), nameSource);
String translatedName = nameSource.getTranslatedName();
desc = TextUtil.fastReplace(desc,"CARDNAME", translatedName);
desc = TextUtil.fastReplace(desc,"NICKNAME", Lang.getInstance().getNickName(translatedName));
if (desc.contains("ORIGINALHOST") && this.getOriginalHost() != null) {
desc = TextUtil.fastReplace(desc, "ORIGINALHOST", this.getOriginalHost().getDisplayName());
}
}
if (getHostCard().getEffectSource() != null) {
if (active)
desc = TextUtil.fastReplace(desc, "EFFECTSOURCE", getHostCard().getEffectSource().toString());
else
desc = TextUtil.fastReplace(desc, "EFFECTSOURCE", getHostCard().getEffectSource().getDisplayName());
}
sb.append(desc);
if (!this.triggerRemembered.isEmpty()) {
sb.append(" (").append(this.triggerRemembered).append(")");
}
return sb.toString();
} else {
if (!hasParam("TriggerDescription") || isSuppressed()) {
return "";
}
StringBuilder sb = new StringBuilder();
ITranslatable nameSource = getHostName(this);
String desc = getParam("TriggerDescription");
if (!desc.contains("ABILITY")) {
desc = CardTranslation.translateSingleDescriptionText(getParam("TriggerDescription"), nameSource);
String translatedName = nameSource.getTranslatedName();
desc = TextUtil.fastReplace(desc,"CARDNAME", translatedName);
desc = TextUtil.fastReplace(desc,"NICKNAME", Lang.getInstance().getNickName(translatedName));
if (desc.contains("ORIGINALHOST") && this.getOriginalHost() != null) {
desc = TextUtil.fastReplace(desc, "ORIGINALHOST", this.getOriginalHost().getDisplayName());
}
}
if (getHostCard().getEffectSource() != null) {
if (active)
desc = TextUtil.fastReplace(desc, "EFFECTSOURCE", getHostCard().getEffectSource().toString());
else
desc = TextUtil.fastReplace(desc, "EFFECTSOURCE", getHostCard().getEffectSource().getDisplayName());
}
sb.append(desc);
return sb.toString();
}

public final String replaceAbilityText(final String desc, final CardState state) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,12 +155,10 @@ public String yieldKey() {
if (getTrigger() != null) {
if (getHostCard() != null) {
return getHostCard().toString() + ": " + getTrigger().toString();
} else {
return getTrigger().toString();
}
} else {
return super.yieldKey();
return getTrigger().toString();
}
return super.yieldKey();
}

// include triggering information so that different effects look different
Expand All @@ -185,6 +183,9 @@ public String getStackDescription(boolean withTargets) {
if (regtrig == null) return "";
final StringBuilder sb =
new StringBuilder(regtrig.replaceAbilityText(regtrig.toString(true), this, true));
if (!regtrig.getTriggerRemembered().isEmpty()) {
sb.append(" (").append(regtrig.getTriggerRemembered()).append(")");
}

// prevent text growing too long when SA target other in a chain and also potential StackOverflow
if (withTargets) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import forge.localinstance.properties.ForgePreferences;
import forge.localinstance.properties.ForgePreferences.FPref;
import forge.model.FModel;
import forge.player.AutoYieldStore.TriggerDecision;
import forge.screens.home.settings.VSubmenuPreferences.KeyboardShortcutField;
import forge.screens.match.CMatchUI;
import forge.toolbox.special.CardZoomer;
Expand Down Expand Up @@ -159,12 +160,11 @@ public void actionPerformed(final ActionEvent e) {
if (matchUI == null) { return; }
StackItemView si = matchUI.getGameView().peekStack();
if (si != null && si.isAbility()) {
boolean abilityScope = !forge.localinstance.properties.ForgeConstants.AUTO_YIELD_PER_CARD.equals(
forge.model.FModel.getPreferences().getPref(forge.localinstance.properties.ForgePreferences.FPref.UI_AUTO_YIELD_MODE));
matchUI.getGameController().setShouldAutoYield(si.getKey(), true, abilityScope);
int triggerID = si.getSourceTrigger();
if (si.isOptionalTrigger() && matchUI.isLocalPlayer(si.getActivatingPlayer())) {
matchUI.getGameController().setShouldAlwaysAcceptTrigger(triggerID);
boolean abilityScope = matchUI.getGameController().getYieldController().isAbilityScope();
String key = si.getKey();
matchUI.getGameController().setShouldAutoYield(key, true, abilityScope);
if (si.isOptionalTrigger() && matchUI.isLocalPlayer(si.getActivatingPlayer()) && !key.isEmpty()) {
matchUI.getGameController().setTriggerDecision(key, TriggerDecision.ACCEPT, abilityScope);
}
matchUI.getGameController().passPriority();
}
Expand All @@ -179,12 +179,11 @@ public void actionPerformed(final ActionEvent e) {
if (matchUI == null) { return; }
StackItemView si = matchUI.getGameView().peekStack();
if (si != null && si.isAbility()) {
boolean abilityScope = !forge.localinstance.properties.ForgeConstants.AUTO_YIELD_PER_CARD.equals(
forge.model.FModel.getPreferences().getPref(forge.localinstance.properties.ForgePreferences.FPref.UI_AUTO_YIELD_MODE));
matchUI.getGameController().setShouldAutoYield(si.getKey(), true, abilityScope);
int triggerID = si.getSourceTrigger();
if (si.isOptionalTrigger() && matchUI.isLocalPlayer(si.getActivatingPlayer())) {
matchUI.getGameController().setShouldAlwaysDeclineTrigger(triggerID);
boolean abilityScope = matchUI.getGameController().getYieldController().isAbilityScope();
String key = si.getKey();
matchUI.getGameController().setShouldAutoYield(key, true, abilityScope);
if (si.isOptionalTrigger() && matchUI.isLocalPlayer(si.getActivatingPlayer()) && !key.isEmpty()) {
matchUI.getGameController().setTriggerDecision(key, TriggerDecision.DECLINE, abilityScope);
}
matchUI.getGameController().passPriority();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ public void initialize() {
initializeLandPlayedComboBox();
initializeColorIdentityCombobox();
initializeSwitchStatesCombobox();
initializeAutoYieldModeComboBox();
initializeAutoDecisionModeComboBox();
initializeStackGroupPermanentsComboBox();
initializeMaxStackDepthComboBox();
initializeCounterDisplayTypeComboBox();
Expand Down Expand Up @@ -571,15 +571,15 @@ private void initializeSwitchStatesCombobox() {
panel.setComboBox(comboBox, selectedItem);
}

private void initializeAutoYieldModeComboBox() {
private void initializeAutoDecisionModeComboBox() {
final String[] elems = {
ForgeConstants.AUTO_YIELD_PER_CARD,
ForgeConstants.AUTO_YIELD_PER_ABILITY,
ForgeConstants.AUTO_YIELD_PER_ABILITY_SESSION,
ForgeConstants.AUTO_YIELD_PER_ABILITY_INSTALL,
ForgeConstants.AUTO_DECISION_PER_CARD,
ForgeConstants.AUTO_DECISION_PER_ABILITY,
ForgeConstants.AUTO_DECISION_PER_ABILITY_SESSION,
ForgeConstants.AUTO_DECISION_PER_ABILITY_INSTALL,
};
final FPref userSetting = FPref.UI_AUTO_YIELD_MODE;
final FComboBoxPanel<String> panel = this.view.getAutoYieldModeComboBoxPanel();
final FPref userSetting = FPref.UI_AUTO_DECISION_MODE;
final FComboBoxPanel<String> panel = this.view.getAutoDecisionModeComboBoxPanel();
final FComboBox<String> comboBox = createComboBox(elems, userSetting);
final String selectedItem = this.prefs.getPref(userSetting);
panel.setComboBox(comboBox, selectedItem);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ public enum VSubmenuPreferences implements IVSubmenu<CSubmenuPreferences> {
private final FComboBoxPanel<String> cbpStackAdditions = new FComboBoxPanel<>(localizer.getMessage("cbpStackAdditions")+":");
private final FComboBoxPanel<String> cbpLandPlayed = new FComboBoxPanel<>(localizer.getMessage("cbpLandPlayed")+":");
private final FComboBoxPanel<String> cbpDisplayCurrentCardColors = new FComboBoxPanel<>(localizer.getMessage("cbpDisplayCurrentCardColors")+":");
private final FComboBoxPanel<String> cbpAutoYieldMode = new FComboBoxPanel<>(localizer.getMessage("cbpAutoYieldMode")+":");
private final FComboBoxPanel<String> cbpAutoDecisionMode = new FComboBoxPanel<>(localizer.getMessage("cbpAutoDecisionMode")+":");
private final FComboBoxPanel<String> cbpStackGroupPermanents = new FComboBoxPanel<>(localizer.getMessage("cbpStackGroupPermanents")+":");
private final FComboBoxPanel<Integer> cbpMaxStackDepth = new FComboBoxPanel<>(localizer.getMessage("cbpMaxStackDepth")+":");
private final FComboBoxPanel<String> cbpCounterDisplayType = new FComboBoxPanel<>(localizer.getMessage("cbpCounterDisplayType")+":");
Expand Down Expand Up @@ -301,8 +301,8 @@ public enum VSubmenuPreferences implements IVSubmenu<CSubmenuPreferences> {
pnlPrefs.add(cbpGraveyardOrdering, comboBoxConstraints);
pnlPrefs.add(new NoteLabel(localizer.getMessage("nlpGraveyardOrdering")), descriptionConstraints);

pnlPrefs.add(cbpAutoYieldMode, comboBoxConstraints);
pnlPrefs.add(new NoteLabel(localizer.getMessage("nlpAutoYieldMode")), descriptionConstraints);
pnlPrefs.add(cbpAutoDecisionMode, comboBoxConstraints);
pnlPrefs.add(new NoteLabel(localizer.getMessage("nlpAutoDecisionMode")), descriptionConstraints);

//Server Preferences
pnlPrefs.add(new SectionLabel(localizer.getMessage("ServerPreferences")), sectionConstraints);
Expand Down Expand Up @@ -902,9 +902,8 @@ public FComboBoxPanel<String> getCbpDefaultLanguageComboBoxPanel() {
return cbpDefaultLanguage;
}


public FComboBoxPanel<String> getAutoYieldModeComboBoxPanel() {
return cbpAutoYieldMode;
public FComboBoxPanel<String> getAutoDecisionModeComboBoxPanel() {
return cbpAutoDecisionMode;
}

public FComboBoxPanel<String> getCbpStackGroupPermanents() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,11 +219,6 @@ public String getAvatarImage(final String playerName) {
return avatarImages.get(playerName);
}

@Override
public boolean isLibgdxPort() {
return false;
}

@Override
public void setGameView(GameView gameView0) {
super.setGameView(gameView0);
Expand Down
109 changes: 0 additions & 109 deletions forge-gui-desktop/src/main/java/forge/screens/match/VAutoYields.java

This file was deleted.

Loading
Loading