Skip to content

Commit

Permalink
Merge pull request #606 from kevlahnota/master
Browse files Browse the repository at this point in the history
Fix for guild_keywords Devotion, added some "Chroma" cards
  • Loading branch information
xawotihs committed Dec 5, 2014
2 parents 15cd86f + fa14219 commit 6f6c8b0
Show file tree
Hide file tree
Showing 9 changed files with 132 additions and 76 deletions.
52 changes: 52 additions & 0 deletions projects/mtg/bin/Res/sets/primitives/mtg.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40413,6 +40413,17 @@ power=2
toughness=2
[/card]
[card]
name=Heartlash Cinder
abilities=haste
auto=type:manar/0 ueot
text=Haste -- Chroma - When Heartlash Cinder enters the battlefield, it gets +X/+0 until end of turn, where X is the number of red mana symbols in the mana costs of permanents you control.
mana={1}{R}
type=Creature
subtype=Elemental Warrior
power=1
toughness=1
[/card]
[card]
name=Heartless Hidetsugu
text={T}: Heartless Hidetsugu deals damage to each player equal to half that player's life total, rounded down.
auto={t}:damage:halfdownlifetotal controller && damage:halfdownopponentlifetotal opponent
Expand Down Expand Up @@ -63547,6 +63558,16 @@ mana={3}{B}
type=Sorcery
[/card]
[card]
name=Outrage Shaman
auto=damage:type:manar target(creature)
text=Chroma - When Outrage Shaman enters the battlefield, it deals damage to target creature equal to the number of red mana symbols in the mana costs of permanents you control.
mana={3}{R}{R}
type=Creature
subtype=Goblin Shaman
power=2
toughness=2
[/card]
[card]
name=Outrider of Jhess
abilities=exalted
text=Exalted (Whenever a creature you control attacks alone, that creature gets +1/+1 until end of turn.)
Expand Down Expand Up @@ -67553,6 +67574,17 @@ type=Enchantment
subtype=Aura
[/card]
[card]
name=Primalcrux
abilities=trample
auto=thisforeach(variable{type:manag:mybattlefield}>0) 1/1
text=Trample -- Chroma - Primalcrux's power and toughness are each equal to the number of green mana symbols in the mana costs of permanents you control.
mana={G}{G}{G}{G}{G}{G}
type=Creature
subtype=Elemental
power=*
toughness=*
[/card]
[card]
name=Prime Speaker Zegana
auto=counter(1/1,power:highest:creature:mybattlefield) && draw:power
text=Prime Speaker Zegana enters the battlefield with X +1/+1 counters on it, where X is the greatest power among other creatures you control. -- When Prime Speaker Zegana enters the battlefield, draw cards equal to its power.
Expand Down Expand Up @@ -85813,6 +85845,16 @@ power=3
toughness=3
[/card]
[card]
name=Springjack Shepherd
auto=token(Goat,Creature Goat,0/1,white)*type:manaw
text=Chroma - When Springjack Shepherd enters the battlefield, put a 0/1 white Goat creature token onto the battlefield for each white mana symbol in the mana costs of permanents you control.
mana={3}{W}
type=Creature
subtype=Kithkin Wizard
power=1
toughness=2
[/card]
[card]
name=Springleaf Drum
auto={T}{T(other creature|myBattlefield)}:Add{W}
auto={T}{T(other creature|myBattlefield)}:Add{U}
Expand Down Expand Up @@ -95775,6 +95817,16 @@ mana={4}
type=Artifact
[/card]
[card]
name=Umbra Stalker
auto=thisforeach(variable{type:manab:mygraveyard}>0) 1/1
text=Chroma - Umbra Stalker's power and toughness are each equal to the number of black mana symbols in the mana costs of cards in your graveyard.
mana={4}{B}{B}{B}
type=Creature
subtype=Elemental
power=*
toughness=*
[/card]
[card]
name=Umbral Mantle
auto=teach(creature) {3}{q}:+2/+2 ueot
auto={0}:equip
Expand Down
46 changes: 0 additions & 46 deletions projects/mtg/bin/Res/sets/primitives/unsupported.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7045,16 +7045,6 @@ mana={2}{G}
type=Enchantment
[/card]
[card]
name=Heartlash Cinder
abilities=haste
text=Haste -- Chroma - When Heartlash Cinder enters the battlefield, it gets +X/+0 until end of turn, where X is the number of red mana symbols in the mana costs of permanents you control.
mana={1}{R}
type=Creature
subtype=Elemental Warrior
power=1
toughness=1
[/card]
[card]
name=Heartstone
text=Activated abilities of creatures cost {1} less to activate. This effect can't reduce the amount of mana an ability costs to activate to less than one mana.
mana={3}
Expand Down Expand Up @@ -11490,15 +11480,6 @@ mana={X}{R}
type=Instant
[/card]
[card]
name=Outrage Shaman
text=Chroma - When Outrage Shaman enters the battlefield, it deals damage to target creature equal to the number of red mana symbols in the mana costs of permanents you control.
mana={3}{R}{R}
type=Creature
subtype=Goblin Shaman
power=2
toughness=2
[/card]
[card]
name=Outrider en-Kor
text=Flanking (Whenever a creature without flanking blocks this creature, the blocking creature gets -1/-1 until end of turn.) -- {0}: The next 1 damage that would be dealt to Outrider en-Kor this turn is dealt to target creature you control instead.
mana={2}{W}
Expand Down Expand Up @@ -12350,15 +12331,6 @@ power=2
toughness=2
[/card]
[card]
name=Primalcrux
text=Trample -- Chroma - Primalcrux's power and toughness are each equal to the number of green mana symbols in the mana costs of permanents you control.
mana={G}{G}{G}{G}{G}{G}
type=Creature
subtype=Elemental
power=*
toughness=*
[/card]
[card]
name=Primitive Etchings
text=Reveal the first card you draw each turn. Whenever you reveal a creature card this way, draw a card.
mana={2}{G}{G}
Expand Down Expand Up @@ -15830,15 +15802,6 @@ text={T}: Add {1} to your mana pool. -- {4}, {T}: Put a 0/1 white Goat creature
type=Land
[/card]
[card]
name=Springjack Shepherd
text=Chroma - When Springjack Shepherd enters the battlefield, put a 0/1 white Goat creature token onto the battlefield for each white mana symbol in the mana costs of permanents you control.
mana={3}{W}
type=Creature
subtype=Kithkin Wizard
power=1
toughness=2
[/card]
[card]
name=Sprout Swarm
text=Convoke (Each creature you tap while casting this spell reduces its total cost by {1} or by one mana of that creature's color.) -- Buyback {3} (You may pay an additional {3} as you cast this spell. If you do, put this card into your hand as it resolves.) -- Put a 1/1 green Saproling creature token onto the battlefield.
mana={1}{G}
Expand Down Expand Up @@ -17631,15 +17594,6 @@ toughness=2
text=Auras attached to permanents you control have totem armor. (If an enchanted permanent you control would be destroyed, instead remove all damage from it and destroy an Aura attached to it.)
[/card]
[card]
name=Umbra Stalker
text=Chroma - Umbra Stalker's power and toughness are each equal to the number of black mana symbols in the mana costs of cards in your graveyard.
mana={4}{B}{B}{B}
type=Creature
subtype=Elemental
power=*
toughness=*
[/card]
[card]
name=Unblinking Bleb
text=Morph {2}{U} (You may cast this face down as a 2/2 creature for {3}. Turn it face up any time for its morph cost.) -- Whenever Unblinking Bleb or another permanent is turned face up, you may scry 2. (To scry 2, look at the top two cards of your library, then put any number of them on the bottom of your library and the rest on top in any order.)
mana={3}{U}
Expand Down
60 changes: 30 additions & 30 deletions projects/mtg/include/AllAbilities.h
Original file line number Diff line number Diff line change
Expand Up @@ -183,10 +183,10 @@ class WParsedInt
for (int k = 0; k < 4; k++)
{
MTGGameZone * zone = dzones[k];
if (dtc->targetsZone(zone, card))
if (dtc->targetsZone(zone, card)&&dp == card->controller())
{
intValue += zone->countTotalManaSymbols(dtc, 2);
intValue += zone->countTotalManaSymbols(dtc, 5);
intValue += zone->countDevotion(dtc, 2);
intValue += zone->countDevotion(dtc, 5);
}
}
}
Expand All @@ -203,10 +203,10 @@ class WParsedInt
for (int k = 0; k < 4; k++)
{
MTGGameZone * zone = dzones[k];
if (dtc->targetsZone(zone, card))
if (dtc->targetsZone(zone, card)&&dp == card->controller())
{
intValue += zone->countTotalManaSymbols(dtc, 3);
intValue += zone->countTotalManaSymbols(dtc, 5);
intValue += zone->countDevotion(dtc, 3);
intValue += zone->countDevotion(dtc, 5);
}
}
}
Expand All @@ -223,10 +223,10 @@ class WParsedInt
for (int k = 0; k < 4; k++)
{
MTGGameZone * zone = dzones[k];
if (dtc->targetsZone(zone, card))
if (dtc->targetsZone(zone, card)&&dp == card->controller())
{
intValue += zone->countTotalManaSymbols(dtc, 2);
intValue += zone->countTotalManaSymbols(dtc, 4);
intValue += zone->countDevotion(dtc, 2);
intValue += zone->countDevotion(dtc, 4);
}
}
}
Expand All @@ -243,10 +243,10 @@ class WParsedInt
for (int k = 0; k < 4; k++)
{
MTGGameZone * zone = dzones[k];
if (dtc->targetsZone(zone, card))
if (dtc->targetsZone(zone, card)&&dp == card->controller())
{
intValue += zone->countTotalManaSymbols(dtc, 1);
intValue += zone->countTotalManaSymbols(dtc, 4);
intValue += zone->countDevotion(dtc, 1);
intValue += zone->countDevotion(dtc, 4);
}
}
}
Expand All @@ -263,10 +263,10 @@ class WParsedInt
for (int k = 0; k < 4; k++)
{
MTGGameZone * zone = dzones[k];
if (dtc->targetsZone(zone, card))
if (dtc->targetsZone(zone, card)&&dp == card->controller())
{
intValue += zone->countTotalManaSymbols(dtc, 1);
intValue += zone->countTotalManaSymbols(dtc, 3);
intValue += zone->countDevotion(dtc, 1);
intValue += zone->countDevotion(dtc, 3);
}
}
}
Expand All @@ -283,10 +283,10 @@ class WParsedInt
for (int k = 0; k < 4; k++)
{
MTGGameZone * zone = dzones[k];
if (dtc->targetsZone(zone, card))
if (dtc->targetsZone(zone, card)&&dp == card->controller())
{
intValue += zone->countTotalManaSymbols(dtc, 2);
intValue += zone->countTotalManaSymbols(dtc, 3);
intValue += zone->countDevotion(dtc, 2);
intValue += zone->countDevotion(dtc, 3);
}
}
}
Expand All @@ -303,10 +303,10 @@ class WParsedInt
for (int k = 0; k < 4; k++)
{
MTGGameZone * zone = dzones[k];
if (dtc->targetsZone(zone, card))
if (dtc->targetsZone(zone, card)&&dp == card->controller())
{
intValue += zone->countTotalManaSymbols(dtc, 4);
intValue += zone->countTotalManaSymbols(dtc, 5);
intValue += zone->countDevotion(dtc, 4);
intValue += zone->countDevotion(dtc, 5);
}
}
}
Expand All @@ -323,10 +323,10 @@ class WParsedInt
for (int k = 0; k < 4; k++)
{
MTGGameZone * zone = dzones[k];
if (dtc->targetsZone(zone, card))
if (dtc->targetsZone(zone, card)&&dp == card->controller())
{
intValue += zone->countTotalManaSymbols(dtc, 3);
intValue += zone->countTotalManaSymbols(dtc, 4);
intValue += zone->countDevotion(dtc, 3);
intValue += zone->countDevotion(dtc, 4);
}
}
}
Expand All @@ -343,10 +343,10 @@ class WParsedInt
for (int k = 0; k < 4; k++)
{
MTGGameZone * zone = dzones[k];
if (dtc->targetsZone(zone, card))
if (dtc->targetsZone(zone, card)&&dp == card->controller())
{
intValue += zone->countTotalManaSymbols(dtc, 1);
intValue += zone->countTotalManaSymbols(dtc, 5);
intValue += zone->countDevotion(dtc, 1);
intValue += zone->countDevotion(dtc, 5);
}
}
}
Expand All @@ -363,10 +363,10 @@ class WParsedInt
for (int k = 0; k < 4; k++)
{
MTGGameZone * zone = dzones[k];
if (dtc->targetsZone(zone, card))
if (dtc->targetsZone(zone, card)&&dp == card->controller())
{
intValue += zone->countTotalManaSymbols(dtc, 1);
intValue += zone->countTotalManaSymbols(dtc, 2);
intValue += zone->countDevotion(dtc, 1);
intValue += zone->countDevotion(dtc, 2);
}
}
}
Expand Down
1 change: 1 addition & 0 deletions projects/mtg/include/MTGGameZones.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ class MTGGameZone {
unsigned int countByType(const string &value);
unsigned int countByCanTarget(TargetChooser * tc);
unsigned int countTotalManaSymbols(TargetChooser * tc, int color);
unsigned int countDevotion(TargetChooser * tc, int color); //devotion for gods
MTGCardInstance * findByName(string name);

//returns true if one of the cards in the zone has the ability
Expand Down
1 change: 1 addition & 0 deletions projects/mtg/include/ManaCost.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ class ManaCost
string toString();
int getCost(int color);
int getManaSymbols(int color);
int getManaSymbolsHybridMerged(int color);

//Returns NULL if i is greater than nbhybrids
ManaCostHybrid * getHybridCost(unsigned int i);
Expand Down
1 change: 1 addition & 0 deletions projects/mtg/include/ManaCostHybrid.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class ManaCostHybrid
string toString();
int getConvertedCost();
int getManaSymbols(int color);
int getManaSymbolsHybridMerged(int color);

friend std::ostream& operator<<(std::ostream& out, ManaCostHybrid& m);
friend std::ostream& operator<<(std::ostream& out, ManaCostHybrid* m);
Expand Down
18 changes: 18 additions & 0 deletions projects/mtg/src/MTGGameZones.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -580,6 +580,24 @@ unsigned int MTGGameZone::countTotalManaSymbols(TargetChooser * tc, int color)
return result;
}

unsigned int MTGGameZone::countDevotion(TargetChooser * tc, int color)
{
if (!tc) {
return 0;
}
// we don't care if cards have protection.
bool withoutProtections = true;
int result = 0;
for (int i = 0; i < nb_cards; i++)
{
if (tc->canTarget(cards[i], withoutProtections))
{
result += cards[i]->getManaCost()->getManaSymbolsHybridMerged(color);
}
}
return result;
}

MTGCardInstance * MTGGameZone::findByName(string name)
{
for (int i = 0; i < (nb_cards); i++)
Expand Down
21 changes: 21 additions & 0 deletions projects/mtg/src/ManaCost.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -618,6 +618,27 @@ int ManaCost::getManaSymbols(int color)
return result;
}

int ManaCost::getManaSymbolsHybridMerged(int color)
{
int result = cost[color];
for (size_t i = 0; i < hybrids.size(); ++i)
{
result = hybrids[i].getManaSymbolsHybridMerged(color);//removed +
}
if (extraCosts && extraCosts->costs.size())
{
for (size_t i = 0; i < extraCosts->costs.size(); ++i)
{
LifeorManaCost * phyrexianMana = dynamic_cast<LifeorManaCost*>(extraCosts->costs[i]);
if (phyrexianMana)
{
result += phyrexianMana->getManaCost()->getManaSymbolsHybridMerged(color);
}
}
}
return result;
}

int ManaCost::parseManaSymbol(char symbol)
{
switch (symbol)
Expand Down
8 changes: 8 additions & 0 deletions projects/mtg/src/ManaCostHybrid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,14 @@ int ManaCostHybrid::getManaSymbols(int color)
return 0;
}

int ManaCostHybrid::getManaSymbolsHybridMerged(int color)
{
// we assume that color1 and color2 are different
if (color1 == color) return value1;
if (color2 == color) return value2;
return 0;
}

int ManaCostHybrid::hasColor(int color)
{
if (((color1 == color) && value1) || ((color2 == color) && value2))
Expand Down

0 comments on commit 6f6c8b0

Please sign in to comment.