Merge pull request #922 from kevlahnota/master

Some Fixes
This commit is contained in:
Anthony Calosa
2017-02-03 15:12:18 +08:00
committed by GitHub
6 changed files with 83 additions and 81 deletions
+19 -18
View File
@@ -11944,9 +11944,10 @@ type=Sorcery
[/card] [/card]
[card] [card]
name=Blood Tribute name=Blood Tribute
target=opponent
auto=life:-halfdownopponentlifetotal targetedplayer
auto=alternative life:opponentlifetotal controller
text=Kicker - Tap an untapped Vampire you control. (You may tap a Vampire you control in addition to any other costs as you cast this spell.) -- Target opponent loses half his or her life, rounded up. If Blood Tribute was kicked, you gain life equal to the life lost this way. text=Kicker - Tap an untapped Vampire you control. (You may tap a Vampire you control in addition to any other costs as you cast this spell.) -- Target opponent loses half his or her life, rounded up. If Blood Tribute was kicked, you gain life equal to the life lost this way.
auto=life:-halfdownopponentlifetotal opponent
auto=life:opponentlifetotal controller
mana={4}{B}{B} mana={4}{B}{B}
other={4}{b}{b}{t(vampire|mybattlefield)} name(Pay Kicker) other={4}{b}{b}{t(vampire|mybattlefield)} name(Pay Kicker)
type=Sorcery type=Sorcery
@@ -23970,7 +23971,7 @@ type=Instant
name=Crypt of Agadeem name=Crypt of Agadeem
auto=tap(noevent) auto=tap(noevent)
auto={T}:Add{B} auto={T}:Add{B}
auto={2}{T}:foreach(creature[black]|mygraveyard) Add{B} auto={2}{T}:name(foreach add black mana) foreach(creature[black]|mygraveyard) Add{B}
text=Crypt of Agadeem enters the battlefield tapped. -- {T}: Add {B} to your mana pool. -- {2}, {T}: Add {B} to your mana pool for each black creature card in your graveyard. text=Crypt of Agadeem enters the battlefield tapped. -- {T}: Add {B} to your mana pool. -- {2}, {T}: Add {B} to your mana pool for each black creature card in your graveyard.
type=Land type=Land
[/card] [/card]
@@ -46940,8 +46941,8 @@ toughness=1
[/card] [/card]
[card] [card]
name=Goblin Goon name=Goblin Goon
auto=@each my attackers:if type(creature|opponentbattlefield)~morethan~type(creature|mybattlefield) then transforms((,cantattack)) ueot auto=while(restriction{lessorequalcreatures}) cantattack
auto=@each my blockers:if type(creature|opponentbattlefield)~morethan~type(creature|mybattlefield) then transforms((,cantblock)) ueot auto=while(restriction{lessorequalcreatures}) cantblock
text=Goblin Goon can't attack unless you control more creatures than defending player. -- Goblin Goon can't block unless you control more creatures than attacking player. text=Goblin Goon can't attack unless you control more creatures than defending player. -- Goblin Goon can't block unless you control more creatures than attacking player.
mana={3}{R} mana={3}{R}
type=Creature type=Creature
@@ -60999,7 +61000,7 @@ toughness=2
[/card] [/card]
[card] [card]
name=Keeper of the Flame name=Keeper of the Flame
auto={R}{T}:if compare(lifetotal)~lessthan~compare(opponentlifetotal) then damage:2 opponent auto={R}{T}:damage:2 opponent restriction{compare(lifetotal)~lessthan~compare(opponentlifetotal)}
text={R}, {T}: Choose target opponent who had more life than you did as you activated this ability. Keeper of the Flame deals 2 damage to him or her. text={R}, {T}: Choose target opponent who had more life than you did as you activated this ability. Keeper of the Flame deals 2 damage to him or her.
mana={R}{R} mana={R}{R}
type=Creature type=Creature
@@ -61009,7 +61010,7 @@ toughness=2
[/card] [/card]
[card] [card]
name=Keeper of the Light name=Keeper of the Light
auto={W}{T}:if compare(lifetotal)~lessthan~compare(opponentlifetotal) then life:3 controller auto={W}{T}:life:3 controller restriction{compare(lifetotal)~lessthan~compare(opponentlifetotal)}
text={W}, {T}: Choose target opponent who had more life than you did as you activated this ability. You gain 3 life. text={W}, {T}: Choose target opponent who had more life than you did as you activated this ability. You gain 3 life.
mana={W}{W} mana={W}{W}
type=Creature type=Creature
@@ -67744,8 +67745,8 @@ subtype=Aura
[card] [card]
name=Lurker name=Lurker
abilities=shroud abilities=shroud
auto=@combat(attacking) source(this):name(loses shroud) -shroud ueot auto=while(restriction{didblock}) transforms((,newability[-shroud])) ueot
auto=@combat(blocking) source(this):name(loses shroud) -shroud ueot auto=while(restriction{didattack}) transforms((,newability[-shroud])) ueot
text=Lurker can't be the target of spells unless it attacked or blocked this turn. text=Lurker can't be the target of spells unless it attacked or blocked this turn.
mana={2}{G} mana={2}{G}
type=Creature type=Creature
@@ -73930,8 +73931,8 @@ toughness=3
[/card] [/card]
[card] [card]
name=Mogg Toady name=Mogg Toady
auto=@each my attackers:if type(creature|opponentbattlefield)~morethan~type(creature|mybattlefield) then transforms((,cantattack)) ueot auto=while(restriction{lessorequalcreatures}) cantattack
auto=@each my blockers:if type(creature|opponentbattlefield)~morethan~type(creature|mybattlefield) then transforms((,cantblock)) ueot auto=while(restriction{lessorequalcreatures}) cantblock
text=Mogg Toady can't attack unless you control more creatures than defending player. -- Mogg Toady can't block unless you control more creatures than attacking player. text=Mogg Toady can't attack unless you control more creatures than defending player. -- Mogg Toady can't block unless you control more creatures than attacking player.
mana={1}{R} mana={1}{R}
type=Creature type=Creature
@@ -74460,8 +74461,8 @@ type=Sorcery
[/card] [/card]
[card] [card]
name=Monstrous Hound name=Monstrous Hound
auto=@each my attackers:if type(land|opponentbattlefield)~morethan~type(land|mybattlefield) then transforms((,cantattack)) ueot auto=while(restriction{lessorequallands}) cantattack
auto=@each my blockers:if type(land|opponentbattlefield)~morethan~type(land|mybattlefield) then transforms((,cantblock)) ueot auto=while(restriction{lessorequallands}) cantblock
text=Monstrous Hound can't attack unless you control more lands than defending player. -- Monstrous Hound can't block unless you control more lands than attacking player. text=Monstrous Hound can't attack unless you control more lands than defending player. -- Monstrous Hound can't block unless you control more lands than attacking player.
mana={3}{R} mana={3}{R}
type=Creature type=Creature
@@ -89051,7 +89052,7 @@ type=Instant
[/card] [/card]
[card] [card]
name=Rackling name=Rackling
auto=@each opponent upkeep:damage:0 && if type(*|opponenthand)~equalto~2 then damage:1 opponent && if type(*|opponenthand)~equalto~1 then damage:2 opponent && if type(*|opponenthand)~equalto~0 then damage:3 opponent auto=@each opponent upkeep:damage:3minustype:*:opponenthandminusend opponent
text=At the beginning of each opponent's upkeep, Rackling deals X damage to that player, where X is 3 minus the number of cards in his or her hand. text=At the beginning of each opponent's upkeep, Rackling deals X damage to that player, where X is 3 minus the number of cards in his or her hand.
mana={4} mana={4}
type=Artifact Creature type=Artifact Creature
@@ -111831,8 +111832,8 @@ toughness=3
[/card] [/card]
[card] [card]
name=Storm World name=Storm World
auto=@each opponent upkeep:damage:0 && if type(*|opponenthand)~equalto~3 then damage:1 opponent && if type(*|opponenthand)~equalto~2 then damage:2 opponent && if type(*|opponenthand)~equalto~1 then damage:3 opponent && if type(*|opponenthand)~equalto~0 then damage:4 opponent auto=@each opponent upkeep:damage:4minustype:*:opponenthandminusend opponent
auto=@each my upkeep:damage:0 && if type(*|myhand)~equalto~3 then damage:1 controller && if type(*|myhand)~equalto~2 then damage:2 controller && if type(*|myhand)~equalto~1 then damage:3 controller && if type(*|myhand)~equalto~0 then damage:4 controller auto=@each my upkeep:damage:damage:4minustype:*:opponenthandminusend opponent
auto=@movedTo(other enchantment[world]|battlefield):sacrifice all(this) auto=@movedTo(other enchantment[world]|battlefield):sacrifice all(this)
text=At the beginning of each player's upkeep, Storm World deals X damage to that player, where X is 4 minus the number of cards in his or her hand. text=At the beginning of each player's upkeep, Storm World deals X damage to that player, where X is 4 minus the number of cards in his or her hand.
mana={R} mana={R}
@@ -117417,7 +117418,7 @@ toughness=5
[card] [card]
name=The Rack name=The Rack
auto=name(choose opponent) notatarget(opponent) deplete:0 auto=name(choose opponent) notatarget(opponent) deplete:0
auto=@each targetedplayer upkeep:damage:0 && if type(*|targetedpersonshand)~equalto~2 then damage:1 targetedplayer && if type(*|targetedpersonshand)~equalto~1 then damage:2 targetedplayer && if type(*|targetedpersonshand)~equalto~0 then damage:3 targetedplayer auto=@each targetedplayer upkeep:damage:3minustype:*:targetedpersonshandminusend targetedplayer
text=As The Rack enters the battlefield, choose an opponent. -- At the beginning of the chosen player's upkeep, The Rack deals X damage to that player, where X is 3 minus the number of cards in his or her hand. text=As The Rack enters the battlefield, choose an opponent. -- At the beginning of the chosen player's upkeep, The Rack deals X damage to that player, where X is 3 minus the number of cards in his or her hand.
mana={1} mana={1}
type=Artifact type=Artifact
@@ -130601,7 +130602,7 @@ type=Sorcery
[/card] [/card]
[card] [card]
name=Wheel of Torture name=Wheel of Torture
auto=@each opponent upkeep:damage:0 && if type(*|opponenthand)~equalto~2 then damage:1 opponent && if type(*|opponenthand)~equalto~1 then damage:2 opponent && if type(*|opponenthand)~equalto~0 then damage:3 opponent auto=@each opponent upkeep:damage:3minustype:*:opponenthandminusend opponent
text=At the beginning of each opponent's upkeep, Wheel of Torture deals X damage to that player, where X is 3 minus the number of cards in his or her hand. text=At the beginning of each opponent's upkeep, Wheel of Torture deals X damage to that player, where X is 3 minus the number of cards in his or her hand.
type=Artifact type=Artifact
mana={3} mana={3}
+15 -36
View File
@@ -781,53 +781,53 @@ private:
} }
else if (s == "olandg") else if (s == "olandg")
{ {
intValue = countManaProducedby(Constants::MTG_COLOR_GREEN, target->controller()->opponent()); intValue = countManaProducedby(Constants::MTG_COLOR_GREEN, target, target->controller()->opponent());
} }
else if (s == "olandu") else if (s == "olandu")
{ {
intValue = countManaProducedby(Constants::MTG_COLOR_BLUE, target->controller()->opponent()); intValue = countManaProducedby(Constants::MTG_COLOR_BLUE, target, target->controller()->opponent());
} }
else if (s == "olandr") else if (s == "olandr")
{ {
intValue = countManaProducedby(Constants::MTG_COLOR_RED, target->controller()->opponent()); intValue = countManaProducedby(Constants::MTG_COLOR_RED, target, target->controller()->opponent());
} }
else if (s == "olandb") else if (s == "olandb")
{ {
intValue = countManaProducedby(Constants::MTG_COLOR_BLACK, target->controller()->opponent()); intValue = countManaProducedby(Constants::MTG_COLOR_BLACK, target, target->controller()->opponent());
} }
else if (s == "olandw") else if (s == "olandw")
{ {
intValue = countManaProducedby(Constants::MTG_COLOR_WHITE, target->controller()->opponent()); intValue = countManaProducedby(Constants::MTG_COLOR_WHITE, target, target->controller()->opponent());
} }
else if (s == "olandc") else if (s == "olandc")
{ {
intValue = countManaProducedby(Constants::MTG_COLOR_ARTIFACT, target->controller()->opponent()) + intValue = countManaProducedby(Constants::MTG_COLOR_ARTIFACT, target, target->controller()->opponent()) +
countManaProducedby(Constants::MTG_COLOR_WASTE, target->controller()->opponent()); countManaProducedby(Constants::MTG_COLOR_WASTE, target, target->controller()->opponent());
} }
else if (s == "plandg") else if (s == "plandg")
{ {
intValue = countManaProducedby(Constants::MTG_COLOR_GREEN, target->controller()); intValue = countManaProducedby(Constants::MTG_COLOR_GREEN, target, target->controller());
} }
else if (s == "plandu") else if (s == "plandu")
{ {
intValue = countManaProducedby(Constants::MTG_COLOR_BLUE, target->controller()); intValue = countManaProducedby(Constants::MTG_COLOR_BLUE, target, target->controller());
} }
else if (s == "plandr") else if (s == "plandr")
{ {
intValue = countManaProducedby(Constants::MTG_COLOR_RED, target->controller()); intValue = countManaProducedby(Constants::MTG_COLOR_RED, target, target->controller());
} }
else if (s == "plandb") else if (s == "plandb")
{ {
intValue = countManaProducedby(Constants::MTG_COLOR_BLACK, target->controller()); intValue = countManaProducedby(Constants::MTG_COLOR_BLACK, target, target->controller());
} }
else if (s == "plandw") else if (s == "plandw")
{ {
intValue = countManaProducedby(Constants::MTG_COLOR_WHITE, target->controller()); intValue = countManaProducedby(Constants::MTG_COLOR_WHITE, target, target->controller());
} }
else if (s == "plandc") else if (s == "plandc")
{ {
intValue = countManaProducedby(Constants::MTG_COLOR_ARTIFACT, target->controller()) + intValue = countManaProducedby(Constants::MTG_COLOR_ARTIFACT, target, target->controller()) +
countManaProducedby(Constants::MTG_COLOR_WASTE, target->controller()); countManaProducedby(Constants::MTG_COLOR_WASTE, target, target->controller());
} }
else if (s == "cantargetmycre")// can target my creature else if (s == "cantargetmycre")// can target my creature
{ {
@@ -1122,7 +1122,7 @@ public:
return count; return count;
} }
/*int countManaProducedby(int color, MTGCardInstance * target, Player * player) int countManaProducedby(int color, MTGCardInstance * target, Player * player)
{ {
int count = 0; int count = 0;
for (size_t i = 0; i < target->getObserver()->mLayers->actionLayer()->manaObjects.size(); i++) for (size_t i = 0; i < target->getObserver()->mLayers->actionLayer()->manaObjects.size(); i++)
@@ -1134,27 +1134,6 @@ public:
count += 1; count += 1;
} }
return count; return count;
}*/
int countManaProducedby(int color, Player * player)
{
int count = 0;
for (int i = 0; i < player->game->battlefield->nb_cards; i++)
{
if(((MTGCardInstance *)player->game->battlefield->cards[i])->isLand() && ((MTGCardInstance *)player->game->battlefield->cards[i])->canproduceC && (color == Constants::MTG_COLOR_ARTIFACT || color == Constants::MTG_COLOR_WASTE))
count += 1;
if(((MTGCardInstance *)player->game->battlefield->cards[i])->isLand() && ((MTGCardInstance *)player->game->battlefield->cards[i])->canproduceG && color == Constants::MTG_COLOR_GREEN)
count += 1;
if(((MTGCardInstance *)player->game->battlefield->cards[i])->isLand() && ((MTGCardInstance *)player->game->battlefield->cards[i])->canproduceU && color == Constants::MTG_COLOR_BLUE)
count += 1;
if(((MTGCardInstance *)player->game->battlefield->cards[i])->isLand() && ((MTGCardInstance *)player->game->battlefield->cards[i])->canproduceR && color == Constants::MTG_COLOR_RED)
count += 1;
if(((MTGCardInstance *)player->game->battlefield->cards[i])->isLand() && ((MTGCardInstance *)player->game->battlefield->cards[i])->canproduceB && color == Constants::MTG_COLOR_BLACK)
count += 1;
if(((MTGCardInstance *)player->game->battlefield->cards[i])->isLand() && ((MTGCardInstance *)player->game->battlefield->cards[i])->canproduceW && color == Constants::MTG_COLOR_WHITE)
count += 1;
}
return count;
} }
WParsedInt(int value = 0) WParsedInt(int value = 0)
+1
View File
@@ -48,6 +48,7 @@ public:
vector<MTGCardInstance*>parentCards; vector<MTGCardInstance*>parentCards;
vector<MTGCardInstance*>childrenCards; vector<MTGCardInstance*>childrenCards;
vector<MTGAbility *>cardsAbilities; vector<MTGAbility *>cardsAbilities;
vector<MTGAbility *>cardsAbilitiesFilter;
int setAttacker(int value); int setAttacker(int value);
int setDefenser(MTGCardInstance * c); int setDefenser(MTGCardInstance * c);
-20
View File
@@ -710,26 +710,6 @@ void GameObserver::gameStateBasedEffects()
card->myPair->myPair = NULL; card->myPair->myPair = NULL;
card->myPair = NULL; card->myPair = NULL;
} }
///set basic land mana objects canproduce
for (size_t gg = 0; gg < mLayers->actionLayer()->manaObjects.size(); gg++)
{
MTGAbility * aa = ((MTGAbility *) mLayers->actionLayer()->manaObjects[gg]);
//AManaProducer * amp = dynamic_cast<AManaProducer*> (aa);
if (dynamic_cast<AManaProducer*> (aa) && (dynamic_cast<AManaProducer*> (aa))->source->isLand() && (dynamic_cast<AManaProducer*> (aa))->source == card)
{
if (card->hasType("forest") && ((AManaProducer*)aa)->output->hasColor(Constants::MTG_COLOR_GREEN))
card->canproduceG = 1;
if (card->hasType("island") && ((AManaProducer*)aa)->output->hasColor(Constants::MTG_COLOR_BLUE))
card->canproduceU = 1;
if (card->hasType("mountain") && ((AManaProducer*)aa)->output->hasColor(Constants::MTG_COLOR_RED))
card->canproduceR = 1;
if (card->hasType("swamp") && ((AManaProducer*)aa)->output->hasColor(Constants::MTG_COLOR_BLACK))
card->canproduceB = 1;
if (card->hasType("plains") && ((AManaProducer*)aa)->output->hasColor(Constants::MTG_COLOR_WHITE))
card->canproduceW = 1;
}
}
///clear imprints ///clear imprints
if(isInPlay(card) && card->imprintedCards.size()) if(isInPlay(card) && card->imprintedCards.size())
{ {
+38
View File
@@ -581,6 +581,22 @@ int AbilityFactory::parseCastRestrictions(MTGCardInstance * card, Player * playe
return 0; return 0;
} }
check = restriction[i].find("lessorequalcreatures");
if(check != string::npos)
{
bool condition = (card->controller()->opponent()->inPlay()->countByType("creature") >= card->controller()->inPlay()->countByType("creature"));
if(!condition)
return 0;
}
check = restriction[i].find("lessorequallands");
if(check != string::npos)
{
bool condition = (card->controller()->opponent()->inPlay()->countByType("land") >= card->controller()->inPlay()->countByType("land"));
if(!condition)
return 0;
}
check = restriction[i].find("outnumbered");//opponent controls atleast 4 or more creatures than you check = restriction[i].find("outnumbered");//opponent controls atleast 4 or more creatures than you
if(check != string::npos) if(check != string::npos)
{ {
@@ -596,6 +612,13 @@ int AbilityFactory::parseCastRestrictions(MTGCardInstance * card, Player * playe
return 0; return 0;
} }
check = restriction[i].find("didblock");
if(check != string::npos)
{
if(!card->didblocked)
return 0;
}
check = restriction[i].find("didattack"); check = restriction[i].find("didattack");
if(check != string::npos) if(check != string::npos)
{ {
@@ -687,6 +710,21 @@ int AbilityFactory::parseCastRestrictions(MTGCardInstance * card, Player * playe
{ {
restriction.push_back("type(creature|mybattlefield)~lessthan~type(creature|opponentbattlefield)"); restriction.push_back("type(creature|mybattlefield)~lessthan~type(creature|opponentbattlefield)");
} }
check = restriction[i].find("control less lands");
if(check != string::npos)
{
restriction.push_back("type(land|mybattlefield)~lessthan~type(land|opponentbattlefield)");
}
check = restriction[i].find("control more creatures");
if(check != string::npos)
{
restriction.push_back("type(creature|mybattlefield)~morethan~type(creature|opponentbattlefield)");
}
check = restriction[i].find("control more lands");
if(check != string::npos)
{
restriction.push_back("type(land|mybattlefield)~morethan~type(land|opponentbattlefield)");
}
check = restriction[i].find("paid("); check = restriction[i].find("paid(");
if(check != string::npos) if(check != string::npos)
+10 -7
View File
@@ -141,14 +141,16 @@ void MTGCardInstance::copy(MTGCardInstance * card)
int castMethodBackUP = this->castMethod; int castMethodBackUP = this->castMethod;
mtgid = source->getId(); mtgid = source->getId();
MTGCardInstance * oldStored = this->storedSourceCard; MTGCardInstance * oldStored = this->storedSourceCard;
/*if(!isPhased) //test copy filtered
cardsAbilitiesFilter.clear();
for(unsigned int i = 0;i < card->cardsAbilities.size();i++)
{ {
Spell * spell = NEW Spell(observer, this); MTGAbility * a = dynamic_cast<MTGAbility *>(card->cardsAbilities[i]);
observer = card->observer; if(a && a->source == card)
AbilityFactory af(observer); {
af.addAbilities(observer->mLayers->actionLayer()->getMaxId(), spell); cardsAbilitiesFilter.push_back(a);
delete spell; }
}*/ }
if(observer->players[1]->playMode == Player::MODE_TEST_SUITE) if(observer->players[1]->playMode == Player::MODE_TEST_SUITE)
mtgid = backupid; // there must be a way to get the token id... mtgid = backupid; // there must be a way to get the token id...
@@ -297,6 +299,7 @@ void MTGCardInstance::initMTGCI()
exileEffects = false; exileEffects = false;
currentZone = NULL; currentZone = NULL;
cardsAbilities = vector<MTGAbility *>(); cardsAbilities = vector<MTGAbility *>();
cardsAbilitiesFilter = vector<MTGAbility *>();
data = this; //an MTGCardInstance point to itself for data, allows to update it without killing the underlying database item data = this; //an MTGCardInstance point to itself for data, allows to update it without killing the underlying database item
if (observer && basicAbilities[(int)Constants::CHANGELING]) if (observer && basicAbilities[(int)Constants::CHANGELING])