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.
|
||||
abilities=first strike
|
||||
id=130550
|
||||
auto=foreach(*|mygraveyard)life:1
|
||||
name=Ancestor's Chosen
|
||||
rarity=U
|
||||
color=White
|
||||
|
||||
@@ -1228,6 +1228,7 @@ text=Add {B} to your mana pool for each creature card in your graveyard.
|
||||
id=2484
|
||||
name=Songs of the Damned
|
||||
rarity=C
|
||||
auto=foreach(creature|mygraveyard)add:{B}
|
||||
type=Instant
|
||||
mana={B}
|
||||
[/card]
|
||||
@@ -1246,6 +1247,8 @@ subtype=Aura
|
||||
[card]
|
||||
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
|
||||
auto=foreach(artifact,creature|opponentgraveyard)add:{1}
|
||||
auto=foreach(artifact,creature|opponentgraveyard)life:1
|
||||
name=Spoils of Evil
|
||||
rarity=R
|
||||
type=Instant
|
||||
|
||||
@@ -3719,13 +3719,12 @@ class AAngelicChorus: public ListMaintainerAbility{
|
||||
class ALifeModifierPutinplay: public ListMaintainerAbility{
|
||||
public:
|
||||
int init;
|
||||
char type[20];
|
||||
int life;
|
||||
int PlayerTarget;
|
||||
int AddOrRemove;
|
||||
ALifeModifierPutinplay(int id, MTGCardInstance * _source,const char * _type, int _life, int _PlayerTarget, int _AddOrRemove):ListMaintainerAbility(id, _source){
|
||||
sprintf(type,"%s",_type);
|
||||
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;
|
||||
@@ -3737,7 +3736,7 @@ class ALifeModifierPutinplay: public ListMaintainerAbility{
|
||||
}
|
||||
|
||||
int canBeInList(MTGCardInstance * card){
|
||||
if (card->hasType(type) && game->isInPlay(card)) return 1;
|
||||
if (tc->canTarget(card)) return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -3803,7 +3802,6 @@ class ALifeModifierPutinplay: public ListMaintainerAbility{
|
||||
virtual ostream& toString(ostream& out) const
|
||||
{
|
||||
out << "ALifeModifierPutinplay ::: init : " << init
|
||||
<< " ; type : " << type
|
||||
<< " ; life : " << life
|
||||
<< " ; PlayerTarget : " << PlayerTarget
|
||||
<< " ; AddOrRemove : " << AddOrRemove
|
||||
|
||||
@@ -97,8 +97,9 @@ class Constants
|
||||
CANTBLOCK = 39,
|
||||
DOESNOTUNTAP =40,
|
||||
OPPONENTSHROUD=41,
|
||||
INDESTRUCTIBLE=42,
|
||||
|
||||
NB_BASIC_ABILITIES = 42,
|
||||
NB_BASIC_ABILITIES = 43,
|
||||
|
||||
|
||||
RARITY_M = 'M',
|
||||
|
||||
@@ -989,12 +989,24 @@ int AbilityFactory::magicText(int id, Spell * spell, MTGCardInstance * card){
|
||||
}
|
||||
}else{
|
||||
OutputDebugString ("uh oh\n");
|
||||
card->controller()->getManaPool()->add(output);
|
||||
delete output;
|
||||
if (lordType == PARSER_FOREACH){
|
||||
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++;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
//Gain/loose Ability
|
||||
for (int j = 0; j < Constants::NB_BASIC_ABILITIES; j++){
|
||||
@@ -1101,12 +1113,6 @@ void AbilityFactory::addAbilities(int _id, Spell * spell){
|
||||
game->addObserver(ability);
|
||||
break;
|
||||
}
|
||||
case 130550: //Ancestor's chosen
|
||||
{
|
||||
int life = card->controller()->game->graveyard->nb_cards;
|
||||
card->controller()->life+= life;
|
||||
break;
|
||||
}
|
||||
case 1190: //Animate Artifact
|
||||
{
|
||||
int x = card->target->getManaCost()->getConvertedCost();
|
||||
@@ -1867,13 +1873,6 @@ void AbilityFactory::addAbilities(int _id, Spell * spell){
|
||||
game->addObserver(NEW AGiveLifeForTappedType (_id, card, "island"));
|
||||
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
|
||||
{
|
||||
game->addObserver(NEW AMinionofLeshrac( _id, card));
|
||||
@@ -1884,15 +1883,6 @@ void AbilityFactory::addAbilities(int _id, Spell * spell){
|
||||
game->addObserver(NEW AShieldOfTheAge( _id, card));
|
||||
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
|
||||
{
|
||||
int cost[] = {Constants::MTG_COLOR_ARTIFACT,2};
|
||||
@@ -2077,7 +2067,6 @@ void AbilityFactory::addAbilities(int _id, Spell * spell){
|
||||
int life;
|
||||
Player * player = spell->getNextPlayerTarget();
|
||||
MTGLibrary * library = card->controller()->game->library;
|
||||
MTGGraveyard * graveyard = card->controller()->game->graveyard;
|
||||
life = player->life;
|
||||
player->life+=life;
|
||||
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;
|
||||
doDamageTest = 0;
|
||||
if (!isACreature()) return 0;
|
||||
if (life <=0 && isInPlay()){
|
||||
if (life <=0 && isInPlay() && !basicAbilities[Constants::INDESTRUCTIBLE]){
|
||||
return destroy();
|
||||
}
|
||||
return 0;
|
||||
@@ -137,11 +137,13 @@ int MTGCardInstance::afterDamage(){
|
||||
|
||||
int MTGCardInstance::bury(){
|
||||
Player * p = controller();
|
||||
if (!basicAbilities[Constants::INDESTRUCTIBLE]){
|
||||
p->game->putInZone(this,p->game->inPlay,owner->game->graveyard);
|
||||
return 1;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
int MTGCardInstance::destroy(){
|
||||
if (!triggerRegenerate()) return bury();
|
||||
if (!triggerRegenerate() || !basicAbilities[Constants::INDESTRUCTIBLE]) return bury();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -50,6 +50,7 @@ const char* Constants::MTGBasicAbilities[] = {
|
||||
"cantblock",
|
||||
"doesnotuntap",
|
||||
"opponentshroud",
|
||||
"indestructible",
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user