Erwan
- added counters to parser. They can be used as an effect, not a cost!!! counter(p/t,n) where n is the number of counters. if n is ommitted, it is 1, if it is negative, it means "remove" counter
This commit is contained in:
@@ -468,6 +468,15 @@ subtype=Spider
|
|||||||
toughness=3
|
toughness=3
|
||||||
[/card]
|
[/card]
|
||||||
[card]
|
[card]
|
||||||
|
text={4}, {T}: Put a -1/-1 counter on target creature.
|
||||||
|
auto={4}{T}:counter(-1/-1) target(creature)
|
||||||
|
id=146015
|
||||||
|
name=Gnarled Effigy
|
||||||
|
rarity=U
|
||||||
|
type=Artifact
|
||||||
|
mana={4}
|
||||||
|
[/card]
|
||||||
|
[card]
|
||||||
text=Persist (When this creature is put into a graveyard from play, if it had no -1/-1 counters on it, return it to play under its owner's control with a -1/-1 counter on it.)
|
text=Persist (When this creature is put into a graveyard from play, if it had no -1/-1 counters on it, return it to play under its owner's control with a -1/-1 counter on it.)
|
||||||
abilities=persist
|
abilities=persist
|
||||||
id=141935
|
id=141935
|
||||||
|
|||||||
@@ -493,14 +493,7 @@ rarity=C
|
|||||||
type=Instant
|
type=Instant
|
||||||
mana={3}{G}
|
mana={3}{G}
|
||||||
[/card]
|
[/card]
|
||||||
[card]
|
|
||||||
text={4}, {T}: Put a -1/-1 counter on target creature.
|
|
||||||
id=146015
|
|
||||||
name=Gnarled Effigy
|
|
||||||
rarity=U
|
|
||||||
type=Artifact
|
|
||||||
mana={4}
|
|
||||||
[/card]
|
|
||||||
[card]
|
[card]
|
||||||
text=Flying Other creatures are 1/1.
|
text=Flying Other creatures are 1/1.
|
||||||
id=142019
|
id=142019
|
||||||
|
|||||||
@@ -86,6 +86,7 @@ ghost_warden.txt
|
|||||||
giant_growth.txt
|
giant_growth.txt
|
||||||
giant_growth2.txt
|
giant_growth2.txt
|
||||||
glimpse_the_unthinkable.txt
|
glimpse_the_unthinkable.txt
|
||||||
|
gnarled_effigy.txt
|
||||||
goblin_balloon_brigade.txt
|
goblin_balloon_brigade.txt
|
||||||
goblin_balloon_brigade2.txt
|
goblin_balloon_brigade2.txt
|
||||||
goblin_king.txt
|
goblin_king.txt
|
||||||
|
|||||||
@@ -0,0 +1,38 @@
|
|||||||
|
#text={4}, {T}: Put a -1/-1 counter on target creature.
|
||||||
|
[INIT]
|
||||||
|
SECONDMAIN
|
||||||
|
[PLAYER1]
|
||||||
|
inplay:gnarled effigy
|
||||||
|
manapool:{4}
|
||||||
|
[PLAYER2]
|
||||||
|
inplay:grizzly bears
|
||||||
|
[DO]
|
||||||
|
gnarled effigy
|
||||||
|
grizzly bears
|
||||||
|
eot
|
||||||
|
next
|
||||||
|
#upkeep
|
||||||
|
next
|
||||||
|
#draw
|
||||||
|
next
|
||||||
|
#firstmain
|
||||||
|
next
|
||||||
|
#begin
|
||||||
|
next
|
||||||
|
#attackers
|
||||||
|
grizzly bears
|
||||||
|
next
|
||||||
|
#blockers
|
||||||
|
next
|
||||||
|
#damage
|
||||||
|
next
|
||||||
|
#end
|
||||||
|
[ASSERT]
|
||||||
|
COMBATEND
|
||||||
|
[PLAYER1]
|
||||||
|
inplay:gnarled effigy
|
||||||
|
manapool:{0}
|
||||||
|
life:19
|
||||||
|
[PLAYER2]
|
||||||
|
inplay:grizzly bears
|
||||||
|
[END]
|
||||||
@@ -57,6 +57,42 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
//counters
|
||||||
|
class AACounter: public ActivatedAbility{
|
||||||
|
public:
|
||||||
|
int nb;
|
||||||
|
int power;
|
||||||
|
int toughness;
|
||||||
|
AACounter(int id, MTGCardInstance * _source, MTGCardInstance * _target, int _power, int _toughness, int nb,ManaCost * cost=NULL, int doTap = 1):ActivatedAbility(id,_source,cost,0,doTap),power(_power),toughness(_toughness),nb(nb){
|
||||||
|
target=_target;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int resolve(){
|
||||||
|
if (target){
|
||||||
|
MTGCardInstance * _target = (MTGCardInstance *)target;
|
||||||
|
if (nb>0){
|
||||||
|
for (int i=0; i < nb; i++){
|
||||||
|
_target->counters->addCounter(power, toughness);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
for (int i=0; i < nb; i++){
|
||||||
|
_target->counters->removeCounter(power, toughness);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nb;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
AACounter * clone() const{
|
||||||
|
AACounter * a = NEW AACounter(*this);
|
||||||
|
a->isClone = 1;
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
class AAFizzler:public ActivatedAbility{
|
class AAFizzler:public ActivatedAbility{
|
||||||
public:
|
public:
|
||||||
AAFizzler(int _id, MTGCardInstance * card, Spell * _target, ManaCost * _cost = NULL, int _tap = 1):ActivatedAbility(_id, card,_cost,0,_tap){
|
AAFizzler(int _id, MTGCardInstance * card, Spell * _target, ManaCost * _cost = NULL, int _tap = 1):ActivatedAbility(_id, card,_cost,0,_tap){
|
||||||
@@ -4207,30 +4243,7 @@ class ALifeModifierPutinplay: public ListMaintainerAbility{
|
|||||||
|
|
||||||
/// Work in Progress also from no on all code could be removed...
|
/// Work in Progress also from no on all code could be removed...
|
||||||
|
|
||||||
//Draft for counters
|
|
||||||
class ACounters: public MTGAbility{
|
|
||||||
public:
|
|
||||||
int counter;
|
|
||||||
int power;
|
|
||||||
int toughness;
|
|
||||||
ACounters(int id, MTGCardInstance * _source, MTGCardInstance * _target, int _power, int _toughness):MTGAbility(id,_source,_target),power(_power),toughness(_toughness){
|
|
||||||
_target->counters->addCounter(power, toughness);
|
|
||||||
}
|
|
||||||
virtual ostream& toString(ostream& out) const
|
|
||||||
{
|
|
||||||
out << "ACounters ::: counter : " << counter
|
|
||||||
<< " ; power : " << power
|
|
||||||
<< " ; toughness : " << toughness
|
|
||||||
<< " (";
|
|
||||||
return MTGAbility::toString(out) << ")";
|
|
||||||
}
|
|
||||||
|
|
||||||
ACounters * clone() const{
|
|
||||||
ACounters * a = NEW ACounters(*this);
|
|
||||||
a->isClone = 1;
|
|
||||||
return a;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
///// Not working need to work on this one
|
///// Not working need to work on this one
|
||||||
///Abomination Kill blocking creature if white or green
|
///Abomination Kill blocking creature if white or green
|
||||||
|
|||||||
@@ -128,6 +128,7 @@ TriggeredAbility * AbilityFactory::parseTrigger(string magicText, int id, Spell
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//Parses a string and returns the corresponding MTGAbility object
|
//Parses a string and returns the corresponding MTGAbility object
|
||||||
// Returns NULL if parsing failed
|
// Returns NULL if parsing failed
|
||||||
MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTGCardInstance *card, int activated){
|
MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTGCardInstance *card, int activated){
|
||||||
@@ -497,25 +498,27 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
|
|||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
|
|
||||||
//counter
|
//counter
|
||||||
found = s.find("counter(");
|
found = s.find("counter(");
|
||||||
if (found != string::npos){
|
if (found != string::npos){
|
||||||
int end = s.find(")", found);
|
found+=8;
|
||||||
string spt = s.substr(9,end - 1);
|
int nb = 1;
|
||||||
|
size_t end = s.find(")", found);
|
||||||
|
size_t separator = s.find(",", found);
|
||||||
|
if (separator != string::npos){
|
||||||
|
nb = atoi(s.substr(found,separator-found).c_str());
|
||||||
|
end = separator;
|
||||||
|
}
|
||||||
|
string spt = s.substr(found,end-found);
|
||||||
int power, toughness;
|
int power, toughness;
|
||||||
if ( parsePowerToughness(spt,&power, &toughness)){
|
if ( parsePowerToughness(spt,&power, &toughness)){
|
||||||
if(tc){
|
return NEW AACounter(id,card,target,power,toughness,nb);
|
||||||
//TODO
|
|
||||||
}else{
|
|
||||||
return NEW ACounters(id,card,target,power,toughness);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
//Change Power/Toughness
|
//Change Power/Toughness
|
||||||
@@ -783,7 +786,7 @@ int AbilityFactory::magicText(int id, Spell * spell, MTGCardInstance * card){
|
|||||||
magicText = "";
|
magicText = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
MTGAbility * a = parseMagicLine(line, result, spell, card);
|
MTGAbility * a = parseMagicLine(line, result, spell, card);
|
||||||
if (dryMode){
|
if (dryMode){
|
||||||
result = abilityEfficiency(a, card->controller(),MODE_PUTINTOPLAY);
|
result = abilityEfficiency(a, card->controller(),MODE_PUTINTOPLAY);
|
||||||
SAFE_DELETE(a);
|
SAFE_DELETE(a);
|
||||||
|
|||||||
Reference in New Issue
Block a user