It is currently 04 Jun 2024, 10:44
   
Text Size

Completed the keyword: Poisonous

Post MTG Forge Related Programming Questions Here

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

Completed the keyword: Poisonous

Postby Sloth » 16 Sep 2010, 17:35

The keyword Poisonous only existed as Poisonous 1. I generalized it to take any integer.

Changed code in executePlayerCombatDamageEffects:
Code: Select all
      if (c.hasStartOfKeyword("Poisonous"))
      {
           int KeywordPosition = c.getKeywordPosition("Poisonous");
           String parse = c.getKeyword().get(KeywordPosition).toString();
          String k[] = parse.split(" ");
          final int poison = Integer.parseInt(k[1]);
         final Card crd = c;
         
         Ability ability = new Ability(c, "0")
         {
            public void resolve()
            {
               final String player = crd.getController();
               final String opponent = AllZone.GameAction.getOpponent(player);

               if(opponent.equals(Constant.Player.Human))
                  AllZone.Human_PoisonCounter.addPoisonCounters(poison);
               else
                  AllZone.Computer_PoisonCounter.addPoisonCounters(poison);
            }
         };

         StringBuilder sb = new StringBuilder();
         sb.append(c);
         sb.append(" - Poisonous: ");
         sb.append(AllZone.GameAction.getOpponent(c.getController()));
         sb.append(" gets poison counters.");

         ability.setStackDescription(sb.toString());
         ArrayList<String> keywords = c.getKeyword();

         for (int i=0;i<keywords.size();i++)
         {
            if (keywords.get(i).contains("Poisonous"))
               AllZone.Stack.add(ability);
         }
      }
Example (and only possible new card):
Code: Select all
Name:Snake Cult Initiation
ManaCost:3 B
Types:Enchantment Aura
Text:Enchanted creature has poisonous 3.
K:Enchant creature
K:enPump:Poisonous 3
User avatar
Sloth
Programmer
 
Posts: 3498
Joined: 23 Jun 2009, 19:40
Has thanked: 125 times
Been thanked: 507 times

Re: Completed the keyword: Poisonous

Postby Rob Cashwalker » 16 Sep 2010, 21:04

Of course, this only appears on two cards... though one of them is a Sliver.

Maro said that they shot down "Poisonous", hence "Infect".
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: Completed the keyword: Poisonous

Postby Sloth » 17 Sep 2010, 05:36

Rob Cashwalker wrote:Maro said that they shot down "Poisonous", hence "Infect".
Really? Well, one new card, is one new card.

PS: I guess I will make a set of AI poison decks to show that we need each of the cards that deal poison counters.
User avatar
Sloth
Programmer
 
Posts: 3498
Joined: 23 Jun 2009, 19:40
Has thanked: 125 times
Been thanked: 507 times

Re: Completed the keyword: Poisonous

Postby Rob Cashwalker » 17 Sep 2010, 11:16

True, I guess it works just as well for the older poison creatures... which were all "Poisonous 1" essentially.
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


Return to Developer's Corner

Who is online

Users browsing this forum: No registered users and 13 guests


Who is online

In total there are 13 users online :: 0 registered, 0 hidden and 13 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 13 guests

Login Form