- Fixed the "CANTREGENERATE" keyword (by Zethfox).
The engine always handled it as "REGENERATE" and thus had to be renamed. Its new name is "CANTREGEN". It has been tested excessively by me and Zethfox. Now all cards with the former "cantregenerate" work as they should. - I also added a test for "CANTREGEN" (Incinerate). - Added the new keyword "FOG" (by Zethfox). This is an equivalent for "PREVENTALLCOMBATDAMAGE", which only worked for instants and sorceries. "Fog" works only for permanents and is used in combination with the newly introduced parameter "ONESHOT"! - I also added 2 tests for "FOG" (Maze of Ith, Spore Frog). Both additions lead to several issue fixes: Fixed issue286. Fixed issue328. Fixed issue332. Fixed issue416. - Removed Demonic Torment, Gaseous Form, General's Kabuto, Sandskin. Those cards never worked and could even not be fixed with "FOG". - Optimized the code of the dragon-lair land-cycle from PLS and added 2 tests for them. - Added 8 successfully tested cards. Card list -> first comment.
This commit is contained in:
@@ -226,7 +226,7 @@ MTGAbility * AbilityFactory::getCoreAbility(MTGAbility * a){
|
||||
//Parses a string and returns the corresponding MTGAbility object
|
||||
//Returns NULL if parsing failed
|
||||
//Beware, Spell CAN be null when the function is called by the AI trying to analyze the effects of a given card
|
||||
MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTGCardInstance *card, int activated, int forceUEOT, MTGGameZone * dest){
|
||||
MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTGCardInstance *card, int activated, int forceUEOT, int oneShot, MTGGameZone * dest){
|
||||
size_t found;
|
||||
|
||||
string whitespaces (" \t\f\v\n\r");
|
||||
@@ -709,6 +709,8 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
|
||||
|
||||
found = s.find("ueot");
|
||||
if (found!= string::npos) forceUEOT = 1;
|
||||
found = s.find("oneshot");
|
||||
if (found!= string::npos) oneShot = 1;
|
||||
|
||||
//PreventCombat Damage
|
||||
found = s.find("preventallcombatdamage");
|
||||
@@ -739,6 +741,25 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
|
||||
return ab;
|
||||
}
|
||||
|
||||
//PreventCombat Damage
|
||||
found = s.find("fog");
|
||||
if (found != string::npos){
|
||||
string to = "";
|
||||
string from = "";
|
||||
found = s.find("to(");
|
||||
if (found != string::npos){
|
||||
size_t end = s.find (")", found);
|
||||
to = s.substr(found+3,end - found - 3);
|
||||
}
|
||||
found = s.find("from(");
|
||||
if (found != string::npos){
|
||||
size_t end = s.find (")", found);
|
||||
from = s.substr(found+5,end - found - 5);
|
||||
}
|
||||
MTGAbility * a = NEW APreventAllCombatDamageUEOT(id,card,to,from);
|
||||
a->oneShot = 1;
|
||||
return a;
|
||||
}
|
||||
|
||||
//Damage
|
||||
found = s.find("damage");
|
||||
@@ -1106,7 +1127,7 @@ int AbilityFactory::abilityEfficiency(MTGAbility * a, Player * p, int mode, Targ
|
||||
badAbilities[Constants::DEFENDER] = true;
|
||||
badAbilities[Constants::DOESNOTUNTAP] = true;
|
||||
badAbilities[Constants::MUSTATTACK] = true;
|
||||
badAbilities[Constants::CANTREGENERATE] = true;
|
||||
badAbilities[Constants::CANTREGEN] = true;
|
||||
|
||||
if (AInstantBasicAbilityModifierUntilEOT * abi = dynamic_cast<AInstantBasicAbilityModifierUntilEOT *>(a)) {
|
||||
int result = badAbilities[abi->ability] ? BAKA_EFFECT_BAD : BAKA_EFFECT_GOOD;
|
||||
@@ -1183,7 +1204,7 @@ int AbilityFactory::getAbilities(vector<MTGAbility *> * v, Spell * spell, MTGCar
|
||||
magicText = "";
|
||||
}
|
||||
|
||||
MTGAbility * a = parseMagicLine(line, result, spell, card,0,0,dest);
|
||||
MTGAbility * a = parseMagicLine(line, result, spell, card,0,0,0,dest);
|
||||
if (a){
|
||||
v->push_back(a);
|
||||
result++;
|
||||
|
||||
Reference in New Issue
Block a user