turned the "ai hint" for level up creatures into an MTGAbility.
this fixes a bug(?) that had high priority and maintains same effect as before. removed all traces of the "bugged(?) hint" from CardPrimitive. Issue: 498
This commit is contained in:
@@ -2915,6 +2915,26 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* set max level up on a levelup creature this is an Ai hint ability, no effect for players.*/
|
||||||
|
class AAWhatsMax:public ActivatedAbility{
|
||||||
|
public:
|
||||||
|
int value;
|
||||||
|
AAWhatsMax(int id, MTGCardInstance * card, MTGCardInstance * source,ManaCost * _cost = NULL, int doTap = 0,int value = 0):ActivatedAbility(id,card, _cost,0,doTap),value(value){
|
||||||
|
}
|
||||||
|
int resolve(){
|
||||||
|
MTGCardInstance * _target = (MTGCardInstance *) target;
|
||||||
|
if (source){
|
||||||
|
source->MaxLevelUp = value;
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
AAWhatsMax * clone() const{
|
||||||
|
AAWhatsMax * a = NEW AAWhatsMax(*this);
|
||||||
|
a->isClone = 1;
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
/* Can prevent a card from untapping next untap */
|
/* Can prevent a card from untapping next untap */
|
||||||
class AAFrozen:public ActivatedAbility{
|
class AAFrozen:public ActivatedAbility{
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -29,7 +29,6 @@ class CardPrimitive {
|
|||||||
string spellTargetType;
|
string spellTargetType;
|
||||||
int power;
|
int power;
|
||||||
int toughness;
|
int toughness;
|
||||||
int level;
|
|
||||||
vector<int>types;
|
vector<int>types;
|
||||||
CardPrimitive();
|
CardPrimitive();
|
||||||
CardPrimitive(CardPrimitive * source);
|
CardPrimitive(CardPrimitive * source);
|
||||||
@@ -75,9 +74,6 @@ class CardPrimitive {
|
|||||||
int getPower();
|
int getPower();
|
||||||
void setToughness(int _toughness);
|
void setToughness(int _toughness);
|
||||||
int getToughness();
|
int getToughness();
|
||||||
void setMaxLevel(int _level);
|
|
||||||
int getMaxLevel();
|
|
||||||
|
|
||||||
const vector<string>& formattedText();
|
const vector<string>& formattedText();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -60,6 +60,7 @@ class MTGCardInstance: public CardPrimitive, public MTGCard, public Damageable {
|
|||||||
int didblocked;
|
int didblocked;
|
||||||
int notblocked;
|
int notblocked;
|
||||||
int fresh;
|
int fresh;
|
||||||
|
int MaxLevelUp;
|
||||||
Player * lastController;
|
Player * lastController;
|
||||||
MTGGameZone * getCurrentZone();
|
MTGGameZone * getCurrentZone();
|
||||||
MTGGameZone * previousZone;
|
MTGGameZone * previousZone;
|
||||||
|
|||||||
@@ -246,7 +246,7 @@ int AIAction::getEfficiency(){
|
|||||||
currentlevel = targetCounter->nb;
|
currentlevel = targetCounter->nb;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (currentlevel < _target->level){
|
if (currentlevel < _target->MaxLevelUp){
|
||||||
efficiency = 85;
|
efficiency = 85;
|
||||||
efficiency += currentlevel;//increase the efficeincy of leveling up by a small amount equal to current level.
|
efficiency += currentlevel;//increase the efficeincy of leveling up by a small amount equal to current level.
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,6 @@ CardPrimitive::CardPrimitive(CardPrimitive * source){
|
|||||||
|
|
||||||
power = source->power;
|
power = source->power;
|
||||||
toughness = source->toughness;
|
toughness = source->toughness;
|
||||||
level = source->level;
|
|
||||||
|
|
||||||
magicText = source->magicText;
|
magicText = source->magicText;
|
||||||
for(map<string,string>::const_iterator it = source->magicTexts.begin(); it != source->magicTexts.end(); ++it)
|
for(map<string,string>::const_iterator it = source->magicTexts.begin(); it != source->magicTexts.end(); ++it)
|
||||||
@@ -312,11 +311,3 @@ void CardPrimitive::setToughness(int _toughness){
|
|||||||
int CardPrimitive::getToughness(){
|
int CardPrimitive::getToughness(){
|
||||||
return toughness;
|
return toughness;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CardPrimitive::setMaxLevel(int _levelcap){
|
|
||||||
level = _levelcap;
|
|
||||||
}
|
|
||||||
|
|
||||||
int CardPrimitive::getMaxLevel(){
|
|
||||||
return level;
|
|
||||||
}
|
|
||||||
@@ -1585,6 +1585,23 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
|
|||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//frozen, next untap this does not untap.
|
||||||
|
found = s.find("maxlevel:");
|
||||||
|
if (found != string::npos){
|
||||||
|
size_t start = s.find(":",found);
|
||||||
|
size_t end = s.find(" ",start);
|
||||||
|
int value;
|
||||||
|
if (end != string::npos){
|
||||||
|
value = atoi(s.substr(start+1,end-start-1).c_str());
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
value = atoi(s.substr(start+1).c_str());
|
||||||
|
}
|
||||||
|
MTGAbility * a = NEW AAWhatsMax(id,card,card,NULL,0,value);
|
||||||
|
a->oneShot = 1;
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
|
||||||
//switch targest power with toughness
|
//switch targest power with toughness
|
||||||
found = s.find("swap");
|
found = s.find("swap");
|
||||||
if (found != string::npos){
|
if (found != string::npos){
|
||||||
|
|||||||
@@ -105,12 +105,6 @@ int MTGAllCards::processConfLine(string &s, MTGCard *card, CardPrimitive * primi
|
|||||||
cost->kicker = ManaCost::parseManaCost(value);
|
cost->kicker = ManaCost::parseManaCost(value);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'l': //Levelup, this is just to give Ai an idea when to stop leveling a creature.
|
|
||||||
if (!primitive) primitive = NEW CardPrimitive();
|
|
||||||
primitive->setMaxLevel(atoi(val));
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'o': //othercost
|
case 'o': //othercost
|
||||||
if (!primitive) primitive = NEW CardPrimitive();
|
if (!primitive) primitive = NEW CardPrimitive();
|
||||||
if (ManaCost * cost = primitive->getManaCost())
|
if (ManaCost * cost = primitive->getManaCost())
|
||||||
|
|||||||
Reference in New Issue
Block a user