Skip to content

Commit

Permalink
whoops heres the other half. tested with following arbor elf test card
Browse files Browse the repository at this point in the history
[card]
name=Arbor Elf
auto={0}:add{1}
auto={0}:add{r}
auto={0}:name(waste) add{waste}
auto={waste}:life:1
auto={3}:damage:1
auto={1}{waste}:moveto(mybattlefield) target(<2>*|mylibrary)
text={T}: Untap target Forest.
mana={0}
type=Creature
subtype=Elf Druid
power=12
toughness=12
[/card]
  • Loading branch information
zethfoxster committed May 30, 2016
1 parent 80d0ee4 commit 7639e18
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
9 changes: 5 additions & 4 deletions projects/mtg/src/MTGAbility.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5762,7 +5762,7 @@ const string AManaProducer::getMenuText()
menutext = _("Add ");
char buffer[128];
int alreadyHasOne = 0;
for (int i = 0; i < 7; i++)
for (int i = 0; i < 8; i++)
{
int value = output->getCost(i);
if (value)
Expand All @@ -5771,10 +5771,11 @@ const string AManaProducer::getMenuText()
menutext.append(",");
sprintf(buffer, "%i ", value);
menutext.append(buffer);
if (i >= Constants::MTG_COLOR_GREEN && i <= Constants::MTG_COLOR_WHITE)
if (i == Constants::MTG_COLOR_WASTE)
menutext.append(_(" colorless"));
else if (i >= Constants::MTG_COLOR_GREEN && i <= Constants::MTG_COLOR_WASTE)
menutext.append(_(Constants::MTGColorStrings[i]));
//if (i == Constants::MTG_COLOR_LAND)
//menutext.append(_(" colorless"));

alreadyHasOne = 1;
}
}
Expand Down
3 changes: 2 additions & 1 deletion projects/mtg/src/MTGDefinitions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ using std::string;

#include "MTGDefinitions.h"

char Constants::MTGColorChars[] = {'x','g','u','r','b','w','l'};
char Constants::MTGColorChars[] = {'x','g','u','r','b','w','c','l'};
vector <const char*> Constants::MTGColorStrings;

const string Constants::kManaColorless = "colorless";
Expand All @@ -13,6 +13,7 @@ const string Constants::kManaBlue = "blue";
const string Constants::kManaRed = "red";
const string Constants::kManaBlack = "black";
const string Constants::kManaWhite = "white";
const string Constants::kManaWaste = "waste";

int Constants::_r[7] = {75,20,20,200,50,255,128};
int Constants::_g[7] = {30,140,30,15,50,255,128};
Expand Down
12 changes: 7 additions & 5 deletions projects/mtg/src/ManaCost.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,6 @@ ManaCost * ManaCost::parseManaCost(string s, ManaCost * _manaCost, MTGCardInstan
{
manaCost->add(Constants::MTG_COLOR_RED, 1);

}
else if (value == "c")
{
manaCost->add(Constants::MTG_COLOR_LAND, 1);

}
else
{
Expand Down Expand Up @@ -295,6 +290,12 @@ ManaCost * ManaCost::parseManaCost(string s, ManaCost * _manaCost, MTGCardInstan
manaCost->addExtraCost(NEW UnattachCost(c));
break;
}
if (value == "waste")
{
manaCost->add(Constants::MTG_COLOR_WASTE, 1);
break;

}
int intvalue = atoi(value.c_str());
int colors[2];
int values[2];
Expand Down Expand Up @@ -870,6 +871,7 @@ int ManaCost::pay(ManaCost * _cost)
ManaCost * diff = Diff(toPay);
for (int i = 0; i < Constants::NB_Colors; i++)
{

cost[i] = diff->getCost(i);
}
delete diff;
Expand Down

7 comments on commit 7639e18

@zethfoxster
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is my styling so off? if looks fine in the ide but when i commit things they come out like 4 tabbed?

@zethfoxster
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

side note: went with "waste" instead of "c" because of conflicts with abilities, c has always been used for counters in wagic. waste because thats the first and only basic land that mtg has that produces that exclusively.

@kevlahnota
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can build but have a crash as soon as I select a deck.

@zethfoxster
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Crash would be in the card code, check the card you are testing with.

@zethfoxster
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will do one of 2 things here, if you are still using "c" it will crash as a counter cost, if you mistyped waste it will crash as a hybrid cost.

@zethfoxster
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh make sure its all lowercase. Not sure when but wagic has stopped automatically dropping everything to lower case before parsing. Ive noticed cost getting parsed however you write them.

@kevlahnota
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a profile with old decks but no cards that use the new c cost. It crashes on me. Ill upload my profile later so you can check. Previous build don't have crash.

Please sign in to comment.