mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 12:18:00 +00:00
- Improved the generic aura code. This code will now check to see if the keyword ends with " you control". If found, the human will only be able to target his or her own cards of the appropriate type. It is assumed that we will not have any auras that also need to end in "Curse" for the AI to determine a target for the aura.
- Converted Caribou Range to use this new code.
This commit is contained in:
@@ -1,10 +1,11 @@
|
|||||||
Name:Caribou Range
|
Name:Caribou Range
|
||||||
ManaCost:2 W W
|
ManaCost:2 W W
|
||||||
Types:Enchantment Aura
|
Types:Enchantment Aura
|
||||||
Text:Enchanted land has "W W, Tap: Put a 0/1 white Caribou creature token onto the battlefield."
|
Text:no text
|
||||||
K:Enchant land you control
|
K:Enchant Land you control
|
||||||
#This doesn't work because the SpellAbility's get cleared after this is added.
|
K:stPumpAll:Card.AttachedBy:0/0/SVar=Token:no Condition:Enchanted land has "W W, Tap: Put a 0/1 white Caribou creature token onto the battlefield."
|
||||||
#A:AB$GainLife|Cost$Sac<1/Caribou.token>|CostDesc$Sacrifice a Caribou token: |LifeAmount$1|SpellDescription$You gain 1 life.
|
SVar:Token:AB$Token | Cost$ W W T | TokenAmount$ 1 | TokenName$ Caribou | TokenTypes$ Creature,Caribou | TokenColors$ White | TokenPower$ 0 | TokenToughness$ 1 | TokenOwner$ You | SpellDescription$ Put a 0/1 white Caribou creature token onto the battlefield.
|
||||||
|
A:AB$ GainLife | Cost$ Sac<1/Caribou.token> | CostDesc$ Sacrifice a Caribou token: | LifeAmount$ 1 | SpellDescription$ You gain 1 life.
|
||||||
SVar:Rarity:Rare
|
SVar:Rarity:Rare
|
||||||
SVar:Picture:http://www.wizards.com/global/images/magic/general/caribou_range.jpg
|
SVar:Picture:http://www.wizards.com/global/images/magic/general/caribou_range.jpg
|
||||||
SetInfo:5ED|Rare|http://magiccards.info/scans/en/5e/290.jpg
|
SetInfo:5ED|Rare|http://magiccards.info/scans/en/5e/290.jpg
|
||||||
|
|||||||
@@ -87,6 +87,7 @@ class CardFactory_Auras {
|
|||||||
// Enchant land you control: *************************************
|
// Enchant land you control: *************************************
|
||||||
// *****************************************************************
|
// *****************************************************************
|
||||||
|
|
||||||
|
/* Converted to generic aura and trigger + AF
|
||||||
//*************** START *********** START **************************
|
//*************** START *********** START **************************
|
||||||
if(cardName.equals("Caribou Range")) {
|
if(cardName.equals("Caribou Range")) {
|
||||||
|
|
||||||
@@ -95,10 +96,10 @@ class CardFactory_Auras {
|
|||||||
private static final long serialVersionUID = 5394181222737344498L;
|
private static final long serialVersionUID = 5394181222737344498L;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
/*
|
//
|
||||||
* The computer will now place this aura on unenchanted lands, but
|
// The computer will now place this aura on unenchanted lands, but
|
||||||
* it will tap an enchanted land for mana to produce the token.
|
// it will tap an enchanted land for mana to produce the token.
|
||||||
*/
|
//
|
||||||
|
|
||||||
public boolean canPlayAI() {
|
public boolean canPlayAI() {
|
||||||
|
|
||||||
@@ -106,8 +107,8 @@ class CardFactory_Auras {
|
|||||||
list = list.filter(new CardListFilter() {
|
list = list.filter(new CardListFilter() {
|
||||||
public boolean addCard(Card c) {
|
public boolean addCard(Card c) {
|
||||||
return c.isLand()
|
return c.isLand()
|
||||||
&& !c.isEnchanted()
|
&& !c.isEnchanted()
|
||||||
&& CardFactoryUtil.canTarget(card, c);
|
&& CardFactoryUtil.canTarget(card, c);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -121,12 +122,12 @@ class CardFactory_Auras {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void resolve() {
|
public void resolve() {
|
||||||
AllZone.GameAction.moveToPlay(card);
|
AllZone.GameAction.moveToPlay(card);
|
||||||
|
|
||||||
Card c = getTargetCard();
|
Card c = getTargetCard();
|
||||||
|
|
||||||
if(AllZone.GameAction.isCardInPlay(c)
|
if(AllZone.GameAction.isCardInPlay(c)
|
||||||
&& CardFactoryUtil.canTarget(card, c)) card.enchantCard(c);
|
&& CardFactoryUtil.canTarget(card, c)) card.enchantCard(c);
|
||||||
}//resolve()
|
}//resolve()
|
||||||
};//SpellAbility
|
};//SpellAbility
|
||||||
spell.setType("Extrinsic");
|
spell.setType("Extrinsic");
|
||||||
@@ -141,7 +142,7 @@ class CardFactory_Auras {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void resolve() {
|
public void resolve() {
|
||||||
CardFactoryUtil.makeToken("Caribou", "W 0 1 Caribou", spell.getTargetCard().getController(), "W", new String[] {
|
CardFactoryUtil.makeToken("Caribou", "W 0 1 Caribou", spell.getTargetCard().getController(), "W", new String[] {
|
||||||
"Creature", "Caribou"}, 0, 1, new String[] {""});
|
"Creature", "Caribou"}, 0, 1, new String[] {""});
|
||||||
}
|
}
|
||||||
};//SpellAbility
|
};//SpellAbility
|
||||||
@@ -214,7 +215,7 @@ class CardFactory_Auras {
|
|||||||
if(!AllZone.GameAction.isCardInPlay(c)) return;
|
if(!AllZone.GameAction.isCardInPlay(c)) return;
|
||||||
|
|
||||||
if(AllZone.GameAction.isCardInPlay(c)) {
|
if(AllZone.GameAction.isCardInPlay(c)) {
|
||||||
c.getController().gainLife(1, card);
|
c.getController().gainLife(1, card);
|
||||||
AllZone.GameAction.sacrifice(c);
|
AllZone.GameAction.sacrifice(c);
|
||||||
}
|
}
|
||||||
}//resolve
|
}//resolve
|
||||||
@@ -278,9 +279,10 @@ class CardFactory_Auras {
|
|||||||
};
|
};
|
||||||
spell.setBeforePayMana(runtime2);
|
spell.setBeforePayMana(runtime2);
|
||||||
}//*************** END ************ END **************************
|
}//*************** END ************ END **************************
|
||||||
|
*/
|
||||||
|
|
||||||
//*************** START *********** START **************************
|
//*************** START *********** START **************************
|
||||||
else if(cardName.equals("Leafdrake Roost")) {
|
if(cardName.equals("Leafdrake Roost")) {
|
||||||
|
|
||||||
final SpellAbility spell = new Spell(card) {
|
final SpellAbility spell = new Spell(card) {
|
||||||
|
|
||||||
@@ -1923,60 +1925,81 @@ class CardFactory_Auras {
|
|||||||
|
|
||||||
////////////////////DRF test generic aura
|
////////////////////DRF test generic aura
|
||||||
//*************** START *********** START **************************
|
//*************** START *********** START **************************
|
||||||
else if(isAuraType(card, "Land") || isAuraType(card, "Creature") ||
|
else if (isAuraType(card, "Land") || isAuraType(card, "Creature") ||
|
||||||
isAuraType(card, "Artifact") || isAuraType(card, "Enchantment") ||
|
isAuraType(card, "Artifact") || isAuraType(card, "Enchantment") ||
|
||||||
isAuraType(card, "Wall")) {
|
isAuraType(card, "Wall")) {
|
||||||
|
|
||||||
final String type = getAuraType(card);
|
final String type = getAuraType(card);
|
||||||
final boolean curse = isCurseAura(card);
|
final boolean curse = isCurseAura(card);
|
||||||
if("" == type) {
|
final boolean youControl = isTypeYouControl(card);
|
||||||
Log.error("Problem in generic Aura code - type is null");
|
if ("" == type) {
|
||||||
}
|
Log.error("Problem in generic Aura code - type is null");
|
||||||
final SpellAbility spell = new Spell(card) {
|
}
|
||||||
private static final long serialVersionUID = 4191777361540717307L;
|
final SpellAbility spell = new Spell(card) {
|
||||||
|
private static final long serialVersionUID = 4191777361540717307L;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canPlayAI() {
|
public boolean canPlayAI() {
|
||||||
Player player;
|
Player player;
|
||||||
if(curse) {
|
if (curse) {
|
||||||
player = AllZone.HumanPlayer;
|
player = AllZone.HumanPlayer;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
player = AllZone.ComputerPlayer;
|
player = AllZone.ComputerPlayer;
|
||||||
}
|
}
|
||||||
CardList list = AllZoneUtil.getPlayerTypeInPlay(player, type);
|
CardList list = AllZoneUtil.getPlayerTypeInPlay(player, type);
|
||||||
|
|
||||||
if(list.isEmpty()) return false;
|
if (list.isEmpty()) return false;
|
||||||
|
|
||||||
//TODO - maybe do something intelligent here if it's not a curse, like
|
//TODO - maybe do something intelligent here if it's not a curse, like
|
||||||
//checking the aura magnet list
|
//checking the aura magnet list
|
||||||
setTargetCard(list.get(0));
|
|
||||||
return super.canPlayAI();
|
|
||||||
}//canPlayAI()
|
|
||||||
|
|
||||||
@Override
|
// We do not want the AI to always enchant the same card.
|
||||||
public void resolve() {
|
list.shuffle();
|
||||||
AllZone.GameAction.moveToPlay(card);
|
|
||||||
|
setTargetCard(list.get(0));
|
||||||
|
return super.canPlayAI();
|
||||||
|
}//canPlayAI()
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void resolve() {
|
||||||
|
AllZone.GameAction.moveToPlay(card);
|
||||||
|
|
||||||
Card c = getTargetCard();
|
Card c = getTargetCard();
|
||||||
if(AllZone.GameAction.isCardInPlay(c) && CardFactoryUtil.canTarget(card, c)) card.enchantCard(c);
|
if (AllZone.GameAction.isCardInPlay(c)
|
||||||
}//resolve()
|
&& CardFactoryUtil.canTarget(card, c)) {
|
||||||
};//SpellAbility
|
card.enchantCard(c);
|
||||||
card.clearFirstSpellAbility();
|
}
|
||||||
card.addSpellAbility(spell);
|
}//resolve()
|
||||||
card.addLeavesPlayCommand(standardUnenchant);
|
};//SpellAbility
|
||||||
|
card.clearFirstSpellAbility();
|
||||||
|
card.addSpellAbility(spell);
|
||||||
|
card.addLeavesPlayCommand(standardUnenchant);
|
||||||
|
|
||||||
Input runtime = new Input() {
|
Input runtime = new Input() {
|
||||||
private static final long serialVersionUID = -7100800261954421849L;
|
private static final long serialVersionUID = -7100800261954421849L;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void showMessage() {
|
public void showMessage() {
|
||||||
CardList land = AllZoneUtil.getTypeInPlay(type);
|
// We will now use a list name other than "land", ugh!
|
||||||
stopSetNext(CardFactoryUtil.input_targetSpecific(spell, land,
|
// CardList land = AllZoneUtil.getTypeInPlay(type);
|
||||||
"Select target "+type.toLowerCase(), true, false));
|
|
||||||
}
|
StringBuilder sbTitle = new StringBuilder();
|
||||||
};
|
sbTitle.append("Select target ").append(type.toLowerCase());
|
||||||
spell.setBeforePayMana(runtime);
|
if (youControl) {
|
||||||
|
sbTitle.append(" you control");
|
||||||
|
}
|
||||||
|
CardList auraCandidates = new CardList();
|
||||||
|
if (youControl) {
|
||||||
|
auraCandidates = AllZoneUtil.getPlayerTypeInPlay(card.getController(), type);
|
||||||
|
} else {
|
||||||
|
auraCandidates = AllZoneUtil.getTypeInPlay(type);
|
||||||
|
}
|
||||||
|
stopSetNext(CardFactoryUtil.input_targetSpecific(spell, auraCandidates,
|
||||||
|
sbTitle.toString(), true, false));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
spell.setBeforePayMana(runtime);
|
||||||
}//*************** END ************ END **************************
|
}//*************** END ************ END **************************
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////
|
||||||
@@ -2546,4 +2569,15 @@ class CardFactory_Auras {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//checks if the aura can only target the controller's cards
|
||||||
|
private static boolean isTypeYouControl(final Card aura) {
|
||||||
|
ArrayList<String> keywords = aura.getKeyword();
|
||||||
|
for (String keyword:keywords) {
|
||||||
|
if (keyword.startsWith("Enchant ")) {
|
||||||
|
if (keyword.endsWith("you control")) return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user