mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 12:48:00 +00:00
- Fixed Karakas AI targeting code.
- Removed Corrupt from CardFactory_Creatures and readded it into CardFactory.
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
program/mail=mtgerror@yahoo.com
|
program/mail=mtgerror@yahoo.com
|
||||||
program/forum=http://www.slightlymagic.net/forum/viewforum.php?f=26
|
program/forum=http://www.slightlymagic.net/forum/viewforum.php?f=26
|
||||||
program/version=MTG Forge -- official beta: 09/11/02, SVN revision: 90
|
program/version=MTG Forge -- official beta: 09/11/02, SVN revision: 92
|
||||||
|
|
||||||
tokens--file=AllTokens.txt
|
tokens--file=AllTokens.txt
|
||||||
|
|
||||||
|
|||||||
@@ -16957,6 +16957,81 @@ return land.size() > 1 && CardFactoryUtil.AI_isMainPhase();
|
|||||||
spell.setBeforePayMana(CardFactoryUtil.input_targetPlayer(spell));
|
spell.setBeforePayMana(CardFactoryUtil.input_targetPlayer(spell));
|
||||||
}//*************** END ************ END **************************
|
}//*************** END ************ END **************************
|
||||||
|
|
||||||
|
//*************** START *********** START **************************
|
||||||
|
if(cardName.equals("Corrupt"))
|
||||||
|
{
|
||||||
|
|
||||||
|
final SpellAbility spell = new Spell(card)
|
||||||
|
{
|
||||||
|
private static final long serialVersionUID = 335838994716307031L;
|
||||||
|
|
||||||
|
Card check;
|
||||||
|
public boolean canPlayAI()
|
||||||
|
{
|
||||||
|
if(AllZone.Human_Life.getLife() <= countSwamps(card))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
check = getFlying();
|
||||||
|
return check != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int countSwamps(Card c)
|
||||||
|
{
|
||||||
|
PlayerZone play = AllZone.getZone(Constant.Zone.Play, c.getController());
|
||||||
|
CardList swamps = new CardList(play.getCards());
|
||||||
|
swamps = swamps.getType("Swamp");
|
||||||
|
return swamps.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void chooseTargetAI()
|
||||||
|
{
|
||||||
|
if(AllZone.Human_Life.getLife() <= 12) //12? mebbe 15?
|
||||||
|
{
|
||||||
|
setTargetPlayer(Constant.Player.Human);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Card c = getFlying();
|
||||||
|
if((c == null) || (! check.equals(c)))
|
||||||
|
throw new RuntimeException(card +" error in chooseTargetAI() - Card c is " +c +", Card check is " +check);
|
||||||
|
|
||||||
|
setTargetCard(c);
|
||||||
|
}//chooseTargetAI()
|
||||||
|
|
||||||
|
//uses "damage" variable
|
||||||
|
Card getFlying()
|
||||||
|
{
|
||||||
|
CardList flying = CardFactoryUtil.AI_getHumanCreature("Flying", card, true);
|
||||||
|
for(int i = 0; i < flying.size(); i++)
|
||||||
|
if(flying.get(i).getNetDefense() <= countSwamps(card))
|
||||||
|
return flying.get(i);
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void resolve()
|
||||||
|
{
|
||||||
|
int damage = countSwamps(card);
|
||||||
|
if(getTargetCard() != null)
|
||||||
|
{
|
||||||
|
if(AllZone.GameAction.isCardInPlay(getTargetCard()) && CardFactoryUtil.canTarget(card, getTargetCard()) )
|
||||||
|
{
|
||||||
|
Card c = getTargetCard();
|
||||||
|
c.addDamage(damage);
|
||||||
|
AllZone.GameAction.getPlayerLife(card.getController()).addLife(damage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
AllZone.GameAction.getPlayerLife(getTargetPlayer()).subtractLife(damage);
|
||||||
|
AllZone.GameAction.getPlayerLife(card.getController()).addLife(damage);
|
||||||
|
}
|
||||||
|
}//resolve()
|
||||||
|
};//SpellAbility
|
||||||
|
card.clearSpellAbility();
|
||||||
|
card.addSpellAbility(spell);
|
||||||
|
|
||||||
|
spell.setBeforePayMana(CardFactoryUtil.input_targetCreaturePlayer(spell,true));
|
||||||
|
}//*************** END ************ END **************************
|
||||||
|
|
||||||
|
|
||||||
// Cards with Cycling abilities
|
// Cards with Cycling abilities
|
||||||
|
|||||||
@@ -10553,84 +10553,7 @@ public class CardFactory_Creatures {
|
|||||||
|
|
||||||
}//*************** END ************ END **************************
|
}//*************** END ************ END **************************
|
||||||
|
|
||||||
//*************** START *********** START **************************
|
//*************** START *********** START **************************
|
||||||
else if(cardName.equals("Corrupt"))
|
|
||||||
{
|
|
||||||
|
|
||||||
final SpellAbility spell = new Spell(card)
|
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 335838994716307031L;
|
|
||||||
|
|
||||||
Card check;
|
|
||||||
public boolean canPlayAI()
|
|
||||||
{
|
|
||||||
if(AllZone.Human_Life.getLife() <= countSwamps(card))
|
|
||||||
return true;
|
|
||||||
|
|
||||||
check = getFlying();
|
|
||||||
return check != null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int countSwamps(Card c)
|
|
||||||
{
|
|
||||||
PlayerZone play = AllZone.getZone(Constant.Zone.Play, c.getController());
|
|
||||||
CardList swamps = new CardList(play.getCards());
|
|
||||||
swamps = swamps.getType("Swamp");
|
|
||||||
return swamps.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void chooseTargetAI()
|
|
||||||
{
|
|
||||||
if(AllZone.Human_Life.getLife() <= 12) //12? mebbe 15?
|
|
||||||
{
|
|
||||||
setTargetPlayer(Constant.Player.Human);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Card c = getFlying();
|
|
||||||
if((c == null) || (! check.equals(c)))
|
|
||||||
throw new RuntimeException(card +" error in chooseTargetAI() - Card c is " +c +", Card check is " +check);
|
|
||||||
|
|
||||||
setTargetCard(c);
|
|
||||||
}//chooseTargetAI()
|
|
||||||
|
|
||||||
//uses "damage" variable
|
|
||||||
Card getFlying()
|
|
||||||
{
|
|
||||||
CardList flying = CardFactoryUtil.AI_getHumanCreature("Flying", card, true);
|
|
||||||
for(int i = 0; i < flying.size(); i++)
|
|
||||||
if(flying.get(i).getNetDefense() <= countSwamps(card))
|
|
||||||
return flying.get(i);
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void resolve()
|
|
||||||
{
|
|
||||||
int damage = countSwamps(card);
|
|
||||||
if(getTargetCard() != null)
|
|
||||||
{
|
|
||||||
if(AllZone.GameAction.isCardInPlay(getTargetCard()) && CardFactoryUtil.canTarget(card, getTargetCard()) )
|
|
||||||
{
|
|
||||||
Card c = getTargetCard();
|
|
||||||
c.addDamage(damage);
|
|
||||||
AllZone.GameAction.getPlayerLife(card.getController()).addLife(damage);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
AllZone.GameAction.getPlayerLife(getTargetPlayer()).subtractLife(damage);
|
|
||||||
AllZone.GameAction.getPlayerLife(card.getController()).addLife(damage);
|
|
||||||
}
|
|
||||||
}//resolve()
|
|
||||||
};//SpellAbility
|
|
||||||
card.clearSpellAbility();
|
|
||||||
card.addSpellAbility(spell);
|
|
||||||
|
|
||||||
spell.setBeforePayMana(CardFactoryUtil.input_targetCreaturePlayer(spell,true));
|
|
||||||
}//*************** END ************ END **************************
|
|
||||||
|
|
||||||
|
|
||||||
//*************** START *********** START **************************
|
|
||||||
else if(cardName.equals("Serra Avatar"))
|
else if(cardName.equals("Serra Avatar"))
|
||||||
{
|
{
|
||||||
Command leavesPlay = new Command()
|
Command leavesPlay = new Command()
|
||||||
|
|||||||
@@ -868,22 +868,23 @@ class CardFactory_Lands {
|
|||||||
final Ability_Tap ability = new Ability_Tap(card, "0")
|
final Ability_Tap ability = new Ability_Tap(card, "0")
|
||||||
{
|
{
|
||||||
|
|
||||||
private static final long serialVersionUID = -6589125907956046586L;
|
private static final long serialVersionUID = -6589125907956046586L;
|
||||||
|
|
||||||
public boolean canPlayAI()
|
public boolean canPlayAI()
|
||||||
{
|
{
|
||||||
CardList list = new CardList(AllZone.Human_Play.getCards());
|
CardList list = new CardList(AllZone.Human_Play.getCards());
|
||||||
list = list.filter(new CardListFilter()
|
list = list.filter(new CardListFilter()
|
||||||
{
|
{
|
||||||
public boolean addCard(Card c) {
|
public boolean addCard(Card c) {
|
||||||
return c.isCreature() && c.getKeyword().contains("Legendary");
|
return c.isCreature() && c.getKeyword().contains("Legendary");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
setTargetCard(CardFactoryUtil.AI_getBestCreature(list, card));
|
if (list.size() > 0)
|
||||||
|
setTargetCard(CardFactoryUtil.AI_getBestCreature(list, card));
|
||||||
return list.size() > 0;
|
|
||||||
}
|
return list.size() > 0;
|
||||||
|
}
|
||||||
|
|
||||||
public void resolve()
|
public void resolve()
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user