GUI: improved choose X or number dialog (added source ability and card hint support, added limits info);

game: choose X - added source ability info to game logs;
This commit is contained in:
Oleg Agafonov 2023-12-18 01:22:14 +04:00
parent d97b034711
commit d4a1e27a44
5 changed files with 124 additions and 99 deletions

View file

@ -37,7 +37,7 @@ public class MageEditorPane extends JEditorPane {
final HTMLDocument doc; final HTMLDocument doc;
MageEditorPane() { public MageEditorPane() {
super(); super();
// merge with UI.setHTMLEditorKit // merge with UI.setHTMLEditorKit
this.setEditorKit(kit); this.setEditorKit(kit);

View file

@ -22,10 +22,12 @@
<Group type="102" attributes="0"> <Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0"> <Group type="103" groupAlignment="0" attributes="0">
<Component id="jScrollPane1" pref="183" max="32767" attributes="0"/> <Component id="scrollMessage" pref="183" max="32767" attributes="0"/>
<Component id="panelCommands" alignment="1" max="32767" attributes="0"/> <Component id="panelCommands" alignment="1" max="32767" attributes="0"/>
<Group type="102" alignment="0" attributes="0"> <Group type="102" alignment="0" attributes="0">
<Component id="spnAmount" min="-2" pref="74" max="-2" attributes="0"/> <Component id="editAmount" min="-2" pref="74" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="labelLimits" min="-2" max="-2" attributes="0"/>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/> <EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group> </Group>
</Group> </Group>
@ -37,9 +39,12 @@
<Group type="103" groupAlignment="0" attributes="0"> <Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0"> <Group type="102" alignment="1" attributes="0">
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Component id="jScrollPane1" pref="117" max="32767" attributes="0"/> <Component id="scrollMessage" pref="117" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Component id="spnAmount" min="-2" max="-2" attributes="0"/> <Group type="103" groupAlignment="3" attributes="0">
<Component id="editAmount" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="labelLimits" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="unrelated" max="-2" attributes="0"/> <EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="panelCommands" min="-2" max="-2" attributes="0"/> <Component id="panelCommands" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
@ -48,7 +53,7 @@
</DimensionLayout> </DimensionLayout>
</Layout> </Layout>
<SubComponents> <SubComponents>
<Container class="javax.swing.JScrollPane" name="jScrollPane1"> <Container class="javax.swing.JScrollPane" name="scrollMessage">
<Properties> <Properties>
<Property name="horizontalScrollBarPolicy" type="int" value="31"/> <Property name="horizontalScrollBarPolicy" type="int" value="31"/>
<Property name="focusable" type="boolean" value="false"/> <Property name="focusable" type="boolean" value="false"/>
@ -59,26 +64,28 @@
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/> <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
<SubComponents> <SubComponents>
<Component class="javax.swing.JTextPane" name="lblMessage"> <Component class="mage.client.components.MageEditorPane" name="textMessage">
<Properties> <Properties>
<Property name="editable" type="boolean" value="false"/> <Property name="editable" type="boolean" value="false"/>
<Property name="text" type="java.lang.String" value="long text long text long text long text long text long text long text long text"/> <Property name="text" type="java.lang.String" value="long text long text long text long text long text long text long text long text"/>
<Property name="cursor" type="java.awt.Cursor" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
<Connection code="null&#x9;" type="code"/>
</Property>
<Property name="focusable" type="boolean" value="false"/> <Property name="focusable" type="boolean" value="false"/>
<Property name="opaque" type="boolean" value="false"/> <Property name="opaque" type="boolean" value="false"/>
</Properties> </Properties>
</Component> </Component>
</SubComponents> </SubComponents>
</Container> </Container>
<Component class="javax.swing.JSpinner" name="spnAmount"> <Component class="javax.swing.JSpinner" name="editAmount">
<Properties> <Properties>
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor"> <Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
<SpinnerModel initial="1" numberType="java.lang.Integer" stepSize="1" type="number"/> <SpinnerModel initial="1" numberType="java.lang.Integer" stepSize="1" type="number"/>
</Property> </Property>
</Properties> </Properties>
</Component> </Component>
<Component class="javax.swing.JLabel" name="labelLimits">
<Properties>
<Property name="text" type="java.lang.String" value="min 1, max 123"/>
</Properties>
</Component>
<Container class="javax.swing.JPanel" name="panelCommands"> <Container class="javax.swing.JPanel" name="panelCommands">
<Layout> <Layout>
@ -86,9 +93,9 @@
<Group type="103" groupAlignment="0" attributes="0"> <Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0"> <Group type="102" alignment="0" attributes="0">
<EmptySpace max="32767" attributes="0"/> <EmptySpace max="32767" attributes="0"/>
<Component id="btnOk" min="-2" max="-2" attributes="0"/> <Component id="buttonOk" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Component id="btnCancel" min="-2" max="-2" attributes="0"/> <Component id="buttonCancel" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
</Group> </Group>
</Group> </Group>
@ -98,8 +105,8 @@
<Group type="102" attributes="0"> <Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0"> <Group type="103" groupAlignment="3" attributes="0">
<Component id="btnOk" alignment="3" min="-2" max="-2" attributes="0"/> <Component id="buttonOk" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="btnCancel" alignment="3" min="-2" max="-2" attributes="0"/> <Component id="buttonCancel" alignment="3" min="-2" max="-2" attributes="0"/>
</Group> </Group>
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
</Group> </Group>
@ -107,23 +114,23 @@
</DimensionLayout> </DimensionLayout>
</Layout> </Layout>
<SubComponents> <SubComponents>
<Component class="javax.swing.JButton" name="btnOk"> <Component class="javax.swing.JButton" name="buttonOk">
<Properties> <Properties>
<Property name="text" type="java.lang.String" value="Choose"/> <Property name="text" type="java.lang.String" value="Choose"/>
</Properties> </Properties>
<Events> <Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnOkActionPerformed"/> <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonOkActionPerformed"/>
</Events> </Events>
<AuxValues> <AuxValues>
<AuxValue name="JavaCodeGenerator_AddingCodePost" type="java.lang.String" value="getRootPane().setDefaultButton(btnOk);"/> <AuxValue name="JavaCodeGenerator_AddingCodePost" type="java.lang.String" value="getRootPane().setDefaultButton(buttonOk);"/>
</AuxValues> </AuxValues>
</Component> </Component>
<Component class="javax.swing.JButton" name="btnCancel"> <Component class="javax.swing.JButton" name="buttonCancel">
<Properties> <Properties>
<Property name="text" type="java.lang.String" value="Cancel"/> <Property name="text" type="java.lang.String" value="Cancel"/>
</Properties> </Properties>
<Events> <Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnCancelActionPerformed"/> <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonCancelActionPerformed"/>
</Events> </Events>
</Component> </Component>
</SubComponents> </SubComponents>

View file

@ -5,30 +5,39 @@ import mage.client.MageFrame;
import javax.swing.*; import javax.swing.*;
import java.awt.event.KeyEvent; import java.awt.event.KeyEvent;
import java.awt.event.KeyListener; import java.awt.event.KeyListener;
import java.util.ArrayList;
import java.util.List;
/** /**
* Game GUI: choose number * Game GUI: choose number
* *
* @author BetaSteward_at_googlemail.com * @author BetaSteward_at_googlemail.com, JayDi85
*/ */
public class PickNumberDialog extends MageDialog { public class PickNumberDialog extends MageDialog {
private boolean cancel; private boolean cancel;
/**
* Creates new form PickNumberDialog
*/
public PickNumberDialog() { public PickNumberDialog() {
initComponents(); initComponents();
this.textMessage.enableHyperlinksAndCardPopups();
this.setModal(true); this.setModal(true);
} }
public void showDialog(int min, int max, String message) { public void showDialog(int min, int max, String message) {
this.spnAmount.setModel(new SpinnerNumberModel(min, min, max, 1)); this.editAmount.setModel(new SpinnerNumberModel(min, min, max, 1));
this.lblMessage.setContentType("text/html"); this.textMessage.setContentType("text/html");
this.lblMessage.setText(message); this.textMessage.setText(message);
this.btnOk.setVisible(true);
this.btnCancel.setVisible(false); List<String> limits = new ArrayList<>();
if (min != Integer.MIN_VALUE) {
limits.add("from " + min);
}
limits.add("to " + (max == Integer.MAX_VALUE ? "any" : max));
this.labelLimits.setText(String.join(" ", limits));
this.buttonOk.setVisible(true);
this.buttonCancel.setVisible(false);
this.pack(); this.pack();
// window settings // window settings
@ -39,11 +48,11 @@ public class PickNumberDialog extends MageDialog {
MageFrame.getDesktop().add(this, JLayeredPane.PALETTE_LAYER); MageFrame.getDesktop().add(this, JLayeredPane.PALETTE_LAYER);
} }
this.getRootPane().setDefaultButton(this.btnOk); // restore default button after root panel change (no need actually) this.getRootPane().setDefaultButton(this.buttonOk); // restore default button after root panel change (no need actually)
// enable spinner's enter key like text (one enter press instead two) // enable spinner's enter key like text (one enter press instead two)
// https://stackoverflow.com/questions/3873870/java-keylistener-not-firing-on-jspinner // https://stackoverflow.com/questions/3873870/java-keylistener-not-firing-on-jspinner
((JSpinner.DefaultEditor) this.spnAmount.getEditor()).getTextField().addKeyListener(new KeyListener() { ((JSpinner.DefaultEditor) this.editAmount.getEditor()).getTextField().addKeyListener(new KeyListener() {
@Override @Override
public void keyPressed(KeyEvent e) { public void keyPressed(KeyEvent e) {
@ -52,7 +61,7 @@ public class PickNumberDialog extends MageDialog {
@Override @Override
public void keyReleased(KeyEvent e) { public void keyReleased(KeyEvent e) {
if (e.getKeyCode() == KeyEvent.VK_ENTER) { if (e.getKeyCode() == KeyEvent.VK_ENTER) {
btnOk.doClick(); buttonOk.doClick();
} }
} }
@ -69,7 +78,7 @@ public class PickNumberDialog extends MageDialog {
} }
public int getAmount() { public int getAmount() {
return ((Number) spnAmount.getValue()).intValue(); return ((Number) editAmount.getValue()).intValue();
} }
public boolean isCancel() { public boolean isCancel() {
@ -86,108 +95,115 @@ public class PickNumberDialog extends MageDialog {
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() { private void initComponents() {
jScrollPane1 = new javax.swing.JScrollPane(); scrollMessage = new javax.swing.JScrollPane();
lblMessage = new javax.swing.JTextPane(); textMessage = new mage.client.components.MageEditorPane();
spnAmount = new javax.swing.JSpinner(); editAmount = new javax.swing.JSpinner();
labelLimits = new javax.swing.JLabel();
panelCommands = new javax.swing.JPanel(); panelCommands = new javax.swing.JPanel();
btnOk = new javax.swing.JButton(); buttonOk = new javax.swing.JButton();
btnCancel = new javax.swing.JButton(); buttonCancel = new javax.swing.JButton();
jScrollPane1.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); scrollMessage.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
jScrollPane1.setFocusable(false); scrollMessage.setFocusable(false);
lblMessage.setEditable(false); textMessage.setEditable(false);
lblMessage.setText("long text long text long text long text long text long text long text long text"); textMessage.setText("long text long text long text long text long text long text long text long text");
lblMessage.setCursor(null); textMessage.setFocusable(false);
lblMessage.setFocusable(false); textMessage.setOpaque(false);
lblMessage.setOpaque(false); scrollMessage.setViewportView(textMessage);
jScrollPane1.setViewportView(lblMessage);
spnAmount.setModel(new javax.swing.SpinnerNumberModel(1, null, null, 1)); editAmount.setModel(new javax.swing.SpinnerNumberModel(1, null, null, 1));
btnOk.setText("Choose"); labelLimits.setText("min 1, max 123");
btnOk.addActionListener(new java.awt.event.ActionListener() {
buttonOk.setText("Choose");
buttonOk.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) { public void actionPerformed(java.awt.event.ActionEvent evt) {
btnOkActionPerformed(evt); buttonOkActionPerformed(evt);
} }
}); });
btnCancel.setText("Cancel"); buttonCancel.setText("Cancel");
btnCancel.addActionListener(new java.awt.event.ActionListener() { buttonCancel.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) { public void actionPerformed(java.awt.event.ActionEvent evt) {
btnCancelActionPerformed(evt); buttonCancelActionPerformed(evt);
} }
}); });
javax.swing.GroupLayout panelCommandsLayout = new javax.swing.GroupLayout(panelCommands); javax.swing.GroupLayout panelCommandsLayout = new javax.swing.GroupLayout(panelCommands);
panelCommands.setLayout(panelCommandsLayout); panelCommands.setLayout(panelCommandsLayout);
panelCommandsLayout.setHorizontalGroup( panelCommandsLayout.setHorizontalGroup(
panelCommandsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) panelCommandsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelCommandsLayout.createSequentialGroup() .addGroup(panelCommandsLayout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(btnOk) .addComponent(buttonOk)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(btnCancel) .addComponent(buttonCancel)
.addContainerGap()) .addContainerGap())
); );
panelCommandsLayout.setVerticalGroup( panelCommandsLayout.setVerticalGroup(
panelCommandsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) panelCommandsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelCommandsLayout.createSequentialGroup() .addGroup(panelCommandsLayout.createSequentialGroup()
.addContainerGap() .addContainerGap()
.addGroup(panelCommandsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addGroup(panelCommandsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(btnOk) .addComponent(buttonOk)
.addComponent(btnCancel)) .addComponent(buttonCancel))
.addContainerGap()) .addContainerGap())
); );
getRootPane().setDefaultButton(btnOk); getRootPane().setDefaultButton(buttonOk);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout); getContentPane().setLayout(layout);
layout.setHorizontalGroup( layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup() .addGroup(layout.createSequentialGroup()
.addContainerGap() .addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 183, Short.MAX_VALUE) .addComponent(scrollMessage, javax.swing.GroupLayout.DEFAULT_SIZE, 183, Short.MAX_VALUE)
.addComponent(panelCommands, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(panelCommands, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(layout.createSequentialGroup() .addGroup(layout.createSequentialGroup()
.addComponent(spnAmount, javax.swing.GroupLayout.PREFERRED_SIZE, 74, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(editAmount, javax.swing.GroupLayout.PREFERRED_SIZE, 74, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, Short.MAX_VALUE))) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addContainerGap()) .addComponent(labelLimits)
.addGap(0, 0, Short.MAX_VALUE)))
.addContainerGap())
); );
layout.setVerticalGroup( layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap() .addContainerGap()
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 117, Short.MAX_VALUE) .addComponent(scrollMessage, javax.swing.GroupLayout.DEFAULT_SIZE, 117, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(spnAmount, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(editAmount, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(panelCommands, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(labelLimits))
.addContainerGap()) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(panelCommands, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
); );
pack(); pack();
}// </editor-fold>//GEN-END:initComponents }// </editor-fold>//GEN-END:initComponents
private void btnOkActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnOkActionPerformed private void buttonOkActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonOkActionPerformed
this.cancel = false; this.cancel = false;
this.hideDialog(); this.hideDialog();
}//GEN-LAST:event_btnOkActionPerformed }//GEN-LAST:event_buttonOkActionPerformed
private void btnCancelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCancelActionPerformed private void buttonCancelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonCancelActionPerformed
this.cancel = true; this.cancel = true;
this.hideDialog(); this.hideDialog();
}//GEN-LAST:event_btnCancelActionPerformed }//GEN-LAST:event_buttonCancelActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables // Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton btnCancel; private javax.swing.JButton buttonCancel;
private javax.swing.JButton btnOk; private javax.swing.JButton buttonOk;
private javax.swing.JScrollPane jScrollPane1; private javax.swing.JSpinner editAmount;
private javax.swing.JTextPane lblMessage; private javax.swing.JLabel labelLimits;
private javax.swing.JPanel panelCommands; private javax.swing.JPanel panelCommands;
private javax.swing.JSpinner spnAmount; private javax.swing.JScrollPane scrollMessage;
private mage.client.components.MageEditorPane textMessage;
// End of variables declaration//GEN-END:variables // End of variables declaration//GEN-END:variables
} }

View file

@ -1658,7 +1658,7 @@ public class HumanPlayer extends PlayerImpl {
while (canRespond()) { while (canRespond()) {
prepareForResponse(game); prepareForResponse(game);
if (!isExecutingMacro()) { if (!isExecutingMacro()) {
game.fireGetAmountEvent(playerId, message + extraMessage, min, max); game.fireGetAmountEvent(playerId, message + extraMessage + CardUtil.getSourceLogName(game, ability), min, max);
} }
waitForResponse(game); waitForResponse(game);

View file

@ -401,7 +401,8 @@ public abstract class AbilityImpl implements Ability {
} }
if (variableManaCost != null) { if (variableManaCost != null) {
int xValue = getManaCostsToPay().getX(); int xValue = getManaCostsToPay().getX();
game.informPlayers(controller.getLogName() + " announces a value of " + xValue + " for " + variableManaCost.getText()); game.informPlayers(controller.getLogName() + " announces a value of " + xValue + " for " + variableManaCost.getText()
+ CardUtil.getSourceLogName(game, this));
} }
activated = true; activated = true;
return true; return true;
@ -516,7 +517,8 @@ public abstract class AbilityImpl implements Ability {
// - Spells with additional costs that include X won't be affected by Unbound Flourishing. X must be in the spell's mana cost. // - Spells with additional costs that include X won't be affected by Unbound Flourishing. X must be in the spell's mana cost.
variableCost.setAmount(xValue, xValue, false); variableCost.setAmount(xValue, xValue, false);
((Cost) variableCost).setPaid(); ((Cost) variableCost).setPaid();
String message = controller.getLogName() + " announces a value of " + xValue + " (" + variableCost.getActionText() + ')'; String message = controller.getLogName() + " announces a value of " + xValue + " (" + variableCost.getActionText() + ')'
+ CardUtil.getSourceLogName(game, this);
announceString.append(message); announceString.append(message);
setCostsTag("X",xValue); setCostsTag("X",xValue);
} }