mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 19:58:00 +00:00
[Mobile] Update Stack Description
-adds Optional Costs payment to Stack Description text.
This commit is contained in:
@@ -38,6 +38,7 @@ public class StackItemView extends TrackableObject implements IHasCardView {
|
||||
updateAbility(si);
|
||||
updateOptionalTrigger(si);
|
||||
updateSubInstance(si);
|
||||
updateOptionalCost(si);
|
||||
}
|
||||
|
||||
public String getKey() {
|
||||
@@ -47,6 +48,55 @@ public class StackItemView extends TrackableObject implements IHasCardView {
|
||||
set(TrackableProperty.Key, si.getSpellAbility(false).yieldKey());
|
||||
}
|
||||
|
||||
public String getOptionalCostString() {
|
||||
return get(TrackableProperty.OptionalCosts);
|
||||
}
|
||||
void updateOptionalCost(SpellAbilityStackInstance si) {
|
||||
String OptionalCostString = "";
|
||||
boolean kicked = false;
|
||||
boolean entwined = false;
|
||||
boolean buyback = false;
|
||||
boolean retraced = false;
|
||||
boolean jumpstart = false;
|
||||
boolean additional = false;
|
||||
boolean alternate = false;
|
||||
boolean generic = false;
|
||||
|
||||
for (OptionalCost cost : si.getSpellAbility(false).getOptionalCosts()) {
|
||||
if (cost == OptionalCost.Kicker1 || cost == OptionalCost.Kicker2)
|
||||
kicked = true;
|
||||
if (cost == OptionalCost.Entwine)
|
||||
entwined = true;
|
||||
if (cost == OptionalCost.Buyback)
|
||||
buyback = true;
|
||||
if (cost == OptionalCost.Retrace)
|
||||
retraced = true;
|
||||
if (cost == OptionalCost.Jumpstart)
|
||||
jumpstart = true;
|
||||
if (cost == OptionalCost.Flash)
|
||||
additional = true;
|
||||
if (cost == OptionalCost.Generic)
|
||||
generic = true;
|
||||
if (cost == OptionalCost.AltCost)
|
||||
alternate = true;
|
||||
}
|
||||
if (!alternate) {
|
||||
if (kicked && !generic)
|
||||
OptionalCostString += "Kicked";
|
||||
if (entwined)
|
||||
OptionalCostString += OptionalCostString.equals("") ? "Entwined" : ", Entwined";
|
||||
if (buyback)
|
||||
OptionalCostString += OptionalCostString.equals("") ? "Buyback" : ", Buyback";
|
||||
if (retraced)
|
||||
OptionalCostString += OptionalCostString.equals("") ? "Retraced" : ", Retraced";
|
||||
if (jumpstart)
|
||||
OptionalCostString += OptionalCostString.equals("") ? "Jumpstart" : ", Jumpstart";
|
||||
if (additional || generic)
|
||||
OptionalCostString += OptionalCostString.equals("") ? "Additional" : ", Additional";
|
||||
}
|
||||
set(TrackableProperty.OptionalCosts, OptionalCostString);
|
||||
}
|
||||
|
||||
public int getSourceTrigger() {
|
||||
return get(TrackableProperty.SourceTrigger);
|
||||
}
|
||||
|
||||
@@ -187,6 +187,7 @@ public enum TrackableProperty {
|
||||
SubInstance(TrackableTypes.StackItemViewType),
|
||||
Ability(TrackableTypes.BooleanType),
|
||||
OptionalTrigger(TrackableTypes.BooleanType),
|
||||
OptionalCosts(TrackableTypes.StringType),
|
||||
|
||||
//Combat
|
||||
AttackersWithDefenders(TrackableTypes.GenericMapType, FreezeMode.IgnoresFreeze),
|
||||
|
||||
@@ -364,6 +364,7 @@ public class VStack extends FDropDown {
|
||||
float y = 0;
|
||||
float w = getWidth();
|
||||
float h = preferredHeight;
|
||||
CardView sourceCard = stackInstance.getSourceCard();
|
||||
|
||||
boolean needAlpha = (activeStackInstance != stackInstance);
|
||||
if (needAlpha) { //use alpha for non-active items on stack
|
||||
@@ -382,16 +383,17 @@ public class VStack extends FDropDown {
|
||||
|
||||
x += PADDING;
|
||||
y += PADDING;
|
||||
CardRenderer.drawCardWithOverlays(g, stackInstance.getSourceCard(), x, y, CARD_WIDTH, CARD_HEIGHT, CardStackPosition.Top, true, false, false);
|
||||
CardRenderer.drawCardWithOverlays(g, sourceCard, x, y, CARD_WIDTH, CARD_HEIGHT, CardStackPosition.Top, true, false, false);
|
||||
|
||||
x += CARD_WIDTH + PADDING;
|
||||
w -= x + PADDING - BORDER_THICKNESS;
|
||||
h -= y + PADDING - BORDER_THICKNESS;
|
||||
|
||||
String name = stackInstance.getSourceCard().getName();
|
||||
String name = sourceCard.getName();
|
||||
int index = text.indexOf(name);
|
||||
String newtext = "";
|
||||
String cId = "(" + stackInstance.getSourceCard().getId() + ")";
|
||||
String cId = "(" + sourceCard.getId() + ")";
|
||||
String optionalCostString = !stackInstance.getOptionalCostString().equals("") ? " ("+ stackInstance.getOptionalCostString() + ")" : "";
|
||||
|
||||
if (index == -1) {
|
||||
newtext = TextUtil.fastReplace(TextUtil.fastReplace(text.trim(),"--","-"),"- -","-");
|
||||
@@ -405,7 +407,7 @@ public class VStack extends FDropDown {
|
||||
newtext = TextUtil.fastReplace(trimSecond, " "+cId, name);
|
||||
|
||||
if(newtext.equals("\n"+name))
|
||||
textRenderer.drawText(g, name + " " + cId, FONT, foreColor, x, y, w, h, y, h, true, Align.left, true);
|
||||
textRenderer.drawText(g, name + " " + cId + optionalCostString, FONT, foreColor, x, y, w, h, y, h, true, Align.left, true);
|
||||
else {
|
||||
newtext = TextUtil.fastReplace(TextUtil.fastReplace(newtext,name+" -","-"), "\n ", "\n");
|
||||
newtext = "\n"+ TextUtil.fastReplace(newtext.trim(),"--","-");
|
||||
|
||||
Reference in New Issue
Block a user