-fixed "lord changes controller" bug
This commit is contained in:
wagic.the.homebrew@gmail.com
2009-07-05 04:49:21 +00:00
parent 20a0322ebb
commit ddc4636bf6
9 changed files with 310 additions and 116 deletions
+4 -4
View File
@@ -1251,7 +1251,7 @@ class ALord:public ListMaintainerAbility{
map<MTGCardInstance *, MTGAbility *> regenerations;
ALord(int _id, MTGCardInstance * card, TargetChooser * _tc, int _includeSelf, int _power = 0 , int _toughness = 0, int _ability = -1, ManaCost * _regenCost = NULL, int _modifier = 1):ListMaintainerAbility(_id,card){
tc = _tc;
tc->source = NULL;
tc->targetter = NULL;
includeSelf = _includeSelf;
power = _power;
toughness = _toughness;
@@ -1334,7 +1334,7 @@ class AForeach:public ListMaintainerAbility{
int includeSelf;
AForeach(int _id, MTGCardInstance * card,MTGCardInstance * _target, TargetChooser * _tc, int _includeSelf, int _power = 0 , int _toughness = 0):ListMaintainerAbility(_id,card,_target){
tc = _tc;
tc->source = NULL;
tc->targetter = NULL;
includeSelf = _includeSelf;
power = _power;
toughness = _toughness;
@@ -1673,7 +1673,7 @@ class AAladdinsLamp: public TargetAbility{
cost = NEW ManaCost();
cost->x();
cd = CardDisplay(1,game,SCREEN_WIDTH/2, SCREEN_HEIGHT/2,NULL);
MTGGameZone * zones[] = {game->currentPlayer->game->library};
int zones[] = {MTGGameZone::MY_LIBRARY};
tc = NEW TargetZoneChooser(zones,1,source);
nbcards = 0;
init = 0;
@@ -2038,7 +2038,7 @@ class ADingusEgg: public ListMaintainerAbility{
class ADisruptingScepter:public TargetAbility{
public:
ADisruptingScepter(int id, MTGCardInstance * _source):TargetAbility(id,_source){
MTGGameZone * zones[] = {GameObserver::GetInstance()->opponent()->game->hand};
int zones[] = {MTGGameZone::OPPONENT_HAND};
tc = NEW TargetZoneChooser(zones,1,_source);
int _cost[] = {Constants::MTG_COLOR_ARTIFACT, 3};
cost = NEW ManaCost(_cost,1);
+48
View File
@@ -18,6 +18,52 @@ class MTGGameZone {
protected:
public:
enum{
MY_GRAVEYARD = 11,
OPPONENT_GRAVEYARD = 12,
TARGET_OWNER_GRAVEYARD = 13,
TARGET_CONTROLLER_GRAVEYARD = 14,
GRAVEYARD = 15,
OWNER_GRAVEYARD = 16,
MY_BATTLEFIELD = 21,
OPPONENT_BATTLEFIELD = 22,
TARGET_OWNER_BATTLEFIELD = 23,
TARGET_CONTROLLER_BATTLEFIELD = 24,
BATTLEFIELD = 25,
OWNER_BATTLEFIELD = 26,
MY_HAND = 31,
OPPONENT_HAND = 32,
TARGET_OWNER_HAND = 33,
TARGET_CONTROLLER_HAND = 34,
HAND = 35,
OWNER_HAND = 36,
MY_EXILE = 41,
OPPONENT_EXILE = 42,
TARGET_OWNER_EXILE = 43,
TARGET_CONTROLLER_EXILE = 44,
EXILE = 45,
OWNER_EXILE = 46,
MY_LIBRARY = 51,
OPPONENT_LIBRARY = 52,
TARGET_OWNER_LIBRARY = 53,
TARGET_CONTROLLER_LIBRARY = 54,
LIBRARY = 55,
OWNER_LIBRARY = 56,
MY_STACK = 61,
OPPONENT_STACK = 62,
TARGET_OWNER_STACK = 63,
TARGET_CONTROLLER_STACK = 64,
STACK = 65,
OWNER_STACK = 66,
};
Player * owner;
//Both cards and cardsMap contain the cards of a zone. The long term objective is to get rid of the array
vector<MTGCardInstance *> cards; //[MTG_MAX_PLAYER_CARDS];
@@ -37,6 +83,8 @@ class MTGGameZone {
void setOwner(Player * player);
MTGCardInstance * lastCardDrawn;
static MTGGameZone * stringToZone(string zoneName, MTGCardInstance * source, MTGCardInstance * target);
static int zoneStringToId(string zoneName);
static MTGGameZone *intToZone(int zoneId, MTGCardInstance * source = NULL,MTGCardInstance * target = NULL);
};
class MTGLibrary: public MTGGameZone {
+9 -8
View File
@@ -29,7 +29,8 @@ class TargetChooser: public TargetsList {
public:
TargetChooser(MTGCardInstance * card = NULL, int _maxtargets = -1);
MTGCardInstance * source; //Optionnal source, used for protection from...
MTGCardInstance * source;
MTGCardInstance * targetter; //Optional, usually equals source, used for protection from...
int maxtargets; //Set to -1 for "unlimited"
virtual int targetsZone(MTGGameZone * z){return 0;};
int ForceTargetListReady();
@@ -64,12 +65,12 @@ public:
class TargetZoneChooser:public TargetChooser{
public:
MTGGameZone * zones[10];
int zones[10];
int nbzones;
int init(MTGGameZone ** _zones, int _nbzones);
int init(int * _zones, int _nbzones);
int targetsZone(MTGGameZone * z);
TargetZoneChooser(MTGCardInstance * card = NULL, int _maxtargets = 1);
TargetZoneChooser(MTGGameZone ** _zones, int _nbzones, MTGCardInstance * card = NULL, int _maxtargets = 1);
TargetZoneChooser(int * _zones, int _nbzones, MTGCardInstance * card = NULL, int _maxtargets = 1);
virtual int canTarget(Targetable * _card);
};
@@ -77,7 +78,7 @@ class CreatureTargetChooser:public TargetZoneChooser{
public:
int maxpower;
int maxtoughness;
CreatureTargetChooser(MTGGameZone ** _zones, int _nbzones,MTGCardInstance * card = NULL, int _maxtargets = 1);
CreatureTargetChooser(int * _zones, int _nbzones,MTGCardInstance * card = NULL, int _maxtargets = 1);
CreatureTargetChooser(MTGCardInstance * card = NULL, int _maxtargets = 1);
virtual int canTarget(Targetable * _card);
@@ -86,7 +87,7 @@ class CreatureTargetChooser:public TargetZoneChooser{
class DamageableTargetChooser:public CreatureTargetChooser{
public:
DamageableTargetChooser(MTGGameZone ** _zones, int _nbzones,MTGCardInstance * card = NULL, int _maxtargets = 1):CreatureTargetChooser( _zones,_nbzones, card, _maxtargets){};
DamageableTargetChooser(int * _zones, int _nbzones,MTGCardInstance * card = NULL, int _maxtargets = 1):CreatureTargetChooser( _zones,_nbzones, card, _maxtargets){};
DamageableTargetChooser(MTGCardInstance * card = NULL, int _maxtargets = 1):CreatureTargetChooser(card, _maxtargets){};
virtual int canTarget(Targetable * target);
};
@@ -105,7 +106,7 @@ class TypeTargetChooser:public TargetZoneChooser{
int nbtypes;
int types[10];
TypeTargetChooser(const char * _type, MTGCardInstance * card = NULL, int _maxtargets = 1);
TypeTargetChooser(const char * _type, MTGGameZone ** _zones, int nbzones, MTGCardInstance * card = NULL, int _maxtargets = 1);
TypeTargetChooser(const char * _type, int * _zones, int nbzones, MTGCardInstance * card = NULL, int _maxtargets = 1);
void addType(int type);
void addType(const char * type);
virtual int canTarget(Targetable * targe);
@@ -115,7 +116,7 @@ class DescriptorTargetChooser:public TargetZoneChooser{
public:
CardDescriptor * cd;
DescriptorTargetChooser(CardDescriptor * _cd, MTGCardInstance * card = NULL, int _maxtargets = 1);
DescriptorTargetChooser(CardDescriptor * _cd, MTGGameZone ** _zones, int nbzones, MTGCardInstance * card = NULL, int _maxtargets = 1);
DescriptorTargetChooser(CardDescriptor * _cd, int * _zones, int nbzones, MTGCardInstance * card = NULL, int _maxtargets = 1);
virtual int canTarget(Targetable * target);
~DescriptorTargetChooser();
};