mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 12:48:00 +00:00
@@ -3,7 +3,6 @@ package forge.game.ability.effects;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
import forge.game.GameObject;
|
||||
import forge.game.PlanarDice;
|
||||
import forge.game.ability.AbilityKey;
|
||||
@@ -45,11 +44,10 @@ public class ReplaceEffect extends SpellAbilityEffect {
|
||||
} else if ("PlanarDice".equals(type)) {
|
||||
params.put(varName, PlanarDice.smartValueOf(varValue));
|
||||
} else if ("Map".equals(type)) {
|
||||
Map<Player, Integer> m = Maps.newHashMap();
|
||||
Map<Player, Integer> m = (Map<Player, Integer>) sa.getReplacingObject(varName);
|
||||
for (Player key : AbilityUtils.getDefinedPlayers(card, sa.getParam("VarKey"), sa)) {
|
||||
m.put(key, AbilityUtils.calculateAmount(card, varValue, sa));
|
||||
m.put(key, m.getOrDefault(key, 0) + AbilityUtils.calculateAmount(card, varValue, sa));
|
||||
}
|
||||
params.put(varName, m);
|
||||
} else {
|
||||
params.put(varName, AbilityUtils.calculateAmount(card, varValue, sa));
|
||||
}
|
||||
|
||||
@@ -584,21 +584,20 @@ public class CardProperty {
|
||||
}
|
||||
}
|
||||
} else if (property.startsWith("EquippedBy") || property.startsWith("AttachedBy")) {
|
||||
if (property.substring(10).equals("Targeted")) {
|
||||
for (final Card c : AbilityUtils.getDefinedCards(source, "Targeted", spellAbility)) {
|
||||
if (!card.hasCardAttachment(c)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} else if (property.substring(10).equals("Enchanted")) {
|
||||
String prop = property.substring(10);
|
||||
if (prop.equals("Enchanted")) {
|
||||
if (source.getEnchantingCard() == null ||
|
||||
!card.hasCardAttachment(source.getEnchantingCard())) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if (!card.hasCardAttachment(source)) {
|
||||
return false;
|
||||
} else if (!StringUtils.isBlank(prop)) {
|
||||
for (final Card c : AbilityUtils.getDefinedCards(source, prop, spellAbility)) {
|
||||
if (!card.hasCardAttachment(c)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} else if (!card.hasCardAttachment(source)) {
|
||||
return false;
|
||||
}
|
||||
} else if (property.startsWith("FortifiedBy")) {
|
||||
if (!card.hasCardAttachment(source)) {
|
||||
|
||||
Reference in New Issue
Block a user