Cleanup cards (#1667)

* Card cleanup

* FailedToTarget fix

* Fix card

* Use ColorSet cache in favor of parsing

Co-authored-by: tool4EvEr <tool4EvEr@192.168.0.59>
This commit is contained in:
tool4ever
2022-10-12 14:54:07 +02:00
committed by GitHub
parent 335133f906
commit b614b9b46f
61 changed files with 91 additions and 96 deletions

View File

@@ -518,7 +518,7 @@ public class ComputerUtilCombat {
return true;
}
return resultingPoison(ai, combat) > 9;
return resultingPoison(ai, combat) >= ai.getGame().getRules().getPoisonCountersToLose();
}
// This calculates the amount of damage a blockgang can deal to the attacker

View File

@@ -5,6 +5,8 @@ import java.util.List;
import java.util.Map;
import com.google.common.base.Predicate;
import com.google.common.base.Predicates;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import forge.ai.ComputerUtil;
@@ -97,7 +99,21 @@ public class CountersMultiplyAi extends SpellAbilityAi {
@Override
protected boolean doTriggerAINoCost(Player ai, SpellAbility sa, boolean mandatory) {
return !sa.usesTargeting() || setTargets(ai, sa) || mandatory;
if (!sa.usesTargeting()) {
return true;
}
if (setTargets(ai, sa)) {
return true;
} else if (mandatory) {
CardCollection list = CardLists.getTargetableCards(ai.getGame().getCardsIn(ZoneType.Battlefield), sa);
if (list.isEmpty()) {
return false;
}
Card safeMatch = Iterables.getFirst(Iterables.filter(list, Predicates.not(CardPredicates.hasCounters())), null);
sa.getTargets().add(safeMatch == null ? list.getFirst() : safeMatch);
return true;
}
return mandatory;
}
private CounterType getCounterType(SpellAbility sa) {