mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 04:38:00 +00:00
cleanup regarding params in a couple AFs
This commit is contained in:
@@ -129,15 +129,16 @@ public class AbilityFactory_AlterLife {
|
||||
}
|
||||
|
||||
public static String gainLifeStackDescription(AbilityFactory af, SpellAbility sa){
|
||||
HashMap<String,String> params = af.getMapParams();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
int amount = AbilityFactory.calculateAmount(af.getHostCard(), af.getMapParams().get("LifeAmount"), sa);
|
||||
int amount = AbilityFactory.calculateAmount(af.getHostCard(), params.get("LifeAmount"), sa);
|
||||
|
||||
if (!(sa instanceof Ability_Sub))
|
||||
sb.append(sa.getSourceCard().getName()).append(" - ");
|
||||
else
|
||||
sb.append(" ");
|
||||
|
||||
String conditionDesc = af.getMapParams().get("ConditionDescription");
|
||||
String conditionDesc = params.get("ConditionDescription");
|
||||
if (conditionDesc != null)
|
||||
sb.append(conditionDesc).append(" ");
|
||||
|
||||
@@ -147,7 +148,7 @@ public class AbilityFactory_AlterLife {
|
||||
if (tgt != null)
|
||||
tgtPlayers = tgt.getTargetPlayers();
|
||||
else
|
||||
tgtPlayers = AbilityFactory.getDefinedPlayers(sa.getSourceCard(), af.getMapParams().get("Defined"), sa);
|
||||
tgtPlayers = AbilityFactory.getDefinedPlayers(sa.getSourceCard(), params.get("Defined"), sa);
|
||||
|
||||
for(Player player : tgtPlayers)
|
||||
sb.append(player).append(" ");
|
||||
@@ -169,7 +170,7 @@ public class AbilityFactory_AlterLife {
|
||||
final Card source = sa.getSourceCard();
|
||||
int life = AllZone.ComputerPlayer.getLife();
|
||||
int lifeAmount = AbilityFactory.calculateAmount(af.getHostCard(), params.get("LifeAmount"), sa);
|
||||
String amountStr = af.getMapParams().get("LifeAmount");
|
||||
String amountStr = params.get("LifeAmount");
|
||||
|
||||
//don't use it if no life to gain
|
||||
if (lifeAmount <= 0) return false;
|
||||
@@ -249,6 +250,8 @@ public class AbilityFactory_AlterLife {
|
||||
if (!ComputerUtil.canPayCost(sa) && !mandatory) // If there is a cost payment it's usually not mandatory
|
||||
return false;
|
||||
|
||||
HashMap<String,String> params = af.getMapParams();
|
||||
|
||||
// If the Target is gaining life, target self.
|
||||
// if the Target is modifying how much life is gained, this needs to be handled better
|
||||
Target tgt = sa.getTarget();
|
||||
@@ -261,7 +264,7 @@ public class AbilityFactory_AlterLife {
|
||||
}
|
||||
|
||||
Card source = sa.getSourceCard();
|
||||
String amountStr = af.getMapParams().get("LifeAmount");
|
||||
String amountStr = params.get("LifeAmount");
|
||||
if (amountStr.equals("X") && source.getSVar(amountStr).equals("Count$xPaid")){
|
||||
// Set PayX here to maximum value.
|
||||
int xPay = ComputerUtil.determineLeftoverMana(sa);
|
||||
@@ -398,15 +401,16 @@ public class AbilityFactory_AlterLife {
|
||||
}
|
||||
|
||||
static String loseLifeStackDescription(AbilityFactory af, SpellAbility sa) {
|
||||
HashMap<String,String> params = af.getMapParams();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
int amount = AbilityFactory.calculateAmount(af.getHostCard(), af.getMapParams().get("LifeAmount"), sa);
|
||||
int amount = AbilityFactory.calculateAmount(af.getHostCard(), params.get("LifeAmount"), sa);
|
||||
|
||||
if (!(sa instanceof Ability_Sub))
|
||||
sb.append(sa.getSourceCard().getName()).append(" - ");
|
||||
else
|
||||
sb.append(" ");
|
||||
|
||||
String conditionDesc = af.getMapParams().get("ConditionDescription");
|
||||
String conditionDesc = params.get("ConditionDescription");
|
||||
if (conditionDesc != null)
|
||||
sb.append(conditionDesc).append(" ");
|
||||
|
||||
@@ -415,7 +419,7 @@ public class AbilityFactory_AlterLife {
|
||||
if (tgt != null)
|
||||
tgtPlayers = tgt.getTargetPlayers();
|
||||
else
|
||||
tgtPlayers = AbilityFactory.getDefinedPlayers(sa.getSourceCard(), af.getMapParams().get("Defined"), sa);
|
||||
tgtPlayers = AbilityFactory.getDefinedPlayers(sa.getSourceCard(), params.get("Defined"), sa);
|
||||
|
||||
for(Player player : tgtPlayers)
|
||||
sb.append(player).append(" ");
|
||||
@@ -511,13 +515,15 @@ public class AbilityFactory_AlterLife {
|
||||
if (!ComputerUtil.canPayCost(sa) && !mandatory) // If there is a cost payment it's usually not mandatory
|
||||
return false;
|
||||
|
||||
HashMap<String,String> params = af.getMapParams();
|
||||
|
||||
Target tgt = sa.getTarget();
|
||||
if (tgt != null){
|
||||
tgt.addTarget(AllZone.HumanPlayer);
|
||||
}
|
||||
|
||||
Card source = sa.getSourceCard();
|
||||
String amountStr = af.getMapParams().get("LifeAmount");
|
||||
String amountStr = params.get("LifeAmount");
|
||||
int amount = 0;
|
||||
if (amountStr.equals("X") && source.getSVar(amountStr).equals("Count$xPaid")){
|
||||
// Set PayX here to maximum value.
|
||||
@@ -532,7 +538,7 @@ public class AbilityFactory_AlterLife {
|
||||
if (tgt != null)
|
||||
tgtPlayers = tgt.getTargetPlayers();
|
||||
else
|
||||
tgtPlayers = AbilityFactory.getDefinedPlayers(sa.getSourceCard(), af.getMapParams().get("Defined"), sa);
|
||||
tgtPlayers = AbilityFactory.getDefinedPlayers(sa.getSourceCard(), params.get("Defined"), sa);
|
||||
|
||||
|
||||
if (tgtPlayers.contains(AllZone.ComputerPlayer)){
|
||||
@@ -561,7 +567,7 @@ public class AbilityFactory_AlterLife {
|
||||
if (tgt != null)
|
||||
tgtPlayers = tgt.getTargetPlayers();
|
||||
else
|
||||
tgtPlayers = AbilityFactory.getDefinedPlayers(sa.getSourceCard(), af.getMapParams().get("Defined"), sa);
|
||||
tgtPlayers = AbilityFactory.getDefinedPlayers(sa.getSourceCard(), params.get("Defined"), sa);
|
||||
|
||||
for(Player p : tgtPlayers)
|
||||
if (tgt == null || p.canTarget(af.getHostCard()))
|
||||
@@ -671,12 +677,14 @@ public class AbilityFactory_AlterLife {
|
||||
if (!ComputerUtil.canPayCost(sa) && !mandatory) // If there is a cost payment it's usually not mandatory
|
||||
return false;
|
||||
|
||||
HashMap<String,String> params = af.getMapParams();
|
||||
|
||||
Target tgt = sa.getTarget();
|
||||
if (tgt != null){
|
||||
tgt.addTarget(AllZone.HumanPlayer);
|
||||
}
|
||||
else{
|
||||
ArrayList<Player> players = AbilityFactory.getDefinedPlayers(sa.getSourceCard(), af.getMapParams().get("Defined"), sa);
|
||||
ArrayList<Player> players = AbilityFactory.getDefinedPlayers(sa.getSourceCard(), params.get("Defined"), sa);
|
||||
for(Player p : players)
|
||||
if (!mandatory && p.isComputer() && p.getPoisonCounters() > p.getOpponent().getPoisonCounters())
|
||||
return false;
|
||||
@@ -701,7 +709,7 @@ public class AbilityFactory_AlterLife {
|
||||
if (tgt != null)
|
||||
tgtPlayers = tgt.getTargetPlayers();
|
||||
else
|
||||
tgtPlayers = AbilityFactory.getDefinedPlayers(sa.getSourceCard(), af.getMapParams().get("Defined"), sa);
|
||||
tgtPlayers = AbilityFactory.getDefinedPlayers(sa.getSourceCard(), params.get("Defined"), sa);
|
||||
|
||||
for(Player p : tgtPlayers)
|
||||
if (tgt == null || p.canTarget(af.getHostCard()))
|
||||
@@ -709,15 +717,16 @@ public class AbilityFactory_AlterLife {
|
||||
}
|
||||
|
||||
private static String poisonStackDescription(AbilityFactory af, SpellAbility sa){
|
||||
HashMap<String,String> params = af.getMapParams();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
int amount = AbilityFactory.calculateAmount(af.getHostCard(), af.getMapParams().get("Num"), sa);
|
||||
int amount = AbilityFactory.calculateAmount(af.getHostCard(), params.get("Num"), sa);
|
||||
|
||||
if (!(sa instanceof Ability_Sub))
|
||||
sb.append(sa.getSourceCard()).append(" - ");
|
||||
else
|
||||
sb.append(" ");
|
||||
|
||||
String conditionDesc = af.getMapParams().get("ConditionDescription");
|
||||
String conditionDesc = params.get("ConditionDescription");
|
||||
if (conditionDesc != null)
|
||||
sb.append(conditionDesc).append(" ");
|
||||
|
||||
@@ -727,7 +736,7 @@ public class AbilityFactory_AlterLife {
|
||||
if (tgt != null)
|
||||
tgtPlayers = tgt.getTargetPlayers();
|
||||
else
|
||||
tgtPlayers = AbilityFactory.getDefinedPlayers(sa.getSourceCard(), af.getMapParams().get("Defined"), sa);
|
||||
tgtPlayers = AbilityFactory.getDefinedPlayers(sa.getSourceCard(), params.get("Defined"), sa);
|
||||
|
||||
if(tgtPlayers.size() > 0) {
|
||||
Iterator<Player> it = tgtPlayers.iterator();
|
||||
@@ -898,15 +907,16 @@ public class AbilityFactory_AlterLife {
|
||||
}
|
||||
|
||||
private static String setLifeStackDescription(AbilityFactory af, SpellAbility sa) {
|
||||
HashMap<String,String> params = af.getMapParams();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
int amount = AbilityFactory.calculateAmount(af.getHostCard(), af.getMapParams().get("LifeAmount"), sa);
|
||||
int amount = AbilityFactory.calculateAmount(af.getHostCard(), params.get("LifeAmount"), sa);
|
||||
|
||||
if (!(sa instanceof Ability_Sub))
|
||||
sb.append(sa.getSourceCard()).append(" -");
|
||||
else
|
||||
sb.append(" ");
|
||||
|
||||
String conditionDesc = af.getMapParams().get("ConditionDescription");
|
||||
String conditionDesc = params.get("ConditionDescription");
|
||||
if (conditionDesc != null)
|
||||
sb.append(conditionDesc).append(" ");
|
||||
|
||||
@@ -916,7 +926,7 @@ public class AbilityFactory_AlterLife {
|
||||
if(tgt != null)
|
||||
tgtPlayers = tgt.getTargetPlayers();
|
||||
else
|
||||
tgtPlayers = AbilityFactory.getDefinedPlayers(sa.getSourceCard(), af.getMapParams().get("Defined"), sa);
|
||||
tgtPlayers = AbilityFactory.getDefinedPlayers(sa.getSourceCard(), params.get("Defined"), sa);
|
||||
|
||||
for(Player player : tgtPlayers)
|
||||
sb.append(player).append(" ");
|
||||
@@ -1001,7 +1011,8 @@ public class AbilityFactory_AlterLife {
|
||||
int life = AllZone.ComputerPlayer.getLife();
|
||||
int hlife = AllZone.HumanPlayer.getLife();
|
||||
Card source = sa.getSourceCard();
|
||||
String amountStr = af.getMapParams().get("LifeAmount");
|
||||
HashMap<String,String> params = af.getMapParams();
|
||||
String amountStr = params.get("LifeAmount");
|
||||
if (!ComputerUtil.canPayCost(sa) && !mandatory) // If there is a cost payment it's usually not mandatory
|
||||
return false;
|
||||
|
||||
|
||||
@@ -136,7 +136,7 @@ public class AbilityFactory_Animate {
|
||||
if (tgt != null)
|
||||
tgts = tgt.getTargetCards();
|
||||
else
|
||||
tgts = AbilityFactory.getDefinedCards(sa.getSourceCard(), af.getMapParams().get("Defined"), sa);
|
||||
tgts = AbilityFactory.getDefinedCards(sa.getSourceCard(), params.get("Defined"), sa);
|
||||
|
||||
for(Card c : tgts) {
|
||||
sb.append(c).append(" ");
|
||||
@@ -194,7 +194,7 @@ public class AbilityFactory_Animate {
|
||||
return false;
|
||||
|
||||
if(null == tgt) {
|
||||
ArrayList<Card> defined = AbilityFactory.getDefinedCards(source, af.getMapParams().get("Defined"), sa);
|
||||
ArrayList<Card> defined = AbilityFactory.getDefinedCards(source, params.get("Defined"), sa);
|
||||
|
||||
boolean bFlag = false;
|
||||
for(Card c : defined) {
|
||||
|
||||
@@ -113,6 +113,7 @@ public class AbilityFactory_Copy {
|
||||
|
||||
private static String copyPermanentStackDescription(AbilityFactory af, SpellAbility sa) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
HashMap<String,String> params = af.getMapParams();
|
||||
|
||||
if (!(sa instanceof Ability_Sub))
|
||||
sb.append(sa.getSourceCard()).append(" - ");
|
||||
@@ -125,7 +126,7 @@ public class AbilityFactory_Copy {
|
||||
if (tgt != null)
|
||||
tgtCards = tgt.getTargetCards();
|
||||
else
|
||||
tgtCards = AbilityFactory.getDefinedCards(sa.getSourceCard(), af.getMapParams().get("Defined"), sa);
|
||||
tgtCards = AbilityFactory.getDefinedCards(sa.getSourceCard(), params.get("Defined"), sa);
|
||||
|
||||
sb.append("Copy ");
|
||||
Iterator<Card> it = tgtCards.iterator();
|
||||
@@ -449,6 +450,7 @@ public class AbilityFactory_Copy {
|
||||
|
||||
private static String copySpellStackDescription(AbilityFactory af, SpellAbility sa) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
HashMap<String,String> params = af.getMapParams();
|
||||
|
||||
if (!(sa instanceof Ability_Sub))
|
||||
sb.append(sa.getSourceCard().getName()).append(" - ");
|
||||
@@ -461,7 +463,7 @@ public class AbilityFactory_Copy {
|
||||
if (tgt != null)
|
||||
tgtSpells = tgt.getTargetSAs();
|
||||
else
|
||||
tgtSpells = AbilityFactory.getDefinedSpellAbilities(sa.getSourceCard(), af.getMapParams().get("Defined"), sa);
|
||||
tgtSpells = AbilityFactory.getDefinedSpellAbilities(sa.getSourceCard(), params.get("Defined"), sa);
|
||||
|
||||
sb.append("Copy ");
|
||||
Iterator<SpellAbility> it = tgtSpells.iterator();
|
||||
@@ -497,7 +499,7 @@ public class AbilityFactory_Copy {
|
||||
}
|
||||
|
||||
private static void copySpellResolve(final AbilityFactory af, final SpellAbility sa) {
|
||||
//final HashMap<String,String> params = af.getMapParams();
|
||||
final HashMap<String,String> params = af.getMapParams();
|
||||
Card card = af.getHostCard();
|
||||
|
||||
ArrayList<SpellAbility> tgtSpells;
|
||||
@@ -506,7 +508,7 @@ public class AbilityFactory_Copy {
|
||||
if (tgt != null)
|
||||
tgtSpells = tgt.getTargetSAs();
|
||||
else
|
||||
tgtSpells = AbilityFactory.getDefinedSpellAbilities(sa.getSourceCard(), af.getMapParams().get("Defined"), sa);
|
||||
tgtSpells = AbilityFactory.getDefinedSpellAbilities(sa.getSourceCard(), params.get("Defined"), sa);
|
||||
|
||||
for(SpellAbility tgtSA: tgtSpells) {
|
||||
if (tgt == null || CardFactoryUtil.canTarget(card, tgtSA.getSourceCard())) {
|
||||
|
||||
Reference in New Issue
Block a user