- fixed the "may" ability a little bit (needs testing: can it be called only once ???)
- Added "Clone", yay :)
This commit is contained in:
wagic.the.homebrew@gmail.com
2009-04-01 12:59:53 +00:00
parent 60b35f7f7f
commit bdf989ffac
12 changed files with 201 additions and 25 deletions
+23
View File
@@ -333,6 +333,25 @@ int AbilityFactory::magicText(int id, Spell * spell, MTGCardInstance * card){
continue;
}
//Copy a target
found = s.find("copy ");
if (found != string::npos){
if (dryMode) return BAKA_EFFECT_GOOD; //TODO :
if (tc){
ACopier * a = NEW ACopier(id,card,tc,cost);
if (may){
game->addObserver(NEW MayAbility(id,a,card));
OutputDebugString("may!\n");
}else{
game->addObserver(a);
}
}else{
//TODO
}
result++;
continue;
}
//Bury
found = s.find("bury");
if (found != string::npos){
@@ -1553,6 +1572,7 @@ MTGAbility::MTGAbility(int id, MTGCardInstance * card):ActionElement(id){
target = card;
aType = MTGAbility::UNKNOWN;
cost = NULL;
forceDestroy = 0;
}
MTGAbility::MTGAbility(int id, MTGCardInstance * _source,Damageable * _target ):ActionElement(id){
@@ -1561,6 +1581,7 @@ MTGAbility::MTGAbility(int id, MTGCardInstance * _source,Damageable * _target ):
target = _target;
aType = MTGAbility::UNKNOWN;
cost = NULL;
forceDestroy = 0;
}
MTGAbility::~MTGAbility(){
@@ -1570,6 +1591,8 @@ MTGAbility::~MTGAbility(){
//returns 1 if this ability needs to be removed from the list of active abilities
int MTGAbility::testDestroy(){
if (game->mLayers->stackLayer()->has(this)) return 0;
if (waitingForAnswer) return 0;
if (forceDestroy) return 1;
if (!game->isInPlay(source) ){
OutputDebugString("Destroying Ability !!!\n");
return 1;
+41
View File
@@ -31,6 +31,47 @@ MTGCardInstance::MTGCardInstance(MTGCard * card, MTGPlayerCards * _belongs_to):
}
void MTGCardInstance::copy(MTGCardInstance * card){
MTGCard * source = card->model;
for (int i = 0; i< Constants::NB_BASIC_ABILITIES; i++){
basicAbilities[i] = source->basicAbilities[i];
}
for (int i = 0; i< MAX_TYPES_PER_CARD; i++){
types[i] = source->types[i];
}
nb_types = source->nb_types;
for (int i = 0; i< Constants::MTG_NB_COLORS; i++){
colors[i] = source->colors[i];
}
manaCost.copy(source->getManaCost());
text = source->text;
name = source->name;
//strcpy(image_name, source->image_name);
//rarity = source->rarity;
power = source->power;
toughness = source->toughness;
life = toughness;
lifeOrig = life;
//mtgid = source->mtgid;
//setId = source->setId;
formattedTextInit = 0;
magicText = source->magicText;
spellTargetType = source->spellTargetType;
alias = source->alias;
//Now this is dirty...
int backupid = mtgid;
mtgid = source->getId();
Spell * spell = NEW Spell(this);
AbilityFactory af;
GameObserver * g = GameObserver::GetInstance();
af.addAbilities(g->mLayers->actionLayer()->getMaxId(), spell);
delete spell;
mtgid = backupid;
}
MTGCardInstance::~MTGCardInstance(){
LOG("==Deleting MTGCardInstance==");
SAFE_DELETE(blockers);