mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 02:38:02 +00:00
- Small performance tweak.
- Reverted Riding the Dilu Horse from keyword to code.
This commit is contained in:
@@ -1,3 +1,8 @@
|
|||||||
|
Riding the Dilu Horse
|
||||||
|
2 G
|
||||||
|
Sorcery
|
||||||
|
no text
|
||||||
|
|
||||||
Mogg Jailer
|
Mogg Jailer
|
||||||
1 R
|
1 R
|
||||||
Creature Goblin
|
Creature Goblin
|
||||||
@@ -4406,12 +4411,6 @@ Creature Human Soldier Archer
|
|||||||
no text
|
no text
|
||||||
1/1
|
1/1
|
||||||
|
|
||||||
Riding the Dilu Horse
|
|
||||||
2 G
|
|
||||||
Sorcery
|
|
||||||
no text
|
|
||||||
spPumpTgt:+2/+2/Horsemanship
|
|
||||||
|
|
||||||
Magus of the Coffers
|
Magus of the Coffers
|
||||||
4 B
|
4 B
|
||||||
Creature Human Wizard
|
Creature Human Wizard
|
||||||
|
|||||||
Binary file not shown.
@@ -17429,6 +17429,133 @@ public class CardFactory implements NewConstants {
|
|||||||
ability.setBeforePayMana(CardFactoryUtil.input_targetType(ability, "Creature"));
|
ability.setBeforePayMana(CardFactoryUtil.input_targetType(ability, "Creature"));
|
||||||
}//Jandor's Saddlebags
|
}//Jandor's Saddlebags
|
||||||
//****************END*******END***********************
|
//****************END*******END***********************
|
||||||
|
|
||||||
|
//*************** START *********** START **************************
|
||||||
|
|
||||||
|
else if(cardName.equals("Reinforcements")) {
|
||||||
|
/* Put up to three target creature cards from your
|
||||||
|
* graveyard on top of your library.
|
||||||
|
*/
|
||||||
|
final SpellAbility spell = new Spell(card) {
|
||||||
|
private static final long serialVersionUID = 4075591356690396548L;
|
||||||
|
|
||||||
|
CardList getComputerCreatures()
|
||||||
|
{
|
||||||
|
CardList list = new CardList(AllZone.Computer_Graveyard.getCards());
|
||||||
|
list = list.getType("Creature");
|
||||||
|
|
||||||
|
//put biggest attack creats first
|
||||||
|
if (list.size()>0)
|
||||||
|
CardListUtil.sortAttack(list);
|
||||||
|
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canPlayAI() {
|
||||||
|
return getComputerCreatures().size() >= 3;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void resolve() {
|
||||||
|
String player = card.getController();
|
||||||
|
PlayerZone grave = AllZone.getZone(Constant.Zone.Graveyard, player);
|
||||||
|
PlayerZone lib = AllZone.getZone(Constant.Zone.Library, player);
|
||||||
|
|
||||||
|
CardList creatures = new CardList(grave.getCards());
|
||||||
|
creatures = creatures.filter(new CardListFilter() {
|
||||||
|
public boolean addCard(Card c) {
|
||||||
|
return c.isCreature();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (player.equals(Constant.Player.Human))
|
||||||
|
{
|
||||||
|
//now, select three creatures
|
||||||
|
int end = -1;
|
||||||
|
end = Math.min(creatures.size(), 3);
|
||||||
|
for(int i = 1; i <= end; i++) {
|
||||||
|
String Title = "Put on top of library: ";
|
||||||
|
if(i == 2) Title = "Put second from top of library: ";
|
||||||
|
if(i == 3) Title = "Put third from top of library: ";
|
||||||
|
Object o = AllZone.Display.getChoiceOptional(Title, creatures.toArray());
|
||||||
|
if(o == null) break;
|
||||||
|
Card c_1 = (Card) o;
|
||||||
|
creatures.remove(c_1); //remove from the display list
|
||||||
|
grave.remove(c_1); //remove from graveyard
|
||||||
|
lib.add(c_1, i - 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else //Computer
|
||||||
|
{
|
||||||
|
CardList list = getComputerCreatures();
|
||||||
|
int max = list.size();
|
||||||
|
|
||||||
|
if (max > 3)
|
||||||
|
max = 3;
|
||||||
|
|
||||||
|
for (int i=0;i<max;i++)
|
||||||
|
{
|
||||||
|
grave.remove(list.get(i));
|
||||||
|
lib.add(list.get(i), i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
};//spell
|
||||||
|
card.clearSpellAbility();
|
||||||
|
card.addSpellAbility(spell);
|
||||||
|
}
|
||||||
|
//*************** END ************ END **************************
|
||||||
|
|
||||||
|
//*************** START *********** START **************************
|
||||||
|
else if(cardName.equals("Riding the Dilu Horse"))
|
||||||
|
{
|
||||||
|
SpellAbility spell = new Spell(card)
|
||||||
|
{
|
||||||
|
private static final long serialVersionUID = -620930445462994580L;
|
||||||
|
|
||||||
|
|
||||||
|
public boolean canPlayAI()
|
||||||
|
{
|
||||||
|
PlayerZone play = AllZone.getZone(Constant.Zone.Play, Constant.Player.Computer);
|
||||||
|
|
||||||
|
CardList list = new CardList(play.getCards());
|
||||||
|
list = list.filter(new CardListFilter()
|
||||||
|
{
|
||||||
|
public boolean addCard(Card c)
|
||||||
|
{
|
||||||
|
return c.isCreature() && !c.getKeyword().contains("Horsemanship") && !c.getKeyword().contains("Defender");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (list.size() > 0) {
|
||||||
|
Card c = CardFactoryUtil.AI_getBestCreature(list, card);
|
||||||
|
setTargetCard(c);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void resolve()
|
||||||
|
{
|
||||||
|
final Card[] target = new Card[1];
|
||||||
|
|
||||||
|
|
||||||
|
target[0] = getTargetCard();
|
||||||
|
if(AllZone.GameAction.isCardInPlay(target[0]) && CardFactoryUtil.canTarget(card, target[0]))
|
||||||
|
{
|
||||||
|
target[0].addTempAttackBoost(2);
|
||||||
|
target[0].addTempDefenseBoost(2);
|
||||||
|
target[0].addExtrinsicKeyword("Horsemanship");
|
||||||
|
|
||||||
|
//String s = target[0].getText();
|
||||||
|
target[0].setText("(+2/+2 and Horsemanship from " +card+")");
|
||||||
|
}
|
||||||
|
}//resolve()
|
||||||
|
};
|
||||||
|
spell.setBeforePayMana(CardFactoryUtil.input_targetCreature(spell));
|
||||||
|
card.clearSpellAbility();
|
||||||
|
card.addSpellAbility(spell);
|
||||||
|
}//*************** END ************ END **************************
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Cards with Cycling abilities
|
// Cards with Cycling abilities
|
||||||
|
|||||||
@@ -447,81 +447,83 @@ public class GameAction {
|
|||||||
new Gui_WinLose();
|
new Gui_WinLose();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
//do this twice, sometimes creatures/permanents will survive when they shouldn't
|
||||||
//card state effects like Glorious Anthem
|
for (int q=0;q<2;q++)
|
||||||
for(String effect:AllZone.StaticEffects.getStateBasedMap().keySet()) {
|
{
|
||||||
Command com = GameActionUtil.commands.get(effect);
|
//card state effects like Glorious Anthem
|
||||||
com.execute();
|
for(String effect:AllZone.StaticEffects.getStateBasedMap().keySet()) {
|
||||||
}
|
Command com = GameActionUtil.commands.get(effect);
|
||||||
|
com.execute();
|
||||||
GameActionUtil.executeCardStateEffects();
|
}
|
||||||
|
|
||||||
//System.out.println("checking state effects");
|
GameActionUtil.executeCardStateEffects();
|
||||||
ArrayList<Card> creature = PlayerZoneUtil.getCardType(AllZone.Computer_Play, "Creature");
|
|
||||||
creature.addAll(PlayerZoneUtil.getCardType(AllZone.Human_Play, "Creature"));
|
//System.out.println("checking state effects");
|
||||||
|
ArrayList<Card> creature = PlayerZoneUtil.getCardType(AllZone.Computer_Play, "Creature");
|
||||||
Card c;
|
creature.addAll(PlayerZoneUtil.getCardType(AllZone.Human_Play, "Creature"));
|
||||||
Iterator<Card> it = creature.iterator();
|
|
||||||
|
Card c;
|
||||||
while(it.hasNext()) {
|
Iterator<Card> it = creature.iterator();
|
||||||
c = it.next();
|
|
||||||
|
while(it.hasNext()) {
|
||||||
if(c.isEquipped()) {
|
c = it.next();
|
||||||
for(int i = 0; i < c.getEquippedBy().size(); i++) {
|
|
||||||
Card equipment = c.getEquippedBy().get(i);
|
if(c.isEquipped()) {
|
||||||
if(!AllZone.GameAction.isCardInPlay(equipment)) {
|
for(int i = 0; i < c.getEquippedBy().size(); i++) {
|
||||||
equipment.unEquipCard(c);
|
Card equipment = c.getEquippedBy().get(i);
|
||||||
}
|
if(!AllZone.GameAction.isCardInPlay(equipment)) {
|
||||||
}
|
equipment.unEquipCard(c);
|
||||||
}//if isEquipped()
|
}
|
||||||
|
}
|
||||||
if(c.getNetDefense() <= c.getDamage() && !c.getKeyword().contains("Indestructible")) {
|
}//if isEquipped()
|
||||||
destroy(c);
|
|
||||||
AllZone.Combat.removeFromCombat(c); //this is untested with instants and abilities but required for First Strike combat phase
|
if(c.getNetDefense() <= c.getDamage() && !c.getKeyword().contains("Indestructible")) {
|
||||||
}
|
destroy(c);
|
||||||
|
AllZone.Combat.removeFromCombat(c); //this is untested with instants and abilities but required for First Strike combat phase
|
||||||
else if(c.getNetDefense() <= 0) {
|
}
|
||||||
destroy(c);
|
|
||||||
AllZone.Combat.removeFromCombat(c);
|
else if(c.getNetDefense() <= 0) {
|
||||||
}
|
destroy(c);
|
||||||
|
AllZone.Combat.removeFromCombat(c);
|
||||||
}//while it.hasNext()
|
}
|
||||||
|
|
||||||
|
}//while it.hasNext()
|
||||||
ArrayList<Card> enchantments = PlayerZoneUtil.getCardType(AllZone.Computer_Play, "Enchantment");
|
|
||||||
enchantments.addAll(PlayerZoneUtil.getCardType(AllZone.Human_Play, "Enchantment"));
|
|
||||||
|
ArrayList<Card> enchantments = PlayerZoneUtil.getCardType(AllZone.Computer_Play, "Enchantment");
|
||||||
Iterator<Card> iterate = enchantments.iterator();
|
enchantments.addAll(PlayerZoneUtil.getCardType(AllZone.Human_Play, "Enchantment"));
|
||||||
while(iterate.hasNext()) {
|
|
||||||
c = iterate.next();
|
Iterator<Card> iterate = enchantments.iterator();
|
||||||
|
while(iterate.hasNext()) {
|
||||||
if(c.isAura()) {
|
c = iterate.next();
|
||||||
for(int i = 0; i < c.getEnchanting().size(); i++) {
|
|
||||||
Card perm = c.getEnchanting().get(i);
|
if(c.isAura()) {
|
||||||
if(!AllZone.GameAction.isCardInPlay(perm)
|
for(int i = 0; i < c.getEnchanting().size(); i++) {
|
||||||
|| CardFactoryUtil.hasProtectionFrom(c, perm)
|
Card perm = c.getEnchanting().get(i);
|
||||||
|| (c.getKeyword().contains("Enchant creature") && !perm.getType().contains("Creature"))) {
|
if(!AllZone.GameAction.isCardInPlay(perm)
|
||||||
c.unEnchantCard(perm);
|
|| CardFactoryUtil.hasProtectionFrom(c, perm)
|
||||||
destroy(c);
|
|| (c.getKeyword().contains("Enchant creature") && !perm.getType().contains("Creature"))) {
|
||||||
}
|
c.unEnchantCard(perm);
|
||||||
}
|
destroy(c);
|
||||||
}//if isAura
|
}
|
||||||
|
}
|
||||||
}//while iterate.hasNext()
|
}//if isAura
|
||||||
|
|
||||||
|
}//while iterate.hasNext()
|
||||||
//Make sure all equipment stops equipping previously equipped creatures that have left play.
|
|
||||||
ArrayList<Card> equip = PlayerZoneUtil.getCardType(AllZone.Computer_Play, "Equipment");
|
//Make sure all equipment stops equipping previously equipped creatures that have left play.
|
||||||
equip.addAll(PlayerZoneUtil.getCardType(AllZone.Human_Play, "Equipment"));
|
ArrayList<Card> equip = PlayerZoneUtil.getCardType(AllZone.Computer_Play, "Equipment");
|
||||||
|
equip.addAll(PlayerZoneUtil.getCardType(AllZone.Human_Play, "Equipment"));
|
||||||
Iterator<Card> iter = equip.iterator();
|
|
||||||
while(iter.hasNext()) {
|
Iterator<Card> iter = equip.iterator();
|
||||||
c = iter.next();
|
while(iter.hasNext()) {
|
||||||
if(c.isEquipping()) {
|
c = iter.next();
|
||||||
Card equippedCreature = c.getEquipping().get(0);
|
if(c.isEquipping()) {
|
||||||
if(!AllZone.GameAction.isCardInPlay(equippedCreature)) c.unEquipCard(equippedCreature);
|
Card equippedCreature = c.getEquipping().get(0);
|
||||||
}
|
if(!AllZone.GameAction.isCardInPlay(equippedCreature)) c.unEquipCard(equippedCreature);
|
||||||
}//while iter.hasNext()
|
}
|
||||||
|
}//while iter.hasNext()
|
||||||
|
}//for q=0;q<2
|
||||||
|
|
||||||
destroyLegendaryCreatures();
|
destroyLegendaryCreatures();
|
||||||
destroyPlaneswalkers();
|
destroyPlaneswalkers();
|
||||||
@@ -896,9 +898,28 @@ public class GameAction {
|
|||||||
c[i].setDamage(0);
|
c[i].setDamage(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//for Quest fantasy mode
|
||||||
|
public void newGame(Deck humanDeck, Deck computerDeck, CardList human, CardList computer, int humanLife, int computerLife)
|
||||||
|
{
|
||||||
|
this.newGame(humanDeck, computerDeck);
|
||||||
|
|
||||||
|
AllZone.Computer_Life.setLife(computerLife);
|
||||||
|
AllZone.Human_Life.setLife(humanLife);
|
||||||
|
|
||||||
|
for (Card c : human)
|
||||||
|
{
|
||||||
|
AllZone.Human_Play.add(c);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Card c: computer)
|
||||||
|
{
|
||||||
|
AllZone.Computer_Play.add(c);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void newGame(Deck humanDeck, Deck computerDeck) {
|
public void newGame(Deck humanDeck, Deck computerDeck) {
|
||||||
// AllZone.Computer = new ComputerAI_Input(new ComputerAI_General());
|
// AllZone.Computer = new ComputerAI_Input(new ComputerAI_General());
|
||||||
//System.gc(); //garbage collection... does it make a difference though?
|
|
||||||
lastPlayerToDraw = Constant.Player.Human;
|
lastPlayerToDraw = Constant.Player.Human;
|
||||||
|
|
||||||
AllZone.GameInfo.setComputerCanPlayNumberOfLands(1);
|
AllZone.GameInfo.setComputerCanPlayNumberOfLands(1);
|
||||||
@@ -936,9 +957,6 @@ public class GameAction {
|
|||||||
|
|
||||||
AllZone.StaticEffects.reset();
|
AllZone.StaticEffects.reset();
|
||||||
|
|
||||||
//clear Image caches, so the problem doesn't get slower and slower
|
|
||||||
//cached images are cleared in Gui_WinLose.quitButton_actionPerformed()
|
|
||||||
|
|
||||||
|
|
||||||
{//re-number cards just so their unique numbers are low, just for user friendliness
|
{//re-number cards just so their unique numbers are low, just for user friendliness
|
||||||
CardFactory c = AllZone.CardFactory;
|
CardFactory c = AllZone.CardFactory;
|
||||||
@@ -956,8 +974,6 @@ public class GameAction {
|
|||||||
}
|
}
|
||||||
AllZone.Human_Library.add(card);
|
AllZone.Human_Library.add(card);
|
||||||
|
|
||||||
//get card picture so that it is in the image cache
|
|
||||||
// ImageCache.getImage(card);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int i = 0; i < computerDeck.countMain(); i++) {
|
for(int i = 0; i < computerDeck.countMain(); i++) {
|
||||||
@@ -992,14 +1008,6 @@ public class GameAction {
|
|||||||
this.drawCard(Constant.Player.Computer);
|
this.drawCard(Constant.Player.Computer);
|
||||||
this.drawCard(Constant.Player.Human);
|
this.drawCard(Constant.Player.Human);
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
Card mp = new Card();
|
|
||||||
mp.setName("Mana Pool");
|
|
||||||
//mp.addType("Land");
|
|
||||||
mp.addIntrinsicKeyword("Indestructible");
|
|
||||||
mp.addIntrinsicKeyword("Shroud");
|
|
||||||
AllZone.Human_Play.add(mp);
|
|
||||||
*/
|
|
||||||
|
|
||||||
ManaPool mp = AllZone.ManaPool;
|
ManaPool mp = AllZone.ManaPool;
|
||||||
AllZone.Human_Play.add(mp.smp);
|
AllZone.Human_Play.add(mp.smp);
|
||||||
|
|||||||
@@ -46,9 +46,6 @@ public class Input_StackNotEmpty extends Input implements java.io.Serializable {
|
|||||||
AllZone.GameAction.scry(sa.getSourceCard().getController(), Integer.parseInt(kk[1]));
|
AllZone.GameAction.scry(sa.getSourceCard().getController(), Integer.parseInt(kk[1]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//check them twice, sometimes creatures will survive when they shouldn't
|
|
||||||
AllZone.GameAction.checkStateEffects();
|
|
||||||
AllZone.GameAction.checkStateEffects();
|
AllZone.GameAction.checkStateEffects();
|
||||||
|
|
||||||
//special consideration for "Beacon of Unrest" and other "Beacon" cards
|
//special consideration for "Beacon of Unrest" and other "Beacon" cards
|
||||||
|
|||||||
Reference in New Issue
Block a user