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.
133 lines
4.7 KiB
C++
133 lines
4.7 KiB
C++
#ifndef _AI_PLAYER_BAKA_H_
|
|
#define _AI_PLAYER_BAKA_H_
|
|
|
|
#include "AIPlayer.h"
|
|
#include "AllAbilities.h"
|
|
|
|
class AIStats;
|
|
class AIHints;
|
|
|
|
|
|
//Would love to define those classes as private nested classes inside of AIPlayerBaka, but they are used by AIHints (which itself should be known only by AIPlayerBaka anyways)
|
|
// Any way to clean this up and make all the AIPlayerBaka universe (AIHints, AIPlayerBaka, OrderedAIAction) "closed" ?
|
|
class OrderedAIAction: public AIAction
|
|
{
|
|
protected:
|
|
Player * getPlayerTarget();
|
|
|
|
public:
|
|
int efficiency;
|
|
|
|
OrderedAIAction(AIPlayer * owner, MTGAbility * a, MTGCardInstance * c, MTGCardInstance * t = NULL)
|
|
: AIAction(owner, a, c, t), efficiency(-1)
|
|
{
|
|
};
|
|
|
|
OrderedAIAction(AIPlayer * owner, MTGCardInstance * c, MTGCardInstance * t = NULL);
|
|
|
|
OrderedAIAction(AIPlayer * owner, Player * p)//player targeting through spells
|
|
: AIAction(owner,p), efficiency(-1)
|
|
{
|
|
};
|
|
|
|
OrderedAIAction(AIPlayer * owner, MTGAbility * a, MTGCardInstance * c, vector<Targetable*>targetCards)
|
|
: AIAction(owner,a, c, targetCards), efficiency(-1)
|
|
{
|
|
};
|
|
|
|
OrderedAIAction(AIPlayer * owner, MTGAbility * a, Player * p, MTGCardInstance * c)//player targeting through abilities.
|
|
: AIAction(owner, a, p, c), efficiency(-1)
|
|
{
|
|
};
|
|
int getEfficiency();
|
|
|
|
// Functions depending on the type of Ability
|
|
int getEfficiency(AADamager * aad);
|
|
|
|
};
|
|
|
|
// compares Abilities efficiency
|
|
class CmpAbilities
|
|
{
|
|
public:
|
|
bool operator()(const OrderedAIAction& a1, const OrderedAIAction& a2) const
|
|
{
|
|
OrderedAIAction* a1Ptr = const_cast<OrderedAIAction*>(&a1);
|
|
OrderedAIAction* a2Ptr = const_cast<OrderedAIAction*>(&a2);
|
|
int e1 = a1Ptr->getEfficiency();
|
|
int e2 = a2Ptr->getEfficiency();
|
|
if (e1 == e2) return a1Ptr->id < a2Ptr->id;
|
|
return (e1 > e2);
|
|
}
|
|
};
|
|
|
|
typedef std::map<OrderedAIAction, int, CmpAbilities> RankingContainer;
|
|
|
|
|
|
class AIPlayerBaka: public AIPlayer{
|
|
protected:
|
|
virtual int orderBlockers();
|
|
virtual int combatDamages();
|
|
virtual int interruptIfICan();
|
|
virtual int chooseAttackers();
|
|
virtual int chooseBlockers();
|
|
virtual int canFirstStrikeKill(MTGCardInstance * card, MTGCardInstance *ennemy);
|
|
virtual int effectBadOrGood(MTGCardInstance * card, int mode = MODE_PUTINTOPLAY, TargetChooser * tc = NULL);
|
|
|
|
|
|
// returns 1 if the AI algorithm supports a given cost (ex:simple mana cost), 0 otherwise (ex: cost involves Sacrificing a target)
|
|
virtual int CanHandleCost(ManaCost * cost, MTGCardInstance * card = NULL);
|
|
|
|
//Tries to play an ability recommended by the deck creator
|
|
virtual int selectHintAbility();
|
|
|
|
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);
|
|
virtual int selectMenuOption();
|
|
|
|
virtual AIStats * getStats();
|
|
|
|
MTGCardInstance * nextCardToPlay;
|
|
AIHints * hints;
|
|
AIStats * stats;
|
|
int oldGamePhase;
|
|
float timer;
|
|
virtual MTGCardInstance * FindCardToPlay(ManaCost * potentialMana, const char * type);
|
|
|
|
//used by MomirPlayer, hence protected instead of private
|
|
virtual int getEfficiency(OrderedAIAction * action);
|
|
virtual int getEfficiency(MTGAbility * ability);
|
|
virtual bool payTheManaCost(ManaCost * cost, MTGCardInstance * card = NULL,vector<MTGAbility*> gotPayment = vector<MTGAbility*>());
|
|
virtual int getCreaturesInfo(Player * player, int neededInfo = INFO_NBCREATURES , int untapMode = 0, int canAttack = 0);
|
|
virtual ManaCost * getPotentialMana(MTGCardInstance * card = NULL);
|
|
virtual int selectAbility();
|
|
|
|
public:
|
|
enum {
|
|
INFO_NBCREATURES,
|
|
INFO_CREATURESPOWER,
|
|
INFO_CREATURESRANK,
|
|
INFO_CREATURESTOUGHNESS,
|
|
INFO_CREATURESATTACKINGPOWER
|
|
};
|
|
|
|
vector<MTGAbility*>gotPayments;
|
|
AIPlayerBaka(GameObserver *observer, string deckFile, string deckfileSmall, string avatarFile, MTGDeck * deck = NULL);
|
|
virtual int Act(float dt);
|
|
void initTimer();
|
|
virtual int computeActions();
|
|
virtual void Render();
|
|
virtual int receiveEvent(WEvent * event);
|
|
virtual ~AIPlayerBaka();
|
|
virtual int affectCombatDamages(CombatStep step);
|
|
virtual int canHandleCost(MTGAbility * ability);
|
|
virtual int chooseTarget(TargetChooser * tc = NULL, Player * forceTarget = NULL,MTGCardInstance * Chosencard = NULL,bool checkonly = false);
|
|
|
|
//used by AIHInts, therefore public instead of private :/
|
|
virtual int createAbilityTargets(MTGAbility * a, MTGCardInstance * c, RankingContainer& ranking);
|
|
};
|
|
|
|
#endif
|