this is the first draft of a simple ai combo system,
format is as follows
HINT#combo hold(blah|myhand)^until(blah|mygraveyard)^until(blah|opponentshand)^restriction{type(creature|mybattlefield)~morethan~2}^cast(blah) targeting(blah|mygraveyard)^totalmananneeded({g}{g}{r}{u}{2})
the ai can be told to hold more then one card, until as many condiations as you want are met, until( is a TC and can basically be used in a fasion of saying "hold arbor elf until you have a lord of atlantas in play and a gaint growth in you hand"
once the condiations are met you can later tell it to cast(gaint growth) targeting(arbor elf[fresh]|mybattlefield)...
I also included the whole of the games restrictions system...
so you can get really really creative with this so far.
the next thing I will do is ability targeting and card favoring.
This commit is contained in:
@@ -283,7 +283,7 @@ ManaCost::ManaCost()
|
||||
init();
|
||||
}
|
||||
|
||||
ManaCost::ManaCost(vector<int8_t>& _cost, int nb_elems)
|
||||
ManaCost::ManaCost(vector<int16_t>& _cost, int nb_elems)
|
||||
{
|
||||
init();
|
||||
for (int i = 0; i < nb_elems; i++)
|
||||
@@ -628,7 +628,7 @@ int ManaCost::getConvertedCost()
|
||||
int ManaCost::remove(int color, int value)
|
||||
{
|
||||
assert (value >= 0);
|
||||
int8_t toRemove = min(cost[color], (int8_t)value);
|
||||
int16_t toRemove = min(cost[color], (int16_t)value);
|
||||
cost[color] -= toRemove;
|
||||
return 1;
|
||||
}
|
||||
@@ -661,7 +661,7 @@ int ManaCost::remove(ManaCost * _cost)
|
||||
return 0;
|
||||
for ( int i = 0; i < Constants::NB_Colors; i++)
|
||||
{
|
||||
int8_t toRemove = min(cost[i], (int8_t)_cost->getCost(i)); //we don't want to be negative
|
||||
int16_t toRemove = min(cost[i], (int16_t)_cost->getCost(i)); //we don't want to be negative
|
||||
cost[i] -= toRemove;
|
||||
assert(cost[i] >= 0);
|
||||
}
|
||||
@@ -773,7 +773,7 @@ int ManaCost::isPositive()
|
||||
|
||||
}
|
||||
|
||||
void ManaCost::randomDiffHybrids(ManaCost * _cost, std::vector<int8_t>& diff)
|
||||
void ManaCost::randomDiffHybrids(ManaCost * _cost, std::vector<int16_t>& diff)
|
||||
{
|
||||
for (size_t i = 0; i < _cost->hybrids.size(); i++)
|
||||
{
|
||||
@@ -785,7 +785,7 @@ void ManaCost::randomDiffHybrids(ManaCost * _cost, std::vector<int8_t>& diff)
|
||||
/**
|
||||
starting from the end of the array (diff)
|
||||
*/
|
||||
int ManaCost::tryToPayHybrids(std::vector<ManaCostHybrid>& _hybrids, int _nbhybrids, std::vector<int8_t>& diff)
|
||||
int ManaCost::tryToPayHybrids(std::vector<ManaCostHybrid>& _hybrids, int _nbhybrids, std::vector<int16_t>& diff)
|
||||
{
|
||||
if (!_nbhybrids)
|
||||
return 1;
|
||||
@@ -816,7 +816,7 @@ ManaCost * ManaCost::Diff(ManaCost * _cost)
|
||||
if (!_cost)
|
||||
return NEW ManaCost(*this); //diff with null is equivalent to diff with 0
|
||||
|
||||
vector<int8_t> diff;
|
||||
vector<int16_t> diff;
|
||||
diff.resize((Constants::NB_Colors + 1) * 2);
|
||||
diff[Constants::NB_Colors * 2] = Constants::NB_Colors;
|
||||
for (int i = 0; i < Constants::NB_Colors; i++)
|
||||
|
||||
Reference in New Issue
Block a user