mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 12:48:00 +00:00
- Added the option "NonMana" to StAb CantBeActivated.
- Converted Pithing Needle to script.
This commit is contained in:
2
.gitattributes
vendored
2
.gitattributes
vendored
@@ -10480,7 +10480,7 @@ src/main/java/forge/card/spellability/TargetChoices.java svneol=native#text/plai
|
||||
src/main/java/forge/card/spellability/TargetSelection.java svneol=native#text/plain
|
||||
src/main/java/forge/card/spellability/package-info.java svneol=native#text/plain
|
||||
src/main/java/forge/card/staticability/StaticAbility.java svneol=native#text/plain
|
||||
src/main/java/forge/card/staticability/StaticAbilityCantBeCast.java -text svneol=native#text/plain
|
||||
src/main/java/forge/card/staticability/StaticAbilityCantBeCast.java svneol=native#text/plain
|
||||
src/main/java/forge/card/staticability/StaticAbilityContinuous.java svneol=native#text/plain
|
||||
src/main/java/forge/card/staticability/StaticAbilityPreventDamage.java -text svneol=native#text/plain
|
||||
src/main/java/forge/card/staticability/package-info.java svneol=native#text/plain
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
Name:Pithing Needle
|
||||
ManaCost:1
|
||||
Types:Artifact
|
||||
Text:As Pithing Needle enters the battlefield, name a card.\r\nActivated abilities of sources with the chosen name can't be activated unless they're mana abilities.
|
||||
Text:no text
|
||||
T:Mode$ ChangesZone | ValidCard$ Card.Self | Origin$ Any | Destination$ Battlefield | Execute$ TrigName | Static$ True | TriggerDescription$ As CARDNAME enters the battlefield, name a card.
|
||||
SVar:TrigName:AB$ NameCard | Cost$ 0 | Defined$ You
|
||||
S:Mode$ CantBeActivated | ValidCard$ Card.NamedCard | NonMana$ True | Description$ Activated abilities of sources with the chosen name can't be activated unless they're mana abilities.
|
||||
SVar:RemRandomDeck:True
|
||||
SVar:Rarity:Rare
|
||||
SVar:Picture:http://www.wizards.com/global/images/magic/general/pithing_needle.jpg
|
||||
|
||||
@@ -1226,7 +1226,7 @@ public abstract class AbstractCardFactory implements CardFactoryInterface {
|
||||
} // *************** END ************ END **************************
|
||||
|
||||
// *************** START *********** START **************************
|
||||
else if (cardName.equals("Pithing Needle")) {
|
||||
/*else if (cardName.equals("Pithing Needle")) {
|
||||
final SpellAbility ability = new AbilityStatic(card, "0") {
|
||||
@Override
|
||||
public void resolve() {
|
||||
@@ -1276,7 +1276,7 @@ public abstract class AbstractCardFactory implements CardFactoryInterface {
|
||||
|
||||
card.addComesIntoPlayCommand(intoPlay);
|
||||
card.addLeavesPlayCommand(leavesPlay);
|
||||
} // *************** END ************ END **************************
|
||||
}*/ // *************** END ************ END **************************
|
||||
|
||||
// *************** START *********** START **************************
|
||||
else if (cardName.equals("Phyrexian Processor")) {
|
||||
|
||||
@@ -18,8 +18,6 @@ import forge.Constant.Zone;
|
||||
* @version $Id$
|
||||
*/
|
||||
public abstract class Ability extends SpellAbility {
|
||||
// Slight hack for Pithing Needle
|
||||
private final String sourceCardName;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -34,7 +32,6 @@ public abstract class Ability extends SpellAbility {
|
||||
public Ability(final Card sourceCard, final String manaCost) {
|
||||
super(SpellAbility.getAbility(), sourceCard);
|
||||
this.setManaCost(manaCost);
|
||||
this.sourceCardName = sourceCard.getName();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -62,17 +59,6 @@ public abstract class Ability extends SpellAbility {
|
||||
return false;
|
||||
}
|
||||
|
||||
CardList pithing = AllZone.getHumanPlayer().getCardsIn(Zone.Battlefield);
|
||||
pithing.addAll(AllZone.getComputerPlayer().getCardsIn(Zone.Battlefield));
|
||||
pithing = pithing.getName("Pithing Needle");
|
||||
pithing = pithing.filter(new CardListFilter() {
|
||||
@Override
|
||||
public boolean addCard(final Card c) {
|
||||
return c.getSVar("PithingTarget").equals(Ability.this.sourceCardName);
|
||||
}
|
||||
});
|
||||
|
||||
return AllZoneUtil.isCardInPlay(this.getSourceCard()) && !this.getSourceCard().isFaceDown()
|
||||
&& !this.getSourceCard().getName().equals("Spreading Seas") && (pithing.size() == 0);
|
||||
return AllZoneUtil.isCardInPlay(this.getSourceCard()) && !this.getSourceCard().isFaceDown();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ public abstract class AbilityActivated extends SpellAbility implements java.io.S
|
||||
for (final Card ca : allp) {
|
||||
final ArrayList<StaticAbility> staticAbilities = ca.getStaticAbilities();
|
||||
for (final StaticAbility stAb : staticAbilities) {
|
||||
if (stAb.applyAbility("CantBeActivated", c, activator)) {
|
||||
if (stAb.applyAbility("CantBeActivated", c, activator, this)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -91,20 +91,6 @@ public abstract class AbilityActivated extends SpellAbility implements java.io.S
|
||||
return false;
|
||||
}
|
||||
|
||||
CardList pithing = AllZone.getHumanPlayer().getCardsIn(Zone.Battlefield);
|
||||
pithing.addAll(AllZone.getComputerPlayer().getCardsIn(Zone.Battlefield));
|
||||
pithing = pithing.getName("Pithing Needle");
|
||||
pithing = pithing.filter(new CardListFilter() {
|
||||
@Override
|
||||
public boolean addCard(final Card crd) {
|
||||
return crd.getSVar("PithingTarget").equals(c.getName());
|
||||
}
|
||||
});
|
||||
|
||||
if ((pithing.size() != 0) && !(this instanceof AbilityMana)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!(this.getRestrictions().canPlay(c, this))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ import forge.Constant.Zone;
|
||||
import forge.GameEntity;
|
||||
import forge.Player;
|
||||
import forge.card.abilityfactory.AbilityFactory;
|
||||
import forge.card.spellability.SpellAbility;
|
||||
|
||||
/**
|
||||
* The Class StaticAbility.
|
||||
@@ -282,8 +283,35 @@ public class StaticAbility {
|
||||
return StaticAbilityCantBeCast.applyCantBeCastAbility(this, card, activator);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply ability.
|
||||
*
|
||||
* @param mode
|
||||
* the mode
|
||||
* @param card
|
||||
* the card
|
||||
* @param activator
|
||||
* the activator
|
||||
* @param sa
|
||||
* the ability
|
||||
* @return true, if successful
|
||||
*/
|
||||
public final boolean applyAbility(final String mode, final Card card, final Player activator, SpellAbility sa) {
|
||||
|
||||
// don't apply the ability if it hasn't got the right mode
|
||||
if (!this.mapParams.get("Mode").equals(mode)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.isSuppressed() || !this.checkConditions()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (mode.equals("CantBeActivated")) {
|
||||
return StaticAbilityCantBeCast.applyCantBeActivatedAbility(this, card, activator);
|
||||
return StaticAbilityCantBeCast.applyCantBeActivatedAbility(this, card, activator, sa);
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
@@ -5,6 +5,8 @@ import java.util.HashMap;
|
||||
import forge.Card;
|
||||
import forge.Phase;
|
||||
import forge.Player;
|
||||
import forge.card.spellability.AbilityMana;
|
||||
import forge.card.spellability.SpellAbility;
|
||||
|
||||
/**
|
||||
* The Class StaticAbility_CantBeCast.
|
||||
@@ -54,7 +56,8 @@ public class StaticAbilityCantBeCast {
|
||||
* the activator
|
||||
* @return true, if successful
|
||||
*/
|
||||
public static boolean applyCantBeActivatedAbility(final StaticAbility stAb, final Card card, final Player activator) {
|
||||
public static boolean applyCantBeActivatedAbility(final StaticAbility stAb, final Card card,
|
||||
final Player activator, SpellAbility sa) {
|
||||
final HashMap<String, String> params = stAb.getMapParams();
|
||||
final Card hostCard = stAb.getHostCard();
|
||||
|
||||
@@ -68,6 +71,10 @@ public class StaticAbilityCantBeCast {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (params.containsKey("NonMana") && sa instanceof AbilityMana) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user