method name tweaking in AF_Pump for clarity

This commit is contained in:
jendave
2011-08-07 01:39:03 +00:00
parent 41d286026d
commit 7e8a3f08c3
2 changed files with 54 additions and 54 deletions

View File

@@ -307,11 +307,11 @@ public class AbilityFactory {
AbilityFactory_Pump afPump = new AbilityFactory_Pump(this); AbilityFactory_Pump afPump = new AbilityFactory_Pump(this);
if (isAb) if (isAb)
SA = afPump.getAbility(); SA = afPump.getAbilityPump();
else if (isSp) else if (isSp)
SA = afPump.getSpell(); SA = afPump.getSpellPump();
else if (isDb) else if (isDb)
SA = afPump.getDrawback(); SA = afPump.getDrawbackPump();
if (isAb || isSp) if (isAb || isSp)
hostCard.setSVar("PlayMain1", "TRUE"); hostCard.setSVar("PlayMain1", "TRUE");
@@ -321,11 +321,11 @@ public class AbilityFactory {
AbilityFactory_Pump afPump = new AbilityFactory_Pump(this); AbilityFactory_Pump afPump = new AbilityFactory_Pump(this);
if (isAb) if (isAb)
SA = afPump.getPumpAllAbility(); SA = afPump.getAbilityPumpAll();
else if (isSp) else if (isSp)
SA = afPump.getPumpAllSpell(); SA = afPump.getSpellPumpAll();
else if (isDb) else if (isDb)
SA = afPump.getPumpAllDrawback(); SA = afPump.getDrawbackPumpAll();
if (isAb || isSp) if (isAb || isSp)
hostCard.setSVar("PlayMain1", "TRUE"); hostCard.setSVar("PlayMain1", "TRUE");
@@ -1301,7 +1301,7 @@ public class AbilityFactory {
{ {
host.clearRemembered(); host.clearRemembered();
} }
else if(params.containsKey("Unimprint")) { if(params.containsKey("Unimprint")) {
host.clearImprinted(); host.clearImprinted();
} }
@@ -1313,7 +1313,7 @@ public class AbilityFactory {
host.addRemembered(o); host.addRemembered(o);
} }
} }
else if(params.containsKey("Imprint")) { if(params.containsKey("Imprint")) {
ArrayList<Card> tgts = (tgt == null) ? new ArrayList<Card>() : tgt.getTargetCards(); ArrayList<Card> tgts = (tgt == null) ? new ArrayList<Card>() : tgt.getTargetCards();
host.addImprinted(tgts); host.addImprinted(tgts);
} }

View File

@@ -63,11 +63,12 @@ public class AbilityFactory_Pump {
Keywords.add("none"); Keywords.add("none");
} }
public SpellAbility getSpell() public SpellAbility getSpellPump()
{ {
SpellAbility spPump = new Spell(hostCard, AF.getAbCost(), AF.getAbTgt()) { SpellAbility spPump = new Spell(hostCard, AF.getAbCost(), AF.getAbTgt()) {
private static final long serialVersionUID = 42244224L; private static final long serialVersionUID = 42244224L;
@Override
public boolean canPlayAI() { public boolean canPlayAI() {
return pumpPlayAI(this); return pumpPlayAI(this);
} }
@@ -77,15 +78,16 @@ public class AbilityFactory_Pump {
return pumpStackDescription(AF, this); return pumpStackDescription(AF, this);
} }
@Override
public void resolve() { public void resolve() {
doResolve(this); pumpResolve(this);
}//resolve }//resolve
};//SpellAbility };//SpellAbility
return spPump; return spPump;
} }
public SpellAbility getAbility() public SpellAbility getAbilityPump()
{ {
final SpellAbility abPump = new Ability_Activated(hostCard, AF.getAbCost(), AF.getAbTgt()) { final SpellAbility abPump = new Ability_Activated(hostCard, AF.getAbCost(), AF.getAbTgt()) {
private static final long serialVersionUID = -1118592153328758083L; private static final long serialVersionUID = -1118592153328758083L;
@@ -102,7 +104,7 @@ public class AbilityFactory_Pump {
@Override @Override
public void resolve() { public void resolve() {
doResolve(this); pumpResolve(this);
hostCard.setAbilityUsed(hostCard.getAbilityUsed() + 1); hostCard.setAbilityUsed(hostCard.getAbilityUsed() + 1);
}//resolve() }//resolve()
@@ -118,11 +120,12 @@ public class AbilityFactory_Pump {
return abPump; return abPump;
} }
public SpellAbility getDrawback() public SpellAbility getDrawbackPump()
{ {
SpellAbility dbPump = new Ability_Sub(hostCard, AF.getAbTgt()) { SpellAbility dbPump = new Ability_Sub(hostCard, AF.getAbTgt()) {
private static final long serialVersionUID = 42244224L; private static final long serialVersionUID = 42244224L;
@Override
public boolean canPlayAI() { public boolean canPlayAI() {
return pumpPlayAI(this); return pumpPlayAI(this);
} }
@@ -132,13 +135,14 @@ public class AbilityFactory_Pump {
return pumpStackDescription(AF, this); return pumpStackDescription(AF, this);
} }
@Override
public void resolve() { public void resolve() {
doResolve(this); pumpResolve(this);
}//resolve }//resolve
@Override @Override
public boolean chkAI_Drawback() { public boolean chkAI_Drawback() {
return doDrawbackAI(this); return pumpDrawbackAI(this);
} }
@Override @Override
@@ -222,7 +226,7 @@ public class AbilityFactory_Pump {
} }
}); });
return list; return list;
} }//getPumpCreatures()
private CardList getCurseCreatures(SpellAbility sa, final int defense, int attack) private CardList getCurseCreatures(SpellAbility sa, final int defense, int attack)
{ {
@@ -255,7 +259,7 @@ public class AbilityFactory_Pump {
return list; return list;
} }//getCurseCreatures()
private boolean pumpPlayAI(SpellAbility sa){ private boolean pumpPlayAI(SpellAbility sa){
// if there is no target and host card isn't in play, don't activate // if there is no target and host card isn't in play, don't activate
@@ -368,12 +372,12 @@ public class AbilityFactory_Pump {
} }
} }
else else
return doTgtAI(sa, defense, attack, false); return pumpTgtAI(sa, defense, attack, false);
return false; return false;
} }//pumpPlayAI()
private boolean doTgtAI(SpellAbility sa, int defense, int attack, boolean mandatory) private boolean pumpTgtAI(SpellAbility sa, int defense, int attack, boolean mandatory)
{ {
if(!mandatory && AllZone.Phase.isAfter(Constant.Phase.Combat_Declare_Blockers_InstantAbility) && !(AF.isCurse() && defense < 0)) if(!mandatory && AllZone.Phase.isAfter(Constant.Phase.Combat_Declare_Blockers_InstantAbility) && !(AF.isCurse() && defense < 0))
return false; return false;
@@ -438,7 +442,7 @@ public class AbilityFactory_Pump {
} }
return true; return true;
} }//pumpTgtAI()
private boolean pumpMandatoryTarget(AbilityFactory af, SpellAbility sa, boolean mandatory){ private boolean pumpMandatoryTarget(AbilityFactory af, SpellAbility sa, boolean mandatory){
CardList list = AllZoneUtil.getCardsInPlay(); CardList list = AllZoneUtil.getCardsInPlay();
@@ -503,7 +507,7 @@ public class AbilityFactory_Pump {
} }
return true; return true;
} }//pumpMandatoryTarget()
private boolean pumpTriggerAI(AbilityFactory af, SpellAbility sa, boolean mandatory){ private boolean pumpTriggerAI(AbilityFactory af, SpellAbility sa, boolean mandatory){
@@ -543,13 +547,13 @@ public class AbilityFactory_Pump {
return true; return true;
} }
else{ else{
return doTgtAI(sa, defense, attack, mandatory); return pumpTgtAI(sa, defense, attack, mandatory);
} }
return true; return true;
} }//pumpTriggerAI
private boolean doDrawbackAI(SpellAbility sa) private boolean pumpDrawbackAI(SpellAbility sa)
{ {
Card source = sa.getSourceCard(); Card source = sa.getSourceCard();
int defense; int defense;
@@ -575,10 +579,10 @@ public class AbilityFactory_Pump {
} }
} }
else else
return doTgtAI(sa, defense, attack, false); return pumpTgtAI(sa, defense, attack, false);
return true; return true;
} }//pumpDrawbackAI()
private String pumpStackDescription(AbilityFactory af, SpellAbility sa){ private String pumpStackDescription(AbilityFactory af, SpellAbility sa){
// when damageStackDescription is called, just build exactly what is happening // when damageStackDescription is called, just build exactly what is happening
@@ -633,9 +637,9 @@ public class AbilityFactory_Pump {
} }
return sb.toString(); return sb.toString();
} }//pumpStackDescription()
private void doResolve(SpellAbility sa) private void pumpResolve(SpellAbility sa)
{ {
ArrayList<Card> tgtCards; ArrayList<Card> tgtCards;
Target tgt = AF.getAbTgt(); Target tgt = AF.getAbTgt();
@@ -694,7 +698,7 @@ public class AbilityFactory_Pump {
else AllZone.EndOfTurn.addUntil(untilEOT); else AllZone.EndOfTurn.addUntil(untilEOT);
} }
} }
} }//pumpResolve()
///////////////////////////////////// /////////////////////////////////////
@@ -703,7 +707,7 @@ public class AbilityFactory_Pump {
// //
////////////////////////////////////// //////////////////////////////////////
public SpellAbility getPumpAllAbility() { public SpellAbility getAbilityPumpAll() {
final SpellAbility abPumpAll = new Ability_Activated(hostCard, AF.getAbCost(), AF.getAbTgt()) { final SpellAbility abPumpAll = new Ability_Activated(hostCard, AF.getAbCost(), AF.getAbTgt()) {
private static final long serialVersionUID = -8299417521903307630L; private static final long serialVersionUID = -8299417521903307630L;
@@ -719,7 +723,7 @@ public class AbilityFactory_Pump {
@Override @Override
public void resolve() { public void resolve() {
doPumpAllResolve(this); pumpAllResolve(this);
hostCard.setAbilityUsed(hostCard.getAbilityUsed() + 1); hostCard.setAbilityUsed(hostCard.getAbilityUsed() + 1);
}//resolve() }//resolve()
@@ -734,7 +738,7 @@ public class AbilityFactory_Pump {
return abPumpAll; return abPumpAll;
} }
public SpellAbility getPumpAllSpell() { public SpellAbility getSpellPumpAll() {
SpellAbility spPumpAll = new Spell(hostCard, AF.getAbCost(), AF.getAbTgt()) { SpellAbility spPumpAll = new Spell(hostCard, AF.getAbCost(), AF.getAbTgt()) {
private static final long serialVersionUID = -4055467978660824703L; private static final long serialVersionUID = -4055467978660824703L;
@@ -748,14 +752,14 @@ public class AbilityFactory_Pump {
} }
public void resolve() { public void resolve() {
doPumpAllResolve(this); pumpAllResolve(this);
}//resolve }//resolve
};//SpellAbility };//SpellAbility
return spPumpAll; return spPumpAll;
} }
public SpellAbility getPumpAllDrawback() { public SpellAbility getDrawbackPumpAll() {
SpellAbility dbPumpAll = new Ability_Sub(hostCard, AF.getAbTgt()) { SpellAbility dbPumpAll = new Ability_Sub(hostCard, AF.getAbTgt()) {
private static final long serialVersionUID = 6411531984691660342L; private static final long serialVersionUID = 6411531984691660342L;
@@ -764,13 +768,14 @@ public class AbilityFactory_Pump {
return pumpAllStackDescription(AF, this); return pumpAllStackDescription(AF, this);
} }
@Override
public void resolve() { public void resolve() {
doPumpAllResolve(this); pumpAllResolve(this);
}//resolve }//resolve
@Override @Override
public boolean chkAI_Drawback() { public boolean chkAI_Drawback() {
return chkPumpAllDrawbackAI(this); return pumpAllChkDrawbackAI(this);
} }
@Override @Override
@@ -838,9 +843,9 @@ public class AbilityFactory_Pump {
return false; return false;
return (r.nextFloat() < .6667) && chance; return (r.nextFloat() < .6667) && chance;
} }//pumpAllCanPlayAI()
private void doPumpAllResolve(SpellAbility sa) { private void pumpAllResolve(SpellAbility sa) {
String valid = ""; String valid = "";
if(params.containsKey("ValidCards")) if(params.containsKey("ValidCards"))
@@ -891,9 +896,9 @@ public class AbilityFactory_Pump {
AllZone.EndOfTurn.addUntil(untilEOT); AllZone.EndOfTurn.addUntil(untilEOT);
} }
} }
} }//pumpAllResolve()
private boolean pumpAllTriggerAI(AbilityFactory af, SpellAbility sa, boolean mandatory){ private boolean pumpAllTriggerAI(AbilityFactory af, SpellAbility sa, boolean mandatory) {
if (!ComputerUtil.canPayCost(sa)) if (!ComputerUtil.canPayCost(sa))
return false; return false;
@@ -902,11 +907,11 @@ public class AbilityFactory_Pump {
return true; return true;
} }
private boolean chkPumpAllDrawbackAI(SpellAbility sa) { private boolean pumpAllChkDrawbackAI(SpellAbility sa) {
return true; return true;
} }
private String pumpAllStackDescription(AbilityFactory af, SpellAbility sa){ private String pumpAllStackDescription(AbilityFactory af, SpellAbility sa) {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
String desc = ""; String desc = "";
@@ -916,15 +921,9 @@ public class AbilityFactory_Pump {
else if(params.containsKey("PumpAllDescription")) { else if(params.containsKey("PumpAllDescription")) {
desc = params.get("PumpAllDescription"); desc = params.get("PumpAllDescription");
} }
/*
if (sa instanceof Ability_Sub)
sb.append(" ").append(desc);
sb.append(name).append(" -");
*/
if (!(sa instanceof Ability_Sub)) if (!(sa instanceof Ability_Sub))
sb.append(sa.getSourceCard().getName()).append(" - "); sb.append(sa.getSourceCard()).append(" - ");
else else
sb.append(" "); sb.append(" ");
sb.append(desc); sb.append(desc);
@@ -936,5 +935,6 @@ public class AbilityFactory_Pump {
} }
return sb.toString(); return sb.toString();
} }//pumpAllStackDescription()
}
}//end class AbilityFactory_Pump