- Added Tokens (needs testing !!!)
- Added a few cards that create tokens
This commit is contained in:
wagic.the.homebrew
2008-12-16 14:20:03 +00:00
parent be4fb31ffc
commit 9dfc89815f
24 changed files with 283 additions and 106 deletions
+65
View File
@@ -9,6 +9,7 @@
#include "Subtypes.h"
#include "CardGui.h"
#include "GameOptions.h"
#include "Token.h"
#include <JGui.h>
#include <hge/hgeparticle.h>
@@ -42,6 +43,70 @@ class ADrawer:public ActivatedAbility{
};
class ATokenCreator:public ActivatedAbility{
public:
list<int>abilities;
list<int>types;
list<int>colors;
int power, toughness;
string name;
ATokenCreator(int _id,MTGCardInstance * _source,ManaCost * _cost, string sname, string stypes,int _power,int _toughness, string sabilities, int _doTap):ActivatedAbility(_id,_source,_cost,0,_doTap){
power = _power;
toughness = _toughness;
name = sname;
//TODO this is a copy/past of other code that's all around the place, everything should be in a dedicated parser class;
for (int j = 0; j < NB_BASIC_ABILITIES; j++){
unsigned int found = sabilities.find(MTGBasicAbilities[j]);
if (found != string::npos){
abilities.push_back(j);
}
}
for (int j = 0; j < MTG_NB_COLORS; j++){
unsigned int found = sabilities.find(MTGColorStrings[j]);
if (found != string::npos){
colors.push_back(j);
}
}
string s = stypes;
while (s.size()){
unsigned int found = s.find(" ");
if (found != string::npos){
int id = Subtypes::subtypesList->Add(s.substr(0,found));
types.push_back(id);
s = s.substr(found+1);
}else{
int id = Subtypes::subtypesList->Add(s);
types.push_back(id);
s = "";
}
}
}
int resolve(){
Token * myToken = NEW Token(name,source,power,toughness);
list<int>::iterator it;
for ( it=types.begin() ; it != types.end(); it++ ){
myToken->addType(*it);
}
for ( it=colors.begin() ; it != colors.end(); it++ ){
myToken->setColor(*it);
}
for ( it=abilities.begin() ; it != abilities.end(); it++ ){
myToken->basicAbilities[*it] = 1;
}
Spell * spell = NEW Spell(myToken);
source->controller()->game->stack->addCard(myToken);
spell->resolve();
delete spell;
return 1;
}
};
//Moves Cards from a zone to another
class AZoneMover:public TargetAbility{
+1
View File
@@ -187,6 +187,7 @@ class AbilityFactory{
int countCards(TargetChooser * tc, Player * player = NULL, int option = 0);
int destroyAllInPlay(TargetChooser * tc, int bury = 0);
int putInPlayFromZone(MTGCardInstance * card, MTGGameZone * zone, Player * p);
int parsePowerToughness(string s, int *power, int *toughness);
Trigger * parseTrigger(string magicText);
public:
int magicText(int id, Spell * spell, MTGCardInstance * card = NULL);
+1 -1
View File
@@ -29,7 +29,6 @@ class MTGCard {
int mtgid;
TexturesCache * mCache;
ManaCost manaCost;
@@ -40,6 +39,7 @@ class MTGCard {
int init();
public:
TexturesCache * mCache;
string text;
string name;
int colors[MTG_NB_COLORS];
+1
View File
@@ -37,6 +37,7 @@ class MTGCardInstance: public MTGCard, public Damageable, public Targetable {
MTGCardInstance * getNextPartner();
void initMTGCI();
public:
bool isToken;
MTGGameZone * getCurrentZone();
int doDamageTest;
int summoningSickness;
+12
View File
@@ -0,0 +1,12 @@
#ifndef _TOKEN_H_
#define _TOKEN_H_
#include "MTGCardInstance.h"
class Token: public MTGCardInstance{
MTGCardInstance * tokenSource;
public:
Token(string _name, MTGCardInstance * source, int _power=0, int _toughness=0);
};
#endif