Performance cleanup

This commit is contained in:
tool4EvEr
2022-02-19 20:18:31 +01:00
parent 797e9a3b66
commit 4c4e7c7723
7 changed files with 25 additions and 27 deletions

View File

@@ -275,11 +275,9 @@ public class AiBlockController {
}
if (mode == TriggerType.DamageDone) {
if ((!trigParams.containsKey("ValidSource")
|| trigger.matchesValid(attacker, trigParams.get("ValidSource").split(",")))
if (trigger.matchesValidParam("ValidSource", attacker)
&& attacker.getNetCombatDamage() > 0
&& (!trigParams.containsKey("ValidTarget")
|| trigger.matchesValid(combat.getDefenderByAttacker(attacker), trigParams.get("ValidTarget").split(",")))) {
&& trigger.matchesValidParam("ValidTarget", combat.getDefenderByAttacker(attacker))) {
value += 50;
}
} else if (mode == TriggerType.AttackerUnblocked) {

View File

@@ -2664,15 +2664,15 @@ public class ComputerUtil {
for (Trigger trigger : theTriggers) {
final Card source = trigger.getHostCard();
if (trigger.getMode() != TriggerType.SpellCast) {
continue;
}
if (!trigger.zonesCheck(game.getZoneOf(source))) {
continue;
}
if (!trigger.requirementsCheck(game)) {
continue;
}
if (trigger.getMode() != TriggerType.SpellCast) {
continue;
}
if (trigger.hasParam("ValidCard")) {
if (!card.isValid(trigger.getParam("ValidCard").split(","), source.getController(), source, sa)) {
continue;
@@ -2724,6 +2724,12 @@ public class ComputerUtil {
for (Trigger trigger : theTriggers) {
final Card source = trigger.getHostCard();
if (trigger.getMode() != TriggerType.ChangesZone) {
continue;
}
if (!"Battlefield".equals(trigger.getParam("Destination"))) {
continue;
}
if (!trigger.zonesCheck(game.getZoneOf(source))) {
continue;
}
@@ -2734,12 +2740,6 @@ public class ComputerUtil {
&& AbilityUtils.getDefinedCards(permanent, source.getSVar(trigger.getParam("CheckOnTriggeredCard").split(" ")[0]), null).isEmpty()) {
continue;
}
if (trigger.getMode() != TriggerType.ChangesZone) {
continue;
}
if (!"Battlefield".equals(trigger.getParam("Destination"))) {
continue;
}
if (trigger.hasParam("ValidCard")) {
if (!permanent.isValid(trigger.getParam("ValidCard"), source.getController(), source, null)) {
continue;