It is currently 26 Apr 2024, 09:32
   
Text Size

mana fix for Flame Javelin

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

mana fix for Flame Javelin

Postby mtgrares » 05 May 2009, 16:18

As usual, this is mostly for Dennis. This fixes Flame Javelin and other cards like it. As a side note this code will also support Reaper King if you ever decide to code it.

My logic was partially wrong. In my head I was thinking that I am treating non-primary colored mana as colorless, so mainly I just had to make a one line fix to Mana_PartSplit - setup(). If the cost is 2/R, red mana is primary, and any other color is treated like colorless mana.

Code: Select all
1. Mana_PayCost - constructor() and comments

  //manaCost can be like "0", "3", "G", "GW", "10", "3 GW", "10 GW"
  //or "split hybrid mana" like "2/G 2/G", "2/B 2/B 2/B"
  //"GW" can be paid with either G or W

  //can barely handle Reaper King mana cost "2/W 2/U 2/B 2/R 2/G"
  //to pay the colored costs for Reaper King you have to tap the colored
  //mana in the order shown from right to left (wierd I know)
  //note that when the cost is displayed it is backward "2/G 2/R 2/B 2/U 2/W"
  //so you would have to tap W, then U, then B, then R, then G (order matters)
  public Mana_PayCost(String manaCost)
  {
    manaPart = split(manaCost);
  }

2. Mana_PartSplit - setup()

  private void setup(String manaToPay)
  {
    //get R out of "2/R"
    String color = originalCost.substring(2, 3);

    //is manaToPay the one color we want or do we
    //treat it like colorless?
    //if originalCost is 2/R and is color W (treated like colorless)
    //or R?  if W use Mana_PartColorless, if R use Mana_PartColor
    //does manaToPay contain color?
    if(0 <= manaToPay.indexOf(color))
    {
      manaPart = new Mana_PartColor(color);
    }
    else
    {
      //get 2 out of "2/R"
      manaPart = new Mana_PartColorless(originalCost.substring(0, 1));
    }
  }//setup()
mtgrares
DEVELOPER
 
Posts: 1352
Joined: 08 Sep 2008, 22:10
Has thanked: 3 times
Been thanked: 12 times

Re: mana fix for Flame Javelin

Postby DennisBergkamp » 05 May 2009, 16:26

Nice :) I will add these fixes!
User avatar
DennisBergkamp
AI Programmer
 
Posts: 2602
Joined: 09 Sep 2008, 15:46
Has thanked: 0 time
Been thanked: 0 time


Return to Forge

Who is online

Users browsing this forum: No registered users and 175 guests


Who is online

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

Login Form