Erwan
-Fix issue 206 (rain of filth)
This commit is contained in:
@@ -284,6 +284,7 @@ prowess_of_the_fair3.txt
|
||||
pygmy_troll.txt
|
||||
pyroclasm.txt
|
||||
quilled_sliver.txt
|
||||
rain_of_filth_i206.txt
|
||||
rampant_growth.txt
|
||||
ray_of_command.txt
|
||||
ray_of_command_i176.txt
|
||||
|
||||
@@ -19,6 +19,7 @@ public:
|
||||
virtual int doPay() = 0;
|
||||
virtual void Render(){};
|
||||
virtual int setSource(MTGCardInstance * _source);
|
||||
virtual ExtraCost* clone() const = 0;
|
||||
};
|
||||
|
||||
class ExtraCosts{
|
||||
@@ -35,6 +36,7 @@ public:
|
||||
int reset();
|
||||
int setAction(MTGAbility * _action, MTGCardInstance * _source);
|
||||
void Dump();
|
||||
ExtraCosts * clone() const;
|
||||
};
|
||||
|
||||
class SacrificeCost: public ExtraCost{
|
||||
@@ -46,6 +48,7 @@ public:
|
||||
virtual int doPay();
|
||||
virtual void Render();
|
||||
virtual int setSource(MTGCardInstance * _source);
|
||||
virtual SacrificeCost * clone() const;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -53,6 +53,7 @@ class TargetChooser: public TargetsList {
|
||||
virtual int ready(){return cursor;};
|
||||
virtual ~TargetChooser(){};
|
||||
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);
|
||||
virtual bool canTarget(Targetable * _card);
|
||||
int setAllZones();
|
||||
virtual TargetZoneChooser * clone() const;
|
||||
};
|
||||
|
||||
class CardTargetChooser:public TargetZoneChooser {
|
||||
@@ -83,6 +85,7 @@ protected:
|
||||
public:
|
||||
CardTargetChooser(MTGCardInstance * card, MTGCardInstance * source, int * zones = NULL, int nbzones = 0);
|
||||
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(MTGCardInstance * card = NULL, int _maxtargets = 1, bool other = false);
|
||||
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(MTGCardInstance * card = NULL, int _maxtargets = 1, bool other = false):CreatureTargetChooser(card, _maxtargets,other){};
|
||||
virtual bool canTarget(Targetable * target);
|
||||
virtual DamageableTargetChooser * clone() const;
|
||||
};
|
||||
|
||||
|
||||
@@ -111,6 +116,7 @@ protected:
|
||||
public:
|
||||
PlayerTargetChooser(MTGCardInstance * card = NULL, int _maxtargets = 1, Player *_p = NULL);
|
||||
virtual bool canTarget(Targetable * target);
|
||||
virtual PlayerTargetChooser * clone() const;
|
||||
};
|
||||
|
||||
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);
|
||||
void addType(int type);
|
||||
void addType(const char * type);
|
||||
virtual bool canTarget(Targetable * targe);
|
||||
virtual bool canTarget(Targetable * target);
|
||||
virtual TypeTargetChooser * clone() const;
|
||||
};
|
||||
|
||||
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);
|
||||
virtual bool canTarget(Targetable * target);
|
||||
~DescriptorTargetChooser();
|
||||
virtual DescriptorTargetChooser * clone() const;
|
||||
};
|
||||
|
||||
|
||||
@@ -139,6 +147,7 @@ class SpellTargetChooser:public TargetChooser{
|
||||
int color;
|
||||
SpellTargetChooser( MTGCardInstance * card = NULL,int _color = -1, int _maxtargets = 1 , bool other = false);
|
||||
virtual bool canTarget(Targetable * target);
|
||||
virtual SpellTargetChooser * clone() const;
|
||||
};
|
||||
|
||||
class SpellOrPermanentTargetChooser:public TargetZoneChooser{
|
||||
@@ -146,6 +155,7 @@ class SpellOrPermanentTargetChooser:public TargetZoneChooser{
|
||||
int color;
|
||||
SpellOrPermanentTargetChooser(MTGCardInstance * card = NULL,int _color = -1 , int _maxtargets = 1, bool other = false);
|
||||
virtual bool canTarget(Targetable * target);
|
||||
virtual SpellOrPermanentTargetChooser * clone() const;
|
||||
};
|
||||
|
||||
|
||||
@@ -156,6 +166,7 @@ class DamageTargetChooser:public TargetChooser{
|
||||
int state;
|
||||
DamageTargetChooser( MTGCardInstance * card = NULL,int _color = -1 , int _maxtargets = 1, int state = NOT_RESOLVED);
|
||||
virtual bool canTarget(Targetable * target);
|
||||
virtual DamageTargetChooser * clone() const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "../include/TargetChooser.h"
|
||||
#include "../include/MTGCardInstance.h"
|
||||
#include "../include/Translate.h"
|
||||
#include "../include/config.h"
|
||||
#include <JGE.h>
|
||||
|
||||
ExtraCost::ExtraCost( TargetChooser *_tc):tc(_tc){
|
||||
@@ -12,13 +13,19 @@ ExtraCost::~ExtraCost(){
|
||||
SAFE_DELETE(tc);
|
||||
}
|
||||
|
||||
|
||||
int ExtraCost::setSource(MTGCardInstance * _source){
|
||||
source=_source;
|
||||
if (tc){ tc->source = _source; tc->targetter = _source;}
|
||||
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){
|
||||
if (tc) tc->targetter = NULL; //Sacrificing is not targetting, protections do not apply
|
||||
target = NULL;
|
||||
@@ -75,6 +82,15 @@ ExtraCosts::ExtraCosts(){
|
||||
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(){
|
||||
//TODO cool window and stuff...
|
||||
for (size_t i = 0; i < costs.size(); i++){
|
||||
|
||||
@@ -183,7 +183,6 @@ void GameStateAwards::Update(float dt)
|
||||
|
||||
bool GameStateAwards::enterSet(int setid){
|
||||
MTGSetInfo * si = setlist.getInfo(setid);
|
||||
char buf[1024];
|
||||
map<int, MTGCard *>::iterator it;
|
||||
|
||||
if(!si)
|
||||
|
||||
@@ -135,7 +135,7 @@ void GameStateDeckViewer::Start()
|
||||
char buf[512];
|
||||
for (int i=0; i < 8; 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);
|
||||
}
|
||||
|
||||
@@ -233,7 +233,7 @@ void GameStateDeckViewer::Update(float dt)
|
||||
//Prevent screen from updating.
|
||||
return;
|
||||
}
|
||||
hudAlpha = 255-(last_user_activity * 500);
|
||||
hudAlpha = (float) 255-(last_user_activity * 500);
|
||||
if (hudAlpha < 0) hudAlpha = 0;
|
||||
if (sellMenu){
|
||||
sellMenu->Update(dt);
|
||||
@@ -889,7 +889,7 @@ void GameStateDeckViewer::renderOnScreenMenu(){
|
||||
sprintf(buffer, ((*countPerCostAndColor)[i][j]>0)?_("%i").c_str():".", (*countPerCostAndColor)[i][j]);
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
@@ -17,17 +17,10 @@ void MTGGamePhase::Update(float dt){
|
||||
activeState = ACTIVE;
|
||||
animation = 4;
|
||||
currentState = newState;
|
||||
|
||||
switch (currentState){
|
||||
|
||||
default: break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (animation > 0){
|
||||
// fprintf(stderr, "animation = %f", animation);
|
||||
animation -- ;
|
||||
}else{
|
||||
activeState = INACTIVE;
|
||||
|
||||
@@ -125,9 +125,8 @@ ManaCost::~ManaCost(){
|
||||
for (unsigned int i = 0; i < nbhybrids ; i++){
|
||||
SAFE_DELETE(hybrids[i]);
|
||||
}
|
||||
if (!extraCostsIsCopy) {
|
||||
SAFE_DELETE(extraCosts);
|
||||
}
|
||||
|
||||
SAFE_DELETE(extraCosts);
|
||||
|
||||
SAFE_DELETE(kicker);
|
||||
}
|
||||
@@ -165,11 +164,9 @@ void ManaCost::copy(ManaCost * _manaCost){
|
||||
}
|
||||
nbhybrids = _manaCost->nbhybrids;
|
||||
|
||||
SAFE_DELETE(extraCosts);
|
||||
if (_manaCost->extraCosts){
|
||||
//TODO Deep copy ?
|
||||
if(!extraCostsIsCopy) SAFE_DELETE(extraCosts);
|
||||
extraCosts = _manaCost->extraCosts;
|
||||
extraCostsIsCopy = 1;
|
||||
extraCosts = _manaCost->extraCosts->clone();
|
||||
}
|
||||
|
||||
SAFE_DELETE(kicker);
|
||||
|
||||
@@ -353,6 +353,11 @@ bool CardTargetChooser::canTarget(Targetable * target ){
|
||||
return false;
|
||||
}
|
||||
|
||||
CardTargetChooser * CardTargetChooser::clone() const{
|
||||
CardTargetChooser * a = NEW CardTargetChooser(*this);
|
||||
return a;
|
||||
}
|
||||
|
||||
/**
|
||||
Choose anything that has a given list of types
|
||||
**/
|
||||
@@ -410,6 +415,11 @@ bool TypeTargetChooser::canTarget(Targetable * target){
|
||||
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
|
||||
@@ -450,6 +460,13 @@ DescriptorTargetChooser::~DescriptorTargetChooser(){
|
||||
SAFE_DELETE(cd);
|
||||
}
|
||||
|
||||
DescriptorTargetChooser * DescriptorTargetChooser ::clone() const{
|
||||
DescriptorTargetChooser * a = NEW DescriptorTargetChooser (*this);
|
||||
a->cd = NEW CardDescriptor(*cd);
|
||||
return a;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Choose a creature
|
||||
**/
|
||||
@@ -484,6 +501,11 @@ bool CreatureTargetChooser::canTarget(Targetable * target){
|
||||
return false;
|
||||
}
|
||||
|
||||
CreatureTargetChooser * CreatureTargetChooser::clone() const{
|
||||
CreatureTargetChooser * a = NEW CreatureTargetChooser(*this);
|
||||
return a;
|
||||
}
|
||||
|
||||
|
||||
/* TargetzoneChooser targets everything in a given zone */
|
||||
TargetZoneChooser::TargetZoneChooser(MTGCardInstance * card, int _maxtargets, bool other):TargetChooser(card,_maxtargets, other){
|
||||
@@ -549,6 +571,11 @@ bool TargetZoneChooser::targetsZone(MTGGameZone * z){
|
||||
return false;
|
||||
}
|
||||
|
||||
TargetZoneChooser * TargetZoneChooser::clone() const{
|
||||
TargetZoneChooser * a = NEW TargetZoneChooser(*this);
|
||||
return a;
|
||||
}
|
||||
|
||||
/* Player Target */
|
||||
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);
|
||||
}
|
||||
|
||||
PlayerTargetChooser* PlayerTargetChooser::clone() const{
|
||||
PlayerTargetChooser * a = NEW PlayerTargetChooser(*this);
|
||||
return a;
|
||||
}
|
||||
|
||||
|
||||
/*Damageable Target */
|
||||
bool DamageableTargetChooser::canTarget(Targetable * target){
|
||||
if (target->typeAsTarget() == TARGET_PLAYER){
|
||||
@@ -565,6 +598,10 @@ bool DamageableTargetChooser::canTarget(Targetable * target){
|
||||
return CreatureTargetChooser::canTarget(target);
|
||||
}
|
||||
|
||||
DamageableTargetChooser* DamageableTargetChooser::clone() const{
|
||||
DamageableTargetChooser * a = NEW DamageableTargetChooser(*this);
|
||||
return a;
|
||||
}
|
||||
|
||||
/*Spell */
|
||||
|
||||
@@ -588,6 +625,10 @@ bool SpellTargetChooser::canTarget(Targetable * target){
|
||||
return false;
|
||||
}
|
||||
|
||||
SpellTargetChooser* SpellTargetChooser::clone() const{
|
||||
SpellTargetChooser * a = NEW SpellTargetChooser(*this);
|
||||
return a;
|
||||
}
|
||||
|
||||
/*Spell or Permanent */
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
SpellOrPermanentTargetChooser* SpellOrPermanentTargetChooser::clone() const{
|
||||
SpellOrPermanentTargetChooser * a = NEW SpellOrPermanentTargetChooser(*this);
|
||||
return a;
|
||||
}
|
||||
|
||||
/*Damage */
|
||||
DamageTargetChooser::DamageTargetChooser(MTGCardInstance * card,int _color, int _maxtargets, int _state):TargetChooser(card, _maxtargets){
|
||||
@@ -632,3 +676,8 @@ bool DamageTargetChooser::canTarget(Targetable * target){
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
DamageTargetChooser* DamageTargetChooser::clone() const{
|
||||
DamageTargetChooser * a = NEW DamageTargetChooser(*this);
|
||||
return a;
|
||||
}
|
||||
Reference in New Issue
Block a user