mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 18:58:00 +00:00
Merge pull request #2939 from Card-Forge/battle-editor
Battle deck editor types
This commit is contained in:
@@ -604,6 +604,7 @@ public final class CardRulesPredicates {
|
||||
};
|
||||
|
||||
public static final Predicate<CardRules> IS_PLANESWALKER = CardRulesPredicates.coreType(true, CardType.CoreType.Planeswalker);
|
||||
public static final Predicate<CardRules> IS_BATTLE = CardRulesPredicates.coreType(true, CardType.CoreType.Battle);
|
||||
public static final Predicate<CardRules> IS_INSTANT = CardRulesPredicates.coreType(true, CardType.CoreType.Instant);
|
||||
public static final Predicate<CardRules> IS_SORCERY = CardRulesPredicates.coreType(true, CardType.CoreType.Sorcery);
|
||||
public static final Predicate<CardRules> IS_ENCHANTMENT = CardRulesPredicates.coreType(true, CardType.CoreType.Enchantment);
|
||||
|
||||
@@ -37,6 +37,7 @@ public class CardTypeFilter extends StatTypeFilter<PaperCard> {
|
||||
addToggleButton(widget, StatTypes.PLANESWALKER);
|
||||
addToggleButton(widget, StatTypes.INSTANT);
|
||||
addToggleButton(widget, StatTypes.SORCERY);
|
||||
addToggleButton(widget, StatTypes.BATTLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -217,7 +217,7 @@ public class FSkin {
|
||||
final FileHandle f4 = getDefaultSkinFile(ForgeConstants.SPRITE_AVATARS_FILE);
|
||||
final FileHandle f5 = getSkinFile(ForgeConstants.SPRITE_AVATARS_FILE);
|
||||
final FileHandle f6 = getDefaultSkinFile(SourceFile.OLD_FOILS.getFilename());
|
||||
final FileHandle f7 = getSkinFile(ForgeConstants.SPRITE_MANAICONS_FILE);
|
||||
final FileHandle f7 = getDefaultSkinFile(ForgeConstants.SPRITE_MANAICONS_FILE);
|
||||
final FileHandle f8 = getDefaultSkinFile(ForgeConstants.SPRITE_SLEEVES_FILE);
|
||||
final FileHandle f9 = getDefaultSkinFile(ForgeConstants.SPRITE_SLEEVES2_FILE);
|
||||
final FileHandle f10 = getDefaultSkinFile(ForgeConstants.SPRITE_BORDER_FILE);
|
||||
|
||||
@@ -326,6 +326,7 @@ public enum FSkinImage implements FImage {
|
||||
PLANESWALKER (FSkinProp.IMG_PLANESWALKER, SourceFile.MANAICONS),
|
||||
PACK (FSkinProp.IMG_PACK, SourceFile.ICONS),
|
||||
SORCERY (FSkinProp.IMG_SORCERY, SourceFile.MANAICONS),
|
||||
BATTLE (FSkinProp.IMG_BATTLE, SourceFile.MANAICONS),
|
||||
COMMANDER (FSkinProp.IMG_COMMANDER, SourceFile.ICONS),
|
||||
|
||||
//Buttons
|
||||
|
||||
@@ -150,7 +150,7 @@ public class CardImageRenderer {
|
||||
float ptBoxHeight = 0;
|
||||
float textBoxHeight = h - headerHeight - artHeight - typeBoxHeight - outerBorderThickness - artInset;
|
||||
|
||||
if (state.isCreature() || state.isPlaneswalker() || state.getType().hasSubtype("Vehicle")) {
|
||||
if (state.isCreature() || state.isPlaneswalker() || state.getType().hasSubtype("Vehicle") || state.isBattle()) {
|
||||
ptBoxHeight = 2 * PT_FONT.getCapHeight();
|
||||
}
|
||||
//space for artist
|
||||
@@ -721,6 +721,8 @@ public class CardImageRenderer {
|
||||
pieces.add("/");
|
||||
pieces.add(String.valueOf(state.getToughness()));
|
||||
pieces.add("]");
|
||||
} else if (state.isBattle()) {
|
||||
pieces.add(String.valueOf(state.getDefense()));
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -533,6 +533,8 @@ public class CardRenderer {
|
||||
type += " (" + loyalty + ")";
|
||||
} else if (card.getCurrentState().getType().hasSubtype("Vehicle")) {
|
||||
type += String.format(" [%s / %s]", power, toughness);
|
||||
} else if (card.getCurrentState().isBattle()) {
|
||||
type += " (" + card.getCurrentState().getDefense() + ")";
|
||||
}
|
||||
g.drawText(type, typeFont, foreColor, x, y, availableTypeWidth, lineHeight, false, Align.left, true);
|
||||
}
|
||||
|
||||
@@ -66,6 +66,8 @@ public class CardZoom extends FOverlay {
|
||||
}
|
||||
|
||||
public static void show(final List<?> items0, int currentIndex0, ActivateHandler activateHandler0) {
|
||||
if (items == null) { return; }
|
||||
if (currentIndex0 < 0 || items.size() <= currentIndex0) { return; }
|
||||
items = items0;
|
||||
activateHandler = activateHandler0;
|
||||
currentIndex = currentIndex0;
|
||||
|
||||
@@ -34,6 +34,7 @@ public class CardTypeFilter extends StatTypeFilter<PaperCard> {
|
||||
addToggleButton(widget, StatTypes.PLANESWALKER);
|
||||
addToggleButton(widget, StatTypes.INSTANT);
|
||||
addToggleButton(widget, StatTypes.SORCERY);
|
||||
addToggleButton(widget, StatTypes.BATTLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -89,7 +89,7 @@ public class TargetingOverlay {
|
||||
}
|
||||
if (null != combat) {
|
||||
final GameEntityView defender = combat.getDefender(c);
|
||||
// if c is attacking a planeswalker
|
||||
// if c is attacking a planeswalker or battle
|
||||
if (defender instanceof CardView) {
|
||||
drawArrow(g, endpoints.get(defender.getId()), endpoints.get(c.getId()), ArcConnection.FoesAttacking);
|
||||
}
|
||||
|
||||
@@ -88,14 +88,6 @@ public class VAssignCombatDamage extends FDialog {
|
||||
throw new RuntimeException("Asking to assign damage to object which is not present in defenders list");
|
||||
}
|
||||
|
||||
/** Constructor.
|
||||
*
|
||||
* @param attacker0 {@link forge.game.card.Card}
|
||||
* @param blockers List<{@link forge.game.card.Card}>
|
||||
* @param damage0 int
|
||||
* @param defender GameEntity that's bein attacked
|
||||
* @param overrideOrder override combatant order
|
||||
*/
|
||||
public VAssignCombatDamage(final CardView attacker, final List<CardView> blockers, final int damage0, final GameEntityView defender0, boolean overrideOrder, boolean maySkip, final WaitCallback<Map<CardView, Integer>> waitCallback) {
|
||||
super(Forge.getLocalizer().getMessage("lbLAssignDamageDealtBy").replace("%s",CardTranslation.getTranslatedName(attacker.getName())) , 3);
|
||||
|
||||
@@ -420,8 +412,6 @@ public class VAssignCombatDamage extends FDialog {
|
||||
return totalDamageToAssign - spent;
|
||||
}
|
||||
|
||||
/** Updates labels and other UI elements.
|
||||
* @param index index of the last assigned damage*/
|
||||
private void updateLabels() {
|
||||
int damageLeft = totalDamageToAssign;
|
||||
boolean allHaveLethal = true;
|
||||
@@ -469,13 +459,19 @@ public class VAssignCombatDamage extends FDialog {
|
||||
}
|
||||
else if (defender instanceof CardView) { // planeswalker
|
||||
CardView pw = (CardView)defender;
|
||||
lethalDamage = Integer.valueOf(pw.getCurrentState().getLoyalty());
|
||||
if (((CardView) defender).getCurrentState().isPlaneswalker()) {
|
||||
lethalDamage = Integer.parseInt(pw.getCurrentState().getLoyalty());
|
||||
} else {
|
||||
lethalDamage = Integer.parseInt(pw.getCurrentState().getDefense());
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
lethalDamage = Math.max(0, source.getLethalDamage());
|
||||
if (source.getCurrentState().getType().isPlaneswalker()) {
|
||||
lethalDamage = Integer.valueOf(source.getCurrentState().getLoyalty());
|
||||
lethalDamage = Integer.parseInt(source.getCurrentState().getLoyalty());
|
||||
} else if (source.getCurrentState().getType().isBattle()) {
|
||||
lethalDamage = Integer.parseInt(source.getCurrentState().getDefense());
|
||||
} else if (attackerHasDeathtouch) {
|
||||
lethalDamage = Math.min(lethalDamage, 1);
|
||||
}
|
||||
|
||||
@@ -176,6 +176,8 @@ public class VReveal extends FDropDown {
|
||||
type += " (" + paperCard.getRules().getPower() + " / " + paperCard.getRules().getToughness() + ")";
|
||||
} else if (paperCard.getRules().getType().isPlaneswalker()) {
|
||||
type += " (" + paperCard.getRules().getInitialLoyalty() + ")";
|
||||
} else if (paperCard.getRules().getType().isBattle()) {
|
||||
type += " (" + paperCard.getRules().getDefense() + ")";
|
||||
} else if (paperCard.getRules().getType().hasSubtype("Vehicle")) {
|
||||
type += String.format(" [%s / %s]", paperCard.getRules().getPower(), paperCard.getRules().getToughness());
|
||||
}
|
||||
|
||||
@@ -824,6 +824,7 @@ lblEnchantments=Enchantments
|
||||
lblPlaneswalkers=Planeswalkers
|
||||
lblInstants=Instants
|
||||
lblSorceries=Sorceries
|
||||
lblBattles=Battles
|
||||
lblCCMC0=Cards with mana value 0
|
||||
lblCCMC1=Cards with mana value 1
|
||||
lblCCMC2=Cards with mana value 2
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 337 KiB After Width: | Height: | Size: 391 KiB |
@@ -97,7 +97,7 @@ public enum GroupDef {
|
||||
if (type.isLand()) { //make Artifact Lands appear in Lands group
|
||||
return 2;
|
||||
}
|
||||
if (type.isArtifact() || type.isEnchantment() || type.isPlaneswalker() || type.isInstant() || type.isSorcery()) {
|
||||
if (type.isArtifact() || type.isEnchantment() || type.isPlaneswalker() || type.isInstant() || type.isSorcery() || type.isBattle()) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -106,7 +106,7 @@ public enum GroupDef {
|
||||
}),
|
||||
|
||||
CARD_TYPE("lblType",
|
||||
new String[] { "Planeswalker", "Creature", "Sorcery", "Instant", "Artifact", "Enchantment", "Land", "Tribal instant" },
|
||||
new String[] { "Planeswalker", "Creature", "Sorcery", "Instant", "Artifact", "Enchantment", "Land", "Tribal instant", "Battle" },
|
||||
new Function<Integer, ColumnDef>() {
|
||||
@Override
|
||||
public ColumnDef apply(final Integer groupIndex) {
|
||||
@@ -142,6 +142,9 @@ public enum GroupDef {
|
||||
if (type.isEnchantment()) {
|
||||
return 5;
|
||||
}
|
||||
if (type.isBattle()) {
|
||||
return 8;
|
||||
}
|
||||
if (type.isLand()) {
|
||||
return 6;
|
||||
}
|
||||
|
||||
@@ -47,6 +47,7 @@ public final class SItemManagerUtil {
|
||||
PLANESWALKER (FSkinProp.IMG_PLANESWALKER, CardRulesPredicates.Presets.IS_PLANESWALKER, "lblPlaneswalkers"),
|
||||
INSTANT (FSkinProp.IMG_INSTANT, CardRulesPredicates.Presets.IS_INSTANT, "lblInstants"),
|
||||
SORCERY (FSkinProp.IMG_SORCERY, CardRulesPredicates.Presets.IS_SORCERY, "lblSorceries"),
|
||||
BATTLE (FSkinProp.IMG_BATTLE, CardRulesPredicates.Presets.IS_BATTLE, "lblBattles"),
|
||||
|
||||
CMC_0 (FSkinProp.IMG_MANA_0, new CardRulesPredicates.LeafNumber(CardRulesPredicates.LeafNumber.CardField.CMC, ComparableOp.EQUALS, 0), "lblCCMC0"),
|
||||
CMC_1 (FSkinProp.IMG_MANA_1, new CardRulesPredicates.LeafNumber(CardRulesPredicates.LeafNumber.CardField.CMC, ComparableOp.EQUALS, 1), "lblCCMC1"),
|
||||
|
||||
@@ -363,6 +363,7 @@ public enum FSkinProp {
|
||||
IMG_PLANESWALKER (new int[] {330, 740, 80, 80}, PropType.MANAICONS),
|
||||
IMG_PACK (new int[] {80, 760, 40, 40}, PropType.IMAGE),
|
||||
IMG_SORCERY (new int[] {412, 740, 80, 80}, PropType.MANAICONS),
|
||||
IMG_BATTLE (new int[] {330, 822, 80, 80}, PropType.MANAICONS),
|
||||
IMG_COMMANDER (new int[] {120, 760, 40, 40}, PropType.IMAGE),
|
||||
IMG_ALCHEMY (new int[] {248, 822, 80, 80}, PropType.MANAICONS),
|
||||
|
||||
|
||||
Reference in New Issue
Block a user