added a new aihint #HINT:dontattackwith(targetchooser)
which tells the ai not to use the targetible cards as attackers, this can be card names, and CD modes.
modified the way ai handles multikicker. it will not be casting 1/1 joragas anymore :D
made WParsedInt ignore "+" signs....
added a new affinity ability...autohand=affinity(creature[vampire]|mygraveyard) ....
this is essentially affinity for creatures in your grave.
added supkeyword to clone clone addtype(zombie)....it adds the type listed to the cards types on clone...
reparse PT bonus on resolve.
reworked bushido, it should now work correctly...aside from that it now excepts word variables...fumiko is now bushido(type:creature[attacking]:battlefield/type:creature[attacking]:battlefield)
added a keyword to access acontrolsteal..the keyword is "steal"
auto=ueot steal target(creature)
reworked persist to handle undying..added the new counter handling rules intruduced by wotc in ISD
added a vector cardsAbilities to mtgcardinstance...this keeps the abilities added to the game for a card to use stored where we can easly alter or remove them.
added an automatic increase to geteff return if the ability is a putinplay ability.
finished coding support for flip and double sided cards, though viewing the "other side" is still not possible yet.
the ability follows the mtg rules.
the ability syntax is flip(card name)...a card can flip into any other card by name...even flip into itself.
added a "canPay() call for Ninja cost...to prevent it from coming up in a menu unless you're in blockers....
added 3 new restriction types that work very similar to type(
thisturn(tc)~morethan~2
lastturn(tc)~lessthan~thisturn(tc)
compare(wordvarible)~equalto~compare(wordvarible)
these are pretty self explanitory.
moved "&&" ability parsing below "this(" allowing "this(" to grant abilities now which contain &&...enclave egologist bug is fixed by this.
fixed an issue with combatspirit link for some reason the way i was doing the bool was not always working.
took care of the todo for AProtectionFrom...you can now give a protection from(blah) in a instant or ueot ability.
added altho very limited right now a "targetedplayer" tc word. i hope to increase this with time.
as always my sidekick doc already has some cards coded for this and test will follow the addition of the cards.
This commit is contained in:
@@ -16,6 +16,7 @@ class AIHint
|
||||
public:
|
||||
string mCondition;
|
||||
string mAction;
|
||||
string mCombatAttackTip;
|
||||
int mSourceId;
|
||||
AIHint(string line);
|
||||
};
|
||||
@@ -36,6 +37,7 @@ protected:
|
||||
public:
|
||||
AIHints (AIPlayerBaka * player);
|
||||
AIAction * suggestAbility(ManaCost * potentialMana);
|
||||
bool HintSaysDontAttack(GameObserver* observer,MTGCardInstance * card = NULL);
|
||||
void add(string line);
|
||||
~AIHints();
|
||||
};
|
||||
|
||||
@@ -81,7 +81,7 @@ class AIPlayerBaka: public AIPlayer{
|
||||
//Tries to play an ability recommended by the deck creator
|
||||
virtual int selectHintAbility();
|
||||
|
||||
virtual vector<MTGAbility*> canPayMana(MTGCardInstance * card = NULL,ManaCost * mCost = NULL);
|
||||
virtual vector<MTGAbility*> canPayMana(MTGCardInstance * card = NULL,ManaCost * mCost = NULL, map<MTGCardInstance*, bool>usedCards = map<MTGCardInstance*,bool>());
|
||||
virtual vector<MTGAbility*> canPaySunBurst(ManaCost * mCost = NULL);
|
||||
|
||||
virtual MTGCardInstance * chooseCard(TargetChooser * tc, MTGCardInstance * source, int random = 0);
|
||||
|
||||
@@ -54,6 +54,11 @@ private:
|
||||
s = s.substr(1);
|
||||
multiplier = -1;
|
||||
}
|
||||
if(s[0] == '+')
|
||||
{
|
||||
//ignore "+" signs....
|
||||
s = s.substr(1);
|
||||
}
|
||||
//rounding values, the words can be written anywhere in the line,
|
||||
//they are erased after parsing.
|
||||
if(s.find("halfup") != string::npos)
|
||||
@@ -858,6 +863,18 @@ public:
|
||||
/*
|
||||
Generic classes
|
||||
*/
|
||||
|
||||
class ANewAffinity: public MTGAbility
|
||||
{
|
||||
public:
|
||||
string tcString;
|
||||
string manaString;
|
||||
ANewAffinity(GameObserver* observer, int _id, MTGCardInstance * _source,string Tc = "", string mana ="");
|
||||
void Update(float dt);
|
||||
int testDestroy();
|
||||
ANewAffinity * clone() const;
|
||||
};
|
||||
|
||||
//if/ifnot Cond then EFFECT
|
||||
class IfThenAbility: public ActivatedAbility
|
||||
{
|
||||
@@ -993,11 +1010,13 @@ class AACloner: public ActivatedAbility
|
||||
public:
|
||||
int who;
|
||||
string with;
|
||||
string types;
|
||||
list<int> awith;
|
||||
list<int> colors;
|
||||
list<int> typesToAdd;
|
||||
|
||||
AACloner(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target = NULL, ManaCost * _cost = NULL, int who = 0,
|
||||
string abilitiesStringList = "");
|
||||
string abilitiesStringList = "",string typeslist = "");
|
||||
int resolve();
|
||||
const char * getMenuText();
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
@@ -1650,6 +1669,11 @@ public:
|
||||
int addToGame()
|
||||
{
|
||||
MTGCardInstance * _target = (MTGCardInstance *) target;
|
||||
if(PT.size())
|
||||
{
|
||||
SAFE_DELETE(wppt);
|
||||
wppt = NEW WParsedPT(PT,NULL,(MTGCardInstance *) source);
|
||||
}
|
||||
_target->power += wppt->power.getValue();
|
||||
_target->addToToughness(wppt->toughness.getValue());
|
||||
if(_target->has(Constants::INDESTRUCTIBLE) && wppt->toughness.getValue() < 0 && _target->toughness <= 0)
|
||||
@@ -4906,50 +4930,25 @@ public:
|
||||
class ABushidoAbility: public MTGAbility
|
||||
{
|
||||
public:
|
||||
MTGCardInstance * opponents[20];
|
||||
int nbOpponents;
|
||||
int PowerModifier;
|
||||
int ToughnessModifier;
|
||||
string PowerToughnessModifier;
|
||||
|
||||
ABushidoAbility(GameObserver* observer, int _id, MTGCardInstance * _source, int _PowerModifier, int _ToughnessModifier) :
|
||||
ABushidoAbility(GameObserver* observer, int _id, MTGCardInstance * _source, string _PowerToughnessModifier) :
|
||||
MTGAbility(observer, _id, _source)
|
||||
{
|
||||
PowerModifier = _PowerModifier;
|
||||
ToughnessModifier = _ToughnessModifier;
|
||||
nbOpponents = 0;
|
||||
PowerToughnessModifier = _PowerToughnessModifier;
|
||||
}
|
||||
int receiveEvent(WEvent * event)
|
||||
{
|
||||
if (dynamic_cast<WEventBlockersChosen*> (event))
|
||||
int receiveEvent(WEvent * event)
|
||||
{
|
||||
MTGCardInstance * opponent = source->getNextOpponent();
|
||||
if (!opponent) return 0;
|
||||
source->power += PowerModifier;
|
||||
source->addToToughness(ToughnessModifier);
|
||||
while (opponent)
|
||||
if (dynamic_cast<WEventBlockersChosen*> (event))
|
||||
{
|
||||
opponents[nbOpponents] = opponent;
|
||||
nbOpponents++;
|
||||
opponent = source->getNextOpponent(opponent);
|
||||
MTGCardInstance * opponent = source->getNextOpponent();
|
||||
if (!opponent) return 0;
|
||||
PTInstant * a = NEW PTInstant(game, this->GetId(), source, source,NEW WParsedPT(PowerToughnessModifier,NULL,source));
|
||||
GenericInstantAbility * wrapper = NEW GenericInstantAbility(game, 1, source,source, a);
|
||||
wrapper->addToGame();
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
else if (WEventPhaseChange* pe = dynamic_cast<WEventPhaseChange*>(event))
|
||||
{
|
||||
if (MTG_PHASE_AFTER_EOT == pe->to->id && nbOpponents)
|
||||
{
|
||||
source->power -= PowerModifier;
|
||||
source->addToToughness(-ToughnessModifier);
|
||||
nbOpponents = 0;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
virtual ostream& toString(ostream& out) const
|
||||
{
|
||||
out << "ABushidoAbility ::: opponents : " << opponents << " ; nbOpponents : " << nbOpponents << " (";
|
||||
return MTGAbility::toString(out) << ")";
|
||||
}
|
||||
|
||||
ABushidoAbility * clone() const
|
||||
{
|
||||
@@ -4999,14 +4998,24 @@ public:
|
||||
AInstantControlSteal(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target) :
|
||||
InstantAbility(observer, _id, _source, _target)
|
||||
{
|
||||
TrueController = _target->controller();
|
||||
TheftController = source->controller();
|
||||
MTGCardInstance * copy = _target->changeController(TheftController);
|
||||
target = copy;
|
||||
source->target = copy;
|
||||
copy->summoningSickness = 0;
|
||||
|
||||
}
|
||||
|
||||
int resolve()
|
||||
{
|
||||
MTGCardInstance * _theftTarget = (MTGCardInstance*)target;
|
||||
if(_theftTarget)
|
||||
{
|
||||
TrueController = _theftTarget->controller();
|
||||
TheftController = source->controller();
|
||||
MTGCardInstance * copy = _theftTarget->changeController(TheftController);
|
||||
target = copy;
|
||||
source->target = copy;
|
||||
copy->summoningSickness = 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int destroy()
|
||||
{
|
||||
MTGCardInstance * _target = (MTGCardInstance *) target;
|
||||
|
||||
@@ -19,6 +19,7 @@ public:
|
||||
int init(MTGCardInstance * _target, const char * _name, int _power, int _toughness);
|
||||
bool sameAs(const char * _name, int _power, int _toughness);
|
||||
bool cancels(int _power, int _toughness);
|
||||
int cancelCounter(int power, int toughness);
|
||||
int added();
|
||||
int removed();
|
||||
};
|
||||
|
||||
@@ -197,6 +197,7 @@ class Ninja : public ExtraCost
|
||||
{
|
||||
public:
|
||||
Ninja(TargetChooser *_tc = NULL);
|
||||
virtual int canPay();
|
||||
virtual int isPaymentSet();
|
||||
virtual int doPay();
|
||||
virtual Ninja * clone() const;
|
||||
|
||||
@@ -47,6 +47,7 @@ protected:
|
||||
public:
|
||||
vector<MTGCardInstance*>parentCards;
|
||||
vector<MTGCardInstance*>childrenCards;
|
||||
vector<MTGAbility *>cardsAbilities;
|
||||
|
||||
int setAttacker(int value);
|
||||
int setDefenser(MTGCardInstance * c);
|
||||
@@ -95,6 +96,7 @@ public:
|
||||
int MaxLevelUp;
|
||||
int kicked;
|
||||
bool isDualWielding;
|
||||
bool stillNeeded;
|
||||
Player * lastController;
|
||||
MTGGameZone * getCurrentZone();
|
||||
MTGGameZone * previousZone;
|
||||
|
||||
@@ -210,8 +210,9 @@ class Constants
|
||||
SNOWSWAMPWALK = 90,
|
||||
CANATTACK = 91,
|
||||
HYDRA = 92,
|
||||
UNDYING = 93,
|
||||
|
||||
NB_BASIC_ABILITIES = 93,
|
||||
NB_BASIC_ABILITIES = 94,
|
||||
|
||||
|
||||
RARITY_S = 'S', //Special Rarity
|
||||
|
||||
@@ -75,6 +75,8 @@ class MTGGameZone {
|
||||
|
||||
//list of cards that have been through this zone in the current turn
|
||||
vector<MTGCardInstance *> cardsSeenThisTurn;
|
||||
//list of cards that have been through this zone in the last turn
|
||||
vector<MTGCardInstance *> cardsSeenLastTurn;
|
||||
int nb_cards;
|
||||
MTGGameZone();
|
||||
~MTGGameZone();
|
||||
@@ -104,8 +106,9 @@ class MTGGameZone {
|
||||
bool hasX();
|
||||
|
||||
//How many cards matching a TargetChooser have been put in this zone during the turn
|
||||
int seenThisTurn(TargetChooser * tc, int castFilter = Constants::CAST_DONT_CARE);
|
||||
int seenThisTurn(string s, int castFilter = Constants::CAST_DONT_CARE);
|
||||
int seenThisTurn(TargetChooser * tc, int castFilter = Constants::CAST_DONT_CARE,bool lastTurn = false);
|
||||
int seenThisTurn(string s, int castFilter = Constants::CAST_DONT_CARE);
|
||||
int seenLastTurn(string s, int castFilter = Constants::CAST_DONT_CARE);
|
||||
|
||||
void setOwner(Player * player);
|
||||
MTGCardInstance * lastCardDrawn;
|
||||
@@ -175,6 +178,7 @@ public:
|
||||
MTGRemovedFromGame * removedFromGame;
|
||||
MTGRemovedFromGame * exile; //alias to removedFromZone
|
||||
MTGGameZone * garbage;
|
||||
MTGGameZone * garbageLastTurn;
|
||||
MTGGameZone * temp;
|
||||
|
||||
MTGPlayerCards();
|
||||
|
||||
@@ -56,6 +56,7 @@ public:
|
||||
virtual void reinit();
|
||||
void x();
|
||||
int hasX();
|
||||
int hasAnotherCost();
|
||||
ManaCost(std::vector<int8_t>& _cost, int nb_elems = 1);
|
||||
ManaCost();
|
||||
~ManaCost();
|
||||
|
||||
Reference in New Issue
Block a user