Please update your rules folder

- "Manapool empties at the end of each step" becomes an ability, and was moved into the external rules file. "removemana(*) to remove all, removemana(*{G}) to remove all green, removemana(*{G}{B}{R}) to remove all green black red, removemana({G}{G}{B}{U}) (no "*") to remove a specific value.
- Added a possibility to make abilities non interruptible. With little work, this could be added to the parser if needed. Please use with care, let's discuss what is an acceptable usage of this now functionality, if needed.
This commit is contained in:
wagic.the.homebrew
2011-05-03 11:59:27 +00:00
parent d8147a0156
commit 0b9ff076e6
13 changed files with 206 additions and 41 deletions
+29 -10
View File
@@ -365,6 +365,23 @@ void ManaCost::init()
suspend = NULL;
}
void ManaCost::reinit()
{
int i;
for (i = 0; i <= Constants::MTG_NB_COLORS; i++)
{
cost[i] = 0;
}
SAFE_DELETE(extraCosts);
SAFE_DELETE(kicker);
SAFE_DELETE(alternative);
SAFE_DELETE(BuyBack);
SAFE_DELETE(FlashBack);
SAFE_DELETE(Retrace);
SAFE_DELETE(morph);
SAFE_DELETE(suspend);
}
void ManaCost::copy(ManaCost * _manaCost)
{
if (!_manaCost)
@@ -475,11 +492,9 @@ int ManaCost::getConvertedCost()
int ManaCost::remove(int color, int value)
{
cost[color] -= value;
if (cost[color] < 0)
{
cost[color] = 0;
}
assert (value >= 0);
int toRemove = min(cost[color], value);
cost[color] -= toRemove;
return 1;
}
@@ -511,15 +526,19 @@ int ManaCost::remove(ManaCost * _cost)
return 0;
for (unsigned int i = 0; i < Constants::MTG_NB_COLORS; i++)
{
for(int c = 0;c < _cost->getCost(i);c++)
{
if(cost[i])//remove 1 at a time to avoid dipping into negitive cost.
cost[i] -= 1;
}
int toRemove = min(cost[i], _cost->getCost(i)); //we don't want to be negative
cost[i] -= toRemove;
assert(cost[i] >= 0);
}
return 1;
}
int ManaCost::removeAll(int color)
{
cost[color] = 0;
return 1;
}
int ManaCost::addHybrid(int c1, int v1, int c2, int v2)
{
hybrids.push_back(ManaCostHybrid(c1, v1, c2, v2));