mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 12:48:00 +00:00
Fix Conspiracy removing types without choice for new one (#6017)
* Skip incomplete overwrite * Fix NPE for Unhaunting
This commit is contained in:
@@ -353,7 +353,7 @@ public class ComputerUtilAbility {
|
||||
}
|
||||
// 1. increase chance of using Surge effects
|
||||
// 2. non-surged versions are usually inefficient
|
||||
if (source.getOracleText().contains("surge cost") && !sa.isSurged()) {
|
||||
if (source.hasKeyword(Keyword.SURGE) && !sa.isSurged()) {
|
||||
p -= 9;
|
||||
}
|
||||
// move snap-casted spells to front
|
||||
@@ -386,8 +386,10 @@ public class ComputerUtilAbility {
|
||||
}
|
||||
|
||||
if (ApiType.DestroyAll == sa.getApi()) {
|
||||
// check boardwipe earlier
|
||||
p += 4;
|
||||
} else if (ApiType.Mana == sa.getApi()) {
|
||||
// keep mana abilities for paying
|
||||
p -= 9;
|
||||
}
|
||||
|
||||
@@ -398,7 +400,7 @@ public class ComputerUtilAbility {
|
||||
|
||||
return p;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public static List<SpellAbility> sortCreatureSpells(final List<SpellAbility> all) {
|
||||
// try to smoothen power creep by making CMC less of a factor
|
||||
|
||||
@@ -47,6 +47,7 @@ public final class CardType implements Comparable<CardType>, CardTypeView {
|
||||
public static final CardTypeView EMPTY = new CardType(false);
|
||||
|
||||
public enum CoreType {
|
||||
Kindred(false, "kindreds"), // always printed first
|
||||
Artifact(true, "artifacts"),
|
||||
Battle(true, "battles"),
|
||||
Conspiracy(false, "conspiracies"),
|
||||
@@ -60,7 +61,6 @@ public final class CardType implements Comparable<CardType>, CardTypeView {
|
||||
Planeswalker(true, "planeswalkers"),
|
||||
Scheme(false, "schemes"),
|
||||
Sorcery(false, "sorceries"),
|
||||
Kindred(false, "kindreds"),
|
||||
Vanguard(false, "vanguards");
|
||||
|
||||
public final boolean isPermanent;
|
||||
|
||||
@@ -194,8 +194,7 @@ public interface IPaperCard extends InventoryItem, Serializable {
|
||||
* easier access from code.
|
||||
*/
|
||||
public abstract static class Presets {
|
||||
// Think twice before using these, since rarity is a prop of printed
|
||||
// card.
|
||||
// Think twice before using these, since rarity is a prop of printed card.
|
||||
/** The Constant isCommon. */
|
||||
public static final Predicate<PaperCard> IS_COMMON = Predicates.rarity(true, CardRarity.Common);
|
||||
|
||||
|
||||
@@ -35,7 +35,6 @@ public class ForgeScript {
|
||||
|
||||
public static boolean cardStateHasProperty(CardState cardState, String property, Player sourceController,
|
||||
Card source, CardTraitBase spellAbility) {
|
||||
|
||||
boolean withSource = property.endsWith("Source");
|
||||
final ColorSet colors;
|
||||
if (withSource && StaticAbilityColorlessDamageSource.colorlessDamageSource(cardState)) {
|
||||
@@ -53,7 +52,7 @@ public class ForgeScript {
|
||||
int desiredColor = MagicColor.fromName(colorName);
|
||||
boolean hasColor = colors.hasAnyColor(desiredColor);
|
||||
return mustHave == hasColor;
|
||||
} else if (property.contains("Colorless")) { // ... Card is colorless
|
||||
} else if (property.contains("Colorless")) {
|
||||
boolean non = property.startsWith("non");
|
||||
return non != colors.isColorless();
|
||||
} else if (property.startsWith("MultiColor")) {
|
||||
@@ -72,7 +71,7 @@ public class ForgeScript {
|
||||
return false;
|
||||
} else if (property.startsWith("AllColors")) {
|
||||
return colors.isAllColors();
|
||||
} else if (property.startsWith("MonoColor")) { // ... Card is monocolored
|
||||
} else if (property.startsWith("MonoColor")) {
|
||||
return colors.isMonoColor();
|
||||
} else if (property.startsWith("ChosenColor")) {
|
||||
return source.hasChosenColor() && colors.hasAnyColor(MagicColor.fromName(source.getChosenColor()));
|
||||
|
||||
@@ -14,7 +14,7 @@ public class HauntEffect extends SpellAbilityEffect {
|
||||
@Override
|
||||
public void resolve(SpellAbility sa) {
|
||||
Card host = sa.getHostCard();
|
||||
if (host.isPermanent()) {
|
||||
if (host.isPermanent() && sa.hasTriggeringObject(AbilityKey.NewCard)) {
|
||||
// get new version instead of battlefield lki
|
||||
host = (Card) sa.getTriggeringObject(AbilityKey.NewCard);
|
||||
}
|
||||
|
||||
@@ -1843,6 +1843,7 @@ public class Player extends GameEntity implements Comparable<Player> {
|
||||
lastDrawnCard = c;
|
||||
return lastDrawnCard;
|
||||
}
|
||||
|
||||
public final Card getRingBearer() {
|
||||
return ringBearer;
|
||||
}
|
||||
@@ -1865,6 +1866,7 @@ public class Player extends GameEntity implements Comparable<Player> {
|
||||
ringBearer.setRingBearer(false);
|
||||
ringBearer = null;
|
||||
}
|
||||
|
||||
public final String getNamedCard() {
|
||||
return namedCard;
|
||||
}
|
||||
|
||||
@@ -422,26 +422,30 @@ public final class StaticAbilityContinuous {
|
||||
if (params.containsKey("AddAllCreatureTypes")) {
|
||||
addAllCreatureTypes = true;
|
||||
}
|
||||
if (params.containsKey("RemoveSuperTypes")) {
|
||||
remove.add(RemoveType.SuperTypes);
|
||||
}
|
||||
if (params.containsKey("RemoveCardTypes")) {
|
||||
remove.add(RemoveType.CardTypes);
|
||||
}
|
||||
if (params.containsKey("RemoveSubTypes")) {
|
||||
remove.add(RemoveType.SubTypes);
|
||||
}
|
||||
if (params.containsKey("RemoveLandTypes")) {
|
||||
remove.add(RemoveType.LandTypes);
|
||||
}
|
||||
if (params.containsKey("RemoveCreatureTypes")) {
|
||||
remove.add(RemoveType.CreatureTypes);
|
||||
}
|
||||
if (params.containsKey("RemoveArtifactTypes")) {
|
||||
remove.add(RemoveType.ArtifactTypes);
|
||||
}
|
||||
if (params.containsKey("RemoveEnchantmentTypes")) {
|
||||
remove.add(RemoveType.EnchantmentTypes);
|
||||
|
||||
// overwrite doesn't work without new value (e.g. Conspiracy missing choice)
|
||||
if (addTypes == null || !addTypes.isEmpty()) {
|
||||
if (params.containsKey("RemoveSuperTypes")) {
|
||||
remove.add(RemoveType.SuperTypes);
|
||||
}
|
||||
if (params.containsKey("RemoveCardTypes")) {
|
||||
remove.add(RemoveType.CardTypes);
|
||||
}
|
||||
if (params.containsKey("RemoveSubTypes")) {
|
||||
remove.add(RemoveType.SubTypes);
|
||||
}
|
||||
if (params.containsKey("RemoveLandTypes")) {
|
||||
remove.add(RemoveType.LandTypes);
|
||||
}
|
||||
if (params.containsKey("RemoveCreatureTypes")) {
|
||||
remove.add(RemoveType.CreatureTypes);
|
||||
}
|
||||
if (params.containsKey("RemoveArtifactTypes")) {
|
||||
remove.add(RemoveType.ArtifactTypes);
|
||||
}
|
||||
if (params.containsKey("RemoveEnchantmentTypes")) {
|
||||
remove.add(RemoveType.EnchantmentTypes);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -510,7 +514,7 @@ public final class StaticAbilityContinuous {
|
||||
// modify players
|
||||
for (final Player p : affectedPlayers) {
|
||||
// add keywords
|
||||
if (addKeywords != null) {
|
||||
if (addKeywords != null && !addKeywords.isEmpty()) {
|
||||
p.addChangedKeywords(addKeywords, removeKeywords, se.getTimestamp(), stAb.getId());
|
||||
}
|
||||
|
||||
@@ -718,7 +722,7 @@ public final class StaticAbilityContinuous {
|
||||
}
|
||||
|
||||
// add keywords
|
||||
if (addKeywords != null || removeKeywords != null || removeAllAbilities) {
|
||||
if ((addKeywords != null && !addKeywords.isEmpty()) || removeKeywords != null || removeAllAbilities) {
|
||||
List<String> newKeywords = null;
|
||||
if (addKeywords != null) {
|
||||
newKeywords = Lists.newArrayList(addKeywords);
|
||||
@@ -876,7 +880,7 @@ public final class StaticAbilityContinuous {
|
||||
}
|
||||
|
||||
// add Types
|
||||
if (addTypes != null || removeTypes != null || addAllCreatureTypes || !remove.isEmpty()) {
|
||||
if ((addTypes != null && !addTypes.isEmpty()) || (removeTypes != null && !removeTypes.isEmpty()) || addAllCreatureTypes || !remove.isEmpty()) {
|
||||
affectedCard.addChangedCardTypes(addTypes, removeTypes, addAllCreatureTypes, remove,
|
||||
se.getTimestamp(), stAb.getId(), true, stAb.hasParam("CharacteristicDefining"));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user