taught told Ai bushido is a good thing. laid ground for Foreach lesson for Ai :) fixed yet another reported bug with aslongas. gave becomes( a better menu name system for the manlands to use.
it will now say "becomes [types]"
This commit is contained in:
@@ -24,6 +24,7 @@ protected:
|
||||
static int currentId;
|
||||
public:
|
||||
MTGAbility * ability;
|
||||
NestedAbility * nability;
|
||||
Player * player;
|
||||
int id;
|
||||
MTGCardInstance * click;
|
||||
|
||||
@@ -2327,7 +2327,7 @@ public:
|
||||
int canBeInList(MTGCardInstance * card){
|
||||
int size = 0;
|
||||
size = (int)cards.size();
|
||||
if(includeSelf && maxi && card == source && size < maxi)
|
||||
if(includeSelf && maxi && card == source && size > maxi)
|
||||
{
|
||||
removed(card);
|
||||
}
|
||||
@@ -2368,7 +2368,7 @@ public:
|
||||
int _added(Damageable * d){
|
||||
int size =(int)cards.size();
|
||||
if (maxi && size < maxi) return 0;
|
||||
if (maxi && size >= maxi) return removeAbilityFromGame();
|
||||
if (maxi && size > maxi) return removeAbilityFromGame();
|
||||
if (maxi) return 0;
|
||||
if (size <= mini) return 0;
|
||||
return addAbilityToGame();
|
||||
@@ -2385,7 +2385,7 @@ public:
|
||||
|
||||
int removed(MTGCardInstance * card){
|
||||
size_t size = cards.size();
|
||||
if (maxi && (int)size < maxi) return addAbilityToGame();
|
||||
if (maxi && (int)size <= maxi) return addAbilityToGame();
|
||||
if (mini && (int)size > mini) return 0;
|
||||
if (mini && (int)size <= mini) return removeAbilityFromGame();
|
||||
if (!mini && !maxi && size !=0) return 0;
|
||||
@@ -2502,7 +2502,9 @@ public:
|
||||
tc->targetter = NULL;
|
||||
includeSelf = _includeSelf;
|
||||
ability->target = _target;
|
||||
}
|
||||
aType = MTGAbility::FOREACH;
|
||||
naType = ability->aType;
|
||||
}
|
||||
|
||||
int canBeInList(MTGCardInstance * card){
|
||||
if ( (includeSelf || card!=source) && tc->canTarget(card)) return 1;
|
||||
@@ -2638,6 +2640,7 @@ public:
|
||||
ability->source = source;
|
||||
ability->target = target;
|
||||
SAFE_DELETE(tc);
|
||||
aType = FOREACH;
|
||||
}
|
||||
|
||||
int removeFromGame(){
|
||||
@@ -3494,6 +3497,7 @@ public:
|
||||
list<int>types;
|
||||
list<int>colors;
|
||||
WParsedPT * wppt;
|
||||
string menu;
|
||||
ABecomes(int id, MTGCardInstance * source, MTGCardInstance * target, string stypes, WParsedPT * wppt, string sabilities):MTGAbility(id,source,target),wppt(wppt){
|
||||
//TODO this is a copy/past of other code that's all around the place, everything should be in a dedicated parser class;
|
||||
|
||||
@@ -3512,6 +3516,7 @@ public:
|
||||
}
|
||||
|
||||
string s = stypes;
|
||||
menu = stypes;
|
||||
while (s.size()){
|
||||
size_t found = s.find(" ");
|
||||
if (found != string::npos){
|
||||
@@ -3561,6 +3566,12 @@ public:
|
||||
return 1;
|
||||
}
|
||||
|
||||
const char * getMenuText(){
|
||||
string s = menu;
|
||||
sprintf(menuText, "Becomes %s",s.c_str());
|
||||
return menuText;
|
||||
}
|
||||
|
||||
ABecomes * clone() const{
|
||||
ABecomes * a = NEW ABecomes(*this);
|
||||
a->wppt = NEW WParsedPT(*(a->wppt));
|
||||
|
||||
@@ -56,6 +56,7 @@ class MTGAbility: public ActionElement{
|
||||
|
||||
Targetable * target;
|
||||
int aType;
|
||||
int naType;
|
||||
MTGCardInstance * source;
|
||||
MTGAbility(int id, MTGCardInstance * card);
|
||||
MTGAbility(int id, MTGCardInstance * _source, Targetable * _target);
|
||||
@@ -93,6 +94,7 @@ class MTGAbility: public ActionElement{
|
||||
STANDARD_PREVENT = 13,
|
||||
STANDARD_EQUIP = 14,
|
||||
STANDARD_LEVELUP = 15,
|
||||
FOREACH = 16,
|
||||
|
||||
|
||||
};
|
||||
|
||||
@@ -121,7 +121,7 @@ ManaCost * AIPlayer::getPotentialMana(MTGCardInstance * target){
|
||||
used[card] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -163,8 +163,7 @@ int AIAction::getEfficiency(){
|
||||
}
|
||||
|
||||
if (!((AIPlayer *)p)->canHandleCost(ability)) return 0;
|
||||
|
||||
switch (a->aType){
|
||||
switch (a->aType){
|
||||
case MTGAbility::DAMAGER:
|
||||
{
|
||||
AADamager * aad = (AADamager *) a;
|
||||
@@ -258,7 +257,7 @@ int AIAction::getEfficiency(){
|
||||
efficiency = 0;
|
||||
break;
|
||||
default:
|
||||
if (target){
|
||||
if (target){
|
||||
AbilityFactory af;
|
||||
int suggestion = af.abilityEfficiency(a, p, MODE_ABILITY);
|
||||
if ((suggestion == BAKA_EFFECT_BAD && p==target->controller()) ||(suggestion == BAKA_EFFECT_GOOD && p!=target->controller())){
|
||||
@@ -317,7 +316,6 @@ int AIPlayer::selectAbility(){
|
||||
MTGAbility * a = ((MTGAbility *)g->mLayers->actionLayer()->mObjects[i]);
|
||||
//Skip mana abilities for performance
|
||||
if (dynamic_cast<AManaProducer*>(a)) continue;
|
||||
|
||||
//Make sure we can use the ability
|
||||
for (int j=0; j < game->inPlay->nb_cards; j++){
|
||||
MTGCardInstance * card = game->inPlay->cards[j];
|
||||
|
||||
@@ -1663,6 +1663,7 @@ int AbilityFactory::abilityEfficiency(MTGAbility * a, Player * p, int mode, Targ
|
||||
if (dynamic_cast<AADrawer *>(a)) return BAKA_EFFECT_GOOD;
|
||||
if (dynamic_cast<AARandomDiscarder *>(a)) return BAKA_EFFECT_BAD;
|
||||
if (dynamic_cast<ARampageAbility *>(a)) return BAKA_EFFECT_GOOD;
|
||||
if (dynamic_cast<ABushidoAbility *>(a)) return BAKA_EFFECT_GOOD;
|
||||
if (AInstantPowerToughnessModifierUntilEOT * abi = dynamic_cast<AInstantPowerToughnessModifierUntilEOT *>(a)) return (abi->wppt->power.getValue()>=0 && abi->wppt->toughness.getValue()>=0) ? BAKA_EFFECT_GOOD : BAKA_EFFECT_BAD;
|
||||
if (APowerToughnessModifier * abi = dynamic_cast<APowerToughnessModifier *>(a)) return (abi->wppt->power.getValue()>=0 && abi->wppt->toughness.getValue()>=0) ? BAKA_EFFECT_GOOD : BAKA_EFFECT_BAD;
|
||||
if (APowerToughnessModifierUntilEndOfTurn * abi = dynamic_cast<APowerToughnessModifierUntilEndOfTurn *>(a)) return abilityEfficiency(abi->ability, p, mode,tc);
|
||||
|
||||
Reference in New Issue
Block a user