Laurent - Update to the foreach parser with "add" to be used for instant and sorcery (e.g. spoil of evil) also removed/added corresponding cards (spoil of evil, song of the damned and ancestor chosen).
Also added the ability "INDESTRUCTIBLE" did not test it yet + not sure about the ruling ...
This commit is contained in:
@@ -66,6 +66,7 @@ toughness=3
|
|||||||
text=First strike (This creature deals combat damage before creatures without first strike.) When Ancestor's Chosen comes into play, you gain 1 life for each card in your graveyard.
|
text=First strike (This creature deals combat damage before creatures without first strike.) When Ancestor's Chosen comes into play, you gain 1 life for each card in your graveyard.
|
||||||
abilities=first strike
|
abilities=first strike
|
||||||
id=130550
|
id=130550
|
||||||
|
auto=foreach(*|mygraveyard)life:1
|
||||||
name=Ancestor's Chosen
|
name=Ancestor's Chosen
|
||||||
rarity=U
|
rarity=U
|
||||||
color=White
|
color=White
|
||||||
|
|||||||
@@ -1228,6 +1228,7 @@ text=Add {B} to your mana pool for each creature card in your graveyard.
|
|||||||
id=2484
|
id=2484
|
||||||
name=Songs of the Damned
|
name=Songs of the Damned
|
||||||
rarity=C
|
rarity=C
|
||||||
|
auto=foreach(creature|mygraveyard)add:{B}
|
||||||
type=Instant
|
type=Instant
|
||||||
mana={B}
|
mana={B}
|
||||||
[/card]
|
[/card]
|
||||||
@@ -1246,6 +1247,8 @@ subtype=Aura
|
|||||||
[card]
|
[card]
|
||||||
text=For each artifact or creature card in an opponent's graveyard, add {1} to your mana pool and you gain 1 life.
|
text=For each artifact or creature card in an opponent's graveyard, add {1} to your mana pool and you gain 1 life.
|
||||||
id=2487
|
id=2487
|
||||||
|
auto=foreach(artifact,creature|opponentgraveyard)add:{1}
|
||||||
|
auto=foreach(artifact,creature|opponentgraveyard)life:1
|
||||||
name=Spoils of Evil
|
name=Spoils of Evil
|
||||||
rarity=R
|
rarity=R
|
||||||
type=Instant
|
type=Instant
|
||||||
|
|||||||
@@ -3719,13 +3719,12 @@ class AAngelicChorus: public ListMaintainerAbility{
|
|||||||
class ALifeModifierPutinplay: public ListMaintainerAbility{
|
class ALifeModifierPutinplay: public ListMaintainerAbility{
|
||||||
public:
|
public:
|
||||||
int init;
|
int init;
|
||||||
char type[20];
|
|
||||||
int life;
|
int life;
|
||||||
int PlayerTarget;
|
int PlayerTarget;
|
||||||
int AddOrRemove;
|
int AddOrRemove;
|
||||||
ALifeModifierPutinplay(int id, MTGCardInstance * _source,const char * _type, int _life, int _PlayerTarget, int _AddOrRemove):ListMaintainerAbility(id, _source){
|
ALifeModifierPutinplay(int id, MTGCardInstance * _source,TargetChooser * _tc, int _life, int _PlayerTarget, int _AddOrRemove):ListMaintainerAbility(id, _source){
|
||||||
sprintf(type,"%s",_type);
|
|
||||||
init = 0;
|
init = 0;
|
||||||
|
tc = _tc;
|
||||||
PlayerTarget = _PlayerTarget;
|
PlayerTarget = _PlayerTarget;
|
||||||
AddOrRemove = _AddOrRemove;
|
AddOrRemove = _AddOrRemove;
|
||||||
life = _life;
|
life = _life;
|
||||||
@@ -3737,7 +3736,7 @@ class ALifeModifierPutinplay: public ListMaintainerAbility{
|
|||||||
}
|
}
|
||||||
|
|
||||||
int canBeInList(MTGCardInstance * card){
|
int canBeInList(MTGCardInstance * card){
|
||||||
if (card->hasType(type) && game->isInPlay(card)) return 1;
|
if (tc->canTarget(card)) return 1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3803,7 +3802,6 @@ class ALifeModifierPutinplay: public ListMaintainerAbility{
|
|||||||
virtual ostream& toString(ostream& out) const
|
virtual ostream& toString(ostream& out) const
|
||||||
{
|
{
|
||||||
out << "ALifeModifierPutinplay ::: init : " << init
|
out << "ALifeModifierPutinplay ::: init : " << init
|
||||||
<< " ; type : " << type
|
|
||||||
<< " ; life : " << life
|
<< " ; life : " << life
|
||||||
<< " ; PlayerTarget : " << PlayerTarget
|
<< " ; PlayerTarget : " << PlayerTarget
|
||||||
<< " ; AddOrRemove : " << AddOrRemove
|
<< " ; AddOrRemove : " << AddOrRemove
|
||||||
|
|||||||
@@ -97,8 +97,9 @@ class Constants
|
|||||||
CANTBLOCK = 39,
|
CANTBLOCK = 39,
|
||||||
DOESNOTUNTAP =40,
|
DOESNOTUNTAP =40,
|
||||||
OPPONENTSHROUD=41,
|
OPPONENTSHROUD=41,
|
||||||
|
INDESTRUCTIBLE=42,
|
||||||
|
|
||||||
NB_BASIC_ABILITIES = 42,
|
NB_BASIC_ABILITIES = 43,
|
||||||
|
|
||||||
|
|
||||||
RARITY_M = 'M',
|
RARITY_M = 'M',
|
||||||
|
|||||||
@@ -989,12 +989,24 @@ int AbilityFactory::magicText(int id, Spell * spell, MTGCardInstance * card){
|
|||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
OutputDebugString ("uh oh\n");
|
OutputDebugString ("uh oh\n");
|
||||||
card->controller()->getManaPool()->add(output);
|
if (lordType == PARSER_FOREACH){
|
||||||
delete output;
|
ManaCost * FinalOutput = NEW ManaCost();
|
||||||
|
int multiplier = countCards(lordTargets);
|
||||||
|
for (int i = 0; i < Constants::MTG_NB_COLORS; i++){
|
||||||
|
if (output->hasColor(i)){
|
||||||
|
FinalOutput->add(i,multiplier);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
card->controller()->getManaPool()->add(FinalOutput);
|
||||||
|
delete FinalOutput;
|
||||||
|
}else{
|
||||||
|
card->controller()->getManaPool()->add(output);
|
||||||
|
delete output;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
result++;
|
result++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Gain/loose Ability
|
//Gain/loose Ability
|
||||||
for (int j = 0; j < Constants::NB_BASIC_ABILITIES; j++){
|
for (int j = 0; j < Constants::NB_BASIC_ABILITIES; j++){
|
||||||
@@ -1101,12 +1113,6 @@ void AbilityFactory::addAbilities(int _id, Spell * spell){
|
|||||||
game->addObserver(ability);
|
game->addObserver(ability);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 130550: //Ancestor's chosen
|
|
||||||
{
|
|
||||||
int life = card->controller()->game->graveyard->nb_cards;
|
|
||||||
card->controller()->life+= life;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 1190: //Animate Artifact
|
case 1190: //Animate Artifact
|
||||||
{
|
{
|
||||||
int x = card->target->getManaCost()->getConvertedCost();
|
int x = card->target->getManaCost()->getConvertedCost();
|
||||||
@@ -1867,13 +1873,6 @@ void AbilityFactory::addAbilities(int _id, Spell * spell){
|
|||||||
game->addObserver(NEW AGiveLifeForTappedType (_id, card, "island"));
|
game->addObserver(NEW AGiveLifeForTappedType (_id, card, "island"));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 2484: //Songs of the Damned
|
|
||||||
{
|
|
||||||
int mana = card->controller()->game->graveyard->countByType("creature");
|
|
||||||
game->currentlyActing()->getManaPool()->add(Constants::MTG_COLOR_BLACK, mana);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case 2474: //Minion of Leshrac
|
case 2474: //Minion of Leshrac
|
||||||
{
|
{
|
||||||
game->addObserver(NEW AMinionofLeshrac( _id, card));
|
game->addObserver(NEW AMinionofLeshrac( _id, card));
|
||||||
@@ -1884,15 +1883,6 @@ void AbilityFactory::addAbilities(int _id, Spell * spell){
|
|||||||
game->addObserver(NEW AShieldOfTheAge( _id, card));
|
game->addObserver(NEW AShieldOfTheAge( _id, card));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 2487: //Spoil of Evil
|
|
||||||
{
|
|
||||||
int mana_cr = game->opponent()->game->graveyard->countByType("creature");
|
|
||||||
int mana_ar = game->opponent()->game->graveyard->countByType("artifact");
|
|
||||||
int spoil = mana_ar + mana_cr;
|
|
||||||
game->currentlyActing()->getManaPool()->add(Constants::MTG_COLOR_ARTIFACT, spoil);
|
|
||||||
game->currentlyActing()->life+= spoil;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 2435: //Whalebone Glider
|
case 2435: //Whalebone Glider
|
||||||
{
|
{
|
||||||
int cost[] = {Constants::MTG_COLOR_ARTIFACT,2};
|
int cost[] = {Constants::MTG_COLOR_ARTIFACT,2};
|
||||||
@@ -2077,7 +2067,6 @@ void AbilityFactory::addAbilities(int _id, Spell * spell){
|
|||||||
int life;
|
int life;
|
||||||
Player * player = spell->getNextPlayerTarget();
|
Player * player = spell->getNextPlayerTarget();
|
||||||
MTGLibrary * library = card->controller()->game->library;
|
MTGLibrary * library = card->controller()->game->library;
|
||||||
MTGGraveyard * graveyard = card->controller()->game->graveyard;
|
|
||||||
life = player->life;
|
life = player->life;
|
||||||
player->life+=life;
|
player->life+=life;
|
||||||
MTGGameZone * zones[] = {card->controller()->game->inPlay,card->controller()->game->graveyard,card->controller()->game->hand};
|
MTGGameZone * zones[] = {card->controller()->game->inPlay,card->controller()->game->graveyard,card->controller()->game->hand};
|
||||||
|
|||||||
@@ -129,7 +129,7 @@ int MTGCardInstance::afterDamage(){
|
|||||||
if (!doDamageTest) return 0;
|
if (!doDamageTest) return 0;
|
||||||
doDamageTest = 0;
|
doDamageTest = 0;
|
||||||
if (!isACreature()) return 0;
|
if (!isACreature()) return 0;
|
||||||
if (life <=0 && isInPlay()){
|
if (life <=0 && isInPlay() && !basicAbilities[Constants::INDESTRUCTIBLE]){
|
||||||
return destroy();
|
return destroy();
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -137,11 +137,13 @@ int MTGCardInstance::afterDamage(){
|
|||||||
|
|
||||||
int MTGCardInstance::bury(){
|
int MTGCardInstance::bury(){
|
||||||
Player * p = controller();
|
Player * p = controller();
|
||||||
|
if (!basicAbilities[Constants::INDESTRUCTIBLE]){
|
||||||
p->game->putInZone(this,p->game->inPlay,owner->game->graveyard);
|
p->game->putInZone(this,p->game->inPlay,owner->game->graveyard);
|
||||||
return 1;
|
}
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
int MTGCardInstance::destroy(){
|
int MTGCardInstance::destroy(){
|
||||||
if (!triggerRegenerate()) return bury();
|
if (!triggerRegenerate() || !basicAbilities[Constants::INDESTRUCTIBLE]) return bury();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ const char* Constants::MTGBasicAbilities[] = {
|
|||||||
"cantblock",
|
"cantblock",
|
||||||
"doesnotuntap",
|
"doesnotuntap",
|
||||||
"opponentshroud",
|
"opponentshroud",
|
||||||
|
"indestructible",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user