-Fix issue 206 (rain of filth)
This commit is contained in:
wagic.the.homebrew@gmail.com
2009-12-13 09:33:51 +00:00
parent f7bd1dcef4
commit ee3286ff2a
10 changed files with 90 additions and 21 deletions
+1
View File
@@ -284,6 +284,7 @@ prowess_of_the_fair3.txt
pygmy_troll.txt pygmy_troll.txt
pyroclasm.txt pyroclasm.txt
quilled_sliver.txt quilled_sliver.txt
rain_of_filth_i206.txt
rampant_growth.txt rampant_growth.txt
ray_of_command.txt ray_of_command.txt
ray_of_command_i176.txt ray_of_command_i176.txt
+3
View File
@@ -19,6 +19,7 @@ public:
virtual int doPay() = 0; virtual int doPay() = 0;
virtual void Render(){}; virtual void Render(){};
virtual int setSource(MTGCardInstance * _source); virtual int setSource(MTGCardInstance * _source);
virtual ExtraCost* clone() const = 0;
}; };
class ExtraCosts{ class ExtraCosts{
@@ -35,6 +36,7 @@ public:
int reset(); int reset();
int setAction(MTGAbility * _action, MTGCardInstance * _source); int setAction(MTGAbility * _action, MTGCardInstance * _source);
void Dump(); void Dump();
ExtraCosts * clone() const;
}; };
class SacrificeCost: public ExtraCost{ class SacrificeCost: public ExtraCost{
@@ -46,6 +48,7 @@ public:
virtual int doPay(); virtual int doPay();
virtual void Render(); virtual void Render();
virtual int setSource(MTGCardInstance * _source); virtual int setSource(MTGCardInstance * _source);
virtual SacrificeCost * clone() const;
}; };
#endif #endif
+12 -1
View File
@@ -53,6 +53,7 @@ class TargetChooser: public TargetsList {
virtual int ready(){return cursor;}; virtual int ready(){return cursor;};
virtual ~TargetChooser(){}; virtual ~TargetChooser(){};
int targetListSet(); int targetListSet();
virtual TargetChooser* clone() const = 0;
}; };
@@ -75,6 +76,7 @@ class TargetZoneChooser:public TargetChooser{
TargetZoneChooser(int * _zones, int _nbzones, MTGCardInstance * card = NULL, int _maxtargets = 1, bool other = false); TargetZoneChooser(int * _zones, int _nbzones, MTGCardInstance * card = NULL, int _maxtargets = 1, bool other = false);
virtual bool canTarget(Targetable * _card); virtual bool canTarget(Targetable * _card);
int setAllZones(); int setAllZones();
virtual TargetZoneChooser * clone() const;
}; };
class CardTargetChooser:public TargetZoneChooser { class CardTargetChooser:public TargetZoneChooser {
@@ -83,6 +85,7 @@ protected:
public: public:
CardTargetChooser(MTGCardInstance * card, MTGCardInstance * source, int * zones = NULL, int nbzones = 0); CardTargetChooser(MTGCardInstance * card, MTGCardInstance * source, int * zones = NULL, int nbzones = 0);
virtual bool canTarget(Targetable * target); virtual bool canTarget(Targetable * target);
virtual CardTargetChooser * clone() const;
}; };
@@ -93,6 +96,7 @@ class CreatureTargetChooser:public TargetZoneChooser{
CreatureTargetChooser(int * _zones, int _nbzones,MTGCardInstance * card = NULL, int _maxtargets = 1, bool other = false); CreatureTargetChooser(int * _zones, int _nbzones,MTGCardInstance * card = NULL, int _maxtargets = 1, bool other = false);
CreatureTargetChooser(MTGCardInstance * card = NULL, int _maxtargets = 1, bool other = false); CreatureTargetChooser(MTGCardInstance * card = NULL, int _maxtargets = 1, bool other = false);
virtual bool canTarget(Targetable * _card); virtual bool canTarget(Targetable * _card);
virtual CreatureTargetChooser * clone() const;
}; };
@@ -102,6 +106,7 @@ class DamageableTargetChooser:public CreatureTargetChooser{
DamageableTargetChooser(int * _zones, int _nbzones,MTGCardInstance * card = NULL, int _maxtargets = 1, bool other = false):CreatureTargetChooser( _zones,_nbzones, card, _maxtargets,other){}; DamageableTargetChooser(int * _zones, int _nbzones,MTGCardInstance * card = NULL, int _maxtargets = 1, bool other = false):CreatureTargetChooser( _zones,_nbzones, card, _maxtargets,other){};
DamageableTargetChooser(MTGCardInstance * card = NULL, int _maxtargets = 1, bool other = false):CreatureTargetChooser(card, _maxtargets,other){}; DamageableTargetChooser(MTGCardInstance * card = NULL, int _maxtargets = 1, bool other = false):CreatureTargetChooser(card, _maxtargets,other){};
virtual bool canTarget(Targetable * target); virtual bool canTarget(Targetable * target);
virtual DamageableTargetChooser * clone() const;
}; };
@@ -111,6 +116,7 @@ protected:
public: public:
PlayerTargetChooser(MTGCardInstance * card = NULL, int _maxtargets = 1, Player *_p = NULL); PlayerTargetChooser(MTGCardInstance * card = NULL, int _maxtargets = 1, Player *_p = NULL);
virtual bool canTarget(Targetable * target); virtual bool canTarget(Targetable * target);
virtual PlayerTargetChooser * clone() const;
}; };
class TypeTargetChooser:public TargetZoneChooser{ class TypeTargetChooser:public TargetZoneChooser{
@@ -121,7 +127,8 @@ class TypeTargetChooser:public TargetZoneChooser{
TypeTargetChooser(const char * _type, int * _zones, int nbzones, MTGCardInstance * card = NULL, int _maxtargets = 1, bool other = false); TypeTargetChooser(const char * _type, int * _zones, int nbzones, MTGCardInstance * card = NULL, int _maxtargets = 1, bool other = false);
void addType(int type); void addType(int type);
void addType(const char * type); void addType(const char * type);
virtual bool canTarget(Targetable * targe); virtual bool canTarget(Targetable * target);
virtual TypeTargetChooser * clone() const;
}; };
class DescriptorTargetChooser:public TargetZoneChooser{ class DescriptorTargetChooser:public TargetZoneChooser{
@@ -131,6 +138,7 @@ class DescriptorTargetChooser:public TargetZoneChooser{
DescriptorTargetChooser(CardDescriptor * _cd, int * _zones, int nbzones, MTGCardInstance * card = NULL, int _maxtargets = 1, bool other = false); DescriptorTargetChooser(CardDescriptor * _cd, int * _zones, int nbzones, MTGCardInstance * card = NULL, int _maxtargets = 1, bool other = false);
virtual bool canTarget(Targetable * target); virtual bool canTarget(Targetable * target);
~DescriptorTargetChooser(); ~DescriptorTargetChooser();
virtual DescriptorTargetChooser * clone() const;
}; };
@@ -139,6 +147,7 @@ class SpellTargetChooser:public TargetChooser{
int color; int color;
SpellTargetChooser( MTGCardInstance * card = NULL,int _color = -1, int _maxtargets = 1 , bool other = false); SpellTargetChooser( MTGCardInstance * card = NULL,int _color = -1, int _maxtargets = 1 , bool other = false);
virtual bool canTarget(Targetable * target); virtual bool canTarget(Targetable * target);
virtual SpellTargetChooser * clone() const;
}; };
class SpellOrPermanentTargetChooser:public TargetZoneChooser{ class SpellOrPermanentTargetChooser:public TargetZoneChooser{
@@ -146,6 +155,7 @@ class SpellOrPermanentTargetChooser:public TargetZoneChooser{
int color; int color;
SpellOrPermanentTargetChooser(MTGCardInstance * card = NULL,int _color = -1 , int _maxtargets = 1, bool other = false); SpellOrPermanentTargetChooser(MTGCardInstance * card = NULL,int _color = -1 , int _maxtargets = 1, bool other = false);
virtual bool canTarget(Targetable * target); virtual bool canTarget(Targetable * target);
virtual SpellOrPermanentTargetChooser * clone() const;
}; };
@@ -156,6 +166,7 @@ class DamageTargetChooser:public TargetChooser{
int state; int state;
DamageTargetChooser( MTGCardInstance * card = NULL,int _color = -1 , int _maxtargets = 1, int state = NOT_RESOLVED); DamageTargetChooser( MTGCardInstance * card = NULL,int _color = -1 , int _maxtargets = 1, int state = NOT_RESOLVED);
virtual bool canTarget(Targetable * target); virtual bool canTarget(Targetable * target);
virtual DamageTargetChooser * clone() const;
}; };
+17 -1
View File
@@ -2,6 +2,7 @@
#include "../include/TargetChooser.h" #include "../include/TargetChooser.h"
#include "../include/MTGCardInstance.h" #include "../include/MTGCardInstance.h"
#include "../include/Translate.h" #include "../include/Translate.h"
#include "../include/config.h"
#include <JGE.h> #include <JGE.h>
ExtraCost::ExtraCost( TargetChooser *_tc):tc(_tc){ ExtraCost::ExtraCost( TargetChooser *_tc):tc(_tc){
@@ -12,13 +13,19 @@ ExtraCost::~ExtraCost(){
SAFE_DELETE(tc); SAFE_DELETE(tc);
} }
int ExtraCost::setSource(MTGCardInstance * _source){ int ExtraCost::setSource(MTGCardInstance * _source){
source=_source; source=_source;
if (tc){ tc->source = _source; tc->targetter = _source;} if (tc){ tc->source = _source; tc->targetter = _source;}
return 1; return 1;
} }
SacrificeCost * SacrificeCost::clone() const{
SacrificeCost * ec = NEW SacrificeCost(*this);
if (tc) ec->tc = tc->clone();
return ec;
}
SacrificeCost::SacrificeCost(TargetChooser *_tc):ExtraCost(_tc){ SacrificeCost::SacrificeCost(TargetChooser *_tc):ExtraCost(_tc){
if (tc) tc->targetter = NULL; //Sacrificing is not targetting, protections do not apply if (tc) tc->targetter = NULL; //Sacrificing is not targetting, protections do not apply
target = NULL; target = NULL;
@@ -75,6 +82,15 @@ ExtraCosts::ExtraCosts(){
source = NULL; source = NULL;
} }
ExtraCosts * ExtraCosts::clone() const{
ExtraCosts * ec = NEW ExtraCosts(*this);
ec->costs.clear();
for (size_t i = 0; i < costs.size(); i++){
ec->costs.push_back(costs[i]->clone());
}
return ec;
}
void ExtraCosts::Render(){ void ExtraCosts::Render(){
//TODO cool window and stuff... //TODO cool window and stuff...
for (size_t i = 0; i < costs.size(); i++){ for (size_t i = 0; i < costs.size(); i++){
-1
View File
@@ -183,7 +183,6 @@ void GameStateAwards::Update(float dt)
bool GameStateAwards::enterSet(int setid){ bool GameStateAwards::enterSet(int setid){
MTGSetInfo * si = setlist.getInfo(setid); MTGSetInfo * si = setlist.getInfo(setid);
char buf[1024];
map<int, MTGCard *>::iterator it; map<int, MTGCard *>::iterator it;
if(!si) if(!si)
+3 -3
View File
@@ -135,7 +135,7 @@ void GameStateDeckViewer::Start()
char buf[512]; char buf[512];
for (int i=0; i < 8; i++){ for (int i=0; i < 8; i++){
sprintf(buf,"iconspsp%d",i); sprintf(buf,"iconspsp%d",i);
pspIcons[i] = resources.RetrieveQuad("iconspsp.png", i*32, 0, 32, 32,buf); pspIcons[i] = resources.RetrieveQuad("iconspsp.png", (float)i*32, 0, 32, 32,buf);
pspIcons[i]->SetHotSpot(16,16); pspIcons[i]->SetHotSpot(16,16);
} }
@@ -233,7 +233,7 @@ void GameStateDeckViewer::Update(float dt)
//Prevent screen from updating. //Prevent screen from updating.
return; return;
} }
hudAlpha = 255-(last_user_activity * 500); hudAlpha = (float) 255-(last_user_activity * 500);
if (hudAlpha < 0) hudAlpha = 0; if (hudAlpha < 0) hudAlpha = 0;
if (sellMenu){ if (sellMenu){
sellMenu->Update(dt); sellMenu->Update(dt);
@@ -889,7 +889,7 @@ void GameStateDeckViewer::renderOnScreenMenu(){
sprintf(buffer, ((*countPerCostAndColor)[i][j]>0)?_("%i").c_str():".", (*countPerCostAndColor)[i][j]); sprintf(buffer, ((*countPerCostAndColor)[i][j]>0)?_("%i").c_str():".", (*countPerCostAndColor)[i][j]);
font->DrawString(buffer, 64 + leftTransition + j*15, posY); font->DrawString(buffer, 64 + leftTransition + j*15, posY);
} }
r->FillRect(77 + leftTransition + (Constants::MTG_NB_COLORS-2)*15, posY + 2, (*countPerCost)[i]*5, 8, graphColor); r->FillRect((float)77 + leftTransition + (Constants::MTG_NB_COLORS-2)*15, posY + 2, (*countPerCost)[i]*5, 8, graphColor);
posY += 10; posY += 10;
} }
-7
View File
@@ -17,17 +17,10 @@ void MTGGamePhase::Update(float dt){
activeState = ACTIVE; activeState = ACTIVE;
animation = 4; animation = 4;
currentState = newState; currentState = newState;
switch (currentState){
default: break;
}
} }
if (animation > 0){ if (animation > 0){
// fprintf(stderr, "animation = %f", animation);
animation -- ; animation -- ;
}else{ }else{
activeState = INACTIVE; activeState = INACTIVE;
+4 -7
View File
@@ -125,9 +125,8 @@ ManaCost::~ManaCost(){
for (unsigned int i = 0; i < nbhybrids ; i++){ for (unsigned int i = 0; i < nbhybrids ; i++){
SAFE_DELETE(hybrids[i]); SAFE_DELETE(hybrids[i]);
} }
if (!extraCostsIsCopy) {
SAFE_DELETE(extraCosts); SAFE_DELETE(extraCosts);
}
SAFE_DELETE(kicker); SAFE_DELETE(kicker);
} }
@@ -165,11 +164,9 @@ void ManaCost::copy(ManaCost * _manaCost){
} }
nbhybrids = _manaCost->nbhybrids; nbhybrids = _manaCost->nbhybrids;
SAFE_DELETE(extraCosts);
if (_manaCost->extraCosts){ if (_manaCost->extraCosts){
//TODO Deep copy ? extraCosts = _manaCost->extraCosts->clone();
if(!extraCostsIsCopy) SAFE_DELETE(extraCosts);
extraCosts = _manaCost->extraCosts;
extraCostsIsCopy = 1;
} }
SAFE_DELETE(kicker); SAFE_DELETE(kicker);
+50 -1
View File
@@ -353,6 +353,11 @@ bool CardTargetChooser::canTarget(Targetable * target ){
return false; return false;
} }
CardTargetChooser * CardTargetChooser::clone() const{
CardTargetChooser * a = NEW CardTargetChooser(*this);
return a;
}
/** /**
Choose anything that has a given list of types Choose anything that has a given list of types
**/ **/
@@ -410,6 +415,11 @@ bool TypeTargetChooser::canTarget(Targetable * target){
return false; return false;
} }
TypeTargetChooser * TypeTargetChooser::clone() const{
TypeTargetChooser * a = NEW TypeTargetChooser(*this);
return a;
}
/** /**
A Target Chooser associated to a Card Descriptor object, for fine tuning of targets description A Target Chooser associated to a Card Descriptor object, for fine tuning of targets description
@@ -450,6 +460,13 @@ DescriptorTargetChooser::~DescriptorTargetChooser(){
SAFE_DELETE(cd); SAFE_DELETE(cd);
} }
DescriptorTargetChooser * DescriptorTargetChooser ::clone() const{
DescriptorTargetChooser * a = NEW DescriptorTargetChooser (*this);
a->cd = NEW CardDescriptor(*cd);
return a;
}
/** /**
Choose a creature Choose a creature
**/ **/
@@ -484,6 +501,11 @@ bool CreatureTargetChooser::canTarget(Targetable * target){
return false; return false;
} }
CreatureTargetChooser * CreatureTargetChooser::clone() const{
CreatureTargetChooser * a = NEW CreatureTargetChooser(*this);
return a;
}
/* TargetzoneChooser targets everything in a given zone */ /* TargetzoneChooser targets everything in a given zone */
TargetZoneChooser::TargetZoneChooser(MTGCardInstance * card, int _maxtargets, bool other):TargetChooser(card,_maxtargets, other){ TargetZoneChooser::TargetZoneChooser(MTGCardInstance * card, int _maxtargets, bool other):TargetChooser(card,_maxtargets, other){
@@ -549,6 +571,11 @@ bool TargetZoneChooser::targetsZone(MTGGameZone * z){
return false; return false;
} }
TargetZoneChooser * TargetZoneChooser::clone() const{
TargetZoneChooser * a = NEW TargetZoneChooser(*this);
return a;
}
/* Player Target */ /* Player Target */
PlayerTargetChooser::PlayerTargetChooser(MTGCardInstance * card, int _maxtargets, Player *p):TargetChooser(card, _maxtargets), p(p){ PlayerTargetChooser::PlayerTargetChooser(MTGCardInstance * card, int _maxtargets, Player *p):TargetChooser(card, _maxtargets), p(p){
} }
@@ -557,6 +584,12 @@ bool PlayerTargetChooser::canTarget(Targetable * target){
return (target->typeAsTarget() == TARGET_PLAYER) && (!p || p == (Player*)target); return (target->typeAsTarget() == TARGET_PLAYER) && (!p || p == (Player*)target);
} }
PlayerTargetChooser* PlayerTargetChooser::clone() const{
PlayerTargetChooser * a = NEW PlayerTargetChooser(*this);
return a;
}
/*Damageable Target */ /*Damageable Target */
bool DamageableTargetChooser::canTarget(Targetable * target){ bool DamageableTargetChooser::canTarget(Targetable * target){
if (target->typeAsTarget() == TARGET_PLAYER){ if (target->typeAsTarget() == TARGET_PLAYER){
@@ -565,6 +598,10 @@ bool DamageableTargetChooser::canTarget(Targetable * target){
return CreatureTargetChooser::canTarget(target); return CreatureTargetChooser::canTarget(target);
} }
DamageableTargetChooser* DamageableTargetChooser::clone() const{
DamageableTargetChooser * a = NEW DamageableTargetChooser(*this);
return a;
}
/*Spell */ /*Spell */
@@ -588,6 +625,10 @@ bool SpellTargetChooser::canTarget(Targetable * target){
return false; return false;
} }
SpellTargetChooser* SpellTargetChooser::clone() const{
SpellTargetChooser * a = NEW SpellTargetChooser(*this);
return a;
}
/*Spell or Permanent */ /*Spell or Permanent */
SpellOrPermanentTargetChooser::SpellOrPermanentTargetChooser(MTGCardInstance * card,int _color, int _maxtargets, bool other):TargetZoneChooser(card, _maxtargets, other){ SpellOrPermanentTargetChooser::SpellOrPermanentTargetChooser(MTGCardInstance * card,int _color, int _maxtargets, bool other):TargetZoneChooser(card, _maxtargets, other){
@@ -612,7 +653,10 @@ bool SpellOrPermanentTargetChooser::canTarget(Targetable * target){
return false; return false;
} }
SpellOrPermanentTargetChooser* SpellOrPermanentTargetChooser::clone() const{
SpellOrPermanentTargetChooser * a = NEW SpellOrPermanentTargetChooser(*this);
return a;
}
/*Damage */ /*Damage */
DamageTargetChooser::DamageTargetChooser(MTGCardInstance * card,int _color, int _maxtargets, int _state):TargetChooser(card, _maxtargets){ DamageTargetChooser::DamageTargetChooser(MTGCardInstance * card,int _color, int _maxtargets, int _state):TargetChooser(card, _maxtargets){
@@ -632,3 +676,8 @@ bool DamageTargetChooser::canTarget(Targetable * target){
} }
return false; return false;
} }
DamageTargetChooser* DamageTargetChooser::clone() const{
DamageTargetChooser * a = NEW DamageTargetChooser(*this);
return a;
}