- some dangerous casts Player/MTGCardInstance fixed
- removed typeAsTarget function and replaced with dynamic casting - The test suite passes, but it is possible that I busted some of AI's features :(
This commit is contained in:
@@ -98,6 +98,7 @@ class AIPlayerBaka: public AIPlayer{
|
||||
|
||||
//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);
|
||||
|
||||
@@ -77,11 +77,6 @@ public:
|
||||
virtual void Render()
|
||||
{
|
||||
}
|
||||
|
||||
int typeAsTarget()
|
||||
{
|
||||
return TARGET_STACKACTION;
|
||||
}
|
||||
|
||||
Interruptible(GameObserver* observer, int inID = 0, bool hasFocus = false)
|
||||
: PlayGuiObject(40, x, y, inID, hasFocus), Targetable(observer), state(NOT_RESOLVED), display(0), source(NULL)
|
||||
@@ -139,7 +134,7 @@ public:
|
||||
Interruptible * getNextInterruptible(Interruptible * previous, int type);
|
||||
Spell * getNextSpellTarget(Spell * previous = 0);
|
||||
Damage * getNextDamageTarget(Damage * previous = 0);
|
||||
Targetable * getNextTarget(Targetable * previous = 0, int type = -1);
|
||||
Targetable * getNextTarget(Targetable * previous = 0);
|
||||
int getNbTargets();
|
||||
};
|
||||
|
||||
|
||||
@@ -113,7 +113,6 @@ public:
|
||||
MTGCardInstance * changeController(Player * newcontroller);
|
||||
Player * owner;
|
||||
Counters * counters;
|
||||
int typeAsTarget(){return TARGET_CARD;}
|
||||
const string getDisplayName() const;
|
||||
MTGCardInstance * target;
|
||||
vector<Targetable *> backupTargets;
|
||||
|
||||
@@ -250,7 +250,7 @@ class MTGVampireRule: public PermanentAbility
|
||||
{
|
||||
public:
|
||||
MTGVampireRule(GameObserver* observer, int _id);
|
||||
map<MTGCardInstance*,vector<MTGCardInstance*> > victems;
|
||||
map<MTGCardInstance*,vector<MTGCardInstance*> > victims;
|
||||
int receiveEvent(WEvent * event);
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
virtual MTGVampireRule * clone() const;
|
||||
|
||||
@@ -48,10 +48,6 @@ public:
|
||||
return 1;
|
||||
}
|
||||
const string getDisplayName() const;
|
||||
int typeAsTarget()
|
||||
{
|
||||
return TARGET_PLAYER;
|
||||
}
|
||||
|
||||
int afterDamage();
|
||||
|
||||
|
||||
@@ -1,17 +1,12 @@
|
||||
#ifndef _TARGETABLE_H_
|
||||
#define _TARGETABLE_H_
|
||||
|
||||
#define TARGET_CARD 1
|
||||
#define TARGET_PLAYER 2
|
||||
#define TARGET_STACKACTION 3
|
||||
|
||||
class Targetable
|
||||
{
|
||||
protected:
|
||||
GameObserver* observer;
|
||||
public:
|
||||
Targetable(GameObserver* observer) : observer(observer) {};
|
||||
virtual int typeAsTarget() = 0;
|
||||
virtual const string getDisplayName() const = 0;
|
||||
inline GameObserver* getObserver() { return observer; };
|
||||
virtual void setObserver(GameObserver*g) { observer = g; };
|
||||
|
||||
@@ -14,6 +14,8 @@ using std::vector;
|
||||
|
||||
class TargetsList
|
||||
{
|
||||
private:
|
||||
size_t iterateTarget(Targetable * previous);
|
||||
public:
|
||||
TargetsList();
|
||||
TargetsList(Targetable * _targets[], int nbtargets);
|
||||
@@ -28,7 +30,7 @@ public:
|
||||
Interruptible * getNextInterruptible(Interruptible * previous, int type);
|
||||
Spell * getNextSpellTarget(Spell * previous = 0);
|
||||
Damage * getNextDamageTarget(Damage * previous = 0);
|
||||
Targetable * getNextTarget(Targetable * previous = 0, int type = -1);
|
||||
Targetable * getNextTarget(Targetable * previous = 0);
|
||||
void initTargets()
|
||||
{
|
||||
targets.clear();
|
||||
|
||||
Reference in New Issue
Block a user