Merge branch 'hexproofUpdate' into 'master'

Hexproof: recode ability to bypass Hexproof

See merge request core-developers/forge!677
This commit is contained in:
Michael Kamensky
2018-06-26 05:53:26 +00:00
5 changed files with 45 additions and 7 deletions

View File

@@ -3987,7 +3987,7 @@ public class Card extends GameEntity implements Comparable<Card> {
// Takes one argument like Permanent.Blue+withFlying
@Override
public final boolean isValid(final String restriction, final Player sourceController, final Card source, SpellAbility spellAbility) {
if (isImmutable() && !source.isRemembered(this) &&
if (isImmutable() && source != null && !source.isRemembered(this) &&
!(restriction.startsWith("Emblem") || restriction.startsWith("Effect"))) { // special case exclusion
return false;
}

View File

@@ -1159,9 +1159,33 @@ public class Player extends GameEntity implements Comparable<Player> {
@Override
public final boolean canBeTargetedBy(final SpellAbility sa) {
if (hasKeyword("Shroud") || (!equals(sa.getActivatingPlayer()) && hasKeyword("Hexproof"))
|| hasProtectionFrom(sa.getHostCard())
|| (hasKeyword("You can't be the targets of spells or activated abilities") && (sa.isSpell() || (sa instanceof AbilityActivated)))) {
if (hasKeyword("Shroud")) {
return false;
}
if (hasKeyword("Hexproof")) {
final Player a = sa.getActivatingPlayer();
if (isOpponentOf(a)) {
boolean cancelHexproof = false;
for (String k : a.getKeywords()) {
if (k.startsWith("IgnoreHexproof")) {
String m[] = k.split(":");
if (isValid(m[1].split(","), a, sa.getHostCard(), sa)) {
cancelHexproof = true;
break;
}
}
}
if (!cancelHexproof) {
return false;
}
}
}
if (hasProtectionFrom(sa.getHostCard())) {
return false;
}
if ((hasKeyword("You can't be the targets of spells or activated abilities") && (sa.isSpell() || (sa instanceof AbilityActivated)))) {
return false;
}
return true;

View File

@@ -89,8 +89,13 @@ public class StaticAbilityCantTarget {
}
if (params.containsKey("Hexproof") && (activator != null)) {
if (activator.hasKeyword("Spells and abilities you control can target hexproof creatures")) {
return false;
for (String k : activator.getKeywords()) {
if (k.startsWith("IgnoreHexproof")) {
String m[] = k.split(":");
if (card.isValid(m[1].split(","), activator, source, spellAbility)) {
return false;
}
}
}
}

View File

@@ -1,7 +1,7 @@
Name:Glaring Spotlight
ManaCost:1
Types:Artifact
S:Mode$ Continuous | Affected$ You | AddKeyword$ Spells and abilities you control can target hexproof creatures | Description$ Creatures your opponents control with hexproof can be the targets of spells and abilities you control as though they didn't have hexproof.
S:Mode$ Continuous | Affected$ You | AddKeyword$ IgnoreHexproof:Creature.OppCtrl | Description$ Creatures your opponents control with hexproof can be the targets of spells and abilities you control as though they didn't have hexproof.
A:AB$ PumpAll | Cost$ 3 Sac<1/CARDNAME> | ValidCards$ Creature.YouCtrl | KW$ Hexproof | SubAbility$ GSEffect | SpellDescription$ Creatures you control gain hexproof until end of turn and can't be blocked this turn.
SVar:GSEffect:DB$ Effect | Name$ Glaring Spotlight Effect | StaticAbilities$ KWPump
SVar:KWPump:Mode$ Continuous | EffectZone$ Command | AffectedZone$ Battlefield | Affected$ Creature.YouCtrl | AddHiddenKeyword$ Unblockable | Description$ Creatures you control can't be blocked this turn.

View File

@@ -0,0 +1,9 @@
Name:Detection Tower
ManaCost:no cost
Types:Land
A:AB$ Mana | Cost$ T | Produced$ C | SpellDescription$ Add {C}.
A:AB$ Effect | Cost$ 1 T | StaticAbilities$ STLoseAB | SpellDescription$ Until end of turn, your opponents and creatures your opponents control with hexproof can be the targets of spells and abilities you control as though they didnt have hexproof.
SVar:STLoseAB:Mode$ Continuous | EffectZone$ Command | Affected$ You | AddKeyword$ IgnoreHexproof:Opponent,Creature.OppCtrl | Description$ Your opponents and creatures your opponents control with hexproof can be the targets of spells and abilities you control as though they didnt have hexproof.
SVar:RemAIDeck:True
SVar:Picture:http://www.wizards.com/global/images/magic/general/detection_tower.jpg
Oracle:{T}: Add {C}.\n{1}, {T}: Until end of turn, your opponents and creatures your opponents control with hexproof can be the targets of spells and abilities you control as though they didnt have hexproof.