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/TargetSelection.java svneol=native#text/plain
|
||||||
src/main/java/forge/card/spellability/package-info.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/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/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/StaticAbilityPreventDamage.java -text svneol=native#text/plain
|
||||||
src/main/java/forge/card/staticability/package-info.java svneol=native#text/plain
|
src/main/java/forge/card/staticability/package-info.java svneol=native#text/plain
|
||||||
|
|||||||
@@ -1,7 +1,10 @@
|
|||||||
Name:Pithing Needle
|
Name:Pithing Needle
|
||||||
ManaCost:1
|
ManaCost:1
|
||||||
Types:Artifact
|
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:RemRandomDeck:True
|
||||||
SVar:Rarity:Rare
|
SVar:Rarity:Rare
|
||||||
SVar:Picture:http://www.wizards.com/global/images/magic/general/pithing_needle.jpg
|
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 **************************
|
} // *************** END ************ END **************************
|
||||||
|
|
||||||
// *************** START *********** START **************************
|
// *************** START *********** START **************************
|
||||||
else if (cardName.equals("Pithing Needle")) {
|
/*else if (cardName.equals("Pithing Needle")) {
|
||||||
final SpellAbility ability = new AbilityStatic(card, "0") {
|
final SpellAbility ability = new AbilityStatic(card, "0") {
|
||||||
@Override
|
@Override
|
||||||
public void resolve() {
|
public void resolve() {
|
||||||
@@ -1276,7 +1276,7 @@ public abstract class AbstractCardFactory implements CardFactoryInterface {
|
|||||||
|
|
||||||
card.addComesIntoPlayCommand(intoPlay);
|
card.addComesIntoPlayCommand(intoPlay);
|
||||||
card.addLeavesPlayCommand(leavesPlay);
|
card.addLeavesPlayCommand(leavesPlay);
|
||||||
} // *************** END ************ END **************************
|
}*/ // *************** END ************ END **************************
|
||||||
|
|
||||||
// *************** START *********** START **************************
|
// *************** START *********** START **************************
|
||||||
else if (cardName.equals("Phyrexian Processor")) {
|
else if (cardName.equals("Phyrexian Processor")) {
|
||||||
|
|||||||
@@ -18,8 +18,6 @@ import forge.Constant.Zone;
|
|||||||
* @version $Id$
|
* @version $Id$
|
||||||
*/
|
*/
|
||||||
public abstract class Ability extends SpellAbility {
|
public abstract class Ability extends SpellAbility {
|
||||||
// Slight hack for Pithing Needle
|
|
||||||
private final String sourceCardName;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
@@ -34,7 +32,6 @@ public abstract class Ability extends SpellAbility {
|
|||||||
public Ability(final Card sourceCard, final String manaCost) {
|
public Ability(final Card sourceCard, final String manaCost) {
|
||||||
super(SpellAbility.getAbility(), sourceCard);
|
super(SpellAbility.getAbility(), sourceCard);
|
||||||
this.setManaCost(manaCost);
|
this.setManaCost(manaCost);
|
||||||
this.sourceCardName = sourceCard.getName();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -62,17 +59,6 @@ public abstract class Ability extends SpellAbility {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
CardList pithing = AllZone.getHumanPlayer().getCardsIn(Zone.Battlefield);
|
return AllZoneUtil.isCardInPlay(this.getSourceCard()) && !this.getSourceCard().isFaceDown();
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ public abstract class AbilityActivated extends SpellAbility implements java.io.S
|
|||||||
for (final Card ca : allp) {
|
for (final Card ca : allp) {
|
||||||
final ArrayList<StaticAbility> staticAbilities = ca.getStaticAbilities();
|
final ArrayList<StaticAbility> staticAbilities = ca.getStaticAbilities();
|
||||||
for (final StaticAbility stAb : staticAbilities) {
|
for (final StaticAbility stAb : staticAbilities) {
|
||||||
if (stAb.applyAbility("CantBeActivated", c, activator)) {
|
if (stAb.applyAbility("CantBeActivated", c, activator, this)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -91,20 +91,6 @@ public abstract class AbilityActivated extends SpellAbility implements java.io.S
|
|||||||
return false;
|
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))) {
|
if (!(this.getRestrictions().canPlay(c, this))) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import forge.Constant.Zone;
|
|||||||
import forge.GameEntity;
|
import forge.GameEntity;
|
||||||
import forge.Player;
|
import forge.Player;
|
||||||
import forge.card.abilityfactory.AbilityFactory;
|
import forge.card.abilityfactory.AbilityFactory;
|
||||||
|
import forge.card.spellability.SpellAbility;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Class StaticAbility.
|
* The Class StaticAbility.
|
||||||
@@ -282,8 +283,35 @@ public class StaticAbility {
|
|||||||
return StaticAbilityCantBeCast.applyCantBeCastAbility(this, card, activator);
|
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")) {
|
if (mode.equals("CantBeActivated")) {
|
||||||
return StaticAbilityCantBeCast.applyCantBeActivatedAbility(this, card, activator);
|
return StaticAbilityCantBeCast.applyCantBeActivatedAbility(this, card, activator, sa);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -1,74 +1,81 @@
|
|||||||
package forge.card.staticability;
|
package forge.card.staticability;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
import forge.Card;
|
import forge.Card;
|
||||||
import forge.Phase;
|
import forge.Phase;
|
||||||
import forge.Player;
|
import forge.Player;
|
||||||
|
import forge.card.spellability.AbilityMana;
|
||||||
/**
|
import forge.card.spellability.SpellAbility;
|
||||||
* The Class StaticAbility_CantBeCast.
|
|
||||||
*/
|
/**
|
||||||
public class StaticAbilityCantBeCast {
|
* The Class StaticAbility_CantBeCast.
|
||||||
|
*/
|
||||||
/**
|
public class StaticAbilityCantBeCast {
|
||||||
* TODO Write javadoc for this method.
|
|
||||||
*
|
/**
|
||||||
* @param stAb
|
* TODO Write javadoc for this method.
|
||||||
* a StaticAbility
|
*
|
||||||
* @param card
|
* @param stAb
|
||||||
* the card
|
* a StaticAbility
|
||||||
* @param activator
|
* @param card
|
||||||
* the activator
|
* the card
|
||||||
* @return true, if successful
|
* @param activator
|
||||||
*/
|
* the activator
|
||||||
public static boolean applyCantBeCastAbility(final StaticAbility stAb, final Card card, final Player activator) {
|
* @return true, if successful
|
||||||
final HashMap<String, String> params = stAb.getMapParams();
|
*/
|
||||||
final Card hostCard = stAb.getHostCard();
|
public static boolean applyCantBeCastAbility(final StaticAbility stAb, final Card card, final Player activator) {
|
||||||
|
final HashMap<String, String> params = stAb.getMapParams();
|
||||||
if (params.containsKey("ValidCard")
|
final Card hostCard = stAb.getHostCard();
|
||||||
&& !card.isValid(params.get("ValidCard").split(","), hostCard.getController(), hostCard)) {
|
|
||||||
return false;
|
if (params.containsKey("ValidCard")
|
||||||
}
|
&& !card.isValid(params.get("ValidCard").split(","), hostCard.getController(), hostCard)) {
|
||||||
|
return false;
|
||||||
if (params.containsKey("Caster") && (activator != null)
|
}
|
||||||
&& !activator.isValid(params.get("Caster"), hostCard.getController(), hostCard)) {
|
|
||||||
return false;
|
if (params.containsKey("Caster") && (activator != null)
|
||||||
}
|
&& !activator.isValid(params.get("Caster"), hostCard.getController(), hostCard)) {
|
||||||
|
return false;
|
||||||
if (params.containsKey("OnlySorcerySpeed") && (activator != null) && Phase.canCastSorcery(activator)) {
|
}
|
||||||
return false;
|
|
||||||
}
|
if (params.containsKey("OnlySorcerySpeed") && (activator != null) && Phase.canCastSorcery(activator)) {
|
||||||
|
return false;
|
||||||
return true;
|
}
|
||||||
}
|
|
||||||
|
return true;
|
||||||
/**
|
}
|
||||||
* TODO Write javadoc for this method.
|
|
||||||
*
|
/**
|
||||||
* @param stAb
|
* TODO Write javadoc for this method.
|
||||||
* a StaticAbility
|
*
|
||||||
* @param card
|
* @param stAb
|
||||||
* the card
|
* a StaticAbility
|
||||||
* @param activator
|
* @param card
|
||||||
* the activator
|
* the card
|
||||||
* @return true, if successful
|
* @param activator
|
||||||
*/
|
* the activator
|
||||||
public static boolean applyCantBeActivatedAbility(final StaticAbility stAb, final Card card, final Player activator) {
|
* @return true, if successful
|
||||||
final HashMap<String, String> params = stAb.getMapParams();
|
*/
|
||||||
final Card hostCard = stAb.getHostCard();
|
public static boolean applyCantBeActivatedAbility(final StaticAbility stAb, final Card card,
|
||||||
|
final Player activator, SpellAbility sa) {
|
||||||
if (params.containsKey("ValidCard")
|
final HashMap<String, String> params = stAb.getMapParams();
|
||||||
&& !card.isValid(params.get("ValidCard").split(","), hostCard.getController(), hostCard)) {
|
final Card hostCard = stAb.getHostCard();
|
||||||
return false;
|
|
||||||
}
|
if (params.containsKey("ValidCard")
|
||||||
|
&& !card.isValid(params.get("ValidCard").split(","), hostCard.getController(), hostCard)) {
|
||||||
if (params.containsKey("Activator") && (activator != null)
|
return false;
|
||||||
&& !activator.isValid(params.get("Activator"), hostCard.getController(), hostCard)) {
|
}
|
||||||
return false;
|
|
||||||
}
|
if (params.containsKey("Activator") && (activator != null)
|
||||||
|
&& !activator.isValid(params.get("Activator"), hostCard.getController(), hostCard)) {
|
||||||
return true;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
if (params.containsKey("NonMana") && sa instanceof AbilityMana) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user