-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
+17 -1
View File
@@ -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++){
-1
View File
@@ -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)
+3 -3
View File
@@ -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;
}
-7
View File
@@ -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;
+4 -7
View File
@@ -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);
+50 -1
View File
@@ -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;
}