mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 19:58:00 +00:00
- Added Auto and Reset buttons to VAssignDamage
This commit is contained in:
@@ -75,8 +75,6 @@ public class VAssignDamage {
|
|||||||
private final FLabel lblReset = new FLabel.Builder().text("Reset").hoverable(true).opaque(true).fontSize(16).build();
|
private final FLabel lblReset = new FLabel.Builder().text("Reset").hoverable(true).opaque(true).fontSize(16).build();
|
||||||
private final FLabel lblAuto = new FLabel.Builder().text("Auto").hoverable(true).opaque(true).fontSize(16).build();
|
private final FLabel lblAuto = new FLabel.Builder().text("Auto").hoverable(true).opaque(true).fontSize(16).build();
|
||||||
|
|
||||||
// TODO Add Auto and Reset Buttons and hook them up to created functions
|
|
||||||
|
|
||||||
// Indexes of defenders correspond to their indexes in the damage list and labels.
|
// Indexes of defenders correspond to their indexes in the damage list and labels.
|
||||||
private final List<Card> lstDefenders = new ArrayList<Card>();
|
private final List<Card> lstDefenders = new ArrayList<Card>();
|
||||||
private final List<Integer> lstDamage = new ArrayList<Integer>();
|
private final List<Integer> lstDamage = new ArrayList<Integer>();
|
||||||
@@ -345,9 +343,13 @@ public class VAssignDamage {
|
|||||||
pnlMain.add(pnlInfo, "gap 20px 0 0 15px");
|
pnlMain.add(pnlInfo, "gap 20px 0 0 15px");
|
||||||
pnlMain.add(scrDefenders, "w 96%!, gap 2% 0 0 0, pushy, growy, ax center, span 2");
|
pnlMain.add(scrDefenders, "w 96%!, gap 2% 0 0 0, pushy, growy, ax center, span 2");
|
||||||
|
|
||||||
pnlMain.add(lblOK, "w 100px!, h 30px!, gap 0 0 5px 10px, ax center, span 2");
|
JPanel pnlButtons = new JPanel(new MigLayout("insets 0, gap 0, ax center"));
|
||||||
// TODO Align lblAuto and lblRest on same row as OK button. Auto, Ok, Reset
|
pnlButtons.setOpaque(false);
|
||||||
|
pnlButtons.add(lblAuto, "w 110px!, h 30px!, gap 0 10px 0 0");
|
||||||
|
pnlButtons.add(lblOK, "w 110px!, h 30px!, gap 0 10px 0 0");
|
||||||
|
pnlButtons.add(lblReset, "w 110px!, h 30px!");
|
||||||
|
|
||||||
|
pnlMain.add(pnlButtons, "ax center, w 350px!, gap 10px 10px 10px 10px, span 2");
|
||||||
overlay.add(pnlMain);
|
overlay.add(pnlMain);
|
||||||
|
|
||||||
initialAssignDamage();
|
initialAssignDamage();
|
||||||
@@ -384,8 +386,9 @@ public class VAssignDamage {
|
|||||||
* then overflows extra onto opponent or last defender card. */
|
* then overflows extra onto opponent or last defender card. */
|
||||||
private void autoAssignDamage() {
|
private void autoAssignDamage() {
|
||||||
// Assign lethal damage to each combatant
|
// Assign lethal damage to each combatant
|
||||||
|
// The first defender should aleady have lethal damage assigned
|
||||||
int size = lstDefenders.size();
|
int size = lstDefenders.size();
|
||||||
for (int i = 0; i < size; i++) {
|
for (int i = 1; i < size; i++) {
|
||||||
int lethalDamage = this.deathtouch ? 1 : lstDefenders.get(i).getLethalDamage();
|
int lethalDamage = this.deathtouch ? 1 : lstDefenders.get(i).getLethalDamage();
|
||||||
int damage = Math.min(lethalDamage, this.damageLeftToAssign);
|
int damage = Math.min(lethalDamage, this.damageLeftToAssign);
|
||||||
if (damage == 0) {
|
if (damage == 0) {
|
||||||
@@ -405,8 +408,8 @@ public class VAssignDamage {
|
|||||||
this.damageLeftToAssign = 0;
|
this.damageLeftToAssign = 0;
|
||||||
}
|
}
|
||||||
// Should we just finish, or update and then let them say ok?
|
// Should we just finish, or update and then let them say ok?
|
||||||
update(null);
|
//update(null);
|
||||||
//finish();
|
finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void assignCombatantDamage(final Card card, int damage) {
|
private void assignCombatantDamage(final Card card, int damage) {
|
||||||
|
|||||||
Reference in New Issue
Block a user