mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 11:48:02 +00:00
Checkstyle fixes in CardFactory_Auras.java
This commit is contained in:
@@ -40,7 +40,7 @@ class CardFactory_Auras {
|
|||||||
* @param c a {@link forge.Card} object.
|
* @param c a {@link forge.Card} object.
|
||||||
* @return a int.
|
* @return a int.
|
||||||
*/
|
*/
|
||||||
public final static int shouldCycle(Card c) {
|
public static final int shouldCycle(final Card c) {
|
||||||
ArrayList<String> a = c.getKeyword();
|
ArrayList<String> a = c.getKeyword();
|
||||||
for (int i = 0; i < a.size(); i++) {
|
for (int i = 0; i < a.size(); i++) {
|
||||||
if (a.get(i).toString().startsWith("Cycling")) {
|
if (a.get(i).toString().startsWith("Cycling")) {
|
||||||
@@ -64,7 +64,8 @@ class CardFactory_Auras {
|
|||||||
if (cardName.equals("Convincing Mirage") || cardName.equals("Phantasmal Terrain")
|
if (cardName.equals("Convincing Mirage") || cardName.equals("Phantasmal Terrain")
|
||||||
|| cardName.equals("Spreading Seas") || cardName.equals("Evil Presence")
|
|| cardName.equals("Spreading Seas") || cardName.equals("Evil Presence")
|
||||||
|| cardName.equals("Lingering Mirage") || cardName.equals("Sea's Claim")
|
|| cardName.equals("Lingering Mirage") || cardName.equals("Sea's Claim")
|
||||||
|| cardName.equals("Tainted Well")) {
|
|| cardName.equals("Tainted Well"))
|
||||||
|
{
|
||||||
|
|
||||||
final String[] newType = new String[1];
|
final String[] newType = new String[1];
|
||||||
final SpellAbility spell = new Spell(card) {
|
final SpellAbility spell = new Spell(card) {
|
||||||
@@ -81,13 +82,16 @@ class CardFactory_Auras {
|
|||||||
if (card.getName().equals("Spreading Seas")
|
if (card.getName().equals("Spreading Seas")
|
||||||
|| card.getName().equals("Lingering Mirage")
|
|| card.getName().equals("Lingering Mirage")
|
||||||
|| card.getName().equals("Sea's Claim")
|
|| card.getName().equals("Sea's Claim")
|
||||||
|| card.getName().equals("Phantasmal Terrain")) {
|
|| card.getName().equals("Phantasmal Terrain"))
|
||||||
|
{
|
||||||
newType[0] = "Island";
|
newType[0] = "Island";
|
||||||
} else if (card.getName().equals("Evil Presence")
|
} else if (card.getName().equals("Evil Presence")
|
||||||
|| card.getName().equals("Tainted Well")) {
|
|| card.getName().equals("Tainted Well"))
|
||||||
|
{
|
||||||
newType[0] = "Swamp";
|
newType[0] = "Swamp";
|
||||||
} else if (card.getName().equals("Convincing Mirage")
|
} else if (card.getName().equals("Convincing Mirage")
|
||||||
|| card.getName().equals("Phantasmal Terrain")) {
|
|| card.getName().equals("Phantasmal Terrain"))
|
||||||
|
{
|
||||||
String[] landTypes = new String[]{"Plains", "Island", "Swamp", "Mountain", "Forest"};
|
String[] landTypes = new String[]{"Plains", "Island", "Swamp", "Mountain", "Forest"};
|
||||||
HashMap<String, Integer> humanLandCount = new HashMap<String, Integer>();
|
HashMap<String, Integer> humanLandCount = new HashMap<String, Integer>();
|
||||||
CardList humanlands = AllZoneUtil.getPlayerLandsInPlay(AllZone.getHumanPlayer());
|
CardList humanlands = AllZoneUtil.getPlayerLandsInPlay(AllZone.getHumanPlayer());
|
||||||
@@ -126,22 +130,26 @@ class CardFactory_Auras {
|
|||||||
}
|
}
|
||||||
setTargetCard(list.get(0));
|
setTargetCard(list.get(0));
|
||||||
return true;
|
return true;
|
||||||
}//canPlayAI()
|
} //canPlayAI()
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void resolve() {
|
public void resolve() {
|
||||||
if (card.getName().equals("Spreading Seas")
|
if (card.getName().equals("Spreading Seas")
|
||||||
|| card.getName().equals("Lingering Mirage")
|
|| card.getName().equals("Lingering Mirage")
|
||||||
|| card.getName().equals("Sea's Claim")) {
|
|| card.getName().equals("Sea's Claim"))
|
||||||
|
{
|
||||||
newType[0] = "Island";
|
newType[0] = "Island";
|
||||||
} else if (card.getName().equals("Evil Presence")
|
} else if (card.getName().equals("Evil Presence")
|
||||||
|| card.getName().equals("Tainted Well")) {
|
|| card.getName().equals("Tainted Well"))
|
||||||
|
{
|
||||||
newType[0] = "Swamp";
|
newType[0] = "Swamp";
|
||||||
} else if (card.getName().equals("Convincing Mirage")
|
} else if (card.getName().equals("Convincing Mirage")
|
||||||
|| card.getName().equals("Phantasmal Terrain")) {
|
|| card.getName().equals("Phantasmal Terrain"))
|
||||||
|
{
|
||||||
//Only query player, AI will have decided already.
|
//Only query player, AI will have decided already.
|
||||||
if (card.getController().isHuman()) {
|
if (card.getController().isHuman()) {
|
||||||
newType[0] = GuiUtils.getChoice("Select land type.", "Plains", "Island", "Swamp", "Mountain", "Forest");
|
newType[0] = GuiUtils.getChoice("Select land type.",
|
||||||
|
"Plains", "Island", "Swamp", "Mountain", "Forest");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
AllZone.getGameAction().moveToPlay(card);
|
AllZone.getGameAction().moveToPlay(card);
|
||||||
@@ -149,12 +157,13 @@ class CardFactory_Auras {
|
|||||||
Card c = getTargetCard();
|
Card c = getTargetCard();
|
||||||
|
|
||||||
if (AllZoneUtil.isCardInPlay(c)
|
if (AllZoneUtil.isCardInPlay(c)
|
||||||
&& CardFactoryUtil.canTarget(card, c)) {
|
&& CardFactoryUtil.canTarget(card, c))
|
||||||
|
{
|
||||||
card.enchantCard(c);
|
card.enchantCard(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
}//resolve()
|
} //resolve()
|
||||||
};//SpellAbility
|
}; //SpellAbility
|
||||||
|
|
||||||
|
|
||||||
spell.setDescription("");
|
spell.setDescription("");
|
||||||
@@ -190,20 +199,20 @@ class CardFactory_Auras {
|
|||||||
|
|
||||||
crd.addType(newType[0]);
|
crd.addType(newType[0]);
|
||||||
} else {
|
} else {
|
||||||
Card Other_Seas = null;
|
Card otherSeas = null;
|
||||||
for (int i = 0; i < seas.size(); i++) {
|
for (int i = 0; i < seas.size(); i++) {
|
||||||
if (seas.get(i) != card) {
|
if (seas.get(i) != card) {
|
||||||
Other_Seas = seas.get(i);
|
otherSeas = seas.get(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SpellAbility[] Abilities = Other_Seas.getSpellAbility();
|
SpellAbility[] abilities = otherSeas.getSpellAbility();
|
||||||
for (int i = 0; i < Abilities.length; i++) {
|
for (int i = 0; i < abilities.length; i++) {
|
||||||
card.addSpellAbility(Abilities[i]);
|
card.addSpellAbility(abilities[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}//execute()
|
} //execute()
|
||||||
};//Command
|
}; //Command
|
||||||
|
|
||||||
Command onUnEnchant = new Command() {
|
Command onUnEnchant = new Command() {
|
||||||
private static final long serialVersionUID = -202144631191180334L;
|
private static final long serialVersionUID = -202144631191180334L;
|
||||||
@@ -224,25 +233,25 @@ class CardFactory_Auras {
|
|||||||
crd.removeType("Basic");
|
crd.removeType("Basic");
|
||||||
crd.removeType("Snow");
|
crd.removeType("Snow");
|
||||||
crd.removeType("Legendary");
|
crd.removeType("Legendary");
|
||||||
SpellAbility[] Card_Abilities = crd.getSpellAbility();
|
SpellAbility[] cardAbilities = crd.getSpellAbility();
|
||||||
for (int i = 0; i < Card_Abilities.length; i++) {
|
for (int i = 0; i < cardAbilities.length; i++) {
|
||||||
if (Card_Abilities[i].isIntrinsic()) {
|
if (cardAbilities[i].isIntrinsic()) {
|
||||||
crd.removeSpellAbility(Card_Abilities[i]);
|
crd.removeSpellAbility(cardAbilities[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Card c = AllZone.getCardFactory().copyCard(crd);
|
Card c = AllZone.getCardFactory().copyCard(crd);
|
||||||
ArrayList<String> types = c.getType();
|
ArrayList<String> types = c.getType();
|
||||||
SpellAbility[] Abilities = card.getSpellAbility();
|
SpellAbility[] abilities = card.getSpellAbility();
|
||||||
for (int i = 0; i < types.size(); i++) {
|
for (int i = 0; i < types.size(); i++) {
|
||||||
crd.addType(types.get(i));
|
crd.addType(types.get(i));
|
||||||
}
|
}
|
||||||
for (int i = 0; i < Abilities.length; i++) {
|
for (int i = 0; i < abilities.length; i++) {
|
||||||
crd.addSpellAbility(Abilities[i]);
|
crd.addSpellAbility(abilities[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}//execute()
|
} //execute()
|
||||||
};//Command
|
}; //Command
|
||||||
|
|
||||||
Command onLeavesPlay = new Command() {
|
Command onLeavesPlay = new Command() {
|
||||||
|
|
||||||
@@ -272,7 +281,7 @@ class CardFactory_Auras {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
spell.setBeforePayMana(runtime);
|
spell.setBeforePayMana(runtime);
|
||||||
}//*************** END ************ END **************************
|
} //*************** END ************ END **************************
|
||||||
|
|
||||||
|
|
||||||
//*************** START *********** START **************************
|
//*************** START *********** START **************************
|
||||||
@@ -292,7 +301,7 @@ class CardFactory_Auras {
|
|||||||
}
|
}
|
||||||
|
|
||||||
CardListFilter f = new CardListFilter() {
|
CardListFilter f = new CardListFilter() {
|
||||||
public final boolean addCard(Card c) {
|
public final boolean addCard(final Card c) {
|
||||||
return c.getNetDefense() - c.getDamage() <= 2;
|
return c.getNetDefense() - c.getDamage() <= 2;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -308,7 +317,7 @@ class CardFactory_Auras {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}//canPlayAI()
|
} //canPlayAI()
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void resolve() {
|
public void resolve() {
|
||||||
@@ -317,12 +326,13 @@ class CardFactory_Auras {
|
|||||||
Card c = getTargetCard();
|
Card c = getTargetCard();
|
||||||
|
|
||||||
if (AllZoneUtil.isCardInPlay(c)
|
if (AllZoneUtil.isCardInPlay(c)
|
||||||
&& CardFactoryUtil.canTarget(card, c)) {
|
&& CardFactoryUtil.canTarget(card, c))
|
||||||
|
{
|
||||||
card.enchantCard(c);
|
card.enchantCard(c);
|
||||||
Log.debug("Enchanted: " + getTargetCard());
|
Log.debug("Enchanted: " + getTargetCard());
|
||||||
}
|
}
|
||||||
}//resolve()
|
} //resolve()
|
||||||
};//SpellAbility
|
}; //SpellAbility
|
||||||
|
|
||||||
card.addSpellAbility(spell);
|
card.addSpellAbility(spell);
|
||||||
|
|
||||||
@@ -343,8 +353,8 @@ class CardFactory_Auras {
|
|||||||
badTarget[0] = true;
|
badTarget[0] = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}//execute()
|
} //execute()
|
||||||
};//Command
|
}; //Command
|
||||||
|
|
||||||
Command onUnEnchant = new Command() {
|
Command onUnEnchant = new Command() {
|
||||||
|
|
||||||
@@ -352,12 +362,13 @@ class CardFactory_Auras {
|
|||||||
|
|
||||||
public void execute() {
|
public void execute() {
|
||||||
if (card.isEnchanting()
|
if (card.isEnchanting()
|
||||||
&& !badTarget[0]) {
|
&& !badTarget[0])
|
||||||
|
{
|
||||||
Card crd = card.getEnchanting().get(0);
|
Card crd = card.getEnchanting().get(0);
|
||||||
crd.addIntrinsicKeyword("Flying");
|
crd.addIntrinsicKeyword("Flying");
|
||||||
}
|
}
|
||||||
}//execute()
|
} //execute()
|
||||||
};//Command
|
}; //Command
|
||||||
|
|
||||||
Command onLeavesPlay = new Command() {
|
Command onLeavesPlay = new Command() {
|
||||||
|
|
||||||
@@ -374,7 +385,7 @@ class CardFactory_Auras {
|
|||||||
card.addEnchantCommand(onEnchant);
|
card.addEnchantCommand(onEnchant);
|
||||||
card.addUnEnchantCommand(onUnEnchant);
|
card.addUnEnchantCommand(onUnEnchant);
|
||||||
card.addLeavesPlayCommand(onLeavesPlay);
|
card.addLeavesPlayCommand(onLeavesPlay);
|
||||||
}//*************** END ************ END **************************
|
} //*************** END ************ END **************************
|
||||||
|
|
||||||
|
|
||||||
//*************** START *********** START **************************
|
//*************** START *********** START **************************
|
||||||
@@ -407,7 +418,8 @@ class CardFactory_Auras {
|
|||||||
for (int i = 0; i < list.size(); i++) {
|
for (int i = 0; i < list.size(); i++) {
|
||||||
if (CardFactoryUtil.canTarget(card, list.get(i))
|
if (CardFactoryUtil.canTarget(card, list.get(i))
|
||||||
&& (list.get(i).getNetAttack() >= list.get(i).getNetDefense())
|
&& (list.get(i).getNetAttack() >= list.get(i).getNetDefense())
|
||||||
&& list.get(i).getNetAttack() >= 3) {
|
&& list.get(i).getNetAttack() >= 3)
|
||||||
|
{
|
||||||
setTargetCard(list.get(i));
|
setTargetCard(list.get(i));
|
||||||
return super.canPlayAI();
|
return super.canPlayAI();
|
||||||
}
|
}
|
||||||
@@ -415,7 +427,7 @@ class CardFactory_Auras {
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
}//canPlayAI()
|
} //canPlayAI()
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void resolve() {
|
public void resolve() {
|
||||||
@@ -424,14 +436,15 @@ class CardFactory_Auras {
|
|||||||
Card c = getTargetCard();
|
Card c = getTargetCard();
|
||||||
|
|
||||||
if (AllZoneUtil.isCardInPlay(c)
|
if (AllZoneUtil.isCardInPlay(c)
|
||||||
&& CardFactoryUtil.canTarget(aura, c)) {
|
&& CardFactoryUtil.canTarget(aura, c))
|
||||||
|
{
|
||||||
aura.enchantCard(c);
|
aura.enchantCard(c);
|
||||||
}
|
}
|
||||||
}//resolve()
|
} //resolve()
|
||||||
};//SpellAbility
|
}; //SpellAbility
|
||||||
|
|
||||||
card.addSpellAbility(spell);
|
card.addSpellAbility(spell);
|
||||||
}//*************** END ************ END **************************
|
} //*************** END ************ END **************************
|
||||||
|
|
||||||
|
|
||||||
//*************** START *********** START **************************
|
//*************** START *********** START **************************
|
||||||
@@ -458,8 +471,9 @@ class CardFactory_Auras {
|
|||||||
CardList cList = getCreturesInGrave();
|
CardList cList = getCreturesInGrave();
|
||||||
// AI will only target something that will stick in play.
|
// AI will only target something that will stick in play.
|
||||||
cList = cList.filter(new CardListFilter() {
|
cList = cList.filter(new CardListFilter() {
|
||||||
public final boolean addCard(Card crd) {
|
public final boolean addCard(final Card crd) {
|
||||||
return CardFactoryUtil.canTarget(card, crd) && !CardFactoryUtil.hasProtectionFrom(card, crd);
|
return CardFactoryUtil.canTarget(card, crd)
|
||||||
|
&& !CardFactoryUtil.hasProtectionFrom(card, crd);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (cList.size() == 0) {
|
if (cList.size() == 0) {
|
||||||
@@ -471,7 +485,7 @@ class CardFactory_Auras {
|
|||||||
setTargetCard(c);
|
setTargetCard(c);
|
||||||
boolean playable = 2 < c.getNetAttack() && 2 < c.getNetDefense() && super.canPlayAI();
|
boolean playable = 2 < c.getNetAttack() && 2 < c.getNetDefense() && super.canPlayAI();
|
||||||
return playable;
|
return playable;
|
||||||
}//canPlayAI
|
} //canPlayAI
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void resolve() {
|
public void resolve() {
|
||||||
@@ -479,7 +493,7 @@ class CardFactory_Auras {
|
|||||||
super.resolve();
|
super.resolve();
|
||||||
}
|
}
|
||||||
|
|
||||||
};//addSpellAbility
|
}; //addSpellAbility
|
||||||
|
|
||||||
// Target AbCost and Restriction are set here to get this working as expected
|
// Target AbCost and Restriction are set here to get this working as expected
|
||||||
Target tgt = new Target(card, "Select a creature in a graveyard", "Creature".split(","));
|
Target tgt = new Target(card, "Select a creature in a graveyard", "Creature".split(","));
|
||||||
@@ -528,7 +542,7 @@ class CardFactory_Auras {
|
|||||||
|
|
||||||
// Everything worked out perfectly.
|
// Everything worked out perfectly.
|
||||||
}
|
}
|
||||||
};//Ability
|
}; //Ability
|
||||||
|
|
||||||
final Command attachCmd = new Command() {
|
final Command attachCmd = new Command() {
|
||||||
private static final long serialVersionUID = 3595188622377350327L;
|
private static final long serialVersionUID = 3595188622377350327L;
|
||||||
@@ -551,7 +565,7 @@ class CardFactory_Auras {
|
|||||||
AllZone.getGameAction().sacrifice(c);
|
AllZone.getGameAction().sacrifice(c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};//Detach
|
}; //Detach
|
||||||
|
|
||||||
final Command detachCmd = new Command() {
|
final Command detachCmd = new Command() {
|
||||||
private static final long serialVersionUID = 2425333033834543422L;
|
private static final long serialVersionUID = 2425333033834543422L;
|
||||||
@@ -575,7 +589,7 @@ class CardFactory_Auras {
|
|||||||
detach.setStackDescription(cardName + " left play. Sacrificing creature if still around.");
|
detach.setStackDescription(cardName + " left play. Sacrificing creature if still around.");
|
||||||
card.addLeavesPlayCommand(detachCmd);
|
card.addLeavesPlayCommand(detachCmd);
|
||||||
card.addUnEnchantCommand(detachCmd);
|
card.addUnEnchantCommand(detachCmd);
|
||||||
}//*************** END ************ END **************************
|
} //*************** END ************ END **************************
|
||||||
|
|
||||||
|
|
||||||
//*************** START *********** START **************************
|
//*************** START *********** START **************************
|
||||||
@@ -583,7 +597,7 @@ class CardFactory_Auras {
|
|||||||
int n = CardFactoryUtil.hasKeyword(card, "enchant");
|
int n = CardFactoryUtil.hasKeyword(card, "enchant");
|
||||||
if (n != -1) {
|
if (n != -1) {
|
||||||
String parse = card.getKeyword().get(n).toString();
|
String parse = card.getKeyword().get(n).toString();
|
||||||
String k[] = parse.split(":");
|
String[] k = parse.split(":");
|
||||||
|
|
||||||
SpellAbility sa = card.getSpellAbility()[0];
|
SpellAbility sa = card.getSpellAbility()[0];
|
||||||
sa.setIsMultiKicker(true);
|
sa.setIsMultiKicker(true);
|
||||||
|
|||||||
Reference in New Issue
Block a user