- Fixed a bug where the AI would block its own attacking creatures (I reintroduced that bug recently when I removed a safeguard Zethfox had added a while ago)

- Added a way to specify "no interrupt" in modrules.xml (I need to write a doc about this file) for a given game. This does not mean the stack does not show up (the stack is interesting to see what the opponent does), but that it only offers to continue.
This commit is contained in:
wagic.the.homebrew
2011-05-07 11:58:37 +00:00
parent fe276ca330
commit ab33d29682
4 changed files with 95 additions and 40 deletions

View File

@@ -46,6 +46,10 @@ bool ModRules::load(string filename)
{
cards.parse(element);
}
else if (strcmp(element->Value(), "game") == 0)
{
game.parse(element);
}
}
}
return true;
@@ -174,21 +178,27 @@ ModRulesMenu::~ModRulesMenu()
other.clear();
}
//inGame rules
ModRulesGame::ModRulesGame()
{
mCanInterrupt = true;
}
void ModRulesGame::parse(TiXmlElement* element)
{
int value = ModRules::getValueAsInt(element, "canInterrupt");
if (value != -1)
mCanInterrupt = value;
}
//General Rules
ModRulesGeneral::ModRulesGeneral()
{
mHasDeckEditor = true;
mHasShop = true;
}
int ModRules::getValueAsInt(TiXmlElement* element, string childName){
TiXmlNode* node = element->FirstChild(childName.c_str());
if (node) {
const char* value = node->ToElement()->GetText();
return atoi(value);
}
return -1;
}
void ModRulesGeneral::parse(TiXmlElement* element)
{
int value = ModRules::getValueAsInt(element, "hasDeckEditor");
@@ -201,6 +211,15 @@ void ModRulesGeneral::parse(TiXmlElement* element)
}
int ModRules::getValueAsInt(TiXmlElement* element, string childName){
TiXmlNode* node = element->FirstChild(childName.c_str());
if (node) {
const char* value = node->ToElement()->GetText();
return atoi(value);
}
return -1;
}
ModRulesCards::ModRulesCards()
{
activateEffect = NEW SimpleCardEffectRotate(M_PI/2); //Default activation effect