Erwan
-added "this" as valid target (still needs some work) see cathodion - Added mythic rares in boosters
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
@@ -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]);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user