-added "this" as valid target (still needs some work)  see cathodion
- Added mythic rares in boosters
This commit is contained in:
wagic.the.homebrew@gmail.com
2009-07-20 03:35:26 +00:00
parent 8d62b9288c
commit a376e8110b
8 changed files with 66 additions and 19 deletions

View File

@@ -91,6 +91,18 @@ toughness=3
subtype=Gnome
[/card]
[card]
text=When Cathodion is put into a graveyard from play, add {3} to your mana pool.
auto=@movedTo(this|graveyard):Add{3}
id=48195
name=Cathodion
rarity=U
type=Artifact Creature
mana={3}
power=3
subtype=Construct
toughness=3
[/card]
[card]
text=Cloudpost comes into play tapped. {T}: Add {1} to your mana pool for each Locus in play.
auto=tap
auto={T}:foreach(Locus)add:{1}

View File

@@ -47,6 +47,7 @@ bottle_gnomes.txt
boggart_arsonists.txt
brass_man.txt
castle.txt
cathodion.txt
celestial_purge.txt
circle_of_protection.txt
clone.txt

View File

@@ -0,0 +1,21 @@
#Testing Cathodion:
# text=When Cathodion is put into a graveyard from play, add {3} to your mana pool.
[INIT]
FIRSTMAIN
[PLAYER1]
hand:lightning bolt
manapool:{R}
[PLAYER2]
inplay:cathodion
[DO]
lightning bolt
cathodion
[ASSERT]
FIRSTMAIN
[PLAYER1]
graveyard:lightning bolt
manapool:{0}
[PLAYER2]
graveyard:cathodion
manapool:{3}
[END]

View File

@@ -53,15 +53,6 @@ class TargetChooserFactory{
};
class CardTargetChooser:public TargetChooser {
protected:
MTGCardInstance * validTarget;
public:
CardTargetChooser(MTGCardInstance * _card, MTGCardInstance * source);
virtual int canTarget(Targetable * target );
};
class TargetZoneChooser:public TargetChooser{
public:
@@ -74,6 +65,16 @@ class TargetZoneChooser:public TargetChooser{
virtual int canTarget(Targetable * _card);
};
class CardTargetChooser:public TargetZoneChooser {
protected:
MTGCardInstance * validTarget;
public:
CardTargetChooser(MTGCardInstance * _card, MTGCardInstance * source,int * _zones = NULL, int _nbzones = 0);
virtual int canTarget(Targetable * target );
};
class CreatureTargetChooser:public TargetZoneChooser{
public:
int maxpower;

View File

@@ -2408,7 +2408,8 @@ int GenericTriggeredAbility::resolve(){
}
int GenericTriggeredAbility::testDestroy(){
if (destroyCondition) return destroyCondition->testDestroy();
if (!TriggeredAbility::testDestroy()) return 0;
if (destroyCondition) return (destroyCondition->testDestroy());
return t->testDestroy();
}

View File

@@ -465,7 +465,10 @@ int MTGDeck::addRandomCards(int howmany, int setId, int rarity, const char * _su
}
}
}
if (subtotal == 0) return 0;
if (subtotal == 0){
if (rarity == Constants::RARITY_M) return addRandomCards(howmany, setId, Constants::RARITY_R, _subtype, colors, nbcolors);
return 0;
}
for (int i = 0; i < howmany; i++){
int id = (rand() % subtotal);
add(subcollection[id]);

View File

@@ -253,8 +253,10 @@ void ShopItems::ButtonPressed(int controllerId, int controlId){
display = NEW CardDisplay(12,NULL, SCREEN_WIDTH - 200, SCREEN_HEIGHT/2,this,NULL,5);
MTGDeck * tempDeck = NEW MTGDeck(NULL,playerdata->collection->database);
tempDeck->addRandomCards(1, setIds[showPriceDialog],Constants::RARITY_R);
int rare_or_mythic = Constants::RARITY_R;
int rnd = rand() % 8;
if (rnd == 0) rare_or_mythic = Constants::RARITY_M;
tempDeck->addRandomCards(1, setIds[showPriceDialog],rare_or_mythic);
tempDeck->addRandomCards(3, setIds[showPriceDialog],Constants::RARITY_U);
tempDeck->addRandomCards(11, setIds[showPriceDialog],Constants::RARITY_C);
playerdata->collection->add(tempDeck);

View File

@@ -183,7 +183,7 @@ TargetChooser * TargetChooserFactory::createTargetChooser(string s, MTGCardInsta
typeName = typeName.substr(0,found);
}
//X targets allowed ?
if (typeName.at(typeName.length()-1) == 's' && !Subtypes::subtypesList->find(typeName)){
if (typeName.at(typeName.length()-1) == 's' && !Subtypes::subtypesList->find(typeName) && typeName.compare("this")!=0){
typeName = typeName.substr(0,typeName.length()-1);
maxtargets = -1;
}
@@ -200,6 +200,8 @@ TargetChooser * TargetChooserFactory::createTargetChooser(string s, MTGCardInsta
if (!tc){
if (typeName.compare("*")==0){
return NEW TargetZoneChooser(zones, nbzones,card, maxtargets);
}else if (typeName.compare("this")==0){
return NEW CardTargetChooser(card,card,zones, nbzones);
}else{
tc = NEW TypeTargetChooser(typeName.c_str(), zones, nbzones, card,maxtargets);
}
@@ -334,15 +336,19 @@ int TargetChooser::targetListSet(){
/**
a specific Card
**/
CardTargetChooser::CardTargetChooser(MTGCardInstance * _card, MTGCardInstance * source):TargetChooser(source){
CardTargetChooser::CardTargetChooser(MTGCardInstance * _card, MTGCardInstance * source,int * _zones, int _nbzones):TargetZoneChooser(_zones,_nbzones,source){
validTarget = _card;
}
int CardTargetChooser::canTarget(Targetable * target ){
if (!TargetChooser::canTarget(target)) return 0;
if (target->typeAsTarget() == TARGET_CARD){
MTGCardInstance * card = (MTGCardInstance *) target;
if (card == validTarget) return 1;
if (!target) return 0;
if (target->typeAsTarget() != TARGET_CARD) return 0;
if (!nbzones && !TargetChooser::canTarget(target)) return 0;
if (nbzones && !TargetZoneChooser::canTarget(target)) return 0;
MTGCardInstance * card = (MTGCardInstance *) target;
while(card){
if(card == validTarget) return 1;
card = card->previous;
}
return 0;
}