Slight modification of ally code to account for simultaneous token creation and added Rite of Replication (Tested but may have bugs as it is quite complex).

This commit is contained in:
jendave
2011-08-06 04:49:59 +00:00
parent ae42f2e04b
commit 26d9612821
4 changed files with 181 additions and 1 deletions

View File

@@ -38,6 +38,7 @@ snow_covered_mountain.jpg http://www.wizards.com/global/images/magic/gene
snow_covered_mountain1.jpg http://www.wizards.com/global/images/magic/general/snow_covered_mountain.jpg
snow_covered_mountain2.jpg http://www.magickartenmarkt.de/img/cards/Ice_Age/snow_covered_mountain.jpg
snow_covered_mountain3.jpg http://www.magickartenmarkt.de/img/cards/Ice_Age/snow_covered_mountain.jpg
rite_of_replication.jpg http://www.wizards.com/global/images/magic/general/rite_of_replication.jpg
undead_gladiator.jpg http://www.wizards.com/global/images/magic/general/undead_gladiator.jpg
martial_coup.jpg http://www.wizards.com/global/images/magic/general/martial_coup.jpg
linvala_keeper_of_silence.jpg http://www.wizards.com/global/images/magic/general/linvala_keeper_of_silence.jpg

View File

@@ -1,3 +1,8 @@
Rite of Replication
2 U U
Sorcery
no text
Eternity Vessel
6
Artifact

View File

@@ -16145,6 +16145,173 @@ public class CardFactory implements NewConstants {
}));
}//*************** END ************ END **************************
//*************** START *********** START **************************
else if(cardName.equals("Rite of Replication")) {
SpellAbility spell = new Spell(card) {
private static final long serialVersionUID = -2902112019334177L;
@Override
public boolean canPlayAI() {
PlayerZone zone = AllZone.getZone(Constant.Zone.Play, card.getController());
Card biggest = null;
if(zone != null) {
CardList creature = new CardList();
creature.addAll(zone.getCards());
creature = creature.getType("Creature");
creature = creature.filter(new CardListFilter() {
public boolean addCard(Card card) {
return (!card.getType().contains("Legendary"));
}
});
if(creature.size() == 0) return false;
biggest = creature.get(0);
for(int i = 0; i < creature.size(); i++)
if(biggest.getNetAttack() < creature.get(i).getNetAttack()) biggest = creature.get(i);
setTargetCard(biggest);
}
return biggest.getNetAttack() > 4;
}
@Override
public void chooseTargetAI() {
PlayerZone zone = AllZone.getZone(Constant.Zone.Play, card.getController());
if(zone != null) {
CardList creature = new CardList();
creature.addAll(zone.getCards());
creature = creature.getType("Creature");
creature = creature.filter(new CardListFilter() {
public boolean addCard(Card card) {
return (!card.getType().contains("Legendary"));
}
});
if(creature.size() > 0) {
Card biggest = creature.get(0);
for(int i = 0; i < creature.size(); i++)
if(biggest.getNetAttack() < creature.get(i).getNetAttack()) biggest = creature.get(i);
setTargetCard(biggest);
}
}
}
@Override
public void resolve() {
if(AllZone.GameAction.isCardInPlay(getTargetCard())
&& CardFactoryUtil.canTarget(card, getTargetCard())) {
PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController());
Card Copy = copyCard(getTargetCard());
CardList all = AllZone.CardFactory.getAllCards();
CardList tokens = new CardList(play.getCards());
tokens = tokens.filter(new CardListFilter() {
public boolean addCard(Card c) {
return c.isToken();
}
});
all.add(tokens);
int Unumber = 0;
for(int i = 0; i < all.size(); i++) {
if(all.get(i).getUniqueNumber() > Unumber) Unumber = all.get(i).getUniqueNumber();
}
Copy.setUniqueNumber(Unumber + 1);
Copy.setToken(true);
Copy.setController(card.getController());
play.add(Copy);
}
}//resolve()
};
spell.setDescription("Put a token onto the battlefield that's a copy of target creature.");
spell.setStackDescription(card.getName() + " - " + card.getController()
+ " puts a token onto the battlefield that's a copy of target creature.");
SpellAbility kicker = new Spell(card) {
private static final long serialVersionUID = 13762512058673590L;
@Override
public boolean canPlayAI() {
PlayerZone zone = AllZone.getZone(Constant.Zone.Play, card.getController());
Card biggest = null;
if(zone != null) {
CardList creature = new CardList();
creature.addAll(zone.getCards());
creature = creature.getType("Creature");
creature = creature.filter(new CardListFilter() {
public boolean addCard(Card card) {
return (!card.getType().contains("Legendary"));
}
});
if(creature.size() == 0) return false;
biggest = creature.get(0);
for(int i = 0; i < creature.size(); i++)
if(biggest.getNetAttack() < creature.get(i).getNetAttack()) biggest = creature.get(i);
setTargetCard(biggest);
}
return biggest.getNetAttack() > 3;
}
@Override
public void chooseTargetAI() {
PlayerZone zone = AllZone.getZone(Constant.Zone.Play, card.getController());
if(zone != null) {
CardList creature = new CardList();
creature.addAll(zone.getCards());
creature = creature.getType("Creature");
creature = creature.filter(new CardListFilter() {
public boolean addCard(Card card) {
return (!card.getType().contains("Legendary"));
}
});
if(creature.size() > 0) {
Card biggest = creature.get(0);
for(int i = 0; i < creature.size(); i++)
if(biggest.getNetAttack() < creature.get(i).getNetAttack()) biggest = creature.get(i);
setTargetCard(biggest);
}
}
}
@Override
public void resolve() {
PlayerZone_ComesIntoPlay.SimultaneousEntry = true;
card.setKicked(true);
PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController());
if(AllZone.GameAction.isCardInPlay(getTargetCard())
&& CardFactoryUtil.canTarget(card, getTargetCard())) {
for(int x = 0; x < 5; x++) {
if(x == 4) PlayerZone_ComesIntoPlay.SimultaneousEntry = false;
Card Copy = copyCard(getTargetCard());
CardList all = AllZone.CardFactory.getAllCards();
CardList tokens = new CardList(play.getCards());
tokens = tokens.filter(new CardListFilter() {
public boolean addCard(Card c) {
return c.isToken();
}
});
all.add(tokens);
int Unumber = 0;
for(int i = 0; i < all.size(); i++) {
if(all.get(i).getUniqueNumber() > Unumber) Unumber = all.get(i).getUniqueNumber();
}
Copy.setUniqueNumber(Unumber + 4);
Copy.setToken(true);
Copy.setController(card.getController());
play.add(Copy);
AllZone.Display.showMessage("Hack for Legendaries going to the graveyard :)"); // Not Working + AI is stuffed
}//for
}
}//resolve()
};
kicker.setKickerAbility(true);
kicker.setManaCost("7 U U");
kicker.setAdditionalManaCost("5");
kicker.setDescription("Kicker 5: If Rite of Replication was kicked, put five of those tokens onto the battlefield instead.");
kicker.setStackDescription(card.getName() + " - " + card.getController()
+ " puts five tokens onto the battlefield that's a copy of target creature.");
kicker.setBeforePayMana(CardFactoryUtil.input_targetCreature(kicker));
card.clearSpellAbility();
card.addSpellAbility(spell);
card.addSpellAbility(kicker);
spell.setBeforePayMana(CardFactoryUtil.input_targetCreature(spell));
}//*************** END ************ END **************************
//*************** START *********** START **************************
else if(cardName.equals("Conqueror's Pledge")) {

View File

@@ -10,6 +10,8 @@ public class PlayerZone_ComesIntoPlay extends DefaultPlayerZone {
private boolean trigger = true;
private boolean leavesTrigger = true;
static boolean SimultaneousEntry = false; // For Cards with Multiple Token Entry. Only Affects Allies at the moment.
static int SimultaneousEntryCounter = 1; // For Cards with Multiple Token Entry. Only Affects Allies at the moment.
public PlayerZone_ComesIntoPlay(String zone, String player) {
super(zone, player);
@@ -132,6 +134,8 @@ public class PlayerZone_ComesIntoPlay extends DefaultPlayerZone {
allyNamesList.add(allyNames[i]);
}
if(SimultaneousEntry == false) { // For Cards with Multiple Token Entry. Only Affects Allies at the moment.
for(int i = 0; i < SimultaneousEntryCounter; i++) {
if(c.getType().contains("Ally") || (c.getKeyword().contains("Changeling") && c.isCreature())
|| (clist.size() > 0 && (c.getType().contains("Creature") || c.getKeyword().contains(
"Changeling"))) || allyNamesList.contains(c.getName())) {
@@ -147,8 +151,11 @@ public class PlayerZone_ComesIntoPlay extends DefaultPlayerZone {
GameActionUtil.executeAllyEffects(var);
}
}
}
SimultaneousEntryCounter = 1;
} else SimultaneousEntryCounter = SimultaneousEntryCounter + 1;
}
if(AllZone.StaticEffects.getCardToEffectsList().containsKey(c.getName())) {
String[] effects = AllZone.StaticEffects.getCardToEffectsList().get(c.getName());
for(String effect:effects) {