- Added "When CARDNAME becomes the target of a spell or ability, return CARDNAME to its owner's hand."

"When CARDNAME becomes the target of a spell or ability, sacrifice it."
"When CARDNAME becomes the target of a spell or ability, destroy CARDNAME." keywords. - Added some cards.
This commit is contained in:
jendave
2011-08-06 08:35:13 +00:00
parent 64628be5cd
commit 7f8c78bb4b
15 changed files with 175 additions and 9 deletions

10
.gitattributes vendored
View File

@@ -1612,6 +1612,7 @@ res/cardsfolder/gorgon_flail.txt -text svneol=native#text/plain
res/cardsfolder/gorgon_recluse.txt -text svneol=native#text/plain
res/cardsfolder/gorilla_chieftain.txt -text svneol=native#text/plain
res/cardsfolder/gorilla_warrior.txt -text svneol=native#text/plain
res/cardsfolder/gossamer_phantasm.txt -text svneol=native#text/plain
res/cardsfolder/graceful_adept.txt -text svneol=native#text/plain
res/cardsfolder/grand_arbiter_augustin_iv.txt -text svneol=native#text/plain
res/cardsfolder/grand_coliseum.txt -text svneol=native#text/plain
@@ -1853,6 +1854,7 @@ res/cardsfolder/ihsans_shade.txt -text svneol=native#text/plain
res/cardsfolder/iizuka_the_ruthless.txt -text svneol=native#text/plain
res/cardsfolder/ikiral_outrider.txt -text svneol=native#text/plain
res/cardsfolder/illusionary_forces.txt -text svneol=native#text/plain
res/cardsfolder/illusionary_servant.txt -text svneol=native#text/plain
res/cardsfolder/illusionary_wall.txt -text svneol=native#text/plain
res/cardsfolder/illusions_of_grandeur.txt -text svneol=native#text/plain
res/cardsfolder/immaculate_magistrate.txt -text svneol=native#text/plain
@@ -2427,6 +2429,7 @@ res/cardsfolder/minotaur_warrior.txt -text svneol=native#text/plain
res/cardsfolder/mirari.txt -text svneol=native#text/plain
res/cardsfolder/mire_boa.txt -text svneol=native#text/plain
res/cardsfolder/mire_kavu.txt -text svneol=native#text/plain
res/cardsfolder/mirozel.txt -text svneol=native#text/plain
res/cardsfolder/mirri_cat_warrior.txt -text svneol=native#text/plain
res/cardsfolder/mirri_the_cursed.txt -text svneol=native#text/plain
res/cardsfolder/mirror_entity.txt -text svneol=native#text/plain
@@ -2766,10 +2769,13 @@ res/cardsfolder/pestermite.txt -text svneol=native#text/plain
res/cardsfolder/pestilence.txt -text svneol=native#text/plain
res/cardsfolder/pestilence_demon.txt -text svneol=native#text/plain
res/cardsfolder/pestilent_kathari.txt -text svneol=native#text/plain
res/cardsfolder/petrahydrox.txt -text svneol=native#text/plain
res/cardsfolder/petravark.txt -text svneol=native#text/plain
res/cardsfolder/pewter_golem.txt -text svneol=native#text/plain
res/cardsfolder/phantasmal_abomination.txt -text svneol=native#text/plain
res/cardsfolder/phantasmal_forces.txt -text svneol=native#text/plain
res/cardsfolder/phantasmal_terrain.txt -text svneol=native#text/plain
res/cardsfolder/phantom_beast.txt -text svneol=native#text/plain
res/cardsfolder/phantom_centaur.txt -text svneol=native#text/plain
res/cardsfolder/phantom_monster.txt -text svneol=native#text/plain
res/cardsfolder/phantom_nishoba.txt -text svneol=native#text/plain
@@ -3403,6 +3409,9 @@ res/cardsfolder/skitter_of_lizards.txt -text svneol=native#text/plain
res/cardsfolder/skittering_invasion.txt -text svneol=native#text/plain
res/cardsfolder/skittish_kavu.txt -text svneol=native#text/plain
res/cardsfolder/skred.txt -text svneol=native#text/plain
res/cardsfolder/skulking_fugitive.txt -text svneol=native#text/plain
res/cardsfolder/skulking_ghost.txt -text svneol=native#text/plain
res/cardsfolder/skulking_knight.txt -text svneol=native#text/plain
res/cardsfolder/skull_catapult.txt -text svneol=native#text/plain
res/cardsfolder/skull_of_ramos.txt -text svneol=native#text/plain
res/cardsfolder/skullclamp.txt -text svneol=native#text/plain
@@ -3782,6 +3791,7 @@ res/cardsfolder/tangle_spider.txt -text svneol=native#text/plain
res/cardsfolder/tanglebloom.txt -text svneol=native#text/plain
res/cardsfolder/taoist_hermit.txt -text svneol=native#text/plain
res/cardsfolder/taoist_mystic.txt -text svneol=native#text/plain
res/cardsfolder/tar_pit_warrior.txt -text svneol=native#text/plain
res/cardsfolder/tar_pitcher.txt -text svneol=native#text/plain
res/cardsfolder/tarfire.txt -text svneol=native#text/plain
res/cardsfolder/tarmogoyf.txt -text svneol=native#text/plain

View File

@@ -0,0 +1,11 @@
Name:Gossamer Phantasm
ManaCost:1 U
Types:Creature Illusion
Text:no text
PT:2/1
K:Flying
K:When CARDNAME becomes the target of a spell or ability, sacrifice it.
SVar:RemAIDeck:True
SVar:Rarity:Common
SVar:Picture:http://www.wizards.com/global/images/magic/general/gossamer_phantasm.jpg
End

View File

@@ -0,0 +1,11 @@
Name:Illusionary Servant
ManaCost:1 U U
Types:Creature Illusion
Text:no text
PT:3/4
K:Flying
K:When CARDNAME becomes the target of a spell or ability, sacrifice it.
SVar:RemAIDeck:True
SVar:Rarity:Common
SVar:Picture:http://www.wizards.com/global/images/magic/general/illusionary_servant.jpg
End

View File

@@ -0,0 +1,11 @@
Name:Mirozel
ManaCost:3 U
Types:Creature Illusion
Text:no text
PT:2/3
K:Flying
K:When CARDNAME becomes the target of a spell or ability, return CARDNAME to its owner's hand.
SVar:RemAIDeck:True
SVar:Rarity:Uncommon
SVar:Picture:http://www.wizards.com/global/images/magic/general/mirozel.jpg
End

View File

@@ -0,0 +1,10 @@
Name:Petrahydrox
ManaCost:3 UR
Types:Creature Weird
Text:no text
PT:3/3
K:When CARDNAME becomes the target of a spell or ability, return CARDNAME to its owner's hand.
SVar:RemAIDeck:True
SVar:Rarity:common
SVar:Picture:http://www.wizards.com/global/images/magic/general/petrahydrox.jpg
End

View File

@@ -0,0 +1,11 @@
Name:Phantasmal Abomination
ManaCost:1 U U
Types:Creature Illusion
Text:no text
PT:5/5
K:Defender
K:When CARDNAME becomes the target of a spell or ability, sacrifice it.
SVar:RemAIDeck:True
SVar:Rarity:Uncommon
SVar:Picture:http://www.wizards.com/global/images/magic/general/phantasmal_abomination.jpg
End

View File

@@ -0,0 +1,10 @@
Name:Phantom Beast
ManaCost:3 U
Types:Creature Illusion Beast
Text:no text
PT:4/5
K:When CARDNAME becomes the target of a spell or ability, sacrifice it.
SVar:RemAIDeck:True
SVar:Rarity:Common
SVar:Picture:http://www.wizards.com/global/images/magic/general/phantom_beast.jpg
End

View File

@@ -0,0 +1,10 @@
Name:Skulking Fugitive
ManaCost:2 B
Types:Creature Horror Mercenary
Text:no text
PT:3/4
K:When CARDNAME becomes the target of a spell or ability, sacrifice it.
SVar:RemAIDeck:True
SVar:Rarity:Common
SVar:Picture:http://www.wizards.com/global/images/magic/general/skulking_fugitive.jpg
End

View File

@@ -0,0 +1,11 @@
Name:Skulking Ghost
ManaCost:1 B
Types:Creature Ghost
Text:no text
PT:2/1
K:Flying
K:When CARDNAME becomes the target of a spell or ability, sacrifice it.
SVar:RemAIDeck:True
SVar:Rarity:Common
SVar:Picture:http://www.wizards.com/global/images/magic/general/skulking_ghost.jpg
End

View File

@@ -0,0 +1,11 @@
Name:Skulking Knight
ManaCost:2 B
Types:Creature Zombie Knight
Text:no text
PT:3/3
K:Flanking
K:When CARDNAME becomes the target of a spell or ability, sacrifice it.
SVar:RemAIDeck:True
SVar:Rarity:Common
SVar:Picture:http://www.wizards.com/global/images/magic/general/skulking_knight.jpg
End

View File

@@ -0,0 +1,10 @@
Name:Tar Pit Warrior
ManaCost:2 B
Types:Creature Cyclops Warrior
Text:no text
PT:3/4
K:When CARDNAME becomes the target of a spell or ability, sacrifice it.
SVar:RemAIDeck:True
SVar:Rarity:Common
SVar:Picture:http://www.wizards.com/global/images/magic/general/tar_pit_warrior.jpg
End

View File

@@ -4634,6 +4634,49 @@ public class CardFactoryUtil {
return "";
}
//whenever CARDNAME becomes the target of a spell or ability, ... :
public static void checkTargetingEffects(SpellAbility sa, final Card c)
{
//if (AllZone.GameAction.isCardInPlay(c))
//{
if (c.getKeyword().contains("When CARDNAME becomes the target of a spell or ability, return CARDNAME to its owner's hand.")) {
SpellAbility ability = new Ability(c, "0")
{
public void resolve()
{
AllZone.GameAction.moveToHand(c);
}
};
ability.setStackDescription(c + " - return CARDNAME to its owner's hand.");
AllZone.Stack.add(ability);
}
if (c.getKeyword().contains("When CARDNAME becomes the target of a spell or ability, destroy CARDNAME.")) {
SpellAbility ability = new Ability(c, "0")
{
public void resolve()
{
AllZone.GameAction.destroy(c);
}
};
ability.setStackDescription(c + " - destroy CARDNAME.");
AllZone.Stack.add(ability);
}
if (c.getKeyword().contains("When CARDNAME becomes the target of a spell or ability, sacrifice it.")) {
SpellAbility ability = new Ability(c, "0")
{
public void resolve()
{
AllZone.GameAction.sacrifice(c);
}
};
ability.setStackDescription(c + " - sacrifice CARDNAME.");
AllZone.Stack.add(ability);
}
//}
}
public static void main(String[] args) {

View File

@@ -253,7 +253,7 @@ public class ComputerAI_General implements Computer {
for(SpellAbility sa:c.getSpellAbility())
//This try/catch should fix the "computer is thinking" bug
try {
if(sa.canPlayAI() && ComputerUtil.canPayCost(sa) &&
if(ComputerUtil.canPayCost(sa) && sa.canPlayAI() &&
(sa.isAnyPlayer() || sa.getSourceCard().getController().equals(Constant.Player.Computer)))
spellAbility.add(sa);
} catch(Exception ex) {

View File

@@ -37,8 +37,11 @@ public class MagicStack extends MyObservable
{
if(sp instanceof Ability_Mana || sp instanceof Ability_Triggered)//TODO make working triggered abilities!
sp.resolve();
else
else {
push(sp);
if (sp.getTargetCard()!= null)
CardFactoryUtil.checkTargetingEffects(sp, sp.getTargetCard());
}
}
}
@@ -179,13 +182,13 @@ public class MagicStack extends MyObservable
Card crd = sa.getSourceCard();
AllZone.InputControl.setInput(new Input_PayManaCost_Ability("Pay X cost for " + crd.getName() + " (X=" +crd.getXManaCostPaid()+")\r\n",
ability.getManaCost(), this, unpaidCommand, true));
}
};
Card crd = sa.getSourceCard();
if(sp.getSourceCard().getController().equals(Constant.Player.Human)) {
AllZone.InputControl.setInput(new Input_PayManaCost_Ability("Pay X cost for " + sp.getSourceCard().getName() + " (X=" +crd.getXManaCostPaid()+")\r\n",
}
};
Card crd = sa.getSourceCard();
if(sp.getSourceCard().getController().equals(Constant.Player.Human)) {
AllZone.InputControl.setInput(new Input_PayManaCost_Ability("Pay X cost for " + sp.getSourceCard().getName() + " (X=" +crd.getXManaCostPaid()+")\r\n",
ability.getManaCost(), paidCommand, unpaidCommand, true));
}
}
else //computer
{
int neededDamage = CardFactoryUtil.getNeededXDamage(sa);
@@ -273,7 +276,9 @@ public class MagicStack extends MyObservable
}
}
}
}
if (sp.getTargetCard()!= null)
CardFactoryUtil.checkTargetingEffects(sp, sp.getTargetCard());
}
public int size()
{

View File

@@ -307,6 +307,8 @@ public abstract class SpellAbility {
if(!card.isFaceDown()) desc = getSourceCard().getName() + " - targeting " + card;
else desc = getSourceCard().getName() + " - targeting Morph(" + card.getUniqueNumber() + ")";
setStackDescription(desc);
//System.out.println(card + " has become target of a spell or ability (" +this.getSourceCard() + ")");
}
public void setTargetPlayer(String p) {