*Added MayEffectFromOpeningHand keyword. This replaces the hardcoding for Leyline-like effects.

*Converted the Leylines to keyword.
*Added
	Chancellor of the Dross
	Chancellor of the Forge
	Chancellor of the Tangle
	
Unfortunately Chancellors of the Annex and Spires have their own problems.
This commit is contained in:
Hellfish
2011-09-11 17:44:07 +00:00
parent 08a4813af4
commit b7bf5e1967
14 changed files with 107 additions and 53 deletions

View File

@@ -10,11 +10,6 @@
<arguments> <arguments>
</arguments> </arguments>
</buildCommand> </buildCommand>
<buildCommand>
<name>net.sf.eclipsecs.core.CheckstyleBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand> <buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name> <name>org.eclipse.m2e.core.maven2Builder</name>
<arguments> <arguments>
@@ -24,6 +19,5 @@
<natures> <natures>
<nature>org.eclipse.m2e.core.maven2Nature</nature> <nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>org.eclipse.jdt.core.javanature</nature> <nature>org.eclipse.jdt.core.javanature</nature>
<nature>net.sf.eclipsecs.core.CheckstyleNature</nature>
</natures> </natures>
</projectDescription> </projectDescription>

View File

@@ -3,6 +3,8 @@ ManaCost:2 U U
Types:Enchantment Types:Enchantment
Text:If CARDNAME is in your opening hand, you may begin the game with it on the battlefield. Text:If CARDNAME is in your opening hand, you may begin the game with it on the battlefield.
S:Mode$ Continuous | Affected$ Card.nonLand+YouCtrl | AddKeyword$ HIDDEN Flash | AffectedZone$ Hand,Graveyard,Exile | Description$ You may cast nonland cards as though they had flash. (You may cast them any time you could cast an instant.) S:Mode$ Continuous | Affected$ Card.nonLand+YouCtrl | AddKeyword$ HIDDEN Flash | AffectedZone$ Hand,Graveyard,Exile | Description$ You may cast nonland cards as though they had flash. (You may cast them any time you could cast an instant.)
K:MayEffectFromOpeningHand:PutOnBattlefield
SVar:PutOnBattlefield:AB$ ChangeZone | Cost$ 0 | Defined$ Self | Origin$ Hand | Destination$ Battlefield
SVar:RemRandomDeck:True SVar:RemRandomDeck:True
SVar:Rarity:Rare SVar:Rarity:Rare
SVar:Picture:http://www.wizards.com/global/images/magic/general/leyline_of_anticipation.jpg SVar:Picture:http://www.wizards.com/global/images/magic/general/leyline_of_anticipation.jpg

View File

@@ -3,6 +3,8 @@ ManaCost:2 G G
Types:Enchantment Types:Enchantment
Text:If CARDNAME is in your opening hand, you may begin the game with it on the battlefield. Text:If CARDNAME is in your opening hand, you may begin the game with it on the battlefield.
S:Mode$ Continuous | Affected$ Creature | AddKeyword$ HIDDEN CARDNAME can't be countered. | AffectedZone$ Stack | Description$ Creature spells can't be countered. S:Mode$ Continuous | Affected$ Creature | AddKeyword$ HIDDEN CARDNAME can't be countered. | AffectedZone$ Stack | Description$ Creature spells can't be countered.
K:MayEffectFromOpeningHand:PutOnBattlefield
SVar:PutOnBattlefield:AB$ ChangeZone | Cost$ 0 | Defined$ Self | Origin$ Hand | Destination$ Battlefield
SVar:RemRandomDeck:True SVar:RemRandomDeck:True
SVar:Rarity:Rare SVar:Rarity:Rare
SVar:Picture:http://www.wizards.com/global/images/magic/general/leyline_of_lifeforce.jpg SVar:Picture:http://www.wizards.com/global/images/magic/general/leyline_of_lifeforce.jpg

View File

@@ -4,6 +4,8 @@ Types:Enchantment
Text:If Leyline of Lightning is in your opening hand, you may begin the game with it on the battlefield. Text:If Leyline of Lightning is in your opening hand, you may begin the game with it on the battlefield.
T:Mode$ SpellCast | ValidCard$ Card.YouCtrl | TriggerZones$ Battlefield | Execute$ TrigDealDamage | TriggerDescription$ Whenever you cast a spell, you may pay 1. If you do, CARDNAME deals 1 damage to target player. T:Mode$ SpellCast | ValidCard$ Card.YouCtrl | TriggerZones$ Battlefield | Execute$ TrigDealDamage | TriggerDescription$ Whenever you cast a spell, you may pay 1. If you do, CARDNAME deals 1 damage to target player.
SVar:TrigDealDamage:AB$DealDamage | Cost$ 1 | Tgt$ TgtP | NumDmg$ 1 SVar:TrigDealDamage:AB$DealDamage | Cost$ 1 | Tgt$ TgtP | NumDmg$ 1
K:MayEffectFromOpeningHand:PutOnBattlefield
SVar:PutOnBattlefield:AB$ ChangeZone | Cost$ 0 | Defined$ Self | Origin$ Hand | Destination$ Battlefield
SVar:RemRandomDeck:True SVar:RemRandomDeck:True
SVar:Rarity:Rare SVar:Rarity:Rare
SVar:Picture:http://www.wizards.com/global/images/magic/general/leyline_of_lightning.jpg SVar:Picture:http://www.wizards.com/global/images/magic/general/leyline_of_lightning.jpg

View File

@@ -2,6 +2,8 @@ Name:Leyline of Punishment
ManaCost:2 R R ManaCost:2 R R
Types:Enchantment Types:Enchantment
Text:If Leyline of Punishment is in your opening hand, you may begin the game with it on the battlefield. Players can't gain life. Damage can't be prevented. Text:If Leyline of Punishment is in your opening hand, you may begin the game with it on the battlefield. Players can't gain life. Damage can't be prevented.
K:MayEffectFromOpeningHand:PutOnBattlefield
SVar:PutOnBattlefield:AB$ ChangeZone | Cost$ 0 | Defined$ Self | Origin$ Hand | Destination$ Battlefield
SVar:RemRandomDeck:True SVar:RemRandomDeck:True
SVar:Rarity:Rare SVar:Rarity:Rare
SVar:Picture:http://www.wizards.com/global/images/magic/general/leyline_of_punishment.jpg SVar:Picture:http://www.wizards.com/global/images/magic/general/leyline_of_punishment.jpg

View File

@@ -2,6 +2,8 @@ Name:Leyline of Sanctity
ManaCost:2 W W ManaCost:2 W W
Types:Enchantment Types:Enchantment
Text:If CARDNAME is in your opening hand, you may begin the game with it on the battlefield. Text:If CARDNAME is in your opening hand, you may begin the game with it on the battlefield.
K:MayEffectFromOpeningHand:PutOnBattlefield
SVar:PutOnBattlefield:AB$ ChangeZone | Cost$ 0 | Defined$ Self | Origin$ Hand | Destination$ Battlefield
S:Mode$ Continuous | Affected$ You | AddKeyword$ Hexproof | Description$ You have hexproof. (You can't be the target of spells or abilities your opponents control.) S:Mode$ Continuous | Affected$ You | AddKeyword$ Hexproof | Description$ You have hexproof. (You can't be the target of spells or abilities your opponents control.)
SVar:Rarity:Rare SVar:Rarity:Rare
SVar:Picture:http://www.wizards.com/global/images/magic/general/leyline_of_sanctity.jpg SVar:Picture:http://www.wizards.com/global/images/magic/general/leyline_of_sanctity.jpg

View File

@@ -2,6 +2,8 @@ Name:Leyline of Singularity
ManaCost:2 U U ManaCost:2 U U
Types:Enchantment Types:Enchantment
Text:If Leyline of Singularity is in your opening hand, you may begin the game with it on the battlefield. Text:If Leyline of Singularity is in your opening hand, you may begin the game with it on the battlefield.
K:MayEffectFromOpeningHand:PutOnBattlefield
SVar:PutOnBattlefield:AB$ ChangeZone | Cost$ 0 | Defined$ Self | Origin$ Hand | Destination$ Battlefield
S:Mode$ Continuous | Affected$ Permanent.nonLand | AddType$ Legendary | Description$ All nonland permanents are legendary. S:Mode$ Continuous | Affected$ Permanent.nonLand | AddType$ Legendary | Description$ All nonland permanents are legendary.
SVar:RemRandomDeck:True SVar:RemRandomDeck:True
SVar:Rarity:Rare SVar:Rarity:Rare

View File

@@ -2,6 +2,8 @@ Name:Leyline of the Meek
ManaCost:2 W W ManaCost:2 W W
Types:Enchantment Types:Enchantment
Text:If Leyline of the Meek is in your opening hand, you may begin the game with it on the battlefield. Text:If Leyline of the Meek is in your opening hand, you may begin the game with it on the battlefield.
K:MayEffectFromOpeningHand:PutOnBattlefield
SVar:PutOnBattlefield:AB$ ChangeZone | Cost$ 0 | Defined$ Self | Origin$ Hand | Destination$ Battlefield
S:Mode$ Continuous | Affected$ Creature.token | AddPower$ 1 | AddToughness$ 1 | Description$ Creature tokens get +1/+1. S:Mode$ Continuous | Affected$ Creature.token | AddPower$ 1 | AddToughness$ 1 | Description$ Creature tokens get +1/+1.
SVar:PlayMain1:TRUE SVar:PlayMain1:TRUE
SVar:RemRandomDeck:True SVar:RemRandomDeck:True

View File

@@ -2,6 +2,8 @@ Name:Leyline of the Void
ManaCost:2 B B ManaCost:2 B B
Types:Enchantment Types:Enchantment
Text:If Leyline of the Void is in your opening hand, you may begin the game with it on the battlefield.\r\nIf a card would be put into an opponent's graveyard from anywhere, exile it instead. Text:If Leyline of the Void is in your opening hand, you may begin the game with it on the battlefield.\r\nIf a card would be put into an opponent's graveyard from anywhere, exile it instead.
K:MayEffectFromOpeningHand:PutOnBattlefield
SVar:PutOnBattlefield:AB$ ChangeZone | Cost$ 0 | Defined$ Self | Origin$ Hand | Destination$ Battlefield
SVar:RemRandomDeck:True SVar:RemRandomDeck:True
SVar:Rarity:Rare SVar:Rarity:Rare
SVar:Picture:http://www.wizards.com/global/images/magic/general/leyline_of_the_void.jpg SVar:Picture:http://www.wizards.com/global/images/magic/general/leyline_of_the_void.jpg

View File

@@ -2,6 +2,8 @@ Name:Leyline of Vitality
ManaCost:2 G G ManaCost:2 G G
Types:Enchantment Types:Enchantment
Text:If Leyline of Vitality is in your opening hand, you may begin the game with it on the battlefield. Text:If Leyline of Vitality is in your opening hand, you may begin the game with it on the battlefield.
K:MayEffectFromOpeningHand:PutOnBattlefield
SVar:PutOnBattlefield:AB$ ChangeZone | Cost$ 0 | Defined$ Self | Origin$ Hand | Destination$ Battlefield
S:Mode$ Continuous | Affected$ Creature.YouCtrl | AddToughness$ 1 | Description$ Creatures you control get +0/+1. S:Mode$ Continuous | Affected$ Creature.YouCtrl | AddToughness$ 1 | Description$ Creatures you control get +0/+1.
T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Creature.YouCtrl | TriggerZones$ Battlefield | OptionalDecider$ You | Execute$ TrigGainLife | TriggerDescription$ Whenever a creature enters the battlefield under your control, you may gain 1 life. T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Creature.YouCtrl | TriggerZones$ Battlefield | OptionalDecider$ You | Execute$ TrigGainLife | TriggerDescription$ Whenever a creature enters the battlefield under your control, you may gain 1 life.
SVar:TrigGainLife:AB$GainLife | Cost$ 0 | Defined$ You | LifeAmount$ 1 SVar:TrigGainLife:AB$GainLife | Cost$ 0 | Defined$ You | LifeAmount$ 1

View File

@@ -58,8 +58,8 @@ draft--properties=draft/draft.properties
lang--transparent-properties=lang/lang.properties lang--transparent-properties=lang/lang.properties
image/base--file=pics image/base--file=d:/Games/forge/pics
image/token--file=pics/tokens image/token--file=d:/Games/forge/pics/tokens
image/icon--file=pics/icons image/icon--file=d:/Games/forge/pics/icons
symbols/small--file=images/symbols-13 symbols/small--file=images/symbols-13
sound/base--file=sound sound/base--file=sound

View File

@@ -1635,6 +1635,8 @@ public class Card extends GameEntity implements Comparable<Card> {
sbLong.append(" (This enters the battlefield with "); sbLong.append(" (This enters the battlefield with ");
sbLong.append(numCounters); sbLong.append(numCounters);
sbLong.append(" +1/+1 counters on it. When it's put into a graveyard, you may put its +1/+1 counters on target artifact creature.)"); sbLong.append(" +1/+1 counters on it. When it's put into a graveyard, you may put its +1/+1 counters on target artifact creature.)");
} else if (keyword.get(i).startsWith("MayEffectFromOpeningHand")) {
continue;
} else { } else {
if (i != 0 && sb.length() != 0) { if (i != 0 && sb.length() != 0) {
sb.append(", "); sb.append(", ");

View File

@@ -302,33 +302,37 @@ public class TriggerHandler {
Player playerAP = AllZone.getPhase().getPlayerTurn(); Player playerAP = AllZone.getPhase().getPlayerTurn();
//This is done to allow the list of triggers to be modified while triggers are running.
ArrayList<Trigger> registeredTriggersWorkingCopy = new ArrayList<Trigger>(registeredTriggers);
ArrayList<Trigger> delayedTriggersWorkingCopy = new ArrayList<Trigger>(delayedTriggers);
//AP //AP
for (int i = 0; i < registeredTriggers.size(); i++) { for (int i = 0; i < registeredTriggersWorkingCopy.size(); i++) {
if (registeredTriggers.get(i).getHostCard().getController().equals(playerAP)) { if (registeredTriggersWorkingCopy.get(i).getHostCard().getController().equals(playerAP)) {
runSingleTrigger(registeredTriggers.get(i), mode, runParams); runSingleTrigger(registeredTriggersWorkingCopy.get(i), mode, runParams);
} }
} }
for (int i = 0; i < delayedTriggers.size(); i++) { for (int i = 0; i < delayedTriggersWorkingCopy.size(); i++) {
Trigger deltrig = delayedTriggers.get(i); Trigger deltrig = delayedTriggersWorkingCopy.get(i);
if (deltrig.getHostCard().getController().equals(playerAP)) { if (deltrig.getHostCard().getController().equals(playerAP)) {
if (runSingleTrigger(deltrig, mode, runParams)) { if (runSingleTrigger(deltrig, mode, runParams)) {
delayedTriggers.remove(i); delayedTriggers.remove(deltrig);
i--; i--;
} }
} }
} }
//NAP //NAP
for (int i = 0; i < registeredTriggers.size(); i++) { for (int i = 0; i < registeredTriggersWorkingCopy.size(); i++) {
if (registeredTriggers.get(i).getHostCard().getController().equals(playerAP.getOpponent())) { if (registeredTriggersWorkingCopy.get(i).getHostCard().getController().equals(playerAP.getOpponent())) {
runSingleTrigger(registeredTriggers.get(i), mode, runParams); runSingleTrigger(registeredTriggersWorkingCopy.get(i), mode, runParams);
} }
} }
for (int i = 0; i < delayedTriggers.size(); i++) { for (int i = 0; i < delayedTriggersWorkingCopy.size(); i++) {
Trigger deltrig = delayedTriggers.get(i); Trigger deltrig = delayedTriggersWorkingCopy.get(i);
if (deltrig.getHostCard().getController().equals(playerAP.getOpponent())) { if (deltrig.getHostCard().getController().equals(playerAP.getOpponent())) {
if (runSingleTrigger(deltrig, mode, runParams)) { if (runSingleTrigger(deltrig, mode, runParams)) {
delayedTriggers.remove(i); delayedTriggers.remove(deltrig);
i--; i--;
} }
} }

View File

@@ -1,6 +1,11 @@
package forge.gui.input; package forge.gui.input;
import java.util.ArrayList;
import forge.*; import forge.*;
import forge.card.abilityFactory.AbilityFactory;
import forge.card.cardFactory.CardFactoryUtil;
import forge.card.spellability.SpellAbility;
import forge.game.GamePlayerRating; import forge.game.GamePlayerRating;
import forge.game.PlayerIndex; import forge.game.PlayerIndex;
import forge.quest.data.QuestData; import forge.quest.data.QuestData;
@@ -84,27 +89,58 @@ public class Input_Mulligan extends Input {
} }
} }
//Human Leylines //Human Leylines & Chancellors
ButtonUtil.reset(); ButtonUtil.reset();
AbilityFactory af = new AbilityFactory();
CardList humanOpeningHand = AllZoneUtil.getPlayerHand(AllZone.getHumanPlayer()); CardList humanOpeningHand = AllZoneUtil.getPlayerHand(AllZone.getHumanPlayer());
for (Card c : humanOpeningHand) { for (Card c : humanOpeningHand) {
if (c.getName().startsWith("Leyline")) { ArrayList<String> kws = c.getKeyword();
if (GameActionUtil.showYesNoDialog(c, "Put onto Battlefield?")) for(int i = 0;i<kws.size();i++) {
AllZone.getGameAction().moveToPlay(c); String kw = kws.get(i);
if(kw.startsWith("MayEffectFromOpeningHand"))
{
String effName = kw.split(":")[1];
SpellAbility effect = af.getAbility(c.getSVar(effName), c);
if(GameActionUtil.showYesNoDialog(c, "Use this card's ability?"))
{
//If we ever let the AI memorize cards in the players hand, this would be a place to do so.
AllZone.getGameAction().playSpellAbility_NoStack(effect, false);
}
}
} }
} }
//Computer Leylines //Computer Leylines & Chancellors
CardList aiOpeningHand = AllZoneUtil.getPlayerHand(AllZone.getComputerPlayer()); CardList aiOpeningHand = AllZoneUtil.getPlayerHand(AllZone.getComputerPlayer());
for (Card c : aiOpeningHand) { for (Card c : aiOpeningHand) {
if (c.getName().startsWith("Leyline") && !(c.getName().startsWith("Leyline of Singularity") if (!(c.getName().startsWith("Leyline of Singularity")
&& AllZoneUtil.getCardsInPlay("Leyline of Singularity").size() > 0)) { && AllZoneUtil.getCardsInPlay("Leyline of Singularity").size() > 0)) {
AllZone.getGameAction().moveToPlay(c); ArrayList<String> kws = c.getKeyword();
AllZone.getGameAction().checkStateEffects(); for(int i = 0;i<kws.size();i++) {
String kw = kws.get(i);
if(kw.startsWith("MayEffectFromOpeningHand"))
{
String effName = kw.split(":")[1];
SpellAbility effect = af.getAbility(c.getSVar(effName), c);
if(effect.doTrigger(false)) //Is there a better way for the AI to decide this?
{
GameActionUtil.showInfoDialg("Computer reveals " + c.getName() + "(" + c.getUniqueNumber() + ").");
ComputerUtil.playNoStack(effect);
}
}
}
} }
} }
AllZone.getGameAction().checkStateEffects();
if (AllZone.getGameAction().isStartCut() && !(humanOpeningHand.contains(AllZone.getGameAction().getHumanCut()) if (AllZone.getGameAction().isStartCut() && !(humanOpeningHand.contains(AllZone.getGameAction().getHumanCut())
|| aiOpeningHand.contains(AllZone.getGameAction().getComputerCut()))) { || aiOpeningHand.contains(AllZone.getGameAction().getComputerCut()))) {
AllZone.getGameAction().moveTo(AllZone.getZone(Constant.Zone.Library, AllZone.getHumanPlayer()), AllZone.getGameAction().getHumanCut()); AllZone.getGameAction().moveTo(AllZone.getZone(Constant.Zone.Library, AllZone.getHumanPlayer()), AllZone.getGameAction().getHumanCut());