- Converted Horde of Notions to script.

This commit is contained in:
Sloth
2012-02-17 12:51:46 +00:00
parent 5f475da767
commit 9dabf4d98a
3 changed files with 67 additions and 4 deletions

View File

@@ -6,6 +6,7 @@ PT:5/5
K:Vigilance
K:Trample
K:Haste
A:AB$ Play | Cost$ W U B R G | TgtZone$ Graveyard | WithoutManaCost$ True | ValidTgts$ Elemental.YouCtrl | TgtPrompt$ Choose target Elemental card from your graveyard | SpellDescription$ You may play target Elemental card from your graveyard without paying its mana cost.
SVar:Rarity:Rare
SVar:Picture:http://www.wizards.com/global/images/magic/general/horde_of_notions.jpg
SetInfo:LRW|Rare|http://magiccards.info/scans/en/lw/249.jpg

View File

@@ -20,19 +20,26 @@ package forge.card.abilityfactory;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Random;
import forge.AllZone;
import forge.AllZoneUtil;
import forge.Card;
import forge.CardList;
import forge.ComputerUtil;
import forge.Player;
import forge.Constant.Zone;
import forge.card.cardfactory.CardFactoryUtil;
import forge.card.cost.Cost;
import forge.card.cost.CostMana;
import forge.card.cost.CostPart;
import forge.card.cost.CostUtil;
import forge.card.spellability.AbilityActivated;
import forge.card.spellability.AbilitySub;
import forge.card.spellability.Spell;
import forge.card.spellability.SpellAbility;
import forge.card.spellability.Target;
import forge.util.MyRandom;
/**
* <p>
* AbilityFactory_Copy class.
@@ -225,9 +232,59 @@ public final class AbilityFactoryPlay {
* @return a boolean.
*/
private static boolean PlayCanPlayAI(final AbilityFactory af, final SpellAbility sa) {
final Cost abCost = af.getAbCost();
final Card source = af.getHostCard();
final HashMap<String, String> params = af.getMapParams();
final Random r = MyRandom.getRandom();
if (abCost != null) {
// AI currently disabled for these costs
if (!CostUtil.checkSacrificeCost(abCost, source)) {
return false;
}
if (!CostUtil.checkLifeCost(abCost, source, 4)) {
return false;
}
if (!CostUtil.checkDiscardCost(abCost, source)) {
return false;
}
if (!CostUtil.checkRemoveCounterCost(abCost, source)) {
return false;
}
}
// don't use this as a response
if (AllZone.getStack().size() != 0) {
return false;
}
// prevent run-away activations - first time will always return true
boolean chance = r.nextFloat() <= Math.pow(.6667, sa.getRestrictions().getNumberTurnActivations());
CardList cards;
final Target tgt = sa.getTarget();
if (tgt != null) {
Zone zone = tgt.getZone().get(0);
cards = AllZoneUtil.getCardsIn(zone);
cards = cards.getValidCards(tgt.getValidTgts(), AllZone.getComputerPlayer(), source);
if (cards.isEmpty()) {
return false;
}
tgt.addTarget(CardFactoryUtil.getBestAI(cards));
} else {
cards = new CardList(AbilityFactory.getDefinedCards(sa.getSourceCard(), params.get("Defined"), sa));
if (cards.isEmpty()) {
return false;
}
}
return chance;
}
/**
* <p>
* PlayTriggerAI.
@@ -277,7 +334,12 @@ public final class AbilityFactoryPlay {
if (tgtCards.isEmpty()) {
return;
}
Card tgtCard = tgtCards.get(0);
if (tgtCard.isLand()) {
controller.playLand(tgtCard);
return;
}
ArrayList<SpellAbility> sas = tgtCard.getBasicSpells();
if (sas.isEmpty()) {

View File

@@ -729,7 +729,7 @@ public class CardFactoryCreatures {
} // *************** END ************ END **************************
// *************** START *********** START **************************
else if (cardName.equals("Horde of Notions")) {
/*else if (cardName.equals("Horde of Notions")) {
final Ability ability = new Ability(card, "W U B R G") {
@Override
public void resolve() {
@@ -782,7 +782,7 @@ public class CardFactoryCreatures {
sbStack.append("graveyard without paying its mana cost.");
ability.setStackDescription(sbStack.toString());
ability.setBeforePayMana(new InputPayManaCost(ability));
} // *************** END ************ END **************************
}*/ // *************** END ************ END **************************
// *************** START *********** START **************************
else if (cardName.equals("Rhys the Redeemed")) {