- Fixed Doomed Necromancer. The AI will no longer target a creature with the keyword "At the beginning of the end step, sacrifice CARDNAME." if it is main phase 2.

This commit is contained in:
jendave
2011-08-06 06:00:34 +00:00
parent ca7a928de9
commit db043d2842

View File

@@ -11789,28 +11789,33 @@ public class CardFactory_Creatures {
ability.setAfterPayMana(target); ability.setAfterPayMana(target);
}//*************** END ************ END ************************** }//*************** END ************ END **************************
//*************** START *********** START ************************** //*************** START *********** START **************************
if(cardName.equals("Doomed Necromancer")) { if(cardName.equals("Doomed Necromancer")) {
final SpellAbility ability = new Ability_Tap(card, "B") { final SpellAbility ability = new Ability_Tap(card, "B") {
private static final long serialVersionUID = -6432831150810562390L; private static final long serialVersionUID = -6432831150810562390L;
@Override
@Override
public boolean canPlayAI() { public boolean canPlayAI() {
return getCreatures().length != 0; return getCreatures().length != 0;
} }//canPlayAI()
public Card[] getCreatures() { public Card[] getCreatures() {
CardList creature = new CardList(); CardList creature = new CardList();
PlayerZone zone = AllZone.getZone(Constant.Zone.Graveyard, card.getController()); PlayerZone zone = AllZone.getZone(Constant.Zone.Graveyard, card.getController());
creature.addAll(zone.getCards()); creature.addAll(zone.getCards());
creature = creature.getType("Creature"); creature = creature.getType("Creature");
if (AllZone.Phase.getPhase().equals(Constant.Phase.Main2) && card.getController().equals(Constant.Player.Computer)) {
creature = creature.getNotKeyword("At the beginning of the end step, sacrifice CARDNAME.");
}
creature = creature.filter(new CardListFilter() { creature = creature.filter(new CardListFilter() {
public boolean addCard(Card c) { public boolean addCard(Card c) {
return c.getNetAttack() > 4; return c.getNetAttack() > 4;
} }
}); });
return creature.toArray(); return creature.toArray();
} }//getCreatures()
@Override @Override
public void chooseTargetAI() { public void chooseTargetAI() {
Card c[] = getCreatures(); Card c[] = getCreatures();
@@ -11819,29 +11824,30 @@ public class CardFactory_Creatures {
if(biggest.getNetAttack() < c[i].getNetAttack()) biggest = c[i]; if(biggest.getNetAttack() < c[i].getNetAttack()) biggest = c[i];
setTargetCard(biggest); setTargetCard(biggest);
} }//chooseTargetAI()
@Override @Override
public void resolve() { public void resolve() {
if(card.getController().equals(Constant.Player.Human)) { if(card.getController().equals(Constant.Player.Human)) {
CardList creature = new CardList(); CardList creature = new CardList();
PlayerZone zone = AllZone.getZone(Constant.Zone.Graveyard, card.getController()); PlayerZone zone = AllZone.getZone(Constant.Zone.Graveyard, card.getController());
creature.addAll(zone.getCards()); creature.addAll(zone.getCards());
creature = creature.getType("Creature"); creature = creature.getType("Creature");
if(creature.size() != 0) { if(creature.size() != 0) {
Object o = AllZone.Display.getChoice("Choose a creature from the graveyard to return to the battlefield", creature.toArray()); Object o = AllZone.Display.getChoice("Choose a creature from the graveyard to return to the battlefield", creature.toArray());
if(o != null) {
Card c = (Card) o; if(o != null) {
if(AllZone.GameAction.isCardInZone(c, zone)) { Card c = (Card) o;
PlayerZone play = AllZone.getZone(Constant.Zone.Play, c.getController()); if(AllZone.GameAction.isCardInZone(c, zone)) {
AllZone.GameAction.moveTo(play, c); PlayerZone play = AllZone.getZone(Constant.Zone.Play, c.getController());
AllZone.GameAction.sacrifice(card); AllZone.GameAction.moveTo(play, c);
} AllZone.GameAction.sacrifice(card);
} }
}
} else { } else {
AllZone.GameAction.sacrifice(card); AllZone.GameAction.sacrifice(card);
} }
} else { } else {//Computer
CardList creature = new CardList(); CardList creature = new CardList();
PlayerZone zone = AllZone.getZone(Constant.Zone.Graveyard, card.getController()); PlayerZone zone = AllZone.getZone(Constant.Zone.Graveyard, card.getController());
creature.addAll(zone.getCards()); creature.addAll(zone.getCards());
@@ -11850,29 +11856,31 @@ public class CardFactory_Creatures {
Card biggest = c[0]; Card biggest = c[0];
for(int i = 0; i < c.length; i++) for(int i = 0; i < c.length; i++)
if(biggest.getNetAttack() < c[i].getNetAttack()) biggest = c[i]; if(biggest.getNetAttack() < c[i].getNetAttack()) biggest = c[i];
if(creature.size() != 0) { if(creature.size() != 0) {
if(biggest != null) { if(biggest != null) {
if(AllZone.GameAction.isCardInZone(biggest, zone)) { if(AllZone.GameAction.isCardInZone(biggest, zone)) {
PlayerZone play = AllZone.getZone(Constant.Zone.Play, biggest.getController()); PlayerZone play = AllZone.getZone(Constant.Zone.Play, biggest.getController());
AllZone.GameAction.moveTo(play, biggest); AllZone.GameAction.moveTo(play, biggest);
AllZone.GameAction.sacrifice(card); AllZone.GameAction.sacrifice(card);
}
} }
} } else {
} else { AllZone.GameAction.sacrifice(card);
AllZone.GameAction.sacrifice(card); }
}
} }
}//resolve() }//resolve()
}; };//SpellAbility
card.clearSpellAbility();
// card.clearSpellAbility();
card.addSpellAbility(ability); card.addSpellAbility(ability);
ability.setStackDescription(cardName ability.setStackDescription(cardName + " gets sacrificed to return target creature card from your graveyard to the battlefield");
+ " gets sacrificed to return target creature card from your graveyard to the battlefield"); // ability.setDescription("B, Tap: Sacrifice Doomed Necromancer: Return target creature card from your graveyard to the battlefield");
ability.setDescription("B, Tap: Sacrifice Doomed Necromancer: Return target creature card from your graveyard to the battlefield"); // card.addSpellAbility(new Spell_Permanent(card) {
card.addSpellAbility(new Spell_Permanent(card) { // private static final long serialVersionUID = -462134621235305833L;
private static final long serialVersionUID = -462134621235305833L; // });
});
}//*************** END ************ END ************************** }//*************** END ************ END **************************
//*************** START *********** START ************************** //*************** START *********** START **************************
else if(cardName.equals("Affa Guard Hound")) { else if(cardName.equals("Affa Guard Hound")) {