- Added the static ability "CantBeCast".

- Added Grid Monitor.
This commit is contained in:
Sloth
2011-10-17 15:06:00 +00:00
parent 66ba724133
commit acb035191d
6 changed files with 70 additions and 2 deletions

2
.gitattributes vendored
View File

@@ -3428,6 +3428,7 @@ res/cardsfolder/g/greenhilt_trainee.txt svneol=native#text/plain
res/cardsfolder/g/greenseeker.txt svneol=native#text/plain
res/cardsfolder/g/greenweaver_druid.txt svneol=native#text/plain
res/cardsfolder/g/gremlin_mine.txt svneol=native#text/plain
res/cardsfolder/g/grid_monitor.txt -text
res/cardsfolder/g/grief_tyrant.txt -text svneol=unset#text/plain
res/cardsfolder/g/griffin_canyon.txt svneol=native#text/plain
res/cardsfolder/g/griffin_guide.txt svneol=native#text/plain
@@ -10276,6 +10277,7 @@ src/main/java/forge/card/spellability/Target_Choices.java svneol=native#text/pla
src/main/java/forge/card/spellability/Target_Selection.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_CantBeCast.java -text
src/main/java/forge/card/staticAbility/StaticAbility_Continuous.java svneol=native#text/plain
src/main/java/forge/card/staticAbility/StaticAbility_PreventDamage.java -text
src/main/java/forge/card/staticAbility/package-info.java svneol=native#text/plain

View File

@@ -0,0 +1,10 @@
Name:Grid Monitor
ManaCost:4
Types:Artifact Creature Construct
Text:no text
PT:4/6
S:Mode$ CantBeCast | ValidCard$ Creature.YouCtrl | Description$ You can't cast creature spells.
SVar:RemAIDeck:True
SVar:Rarity:Rare
SVar:Picture:http://www.wizards.com/global/images/magic/general/grid_monitor.jpg
End

View File

@@ -3895,6 +3895,17 @@ public class Card extends GameEntity implements Comparable<Card> {
* @return a boolean.
*/
public final boolean isUnCastable() {
//Prevent Damage static abilities
CardList allp = AllZoneUtil.getCardsIn(Zone.Battlefield);
for (Card ca : allp) {
ArrayList<StaticAbility> staticAbilities = ca.getStaticAbilities();
for (StaticAbility stAb : staticAbilities) {
if(stAb.applyAbility("CantBeCast", this)) {
return true;
}
}
}
return unCastable;
}

View File

@@ -19,6 +19,7 @@ import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
import java.util.Map.Entry;
import java.util.Random;
@@ -1021,7 +1022,11 @@ public class CardFactoryUtil {
sourceCard.setBaseDefense(defense);
sourceCard.setIntrinsicKeyword(sourceCard.getPrevIntrinsicKeyword());
sourceCard.setType(sourceCard.getPrevType());
sourceCard.turnFaceUp();
//Run triggers
Map<String, Object> runParams = new TreeMap<String, Object>();
runParams.put("Card", sourceCard);
AllZone.getTriggerHandler().runTrigger("TurnFaceUp", runParams);
}
@Override
@@ -1104,7 +1109,6 @@ public class CardFactoryUtil {
@Override
public void resolve() {
sourceCard.getController().drawCard();
sourceCard.cycle();
}
};
cycle.setIsCycling(true);

View File

@@ -168,6 +168,22 @@ public class StaticAbility {
return in;
}
//apply the ability if it has the right mode
public boolean applyAbility(String mode, Card card) {
//don't apply the ability if it hasn't got the right mode
if (!mapParams.get("Mode").equals(mode))
return false;
if (isSuppressed() || !checkConditions())
return false;
if (mode.equals("CantBeCast"))
return StaticAbility_CantBeCast.applyCantBeCastAbility(this, card);
return false;
}
public boolean checkConditions() {
Player controller = hostCard.getController();

View File

@@ -0,0 +1,25 @@
package forge.card.staticAbility;
import java.util.HashMap;
import forge.Card;
public class StaticAbility_CantBeCast {
/**
*
* TODO Write javadoc for this method.
* @param stAb a StaticAbility
*/
public static boolean applyCantBeCastAbility(final StaticAbility stAb, Card card) {
HashMap<String, String> params = stAb.getMapParams();
Card hostCard = stAb.getHostCard();
if(params.containsKey("ValidCard") && !card.isValid(params.get("ValidCard").split(","), hostCard.getController(), hostCard)) {
return false;
}
return true;
}
}