Erwan
- In line Zethfox's idea with WParsedInt objects inside MTGAbilities, deleted some unused variables.
This commit is contained in:
@@ -1227,17 +1227,15 @@ public:
|
|||||||
class AADrawer: public ActivatedAbilityTP
|
class AADrawer: public ActivatedAbilityTP
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
WParsedInt *nbcards;
|
|
||||||
WParsedInt *RefreshedNbcards;
|
|
||||||
|
|
||||||
string nbcardsStr;
|
string nbcardsStr;
|
||||||
|
|
||||||
AADrawer(int _id, MTGCardInstance * card, Targetable * _target, ManaCost * _cost, WParsedInt * nbcards,string nbcardsStr, int _tap = 0, int who =
|
AADrawer(int _id, MTGCardInstance * card, Targetable * _target, ManaCost * _cost,string nbcardsStr, int _tap = 0, int who =
|
||||||
TargetChooser::UNSET);
|
TargetChooser::UNSET);
|
||||||
int resolve();
|
int resolve();
|
||||||
const char * getMenuText();
|
const char * getMenuText();
|
||||||
AADrawer * clone() const;
|
AADrawer * clone() const;
|
||||||
~AADrawer();
|
int getNumCards();
|
||||||
};
|
};
|
||||||
|
|
||||||
//lands, allows to play more land during a turn:
|
//lands, allows to play more land during a turn:
|
||||||
@@ -1261,14 +1259,12 @@ class AALifer: public ActivatedAbilityTP
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
string life_s;
|
string life_s;
|
||||||
WParsedInt *life;
|
AALifer(int _id, MTGCardInstance * card, Targetable * _target,string life_s, ManaCost * _cost = NULL, int _tap = 0,
|
||||||
WParsedInt *RefreshedLife;
|
|
||||||
AALifer(int _id, MTGCardInstance * card, Targetable * _target,string life_s, WParsedInt * life, ManaCost * _cost = NULL, int _tap = 0,
|
|
||||||
int who = TargetChooser::UNSET);
|
int who = TargetChooser::UNSET);
|
||||||
int resolve();
|
int resolve();
|
||||||
const char * getMenuText();
|
const char * getMenuText();
|
||||||
AALifer * clone() const;
|
AALifer * clone() const;
|
||||||
~AALifer();
|
int getLife();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -3274,16 +3270,14 @@ public:
|
|||||||
class AADamager: public ActivatedAbilityTP
|
class AADamager: public ActivatedAbilityTP
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
WParsedInt * damage;
|
|
||||||
WParsedInt * RefreshedDamage;
|
|
||||||
string d;
|
string d;
|
||||||
|
|
||||||
AADamager(int _id, MTGCardInstance * _source, Targetable * _target,WParsedInt * damage, string d, ManaCost * _cost = NULL,
|
AADamager(int _id, MTGCardInstance * _source, Targetable * _target, string d, ManaCost * _cost = NULL,
|
||||||
int doTap = 0, int who = TargetChooser::UNSET);
|
int doTap = 0, int who = TargetChooser::UNSET);
|
||||||
int resolve();
|
int resolve();
|
||||||
const char * getMenuText();
|
const char * getMenuText();
|
||||||
|
int getDamage();
|
||||||
AADamager * clone() const;
|
AADamager * clone() const;
|
||||||
~AADamager();
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -3319,11 +3313,11 @@ class TADamager: public TargetAbility
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
TADamager(int id, MTGCardInstance * card, ManaCost * _cost,WParsedInt *damage, string d, TargetChooser * _tc = NULL, int _tap = 0) :
|
TADamager(int id, MTGCardInstance * card, ManaCost * _cost, string d, TargetChooser * _tc = NULL, int _tap = 0) :
|
||||||
TargetAbility(id, card, _tc, _cost, 0, _tap)
|
TargetAbility(id, card, _tc, _cost, 0, _tap)
|
||||||
{
|
{
|
||||||
if (!tc) tc = NEW DamageableTargetChooser(card);
|
if (!tc) tc = NEW DamageableTargetChooser(card);
|
||||||
ability = NEW AADamager(id, card, NULL,damage, d);
|
ability = NEW AADamager(id, card, NULL, d);
|
||||||
}
|
}
|
||||||
|
|
||||||
TADamager * clone() const
|
TADamager * clone() const
|
||||||
@@ -5432,16 +5426,13 @@ public:
|
|||||||
class AADepleter: public ActivatedAbilityTP
|
class AADepleter: public ActivatedAbilityTP
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
WParsedInt * nbcards;
|
|
||||||
WParsedInt * RefreshedNbcards;
|
|
||||||
string nbcardsStr;
|
string nbcardsStr;
|
||||||
|
|
||||||
AADepleter(int _id, MTGCardInstance * card, Targetable * _target, WParsedInt * nbcards,string nbcardsStr, ManaCost * _cost = NULL, int _tap = 0,
|
AADepleter(int _id, MTGCardInstance * card, Targetable * _target,string nbcardsStr, ManaCost * _cost = NULL, int _tap = 0,
|
||||||
int who = TargetChooser::UNSET);
|
int who = TargetChooser::UNSET);
|
||||||
int resolve();
|
int resolve();
|
||||||
const char * getMenuText();
|
const char * getMenuText();
|
||||||
AADepleter * clone() const;
|
AADepleter * clone() const;
|
||||||
~AADepleter();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//Shuffle
|
//Shuffle
|
||||||
@@ -5492,16 +5483,13 @@ public:
|
|||||||
class AARandomDiscarder: public ActivatedAbilityTP
|
class AARandomDiscarder: public ActivatedAbilityTP
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
WParsedInt * nbcards;
|
|
||||||
WParsedInt * RefreshedNbcards;
|
|
||||||
string nbcardsStr;
|
string nbcardsStr;
|
||||||
|
|
||||||
AARandomDiscarder(int _id, MTGCardInstance * card, Targetable * _target, WParsedInt * nbcards,string nbcardsStr, ManaCost * _cost = NULL,
|
AARandomDiscarder(int _id, MTGCardInstance * card, Targetable * _target,string nbcardsStr, ManaCost * _cost = NULL,
|
||||||
int _tap = 0, int who = TargetChooser::UNSET);
|
int _tap = 0, int who = TargetChooser::UNSET);
|
||||||
int resolve();
|
int resolve();
|
||||||
const char * getMenuText();
|
const char * getMenuText();
|
||||||
AARandomDiscarder * clone() const;
|
AARandomDiscarder * clone() const;
|
||||||
~AARandomDiscarder();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//Minion of Leshrac
|
//Minion of Leshrac
|
||||||
|
|||||||
@@ -124,7 +124,6 @@ class MTGAbility: public ActionElement{
|
|||||||
int aType;
|
int aType;
|
||||||
int naType;
|
int naType;
|
||||||
int abilitygranted;
|
int abilitygranted;
|
||||||
int nbcardAmount;
|
|
||||||
MTGCardInstance * source;
|
MTGCardInstance * source;
|
||||||
MTGAbility(int id, MTGCardInstance * card);
|
MTGAbility(int id, MTGCardInstance * card);
|
||||||
MTGAbility(int id, MTGCardInstance * _source, Targetable * _target);
|
MTGAbility(int id, MTGCardInstance * _source, Targetable * _target);
|
||||||
|
|||||||
@@ -238,13 +238,13 @@ int AIAction::getEfficiency()
|
|||||||
{
|
{
|
||||||
efficiency = 0;
|
efficiency = 0;
|
||||||
}
|
}
|
||||||
else if (aad->damage->getValue() >= target->toughness)
|
else if (aad->getDamage() >= target->toughness)
|
||||||
{
|
{
|
||||||
efficiency = 100;
|
efficiency = 100;
|
||||||
}
|
}
|
||||||
else if (target->toughness)
|
else if (target->toughness)
|
||||||
{
|
{
|
||||||
efficiency = (50 * aad->damage->getValue()) / target->toughness;
|
efficiency = (50 * aad->getDamage()) / target->toughness;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -592,6 +592,7 @@ int AIAction::getEfficiency()
|
|||||||
}
|
}
|
||||||
case MTGAbility::STANDARD_DRAW:
|
case MTGAbility::STANDARD_DRAW:
|
||||||
{
|
{
|
||||||
|
AADrawer * drawer = (AADrawer *)a;
|
||||||
//adding this case since i played a few games where Ai litterally decided to mill himself to death. fastest and easiest win ever.
|
//adding this case since i played a few games where Ai litterally decided to mill himself to death. fastest and easiest win ever.
|
||||||
//this should help a little, tho ultimately it will be decided later what the best course of action is.
|
//this should help a little, tho ultimately it will be decided later what the best course of action is.
|
||||||
efficiency = 0;
|
efficiency = 0;
|
||||||
@@ -602,7 +603,7 @@ int AIAction::getEfficiency()
|
|||||||
{
|
{
|
||||||
efficiency -= 70;
|
efficiency -= 70;
|
||||||
}
|
}
|
||||||
if ((a->nbcardAmount >= p->game->library->nb_cards && p->isAI()) || (p->game->hand->nb_cards > 10 && p->isAI()))
|
if ((drawer->getNumCards() >= p->game->library->nb_cards && p->isAI()) || (p->game->hand->nb_cards > 10 && p->isAI()))
|
||||||
{
|
{
|
||||||
//if the amount im drawing will mill me to death or i have more then 10 cards in hand, eff is 0;
|
//if the amount im drawing will mill me to death or i have more then 10 cards in hand, eff is 0;
|
||||||
efficiency = 0;
|
efficiency = 0;
|
||||||
|
|||||||
@@ -142,9 +142,9 @@ AADamagePrevent::~AADamagePrevent()
|
|||||||
}
|
}
|
||||||
|
|
||||||
//AADamager
|
//AADamager
|
||||||
AADamager::AADamager(int _id, MTGCardInstance * _source, Targetable * _target,WParsedInt * damage, string d, ManaCost * _cost, int doTap,
|
AADamager::AADamager(int _id, MTGCardInstance * _source, Targetable * _target, string d, ManaCost * _cost, int doTap,
|
||||||
int who) :
|
int who) :
|
||||||
ActivatedAbilityTP(_id, _source, _target, _cost, doTap, who),damage(damage), d(d)
|
ActivatedAbilityTP(_id, _source, _target, _cost, doTap, who), d(d)
|
||||||
{
|
{
|
||||||
aType = MTGAbility::DAMAGER;
|
aType = MTGAbility::DAMAGER;
|
||||||
}
|
}
|
||||||
@@ -154,15 +154,20 @@ AADamager::AADamager(int _id, MTGCardInstance * _source, Targetable * _target,WP
|
|||||||
Damageable * _target = (Damageable *) getTarget();
|
Damageable * _target = (Damageable *) getTarget();
|
||||||
if (_target)
|
if (_target)
|
||||||
{
|
{
|
||||||
RefreshedDamage = NEW WParsedInt(d, NULL, (MTGCardInstance *)source);
|
WParsedInt damage(d, NULL, (MTGCardInstance *)source);
|
||||||
game->mLayers->stackLayer()->addDamage(source, _target, RefreshedDamage->getValue());
|
game->mLayers->stackLayer()->addDamage(source, _target, damage.getValue());
|
||||||
game->mLayers->stackLayer()->resolve();
|
game->mLayers->stackLayer()->resolve();
|
||||||
delete RefreshedDamage;
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int AADamager::getDamage()
|
||||||
|
{
|
||||||
|
WParsedInt damage(d, NULL, (MTGCardInstance *)source);
|
||||||
|
return damage.getValue();
|
||||||
|
}
|
||||||
|
|
||||||
const char * AADamager::getMenuText()
|
const char * AADamager::getMenuText()
|
||||||
{
|
{
|
||||||
return "Damage";
|
return "Damage";
|
||||||
@@ -171,21 +176,16 @@ AADamager::AADamager(int _id, MTGCardInstance * _source, Targetable * _target,WP
|
|||||||
AADamager * AADamager::clone() const
|
AADamager * AADamager::clone() const
|
||||||
{
|
{
|
||||||
AADamager * a = NEW AADamager(*this);
|
AADamager * a = NEW AADamager(*this);
|
||||||
a->damage = NEW WParsedInt(*(a->damage));
|
|
||||||
a->isClone = 1;
|
a->isClone = 1;
|
||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
|
|
||||||
AADamager::~AADamager()
|
|
||||||
{
|
|
||||||
SAFE_DELETE(damage);
|
|
||||||
}
|
|
||||||
|
|
||||||
//AADepleter
|
//AADepleter
|
||||||
AADepleter::AADepleter(int _id, MTGCardInstance * card, Targetable * _target,WParsedInt * nbcards,string nbcardsStr, ManaCost * _cost, int _tap, int who) :
|
AADepleter::AADepleter(int _id, MTGCardInstance * card, Targetable * _target,string nbcardsStr, ManaCost * _cost, int _tap, int who) :
|
||||||
ActivatedAbilityTP(_id, card, _target, _cost, _tap, who), nbcards(nbcards),nbcardsStr(nbcardsStr)
|
ActivatedAbilityTP(_id, card, _target, _cost, _tap, who),nbcardsStr(nbcardsStr)
|
||||||
{
|
{
|
||||||
RefreshedNbcards = NULL;
|
|
||||||
}
|
}
|
||||||
int AADepleter::resolve()
|
int AADepleter::resolve()
|
||||||
{
|
{
|
||||||
@@ -194,7 +194,7 @@ RefreshedNbcards = NULL;
|
|||||||
Player * player;
|
Player * player;
|
||||||
if (_target)
|
if (_target)
|
||||||
{
|
{
|
||||||
RefreshedNbcards = NEW WParsedInt(nbcardsStr, NULL, source);
|
WParsedInt numCards(nbcardsStr, NULL, source);
|
||||||
if (_target->typeAsTarget() == TARGET_CARD)
|
if (_target->typeAsTarget() == TARGET_CARD)
|
||||||
{
|
{
|
||||||
player = ((MTGCardInstance *) _target)->controller();
|
player = ((MTGCardInstance *) _target)->controller();
|
||||||
@@ -204,12 +204,11 @@ RefreshedNbcards = NULL;
|
|||||||
player = (Player *) _target;
|
player = (Player *) _target;
|
||||||
}
|
}
|
||||||
MTGLibrary * library = player->game->library;
|
MTGLibrary * library = player->game->library;
|
||||||
for (int i = 0; i < RefreshedNbcards->getValue(); i++)
|
for (int i = 0; i < numCards.getValue(); i++)
|
||||||
{
|
{
|
||||||
if (library->nb_cards)
|
if (library->nb_cards)
|
||||||
player->game->putInZone(library->cards[library->nb_cards - 1], library, player->game->graveyard);
|
player->game->putInZone(library->cards[library->nb_cards - 1], library, player->game->graveyard);
|
||||||
}
|
}
|
||||||
delete RefreshedNbcards;
|
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -225,11 +224,7 @@ AADepleter * AADepleter::clone() const
|
|||||||
a->isClone = 1;
|
a->isClone = 1;
|
||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
AADepleter::~AADepleter()
|
|
||||||
{
|
|
||||||
if(!isClone)
|
|
||||||
SAFE_DELETE(nbcards);
|
|
||||||
}
|
|
||||||
//AACopier
|
//AACopier
|
||||||
AACopier::AACopier(int _id, MTGCardInstance * _source, MTGCardInstance * _target, ManaCost * _cost) :
|
AACopier::AACopier(int _id, MTGCardInstance * _source, MTGCardInstance * _target, ManaCost * _cost) :
|
||||||
ActivatedAbility(_id, _source, _cost, 0, 0)
|
ActivatedAbility(_id, _source, _cost, 0, 0)
|
||||||
@@ -647,12 +642,11 @@ AADiscardCard * AADiscardCard::clone() const
|
|||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
|
|
||||||
AADrawer::AADrawer(int _id, MTGCardInstance * card, Targetable * _target, ManaCost * _cost,WParsedInt * nbcards, string nbcardsStr, int _tap,
|
AADrawer::AADrawer(int _id, MTGCardInstance * card, Targetable * _target, ManaCost * _cost, string nbcardsStr, int _tap,
|
||||||
int who) :
|
int who) :
|
||||||
ActivatedAbilityTP(_id, card, _target, _cost, _tap, who),nbcards(nbcards), nbcardsStr(nbcardsStr)
|
ActivatedAbilityTP(_id, card, _target, _cost, _tap, who), nbcardsStr(nbcardsStr)
|
||||||
{
|
{
|
||||||
aType = MTGAbility::STANDARD_DRAW;
|
aType = MTGAbility::STANDARD_DRAW;
|
||||||
nbcardAmount = nbcards->getValue();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int AADrawer::resolve()
|
int AADrawer::resolve()
|
||||||
@@ -661,7 +655,7 @@ AADrawer::AADrawer(int _id, MTGCardInstance * card, Targetable * _target, ManaCo
|
|||||||
Player * player;
|
Player * player;
|
||||||
if (_target)
|
if (_target)
|
||||||
{
|
{
|
||||||
RefreshedNbcards = NEW WParsedInt(nbcardsStr, NULL, source);
|
WParsedInt numCards(nbcardsStr, NULL, source);
|
||||||
if (_target->typeAsTarget() == TARGET_CARD)
|
if (_target->typeAsTarget() == TARGET_CARD)
|
||||||
{
|
{
|
||||||
player = ((MTGCardInstance *) _target)->controller();
|
player = ((MTGCardInstance *) _target)->controller();
|
||||||
@@ -670,13 +664,18 @@ AADrawer::AADrawer(int _id, MTGCardInstance * card, Targetable * _target, ManaCo
|
|||||||
{
|
{
|
||||||
player = (Player *) _target;
|
player = (Player *) _target;
|
||||||
}
|
}
|
||||||
game->mLayers->stackLayer()->addDraw(player, RefreshedNbcards->getValue());
|
game->mLayers->stackLayer()->addDraw(player, numCards.getValue());
|
||||||
game->mLayers->stackLayer()->resolve();
|
game->mLayers->stackLayer()->resolve();
|
||||||
delete RefreshedNbcards;
|
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int AADrawer::getNumCards()
|
||||||
|
{
|
||||||
|
WParsedInt numCards(nbcardsStr, NULL, source);
|
||||||
|
return numCards.getValue();
|
||||||
|
}
|
||||||
|
|
||||||
const char * AADrawer::getMenuText()
|
const char * AADrawer::getMenuText()
|
||||||
{
|
{
|
||||||
return "Draw";
|
return "Draw";
|
||||||
@@ -685,16 +684,10 @@ const char * AADrawer::getMenuText()
|
|||||||
AADrawer * AADrawer::clone() const
|
AADrawer * AADrawer::clone() const
|
||||||
{
|
{
|
||||||
AADrawer * a = NEW AADrawer(*this);
|
AADrawer * a = NEW AADrawer(*this);
|
||||||
a->nbcards = NEW WParsedInt(*(this->nbcards));
|
|
||||||
a->isClone = 1;
|
a->isClone = 1;
|
||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
|
|
||||||
AADrawer::~AADrawer()
|
|
||||||
{
|
|
||||||
SAFE_DELETE(nbcards);
|
|
||||||
}
|
|
||||||
|
|
||||||
// AAFrozen: Prevent a card from untapping during next untap phase
|
// AAFrozen: Prevent a card from untapping during next untap phase
|
||||||
AAFrozen::AAFrozen(int id, MTGCardInstance * card, MTGCardInstance * _target, ManaCost * _cost, int doTap) :
|
AAFrozen::AAFrozen(int id, MTGCardInstance * card, MTGCardInstance * _target, ManaCost * _cost, int doTap) :
|
||||||
ActivatedAbility(id, card, _cost, 0, doTap)
|
ActivatedAbility(id, card, _cost, 0, doTap)
|
||||||
@@ -1247,8 +1240,8 @@ AADynamic::~AADynamic()
|
|||||||
}
|
}
|
||||||
|
|
||||||
//AALifer
|
//AALifer
|
||||||
AALifer::AALifer(int _id, MTGCardInstance * card, Targetable * _target, string life_s, WParsedInt * life, ManaCost * _cost, int _tap, int who) :
|
AALifer::AALifer(int _id, MTGCardInstance * card, Targetable * _target, string life_s, ManaCost * _cost, int _tap, int who) :
|
||||||
ActivatedAbilityTP(_id, card, _target, _cost, _tap, who),life_s(life_s), life(life)
|
ActivatedAbilityTP(_id, card, _target, _cost, _tap, who),life_s(life_s)
|
||||||
{
|
{
|
||||||
aType = MTGAbility::LIFER;
|
aType = MTGAbility::LIFER;
|
||||||
}
|
}
|
||||||
@@ -1259,37 +1252,38 @@ int AALifer::resolve()
|
|||||||
if (!_target)
|
if (!_target)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
RefreshedLife = NEW WParsedInt(life_s, NULL, source);
|
WParsedInt life(life_s, NULL, source);
|
||||||
if (_target->type_as_damageable == DAMAGEABLE_MTGCARDINSTANCE)
|
if (_target->type_as_damageable == DAMAGEABLE_MTGCARDINSTANCE)
|
||||||
{
|
{
|
||||||
_target = ((MTGCardInstance *) _target)->controller();
|
_target = ((MTGCardInstance *) _target)->controller();
|
||||||
}
|
}
|
||||||
Player *player = (Player*)_target;
|
Player *player = (Player*)_target;
|
||||||
player->gainOrLoseLife(RefreshedLife->getValue());
|
player->gainOrLoseLife(life.getValue());
|
||||||
|
|
||||||
delete RefreshedLife;
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int AALifer::getLife()
|
||||||
|
{
|
||||||
|
WParsedInt life(life_s, NULL, source);
|
||||||
|
return life.getValue();
|
||||||
|
}
|
||||||
|
|
||||||
const char * AALifer::getMenuText()
|
const char * AALifer::getMenuText()
|
||||||
{
|
{
|
||||||
if(life->getValue() < 0)
|
if(getLife() < 0)
|
||||||
return "Life Loss";
|
return "Life Loss";
|
||||||
return "Life";
|
return "Life";
|
||||||
}
|
}
|
||||||
|
|
||||||
AALifer * AALifer::clone() const
|
AALifer * AALifer::clone() const
|
||||||
{
|
{
|
||||||
AALifer * a = NEW AALifer(*this);
|
AALifer * a = NEW AALifer(*this);
|
||||||
a->life = NEW WParsedInt(*(a->life));
|
|
||||||
a->isClone = 1;
|
a->isClone = 1;
|
||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
|
|
||||||
AALifer::~AALifer()
|
|
||||||
{
|
|
||||||
SAFE_DELETE(life);
|
|
||||||
}
|
|
||||||
|
|
||||||
//Lifeset
|
//Lifeset
|
||||||
AALifeSet::AALifeSet(int _id, MTGCardInstance * _source, Targetable * _target, WParsedInt * life, ManaCost * _cost, int doTap,
|
AALifeSet::AALifeSet(int _id, MTGCardInstance * _source, Targetable * _target, WParsedInt * life, ManaCost * _cost, int doTap,
|
||||||
@@ -1636,9 +1630,9 @@ AAOnlyOne * AAOnlyOne::clone() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Random Discard
|
//Random Discard
|
||||||
AARandomDiscarder::AARandomDiscarder(int _id, MTGCardInstance * card, Targetable * _target,WParsedInt * nbcards,string nbcardsStr, ManaCost * _cost,
|
AARandomDiscarder::AARandomDiscarder(int _id, MTGCardInstance * card, Targetable * _target,string nbcardsStr, ManaCost * _cost,
|
||||||
int _tap, int who) :
|
int _tap, int who) :
|
||||||
ActivatedAbilityTP(_id, card, _target, _cost, _tap, who), nbcards(nbcards),nbcardsStr(nbcardsStr)
|
ActivatedAbilityTP(_id, card, _target, _cost, _tap, who), nbcardsStr(nbcardsStr)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1658,13 +1652,13 @@ int AARandomDiscarder::resolve()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
RefreshedNbcards = NEW WParsedInt(nbcardsStr, NULL, source);
|
WParsedInt numCards(nbcardsStr, NULL, source);
|
||||||
for (int i = 0; i < RefreshedNbcards->intValue; i++)
|
for (int i = 0; i < numCards.intValue; i++)
|
||||||
{
|
{
|
||||||
player->game->discardRandom(player->game->hand, source);
|
player->game->discardRandom(player->game->hand, source);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
delete RefreshedNbcards;
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1677,13 +1671,8 @@ AARandomDiscarder * AARandomDiscarder::clone() const
|
|||||||
{
|
{
|
||||||
AARandomDiscarder * a = NEW AARandomDiscarder(*this);
|
AARandomDiscarder * a = NEW AARandomDiscarder(*this);
|
||||||
a->isClone = 1;
|
a->isClone = 1;
|
||||||
a->nbcards = NEW WParsedInt(nbcardsStr, NULL, source);
|
|
||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
AARandomDiscarder ::~AARandomDiscarder ()
|
|
||||||
{
|
|
||||||
SAFE_DELETE(nbcards);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Shuffle
|
// Shuffle
|
||||||
AAShuffle::AAShuffle(int _id, MTGCardInstance * card, Targetable * _target, ManaCost * _cost, int _tap, int who) :
|
AAShuffle::AAShuffle(int _id, MTGCardInstance * card, Targetable * _target, ManaCost * _cost, int _tap, int who) :
|
||||||
|
|||||||
@@ -2004,11 +2004,11 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
|
|||||||
{
|
{
|
||||||
d = s.substr(start + 1);
|
d = s.substr(start + 1);
|
||||||
}
|
}
|
||||||
WParsedInt * damage = NEW WParsedInt(d, spell, card);
|
|
||||||
Targetable * t = NULL;
|
Targetable * t = NULL;
|
||||||
if (spell)
|
if (spell)
|
||||||
t = spell->getNextTarget();
|
t = spell->getNextTarget();
|
||||||
MTGAbility * a = NEW AADamager(id, card, t,damage, d, NULL, 0, who);
|
MTGAbility * a = NEW AADamager(id, card, t, d, NULL, 0, who);
|
||||||
a->oneShot = 1;
|
a->oneShot = 1;
|
||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
@@ -2100,11 +2100,10 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
|
|||||||
{
|
{
|
||||||
life_s = s.substr(start + 1);
|
life_s = s.substr(start + 1);
|
||||||
}
|
}
|
||||||
WParsedInt * life = NEW WParsedInt(life_s, spell, card);
|
|
||||||
Targetable * t = NULL;
|
Targetable * t = NULL;
|
||||||
if (spell)
|
if (spell)
|
||||||
t = spell->getNextTarget();
|
t = spell->getNextTarget();
|
||||||
MTGAbility * a = NEW AALifer(id, card, t,life_s, life, NULL, 0, who);
|
MTGAbility * a = NEW AALifer(id, card, t, life_s, NULL, 0, who);
|
||||||
a->oneShot = 1;
|
a->oneShot = 1;
|
||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
@@ -2136,11 +2135,10 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
|
|||||||
{
|
{
|
||||||
nbcardsStr = s.substr(start + 1);
|
nbcardsStr = s.substr(start + 1);
|
||||||
}
|
}
|
||||||
WParsedInt * nbcards = NEW WParsedInt(nbcardsStr, spell, card);
|
|
||||||
Targetable * t = NULL;
|
Targetable * t = NULL;
|
||||||
if (spell)
|
if (spell)
|
||||||
t = spell->getNextTarget();
|
t = spell->getNextTarget();
|
||||||
MTGAbility * a = NEW AADrawer(id, card, t, NULL,nbcards ,nbcardsStr, 0, who);
|
MTGAbility * a = NEW AADrawer(id, card, t, NULL,nbcardsStr, 0, who);
|
||||||
a->oneShot = 1;
|
a->oneShot = 1;
|
||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
@@ -2183,11 +2181,10 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
|
|||||||
{
|
{
|
||||||
nbcardsStr = s.substr(start + 1);
|
nbcardsStr = s.substr(start + 1);
|
||||||
}
|
}
|
||||||
WParsedInt * nbcards = NEW WParsedInt(nbcardsStr, spell, card);
|
|
||||||
Targetable * t = NULL;
|
Targetable * t = NULL;
|
||||||
if (spell)
|
if (spell)
|
||||||
t = spell->getNextTarget();
|
t = spell->getNextTarget();
|
||||||
MTGAbility * a = NEW AADepleter(id, card, t,nbcards ,nbcardsStr, NULL, 0, who);
|
MTGAbility * a = NEW AADepleter(id, card, t ,nbcardsStr, NULL, 0, who);
|
||||||
a->oneShot = 1;
|
a->oneShot = 1;
|
||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
@@ -2253,12 +2250,10 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
|
|||||||
{
|
{
|
||||||
nbcardsStr = s.substr(start + 1);
|
nbcardsStr = s.substr(start + 1);
|
||||||
}
|
}
|
||||||
WParsedInt * nbcards = NEW WParsedInt(nbcardsStr, spell, card);
|
|
||||||
|
|
||||||
Targetable * t = NULL;
|
Targetable * t = NULL;
|
||||||
if (spell)
|
if (spell)
|
||||||
t = spell->getNextPlayerTarget();
|
t = spell->getNextPlayerTarget();
|
||||||
MTGAbility * a = NEW AARandomDiscarder(id, card, t, nbcards,nbcardsStr, NULL, 0, who);
|
MTGAbility * a = NEW AARandomDiscarder(id, card, t, nbcardsStr, NULL, 0, who);
|
||||||
a->oneShot = 1;
|
a->oneShot = 1;
|
||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
@@ -2742,7 +2737,7 @@ int AbilityFactory::abilityEfficiency(MTGAbility * a, Player * p, int mode, Targ
|
|||||||
if (dynamic_cast<AStandardRegenerate *> (a))
|
if (dynamic_cast<AStandardRegenerate *> (a))
|
||||||
return BAKA_EFFECT_GOOD;
|
return BAKA_EFFECT_GOOD;
|
||||||
if (AALifer * abi = dynamic_cast<AALifer *>(a))
|
if (AALifer * abi = dynamic_cast<AALifer *>(a))
|
||||||
return abi->life > 0 ? BAKA_EFFECT_GOOD : BAKA_EFFECT_BAD;
|
return abi->getLife() > 0 ? BAKA_EFFECT_GOOD : BAKA_EFFECT_BAD;
|
||||||
if (AAAlterPoison * abi = dynamic_cast<AAAlterPoison *>(a))
|
if (AAAlterPoison * abi = dynamic_cast<AAAlterPoison *>(a))
|
||||||
return abi->poison > 0 ? BAKA_EFFECT_GOOD : BAKA_EFFECT_BAD;
|
return abi->poison > 0 ? BAKA_EFFECT_GOOD : BAKA_EFFECT_BAD;
|
||||||
if (dynamic_cast<AADepleter *> (a))
|
if (dynamic_cast<AADepleter *> (a))
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
#include "MTGGameZones.h"
|
#include "MTGGameZones.h"
|
||||||
#include "MTGAbility.h"
|
#include "MTGAbility.h"
|
||||||
|
#include "AllAbilities.h"
|
||||||
#include "DeckManager.h"
|
#include "DeckManager.h"
|
||||||
#include "AIPlayer.h"
|
#include "AIPlayer.h"
|
||||||
#include <JLogger.h>
|
#include <JLogger.h>
|
||||||
@@ -199,7 +200,7 @@ void Rules::addExtraRules()
|
|||||||
!= GAME_TYPE_RANDOM1 && g->mRules->gamemode != GAME_TYPE_RANDOM2 && g->mRules->gamemode
|
!= GAME_TYPE_RANDOM1 && g->mRules->gamemode != GAME_TYPE_RANDOM2 && g->mRules->gamemode
|
||||||
!= GAME_TYPE_STORY)//stupid protections to keep this out of mimor and other game modes.
|
!= GAME_TYPE_STORY)//stupid protections to keep this out of mimor and other game modes.
|
||||||
{
|
{
|
||||||
handsize = a->nbcardAmount;
|
handsize = ((AADrawer *)a)->getNumCards();
|
||||||
((AIPlayer *) p)->forceBestAbilityUse = true;
|
((AIPlayer *) p)->forceBestAbilityUse = true;
|
||||||
((AIPlayer *) p)->agressivity += 100;
|
((AIPlayer *) p)->agressivity += 100;
|
||||||
hand->OptimizedHand(p,handsize, 3, 1, 3);//easy decks get a major boost, open hand is 2lands,1 creature under 3 mana,3spells under 3 mana.
|
hand->OptimizedHand(p,handsize, 3, 1, 3);//easy decks get a major boost, open hand is 2lands,1 creature under 3 mana,3spells under 3 mana.
|
||||||
@@ -209,7 +210,7 @@ void Rules::addExtraRules()
|
|||||||
!= GAME_TYPE_RANDOM1 && g->mRules->gamemode != GAME_TYPE_RANDOM2 && g->mRules->gamemode
|
!= GAME_TYPE_RANDOM1 && g->mRules->gamemode != GAME_TYPE_RANDOM2 && g->mRules->gamemode
|
||||||
!= GAME_TYPE_STORY)//stupid protections to keep this out of mimor and other game modes.
|
!= GAME_TYPE_STORY)//stupid protections to keep this out of mimor and other game modes.
|
||||||
{
|
{
|
||||||
handsize = a->nbcardAmount;
|
handsize = ((AADrawer *)a)->getNumCards();
|
||||||
hand->OptimizedHand(p,handsize, 1, 0, 2);//give the Ai deck a tiny boost by giving it 1 land and 2 spells under 3 manacost.
|
hand->OptimizedHand(p,handsize, 1, 0, 2);//give the Ai deck a tiny boost by giving it 1 land and 2 spells under 3 manacost.
|
||||||
}else if (( !p->isAI() && Optimizedhandcheat) && a->aType == MTGAbility::STANDARD_DRAW && p->playMode
|
}else if (( !p->isAI() && Optimizedhandcheat) && a->aType == MTGAbility::STANDARD_DRAW && p->playMode
|
||||||
!= Player::MODE_TEST_SUITE && g->mRules->gamemode != GAME_TYPE_MOMIR && g->mRules->gamemode
|
!= Player::MODE_TEST_SUITE && g->mRules->gamemode != GAME_TYPE_MOMIR && g->mRules->gamemode
|
||||||
|
|||||||
Reference in New Issue
Block a user