It is currently 29 Apr 2024, 15:30
   
Text Size

More mass pump spells

Post MTG Forge Related Programming Questions Here

Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins

More mass pump spells

Postby Sloth » 14 Aug 2009, 12:53

In an effort to add a few more cards from M10, I stumbled upon Burst of Speed and Glorious Charge (well and a added few older ones too). Here are the changes:

cards.txt:
Code: Select all
Tortoise Formation
3 U
Instant
Creatures you control gain shroud until end of turn. (They can't be the targets of spells or abilities.)

Steadfastness
1 W
Sorcery
Creatures you control get +0/+3 until end of turn.

Resuscitate
1 G
Instant
Until end of turn, creatures you control gain "1: Regenerate this creature."

Nature's Cloak
2 G
Sorcery
Green creatures you control gain forestwalk until end of turn.

Glorious Charge
1 W
Instant
Creatures you control get +1/+1 until end of turn.

Burst of Speed
R
Sorcery
Creatures you control gain haste until end of turn.
Here is the complete block of mass pump spells from cardfactory.java:
Code: Select all
//*************** START *********** START **************************
     if(     cardName.equals("Burst of Speed") ||
           cardName.equals("Chorus of Woe") ||
             cardName.equals("Dance of Shadows") ||
             cardName.equals("Desperate Charge") ||
             cardName.equals("Glorious Charge") ||
             cardName.equals("Kjeldoran War Cry") ||
             cardName.equals("Magnify") ||
             cardName.equals("Nature's Cloak") ||
             cardName.equals("Nocturnal Raid") ||
             cardName.equals("Overrun") ||
             cardName.equals("Path of Anger's Flame") ||
             cardName.equals("Resuscitate") ||
             cardName.equals("Righteous Charge") ||
             cardName.equals("Scare Tactics") ||
             cardName.equals("Shield Wall") ||
             cardName.equals("Solidarity") ||
             cardName.equals("Steadfastness") ||
             cardName.equals("Tortoise Formation") ||
             cardName.equals("Tromp the Domains") ||
             cardName.equals("Valorous Charge") ||
             cardName.equals("Virtuous Charge") ||
             cardName.equals("Vitalizing Wind") ||
             cardName.equals("Warrior's Charge") ||
             cardName.equals("Warrior's Honor"))
    {
      SpellAbility spell = new Spell(card)
      {
      private static final long serialVersionUID = -5844664906503221006L;

      public boolean canPlayAI()
        {
          return getAttacker() != null;
        }
        public Card getAttacker()
        {
          //target creatures that is going to attack
          Combat c = ComputerUtil.getAttackers();
          Card[] att = c.getAttackers();
          if(cardName.equals("Dance of Shadows") ||
             cardName.equals("Overrun") ||
             cardName.equals("Tromp the Domains"))
          {
              if (att.length > 2)   // Effect best used with a few creatures
                  return att[0];
              else
                  return null;
          }
          if(cardName.equals("Burst of Speed") ||
            cardName.equals("Chorus of Woe") ||
             cardName.equals("Desperate Charge") ||
             cardName.equals("Glorious Charge") ||
             cardName.equals("Kjeldoran War Cry") ||
             cardName.equals("Magnify") ||
             cardName.equals("Nature's Cloak") ||
             cardName.equals("Nocturnal Raid") ||
             cardName.equals("Path of Anger's Flame") ||
             cardName.equals("Resuscitate") ||
             cardName.equals("Righteous Charge") ||
             cardName.equals("Scare Tactics") ||
             cardName.equals("Shield Wall") ||
             cardName.equals("Solidarity") ||
             cardName.equals("Steadfastness") ||
             cardName.equals("Tortoise Formation") ||
             cardName.equals("Valorous Charge") ||
             cardName.equals("Vitalizing Wind") ||
             cardName.equals("Virtuous Charge") ||
             cardName.equals("Warrior's Charge") ||
             cardName.equals("Warrior's Honor"))
          {
              if (att.length > 1)   // Effect best used on at least a couple creatures
                  return att[0];
              else
                  return null;
          }
          return null;
        }//getAttacker()

        int getPowerBoost()
        {
          if(cardName.equals("Tromp the Domains"))
              return getTtDBoost();

          if(cardName.equals("Kjeldoran War Cry"))
              return getKWCBoost();

          if(cardName.equals("Chorus of Woe") ||
             cardName.equals("Dance of Shadows") ||
             cardName.equals("Glorious Charge") ||
             cardName.equals("Magnify") ||
             cardName.equals("Scare Tactics") ||
             cardName.equals("Virtuous Charge") ||
             cardName.equals("Warrior's Charge") ||
             cardName.equals("Warrior's Honor"))
              return 1;

          if(cardName.equals("Desperate Charge") ||
             cardName.equals("Nocturnal Raid") ||
             cardName.equals("Path of Anger's Flame") ||
             cardName.equals("Righteous Charge") ||
             cardName.equals("Valorous Charge"))
              return 2;

          if(cardName.equals("Overrun"))
              return 3;

          if(cardName.equals("Vitalizing Wind"))
              return 7;

          return 0;
        }//getPowerBoost()

        int getToughBoost()
        {
          if(cardName.equals("Tromp the Domains"))
              return getTtDBoost();

          if(cardName.equals("Kjeldoran War Cry"))
              return getKWCBoost();

          if(cardName.equals("Glorious Charge") ||
            cardName.equals("Magnify") ||
             cardName.equals("Virtuous Charge") ||
             cardName.equals("Warrior's Charge") ||
             cardName.equals("Warrior's Honor"))
              return 1;

          if(cardName.equals("Righteous Charge") ||
             cardName.equals("Shield Wall"))
              return 2;

          if(cardName.equals("Overrun") ||
             cardName.equals("Steadfastness"))
              return 3;

          if(cardName.equals("Solidarity"))
              return 5;

          if(cardName.equals("Vitalizing Wind"))
              return 7;

          return 0;
        }//getToughBoost()

        String getKeywordBoost()
        {
           if(cardName.equals("Burst of Speed"))
               return "Haste";
           
            if(cardName.equals("Overrun") ||
               cardName.equals("Tromp the Domains"))
                return "Trample";

            if(cardName.equals("Dance of Shadows"))
                return "Fear";
           
            if(cardName.equals("Nature's Cloak"))
               return "Forestwalk";
           
            if(cardName.equals("Resuscitate"))
               return "RegenerateMe:1";
           
            if(cardName.equals("Tortoise Formation"))
               return "Shroud";
           
            return "None";
        }//getKeywordBoost()

        int getTtDBoost()     // Tromp the Domains - +1/+1 for each basic land you control
        {
            PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController());
            CardList land = new CardList(play.getCards());

            String basic[] = {"Forest", "Plains", "Mountain", "Island", "Swamp"};
            int count = 0;

            for (int i = 0; i < basic.length; i++)
            {
                CardList c = land.getType(basic[i]);
                if (!c.isEmpty())
                    count++;
            }
            return count;
        }//getTtDBoost

        int getKWCBoost()     // Kjeldoran War Cry - +X/+X, X = 1 + Num(KWC in All Graveyards)
        {
            PlayerZone hYard = AllZone.getZone(Constant.Zone.Graveyard, Constant.Player.Human);
            PlayerZone cYard = AllZone.getZone(Constant.Zone.Graveyard, Constant.Player.Computer);
            CardList allYards = new CardList();

            allYards.addAll(hYard.getCards());
            allYards.addAll(cYard.getCards());
            allYards = allYards.getName("Kjeldoran War Cry");

            return allYards.size() + 1;
        }//getKWCBoost

        public void resolve()
        {

            final int pboost = getPowerBoost();
            final int tboost = getToughBoost();
            final String kboost = getKeywordBoost();

            CardList list = new CardList();

            if (cardName.equals("Burst of Speed") || // Creatures "you" Control
               cardName.equals("Chorus of Woe") ||
                cardName.equals("Dance of Shadows") ||
                cardName.equals("Desperate Charge") ||
                cardName.equals("Glorious Charge") ||
                cardName.equals("Kjeldoran War Cry") ||
                cardName.equals("Nature's Cloak") ||
                cardName.equals("Overrun") ||
                cardName.equals("Path of Anger's Flame") ||
                cardName.equals("Resuscitate") ||
                cardName.equals("Righteous Charge") ||
                cardName.equals("Scare Tactics") ||
                cardName.equals("Shield Wall") ||
                cardName.equals("Solidarity") ||
                cardName.equals("Steadfastness") ||
                cardName.equals("Tortoise Formation") ||
                cardName.equals("Virtuous Charge") ||
                cardName.equals("Vitalizing Wind") ||
                cardName.equals("Warrior's Charge") ||
                cardName.equals("Warrior's Honor"))
            {
                PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController());
                list.addAll(play.getCards());
               
                if(cardName.equals("Nature's Cloak"))
                   list = list.getColor("G");
            }

            if (cardName.equals("Magnify") || // All Creatures in Play
                cardName.equals("Nocturnal Raid") || // All Black Creatures in Play
                cardName.equals("Valorous Charge")) // All White Creatures in Play
            {
                PlayerZone human = AllZone.getZone(Constant.Zone.Play, Constant.Player.Human);
                PlayerZone comp = AllZone.getZone(Constant.Zone.Play, Constant.Player.Computer);

                list.addAll(human.getCards());
                list.addAll(comp.getCards());

                if(cardName.equals("Nocturnal Raid"))
                    list = list.getColor("B");

                if(cardName.equals("Valorous Charge"))
                    list = list.getColor("W");
            }

          for(int i = 0; i < list.size(); i++)
          {
            final Card[] target = new Card[1];
            target[0] = list.get(i);

            final Command untilEOT = new Command()
            {
           private static final long serialVersionUID = 5063161656920609389L;

           public void execute()
              {
                if(AllZone.GameAction.isCardInPlay(target[0]))
                {
                  target[0].addTempAttackBoost(-pboost);
                  target[0].addTempDefenseBoost(-tboost);

                  if(!kboost.equals("None"))
                      target[0].removeExtrinsicKeyword(kboost);
                }
              }
            };//Command

            if(AllZone.GameAction.isCardInPlay(target[0]))
            {
              target[0].addTempAttackBoost(pboost);
              target[0].addTempDefenseBoost(tboost);

              if(!kboost.equals("None"))
                  target[0].addExtrinsicKeyword(kboost);

              AllZone.EndOfTurn.addUntil(untilEOT);
            }//if
          }//for
        }//resolve()
      };
      card.clearSpellAbility();
      card.addSpellAbility(spell);
    }//*************** END ************ END **************************
Remarks:
1. I noticed that Kjeldoran War Cry is in this batch, but has also its own section. A possible Redundancy?
2. Most of the new and some of the old mass pump spells are not effectively usable by the AI at the moment. Thus i suggest adding these entries to GenerateConstructedDeck.java:
Code: Select all
remove.add("Burst of Speed");
remove.add("Magnify");
remove.add("Nature's Cloak");
remove.add("Resuscitate");
remove.add("Shield Wall");
remove.add("Solidarity");
remove.add("Steadfastness");
remove.add("Tortoise Formation");
PS: I look forward to the UI-Changes by silly freak and Chris H., they look promising!
User avatar
Sloth
Programmer
 
Posts: 3498
Joined: 23 Jun 2009, 19:40
Has thanked: 125 times
Been thanked: 507 times

Re: More mass pump spells

Postby Chris H. » 14 Aug 2009, 14:16

Thank you, Sloth, for your efforts. :)

We may have to wait awhile for the next update release, we have a lot of cards and code to add.

I have my fingers crossed in the hopes that Dennis may be able to figure out Zerker's mana Pool code changes.
User avatar
Chris H.
Forge Moderator
 
Posts: 6320
Joined: 04 Nov 2008, 12:11
Location: Mac OS X Yosemite
Has thanked: 644 times
Been thanked: 643 times

Re: More mass pump spells

Postby Rob Cashwalker » 14 Aug 2009, 14:57

When you say effectively not usable, what do you mean?

Look at the AI code there. It attempts to use the AI's planned number of attackers. It's one of my first AI's, and the whole thing is a bit of a mess - I plan to rewrite it as a keyword.

If anyone can suggest more logical AI rules, please do. I'd rather get the AI tweaked instead of censoring them from the computer player.
The Force will be with you, Always.
User avatar
Rob Cashwalker
Programmer
 
Posts: 2167
Joined: 09 Sep 2008, 15:09
Location: New York
Has thanked: 5 times
Been thanked: 40 times

Re: More mass pump spells

Postby Chris H. » 14 Aug 2009, 15:22

I took a look at the mass pump section. The AI using the number of planned attackers to determine to cast the spell or not is interesting.

I guess this code could determine that the AI should cast the spell and then some other section of code might come into play causing the AI to decide that it will not attack after it has pumped its creatures.

:-k
User avatar
Chris H.
Forge Moderator
 
Posts: 6320
Joined: 04 Nov 2008, 12:11
Location: Mac OS X Yosemite
Has thanked: 644 times
Been thanked: 643 times

Re: More mass pump spells

Postby Sloth » 22 Aug 2009, 10:38

When you say effectively not usable, what do you mean?
I did say "not effectively usable" and this is because these spells are not meant to be used in an attack situation (Resuscitate, Shield Wall, Tortoise Formation,..) or the computer checks for creatures which do not profit from the spell (Burst of Speed, Nature's Cloak) or the opponent might profit more from the spell (Magnify).
User avatar
Sloth
Programmer
 
Posts: 3498
Joined: 23 Jun 2009, 19:40
Has thanked: 125 times
Been thanked: 507 times


Return to Developer's Corner

Who is online

Users browsing this forum: No registered users and 87 guests


Who is online

In total there are 87 users online :: 0 registered, 0 hidden and 87 guests (based on users active over the past 10 minutes)
Most users ever online was 4143 on 23 Jan 2024, 08:21

Users browsing this forum: No registered users and 87 guests

Login Form