- Convert Dauntless Escort to AF_Effect

- Cleanup in Phase and MagicStack
This commit is contained in:
jendave
2011-08-06 23:55:37 +00:00
parent 64662f9392
commit fdef127647
5 changed files with 28 additions and 232 deletions

View File

@@ -1,8 +1,10 @@
Name:Dauntless Escort
ManaCost:1 W G
Types:Creature Rhino Soldier
Text:Sacrifice Dauntless Escort: Creatures you control are indestructible this turn.
Text:no text
PT:3/3
A:AB$ Effect | Cost$ Sac<1/CARDNAME> | Name$ Dauntless Escort Effect | Keywords$ KWPump | SpellDescription$ Creatures you control are indestructible this turn.
SVar:KWPump:stPumpAll:Creature.YouCtrl:0/0/HIDDEN Indestructible:no Condition:Creatures you control are indestructible this turn.
SVar:Rarity:Rare
SVar:Picture:http://www.wizards.com/global/images/magic/general/dauntless_escort.jpg
SetInfo:ARB|Rare|http://magiccards.info/scans/en/arb/67.jpg

View File

@@ -5336,7 +5336,6 @@ public class GameActionUtil {
Valor.execute();
Brawn.execute();
Filth.execute();
Dauntless_Escort.execute();
Sacrifice_NoIslands.execute();
Sacrifice_NoForests.execute();
@@ -6456,78 +6455,6 @@ public class GameActionUtil {
}// execute()
};
public static Command Dauntless_Escort = new Command() {
private static final long serialVersionUID = -2201201455269804L;
CardList old = new CardList();
public void execute() {
// Human Activates Dauntless Escort
PlayerZone PlayerPlayZone = AllZone.getZone(Constant.Zone.Battlefield,AllZone.HumanPlayer);
CardList PlayerCreatureList = AllZoneUtil.getCreaturesInPlay(AllZone.HumanPlayer);
PlayerZone opponentPlayZone = AllZone.getZone(Constant.Zone.Battlefield,AllZone.ComputerPlayer);
CardList opponentCreatureList = AllZoneUtil.getCreaturesInPlay(AllZone.ComputerPlayer);
if(Phase.isSacDauntlessEscort() == true) {
if(PlayerCreatureList.size() != 0) {
for(int i = 0; i < PlayerCreatureList.size(); i++) {
Card c = PlayerCreatureList.get(i);
c.removeExtrinsicKeyword("Indestructible");
c.addExtrinsicKeyword("Indestructible");
}
}
if(opponentCreatureList.size() != 0) {
for(int i = 0; i < opponentCreatureList.size(); i++) {
Card c = opponentCreatureList.get(i);
if(c.getOwner().isHuman()) {
if(old.size() == 0) {
c.removeExtrinsicKeyword("Indestructible");
old.add(c);
}
for(int x = 0; x < old.size(); x++) {
if(old.get(x) == c) break;
c.removeExtrinsicKeyword("Indestructible");
old.add(c);
}
}
}
}
}
// Computer Activates Dauntless Escort
PlayerPlayZone = AllZone.getZone(Constant.Zone.Battlefield,AllZone.ComputerPlayer);
PlayerCreatureList = new CardList(PlayerPlayZone.getCards());
PlayerCreatureList = PlayerCreatureList.getType("Creature");
opponentPlayZone = AllZone.getZone(Constant.Zone.Battlefield,AllZone.HumanPlayer);
opponentCreatureList = new CardList(opponentPlayZone.getCards());
opponentCreatureList = opponentCreatureList.getType("Creature");
if(Phase.isSacDauntlessEscortAI() == true) {
if(PlayerCreatureList.size() != 0) {
for(int i = 0; i < PlayerCreatureList.size(); i++) {
Card c = PlayerCreatureList.get(i);
c.removeExtrinsicKeyword("Indestructible");
c.addExtrinsicKeyword("Indestructible");
}
}
if(opponentCreatureList.size() != 0) {
for(int i = 0; i < opponentCreatureList.size(); i++) {
Card c = opponentCreatureList.get(i);
if(c.getOwner().isComputer()) {
if(old.size() == 0) {
c.removeExtrinsicKeyword("Indestructible");
old.add(c);
}
for(int x = 0; x < old.size(); x++) {
if(old.get(x) == c) break;
c.removeExtrinsicKeyword("Indestructible");
old.add(c);
}
}
}
}
}
}// execute()
};
public static Command Liu_Bei = new Command() {
private static final long serialVersionUID = 4235093010715735727L;

View File

@@ -30,12 +30,6 @@ public class MagicStack extends MyObservable {
private boolean bResolving = false;
private boolean splitSecondOnStack = false;
private Object StormCount;
private Object PlayerSpellCount;
private Object PlayerCreatureSpellCount;
private Object ComputerSpellCount;
private Object ComputerCreatureSpellCount;
public boolean isFrozen() {
return frozen;
}
@@ -106,8 +100,7 @@ public class MagicStack extends MyObservable {
}
public void clearFrozen() {
// TODO: frozen triggered abilities and undoable costs have nasty
// consequences
// TODO: frozen triggered abilities and undoable costs have nasty consequences
frozen = false;
frozenStack.clear();
}
@@ -691,20 +684,8 @@ public class MagicStack extends MyObservable {
this.updateObservers();
if (sp.isSpell() && !sp.getSourceCard().isCopiedSpell()) {
Phase.setStormCount(Phase.getStormCount() + 1);
if (sp.getSourceCard().getController().isHuman()) {
Phase.PlayerSpellCount = Phase.PlayerSpellCount + 1;
if (sp.getSourceCard().isCreature()) {
Phase.PlayerCreatureSpellCount = Phase.PlayerCreatureSpellCount + 1;
}
}
Phase.increaseSpellCount(sp);
else {
Phase.ComputerSpellCount = Phase.ComputerSpellCount + 1;
if (sp.getSourceCard().isCreature()) {
Phase.ComputerCreatureSpellCount = Phase.ComputerCreatureSpellCount + 1;
}
}
// attempt to counter human spell
GameActionUtil.executePlayCardEffects(sp);
@@ -887,47 +868,7 @@ public class MagicStack extends MyObservable {
return a;
}
public void setStormCount(Object stormCount) {
StormCount = stormCount;
}
public Object getStormCount() {
return StormCount;
}
public void setPlayerCreatureSpellCount(Object playerCreatureSpellCount) {
PlayerCreatureSpellCount = playerCreatureSpellCount;
}
public Object getPlayerCreatureSpellCount() {
return PlayerCreatureSpellCount;
}
public void setPlayerSpellCount(Object playerSpellCount) {
PlayerSpellCount = playerSpellCount;
}
public Object getPlayerSpellCount() {
return PlayerSpellCount;
}
public void setComputerSpellCount(Object computerSpellCount) {
ComputerSpellCount = computerSpellCount;
}
public Object getComputerSpellCount() {
return ComputerSpellCount;
}
public void setComputerCreatureSpellCount(Object computerCreatureSpellCount) {
ComputerCreatureSpellCount = computerCreatureSpellCount;
}
public Object getComputerCreatureSpellCount() {
return ComputerCreatureSpellCount;
}
public boolean hasSimultaneousStackEntries()
public boolean hasSimultaneousStackEntries()
{
return simultaneousStackEntryList.size() > 0;
}
@@ -935,21 +876,10 @@ public class MagicStack extends MyObservable {
public void addSimultaneousStackEntry(SpellAbility sa)
{
simultaneousStackEntryList.add(sa);
/*
*Debug output.
System.out.println("STO add! Size:" + simultaneousStackEntryList.size());
*/
}
public void chooseOrderOfSimultaneousStackEntryAll()
{
/*
*Debug output.
if(simultaneousStackEntryList.size() > 0)
{
System.out.println("STO run! Size:" + simultaneousStackEntryList.size());
}
*/
chooseOrderOfSimultaneousStackEntry(AllZone.Phase.getPlayerTurn());
chooseOrderOfSimultaneousStackEntry(AllZone.Phase.getPlayerTurn().getOpponent());
}
@@ -1014,7 +944,7 @@ public class MagicStack extends MyObservable {
if(activePlayerSAs.get(0).isTrigger())
AllZone.GameAction.playSpellAbility(activePlayerSAs.get(0));
else
add(activePlayerSAs.get(0));
add(activePlayerSAs.get(0));
//AllZone.GameAction.playSpellAbility(activePlayerSAs.get(0));
}
}

View File

@@ -7,6 +7,9 @@ import java.util.Stack;
import com.esotericsoftware.minlog.Log;
import forge.card.spellability.SpellAbility;
import forge.card.spellability.Spell_Permanent;
public class Phase extends MyObservable
{
private int phaseIndex;
@@ -18,8 +21,6 @@ public class Phase extends MyObservable
static int PlayerCreatureSpellCount;
static int ComputerSpellCount;
static int ComputerCreatureSpellCount;
private static boolean Sac_Dauntless_Escort;
private static boolean Sac_Dauntless_Escort_Comp;
//Not sure these should be here but I can't think of a better place
private static ArrayList<Integer> ManaDrain_BonusMana_Human = new ArrayList<Integer>();
@@ -595,21 +596,6 @@ public class Phase extends MyObservable
return sb.toString();
}
public static boolean canPlayDuringCombat() {
String phase = AllZone.Phase.getPhase();
ArrayList<String> validPhases = new ArrayList<String>();
validPhases.add(Constant.Phase.Combat_Begin);
validPhases.add(Constant.Phase.Combat_Declare_Attackers);
validPhases.add(Constant.Phase.Combat_Declare_Attackers_InstantAbility);
validPhases.add(Constant.Phase.Combat_Declare_Blockers);
validPhases.add(Constant.Phase.Combat_Declare_Blockers_InstantAbility);
validPhases.add(Constant.Phase.Combat_FirstStrikeDamage);
validPhases.add(Constant.Phase.Combat_Damage);
validPhases.add(Constant.Phase.Combat_End);
return validPhases.contains(phase);
}
public static void main(String args[]) {
Phase phase = new Phase();
for(int i = 0; i < phase.phaseOrder.length; i++) {
@@ -618,20 +604,22 @@ public class Phase extends MyObservable
}
}
public static void setSacDauntlessEscort(boolean sac_Dauntless_Escort) {
Sac_Dauntless_Escort = sac_Dauntless_Escort;
}
public static void increaseSpellCount(SpellAbility sp){
StormCount++;
public static boolean isSacDauntlessEscort() {
return Sac_Dauntless_Escort;
}
if (sp.getActivatingPlayer().isHuman()) {
PlayerSpellCount++;
if (sp instanceof Spell_Permanent && sp.getSourceCard().isCreature()) {
PlayerCreatureSpellCount++;
}
}
public static void setSacDauntlessEscortAI(boolean sac_Dauntless_Escort_Comp) {
Sac_Dauntless_Escort_Comp = sac_Dauntless_Escort_Comp;
}
public static boolean isSacDauntlessEscortAI() {
return Sac_Dauntless_Escort_Comp;
else {
ComputerSpellCount++;
if (sp instanceof Spell_Permanent && sp.getSourceCard().isCreature()) {
Phase.ComputerCreatureSpellCount++;
}
}
}
public static void setStormCount(int stormCount) {

View File

@@ -1480,57 +1480,6 @@ public class CardFactory_Creatures {
card.addComesIntoPlayCommand(comesIntoPlay);
}//*************** END ************ END **************************
//*************** START *********** START **************************
else if(cardName.equals("Dauntless Escort")) {
final SpellAbility ability = new Ability(card, "0") {
@Override
public boolean canPlayAI() {
PlayerZone PlayerPlayZone = AllZone.getZone(Constant.Zone.Battlefield, AllZone.ComputerPlayer);
CardList PlayerCreatureList = new CardList(PlayerPlayZone.getCards());
PlayerCreatureList = PlayerCreatureList.getType("Creature");
PlayerZone opponentPlayZone = AllZone.getZone(Constant.Zone.Battlefield, AllZone.HumanPlayer);
CardList opponentCreatureList = new CardList(opponentPlayZone.getCards());
opponentCreatureList = opponentCreatureList.getType("Creature");
return ((PlayerCreatureList.size() + 1 > 2* opponentCreatureList.size() + 1) && (Phase.isSacDauntlessEscortAI() == false) && (AllZone.Phase.getPhase().equals(Constant.Phase.Main1))) ;
}
final Command untilEOT = new Command() {
private static final long serialVersionUID = 2701248867610L;
public void execute() {
if(card.getController().isHuman()) {
Phase.setSacDauntlessEscort(false);
} else {
Phase.setSacDauntlessEscortAI(false);
}
PlayerZone PlayerPlayZone = AllZone.getZone(Constant.Zone.Battlefield, card.getController());
CardList PlayerCreatureList = new CardList(PlayerPlayZone.getCards());
PlayerCreatureList = PlayerCreatureList.getType("Creature");
if(PlayerCreatureList.size() != 0) {
for(int i = 0; i < PlayerCreatureList.size(); i++) {
Card c = PlayerCreatureList.get(i);
c.removeExtrinsicKeyword("Indestructible");
}
}
}
};
@Override
public void resolve() {
AllZone.GameAction.sacrifice(card);
if(card.getController().isHuman()) {
Phase.setSacDauntlessEscort(true);
}
else Phase.setSacDauntlessEscortAI(true);
AllZone.EndOfTurn.addUntil(untilEOT);
}
};
card.addSpellAbility(ability);
ability.setStackDescription("Sacrifice Dauntless Escort: Creatures you control are indestructible this turn.");
}//*************** END ************ END **************************
//*************** START *********** START **************************
else if(cardName.equals("Wojek Embermage")) {
Cost abCost = new Cost("T", cardName, true);