- Added "loseSubtypesOf(type)" ability. For example, loseSubtypesOf(land) means "target loses all its land subtypes"

- Added Evil Presence, as an example of the new keywords loseabilities and losesubtypes. It's quite experimental but I added 3 tests that cover the basics. Please report if you find bugs.
- moved the "lands produce mana" rules outside of the primitives, and into the external rules. This was a necessary step to create cards such as Evil Presence. 
- real support for subtypes. Needs some more testing, but there are now functions in Subtypes.cpp to know if a given subtype is a creature subtype, or a land subtype, etc...
- minor refactor of MTGDeck.cpp

Notes:
- I checked that the AI can still use lands
- This change has a bad impact on primitives loading performance (thanks Wil for the loading time output). This is probably due to suboptimal algorithms and data structures for subtypes. If the impact is strong on lowend devices, I can probably optimize a bit (the map subtypesOf could be changed into a vector with some work)
- The test suite passes, added 3 tests for evil presence.
This commit is contained in:
wagic.the.homebrew
2011-05-04 04:04:03 +00:00
parent 494bcf3315
commit d922d4fe06
15 changed files with 250 additions and 118 deletions

View File

@@ -196,7 +196,17 @@ void CardPrimitive::addType(char * _type_text)
void CardPrimitive::setSubtype(const string& value)
{
int id = Subtypes::subtypesList->find(value);
//find the parent type for this card
int parentType = 0;
for (size_t i = 0; i < types.size(); ++i)
{
if (Subtypes::subtypesList->isType(types[i]))
{
parentType = types[i];
break;
}
}
int id = Subtypes::subtypesList->add(value, parentType);
addType(id);
}