- code cleanup
This commit is contained in:
wagic.the.homebrew@gmail.com
2009-07-28 14:15:59 +00:00
parent cd1b5e3b3b
commit 62048ef486
5 changed files with 24 additions and 225 deletions
+2
View File
@@ -547,6 +547,8 @@ mana={2}{G}{G}
[card]
text=Destroy target Plains or Island. Cryoclasm deals 3 damage to that land's controller.
target=plains,island
auto=Damage:3 targetController
auto=destroy
id=129909
name=Cryoclasm
rarity=U
+2
View File
@@ -59,6 +59,8 @@ subtype=Aura
[/card]
[card]
text=Whenever a land comes into play, Ankh of Mishra deals 2 damage to that land's controller.
auto=@movedTo(land|opponentBattlefield): damage:2 opponent
auto=@movedTo(land|myBattlefield): damage:2 controller
id=1094
name=Ankh of Mishra
rarity=R
+4
View File
@@ -425,6 +425,8 @@ toughness=6
text=Destroy all artifacts and enchantments. You gain 2 life for each permanent destroyed this way.
id=146759
name=Fracturing Gust
auto=all(artifact,enchantment) life:2
auto=destroy all(artifact,enchantment)
rarity=R
type=Instant
mana={2}{GW}{GW}{GW}
@@ -799,6 +801,7 @@ toughness=1
text=Destroy target land. Poison the Well deals 2 damage to that land's controller.
id=147427
target=Land
auto=Damage:2 targetController
auto=destroy
name=Poison the Well
rarity=C
@@ -865,6 +868,7 @@ toughness=2
text=Destroy target artifact. Smash to Smithereens deals 3 damage to that artifact's controller.
id=158243
target=Artifact
auto=damage:3 targetController
auto=destroy
name=Smash to Smithereens
rarity=C
-169
View File
@@ -3225,31 +3225,6 @@ class APsychicVenom:public MTGAbility{
};
//1221 Serendib Efreet
class ASerendibEfreet:public MTGAbility{
public:
ASerendibEfreet(int _id, MTGCardInstance * _source):MTGAbility(_id, _source){
}
void Update(float dt){
if (newPhase == Constants::MTG_PHASE_UPKEEP && newPhase != currentPhase && game->currentPlayer == source->controller()){
game->mLayers->stackLayer()->addDamage(source,game->currentPlayer,1);
}
}
virtual ostream& toString(ostream& out) const
{
out << "ASerendibEfreet ::: (";
return MTGAbility::toString(out) << ")";
}
ASerendibEfreet * clone() const{
ASerendibEfreet * a = NEW ASerendibEfreet(*this);
a->isClone = 1;
return a;
}
};
//1235 Aspect of Wolf
class AAspectOfWolf:public ListMaintainerAbility{
public:
@@ -4059,47 +4034,6 @@ class ASeedbornMuse: public TriggeredAbility{
}
};
// Graveborn Muse
class AGravebornMuse: public TriggeredAbility{
public:
int nbcards_life;
AGravebornMuse(int _id, MTGCardInstance * _source):TriggeredAbility(_id, _source){
nbcards_life=0;
}
int trigger(){
if (newPhase != currentPhase && newPhase == Constants::MTG_PHASE_UPKEEP && ((MTGCardInstance *) source)->controller()== game->currentPlayer){
return 1;
}
return 0;
}
int resolve(){
for (int j = source->controller()->game->inPlay->nb_cards-1; j >=0 ; j--){
MTGCardInstance * current = source->controller()->game->inPlay->cards[j];
if (current->hasSubtype("zombie")){
nbcards_life++;
}
}
source->controller()->life-=nbcards_life;
game->mLayers->stackLayer()->addDraw(source->controller(),nbcards_life);
return 1;
}
virtual ostream& toString(ostream& out) const
{
out << "AGravebornMuse ::: nbcards_life : " << nbcards_life
<< " (";
return TriggeredAbility::toString(out) << ")";
}
AGravebornMuse * clone() const{
AGravebornMuse * a = NEW AGravebornMuse(*this);
a->isClone = 1;
return a;
}
};
//Instant Steal control of a target
class AInstantControlSteal: public InstantAbility{
public:
@@ -4184,109 +4118,6 @@ class AAngelicChorus: public ListMaintainerAbility{
}
};
//Life/Damage for type removed/added from game - Generic Ankh of Mishra/dingus Egg
class ALifeModifierPutinplay: public ListMaintainerAbility{
public:
int init;
int life;
int PlayerTarget;
int AddOrRemove;
ALifeModifierPutinplay(int id, MTGCardInstance * _source,TargetChooser * _tc, int _life, int _PlayerTarget, int _AddOrRemove):ListMaintainerAbility(id, _source){
init = 0;
tc = _tc;
PlayerTarget = _PlayerTarget;
AddOrRemove = _AddOrRemove;
life = _life;
}
void Update(float dt){
ListMaintainerAbility::Update(dt);
init = 1;
}
int canBeInList(MTGCardInstance * card){
if (tc->canTarget(card)) return 1;
return 0;
}
int added(MTGCardInstance * card){
if (!init) return 0;
if (AddOrRemove == 1){
if (life < 0){
int damage = life * -1;
if (PlayerTarget == 2){
game->mLayers->stackLayer()->addDamage(source,card->controller(), damage);
}
if (PlayerTarget == 1){
game->mLayers->stackLayer()->addDamage(source,source->controller(), damage);
}
if (PlayerTarget == 0){
game->mLayers->stackLayer()->addDamage(source,source->controller()->opponent(), damage);
}
}
if (life > 0){
if (PlayerTarget == 2){
card->controller()->life+=life;
}
if (PlayerTarget == 1){
source->controller()->life+=life;
}
if (PlayerTarget == 0){
source->controller()->opponent()->life+=life;
}
}
}
return 1;
}
int removed(MTGCardInstance * card){
if (AddOrRemove == 0){
if (life < 0){
int damage = life * -1;
if (PlayerTarget == 2){
game->mLayers->stackLayer()->addDamage(source,card->controller(), damage);
}
if (PlayerTarget == 1){
game->mLayers->stackLayer()->addDamage(source,source->controller(), damage);
}
if (PlayerTarget == 0){
game->mLayers->stackLayer()->addDamage(source,source->controller()->opponent(), damage);
}
}
if (life > 0){
if (PlayerTarget == 2){
card->controller()->life+=life;
}
if (PlayerTarget == 1){
source->controller()->life+=life;
}
if (PlayerTarget == 0){
source->controller()->opponent()->life+=life;
}
}
}
return 1;
}
virtual ostream& toString(ostream& out) const
{
out << "ALifeModifierPutinplay ::: init : " << init
<< " ; life : " << life
<< " ; PlayerTarget : " << PlayerTarget
<< " ; AddOrRemove : " << AddOrRemove
<< " (";
return ListMaintainerAbility::toString(out) << ")";
}
ALifeModifierPutinplay * clone() const{
ALifeModifierPutinplay * a = NEW ALifeModifierPutinplay(*this);
a->isClone = 1;
return a;
}
};
/// Work in Progress also from no on all code could be removed...
+16 -56
View File
@@ -859,14 +859,6 @@ void AbilityFactory::addAbilities(int _id, Spell * spell){
game->addObserver(NEW AConvertToCreatureAura(_id, card,card->target,x,x));
break;
}
case 1094: //Ankh of Mishra
{
TargetChooser * tc = NULL;
TargetChooserFactory tcf;
tc = tcf.createTargetChooser("land", card);
game->addObserver (NEW ALifeModifierPutinplay(_id,card,tc,-2,2,1));
break;
}
case 1095: //Armageddon clock
{
AArmageddonClock * ability = NEW AArmageddonClock(_id,card);
@@ -1606,9 +1598,10 @@ void AbilityFactory::addAbilities(int _id, Spell * spell){
{
int x = computeX(spell,card);
ATokenCreator * tok = NEW ATokenCreator(id,card,NEW ManaCost(),"Goblin","creature Goblin",1,1,"Red",0);
for (int i=0; i < x; i++){
tok->resolve();
}
for (int i=0; i < x; i++){
tok->resolve();
}
delete(tok);
break;
}
@@ -1644,13 +1637,6 @@ void AbilityFactory::addAbilities(int _id, Spell * spell){
break;
}
case 129909: //Cryoclasm
{
card->target->controller()->game->putInGraveyard(card->target);
card->target->controller()->life-= 3;
break;
}
case 130373: //Lavaborn Muse
{
game->addObserver( NEW ALavaborn(_id ,card, Constants::MTG_PHASE_UPKEEP, -3,-3));
@@ -1732,44 +1718,16 @@ void AbilityFactory::addAbilities(int _id, Spell * spell){
break;
}
//--- addon shm---
case 147427: // Poison the Well
{
card->target->controller()->life-=2;
break;
}
case 158243: //Smash to Smithereens
{
card->target->controller()->life-=3;
break;
}
case 146759: //Fracturing Gust
{
GameObserver * game = GameObserver::GetInstance();
for (int i = 0; i < 2 ; i++){
for (int j = 0; j < game->players[i]->game->inPlay->nb_cards; j++){
MTGCardInstance * current = game->players[i]->game->inPlay->cards[j];
if (current->hasType("Artifact") || current->hasType("Enchantment")){
game->players[i]->game->putInGraveyard(current);
card->controller()->life+= 2;
}
}
}
break;
}
// --- addon Invasion---
case 23195: //Artifact Mutation
{
card->target->controller()->game->putInGraveyard(card->target);
int x = card->target->getManaCost()->getConvertedCost();
ATokenCreator * tok = NEW ATokenCreator(id,card,NEW ManaCost(),"Saproling","creature Saproling",1,1,"green",0);
for (int i=0; i < x; i++){
tok->resolve();
}
for (int i=0; i < x; i++){
tok->resolve();
}
delete(tok);
break;
}
//--- addon Eventide ----
@@ -1778,9 +1736,10 @@ void AbilityFactory::addAbilities(int _id, Spell * spell){
{
int x = computeX(spell,card);
ATokenCreator * tok = NEW ATokenCreator(id,card,NEW ManaCost(),"Goblin Soldier","creature Goblin Soldier",1,1,"red white",0);
for (int i=0; i < x; i++){
tok->resolve();
}
for (int i=0; i < x; i++){
tok->resolve();
}
delete(tok);
break;
}
@@ -1805,9 +1764,10 @@ void AbilityFactory::addAbilities(int _id, Spell * spell){
card->target->controller()->game->putInZone(card->target, card->target->controller()->game->inPlay,card->owner->game->removedFromGame);
int x = card->target->toughness;
ATokenCreator * tok = NEW ATokenCreator(id,card,NEW ManaCost(),"Saproling","creature Saproling",1,1,"green",0);
for (int i=0; i < x; i++){
tok->resolve();
}
for (int i=0; i < x; i++){
tok->resolve();
}
delete(tok);
break;
}