mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-15 10:18:01 +00:00
- Fixed the AI trying to cast Animate Dead/Dance of the Dead on cards which will have Protection from Black once they hit the battlefield.
This commit is contained in:
@@ -4,6 +4,7 @@ import com.google.common.base.Predicate;
|
|||||||
import com.google.common.base.Predicates;
|
import com.google.common.base.Predicates;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import forge.ai.*;
|
import forge.ai.*;
|
||||||
|
import forge.card.MagicColor;
|
||||||
import forge.game.Game;
|
import forge.game.Game;
|
||||||
import forge.game.GameObject;
|
import forge.game.GameObject;
|
||||||
import forge.game.GlobalRuleChange;
|
import forge.game.GlobalRuleChange;
|
||||||
@@ -88,6 +89,19 @@ public class AttachAi extends SpellAbilityAi {
|
|||||||
if (!attachPreference(sa, tgt, false)) {
|
if (!attachPreference(sa, tgt, false)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Don't try to attach an aura to a card which will have protection from the relevant color
|
||||||
|
Card targeted = sa.getTargets().getFirstTargetedCard();
|
||||||
|
if (targeted != null && !targeted.getZone().is(ZoneType.Battlefield)) {
|
||||||
|
byte color = sa.getTargets().getFirstTargetedCard().getCurrentState().getColor();
|
||||||
|
for (byte c : MagicColor.WUBRG) {
|
||||||
|
if ((color & c) == c) {
|
||||||
|
if (targeted.hasKeyword("Protection from " + MagicColor.toLongString(c))) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Flash logic
|
// Flash logic
|
||||||
|
|||||||
Reference in New Issue
Block a user