mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 12:48:00 +00:00
- Added the new static ability CantAttackUnless.
This commit is contained in:
@@ -24,6 +24,7 @@ import forge.Card;
|
||||
import forge.CardList;
|
||||
import forge.Counters;
|
||||
import forge.card.abilityfactory.AbilityFactory;
|
||||
import forge.card.mana.ManaCost;
|
||||
import forge.card.spellability.SpellAbility;
|
||||
import forge.control.input.Input;
|
||||
import forge.game.player.ComputerUtil;
|
||||
@@ -456,4 +457,36 @@ public class CostUtil {
|
||||
// Just a shortcut..
|
||||
AllZone.getInputControl().setInput(in, true);
|
||||
}
|
||||
|
||||
|
||||
public static Cost combineCosts(Cost cost1, Cost cost2) {
|
||||
if (cost1 == null) {
|
||||
if (cost2 == null) {
|
||||
return null;
|
||||
} else {
|
||||
return cost2;
|
||||
}
|
||||
}
|
||||
|
||||
if (cost2 == null) {
|
||||
return cost1;
|
||||
}
|
||||
|
||||
for (final CostPart part : cost1.getCostParts()) {
|
||||
if (!(part instanceof CostMana)) {
|
||||
cost2.getCostParts().add(part);
|
||||
} else {
|
||||
CostMana newCostMana = cost2.getCostMana();
|
||||
if (newCostMana != null) {
|
||||
ManaCost oldManaCost = new ManaCost(part.toString());
|
||||
newCostMana.setXMana(oldManaCost.getXcounter() + newCostMana.getXMana());
|
||||
oldManaCost.combineManaCost(newCostMana.toString());
|
||||
newCostMana.setMana(oldManaCost.toString(false));
|
||||
} else {
|
||||
cost2.getCostParts().add(part);
|
||||
}
|
||||
}
|
||||
}
|
||||
return cost2;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user