mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 20:58:03 +00:00
Merge remote-tracking branch 'remotes/core/master' into newBranch
This commit is contained in:
@@ -116,9 +116,12 @@ public final class ImageKeys {
|
|||||||
String fullborderFile = TextUtil.fastReplace(filename, ".full", ".fullborder");
|
String fullborderFile = TextUtil.fastReplace(filename, ".full", ".fullborder");
|
||||||
file = findFile(dir, fullborderFile);
|
file = findFile(dir, fullborderFile);
|
||||||
if (file != null) { return file; }
|
if (file != null) { return file; }
|
||||||
// if there's an art variant try without it
|
// if there's a 1st art variant try without it for .fullborder images
|
||||||
file = findFile(dir, TextUtil.fastReplace(fullborderFile, "1.fullborder", ".fullborder"));
|
file = findFile(dir, TextUtil.fastReplace(fullborderFile, "1.fullborder", ".fullborder"));
|
||||||
if (file != null) { return file; }
|
if (file != null) { return file; }
|
||||||
|
// if there's a 1st art variant try without it for .full images
|
||||||
|
file = findFile(dir, TextUtil.fastReplace(filename, "1.full", ".full"));
|
||||||
|
if (file != null) { return file; }
|
||||||
}
|
}
|
||||||
//if an image, like phenomenon or planes is missing .full in their filenames but you have an existing images that have .full/.fullborder
|
//if an image, like phenomenon or planes is missing .full in their filenames but you have an existing images that have .full/.fullborder
|
||||||
if (!filename.contains(".full")) {
|
if (!filename.contains(".full")) {
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ import forge.game.card.CardCollection;
|
|||||||
import forge.game.card.CardCollectionView;
|
import forge.game.card.CardCollectionView;
|
||||||
import forge.game.card.CardDamageMap;
|
import forge.game.card.CardDamageMap;
|
||||||
import forge.game.card.CardFactory;
|
import forge.game.card.CardFactory;
|
||||||
|
import forge.game.card.CardPredicates;
|
||||||
import forge.game.card.CardZoneTable;
|
import forge.game.card.CardZoneTable;
|
||||||
import forge.game.cost.Cost;
|
import forge.game.cost.Cost;
|
||||||
import forge.game.cost.CostPart;
|
import forge.game.cost.CostPart;
|
||||||
@@ -46,6 +47,7 @@ import forge.game.trigger.Trigger;
|
|||||||
import forge.game.trigger.TriggerType;
|
import forge.game.trigger.TriggerType;
|
||||||
import forge.game.trigger.WrappedAbility;
|
import forge.game.trigger.WrappedAbility;
|
||||||
import forge.game.zone.ZoneType;
|
import forge.game.zone.ZoneType;
|
||||||
|
import forge.util.Aggregates;
|
||||||
import forge.util.Expressions;
|
import forge.util.Expressions;
|
||||||
import forge.util.TextUtil;
|
import forge.util.TextUtil;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
@@ -1099,8 +1101,14 @@ public abstract class SpellAbility extends CardTraitBase implements ISpellAbilit
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (hasParam("MaxTotalTargetCMC") && entity instanceof Card) {
|
if (hasParam("MaxTotalTargetCMC") && entity instanceof Card) {
|
||||||
|
int soFar = Aggregates.sum(getTargets().getTargetCards(), CardPredicates.Accessors.fnGetCmc);
|
||||||
|
// only add if it isn't already targeting
|
||||||
|
if (!isTargeting(entity)) {
|
||||||
final Card c = (Card) entity;
|
final Card c = (Card) entity;
|
||||||
if (c.getCMC() > tr.getMaxTotalCMC(c, this)) {
|
soFar += c.getCMC();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (soFar > tr.getMaxTotalCMC(getHostCard(), this)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import forge.game.GameEntity;
|
|||||||
import forge.game.GameObject;
|
import forge.game.GameObject;
|
||||||
import forge.game.ability.ApiType;
|
import forge.game.ability.ApiType;
|
||||||
import forge.game.card.Card;
|
import forge.game.card.Card;
|
||||||
|
import forge.game.card.CardPredicates;
|
||||||
import forge.game.card.CardView;
|
import forge.game.card.CardView;
|
||||||
import forge.game.player.Player;
|
import forge.game.player.Player;
|
||||||
import forge.game.spellability.SpellAbility;
|
import forge.game.spellability.SpellAbility;
|
||||||
@@ -16,6 +17,7 @@ import forge.player.PlayerZoneUpdate;
|
|||||||
import forge.player.PlayerZoneUpdates;
|
import forge.player.PlayerZoneUpdates;
|
||||||
import forge.properties.ForgeConstants;
|
import forge.properties.ForgeConstants;
|
||||||
import forge.properties.ForgePreferences;
|
import forge.properties.ForgePreferences;
|
||||||
|
import forge.util.Aggregates;
|
||||||
import forge.util.ITriggerEvent;
|
import forge.util.ITriggerEvent;
|
||||||
import forge.util.TextUtil;
|
import forge.util.TextUtil;
|
||||||
|
|
||||||
@@ -148,6 +150,9 @@ public final class InputSelectTargets extends InputSyncronizedBase {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO should use sa.canTarget(card) instead?
|
||||||
|
// it doesn't have messages
|
||||||
|
|
||||||
//If the card is not a valid target
|
//If the card is not a valid target
|
||||||
if (!card.canBeTargetedBy(sa)) {
|
if (!card.canBeTargetedBy(sa)) {
|
||||||
showMessage(sa.getHostCard() + " - Cannot target this card (Shroud? Protection? Restrictions).");
|
showMessage(sa.getHostCard() + " - Cannot target this card (Shroud? Protection? Restrictions).");
|
||||||
@@ -170,6 +175,20 @@ public final class InputSelectTargets extends InputSyncronizedBase {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (sa.hasParam("MaxTotalTargetCMC")) {
|
||||||
|
int maxTotalCMC = tgt.getMaxTotalCMC(sa.getHostCard(), sa);
|
||||||
|
if (maxTotalCMC > 0) {
|
||||||
|
int soFar = Aggregates.sum(sa.getTargets().getTargetCards(), CardPredicates.Accessors.fnGetCmc);
|
||||||
|
if (!sa.isTargeting(card)) {
|
||||||
|
soFar += card.getCMC();
|
||||||
|
}
|
||||||
|
if (soFar > maxTotalCMC) {
|
||||||
|
showMessage(sa.getHostCard() + " - Cannot target this card (CMC limit exceeded)");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// If all cards must have different controllers
|
// If all cards must have different controllers
|
||||||
if (tgt.isDifferentControllers()) {
|
if (tgt.isDifferentControllers()) {
|
||||||
final List<Player> targetedControllers = new ArrayList<>();
|
final List<Player> targetedControllers = new ArrayList<>();
|
||||||
@@ -186,12 +205,7 @@ public final class InputSelectTargets extends InputSyncronizedBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!choices.contains(card)) {
|
if (!choices.contains(card)) {
|
||||||
if (card.isPlaneswalker() && sa.getApi() == ApiType.DealDamage) {
|
|
||||||
showMessage(sa.getHostCard() + " - To deal an opposing Planeswalker direct damage, target its controller and then redirect the damage on resolution.");
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
showMessage(sa.getHostCard() + " - The selected card is not a valid choice to be targeted.");
|
showMessage(sa.getHostCard() + " - The selected card is not a valid choice to be targeted.");
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user