Erwan
- Fixed Damage All (Ashen Firebeast/ See test) - Fixed Momir crash if no card with corresponding mana cost exists
This commit is contained in:
@@ -28,6 +28,7 @@ ardakar_wastes.txt
|
||||
ascendant_evincar.txt
|
||||
ascendant_evincar2.txt
|
||||
ascendant_evincar3.txt
|
||||
ashen_firebeast.txt
|
||||
blessed_wine.txt
|
||||
bottle_gnomes.txt
|
||||
boggart_arsonists.txt
|
||||
@@ -119,4 +120,5 @@ zombify.txt
|
||||
########################
|
||||
#Momir Basic Tests
|
||||
########################
|
||||
momir/keldon_warlord.txt
|
||||
momir/keldon_warlord.txt
|
||||
momir/overcost.txt
|
||||
20
projects/mtg/bin/Res/test/ashen_firebeast.txt
Normal file
20
projects/mtg/bin/Res/test/ashen_firebeast.txt
Normal file
@@ -0,0 +1,20 @@
|
||||
#Testing Ashen firebeast: {1}{R}: Ashen Firebeast deals 1 damage to each creature without flying.
|
||||
[INIT]
|
||||
FIRSTMAIN
|
||||
[PLAYER1]
|
||||
inplay:Ashen Firebeast,Benalish Hero,Birds of Paradise
|
||||
manapool:{1}{R}
|
||||
[PLAYER2]
|
||||
inplay:plague rats,drudge skelettons,El_Hajaj,Air elemental
|
||||
[DO]
|
||||
Ashen Firebeast
|
||||
[ASSERT]
|
||||
FIRSTMAIN
|
||||
[PLAYER1]
|
||||
graveyard:Benalish Hero
|
||||
inplay:Ashen Firebeast,Birds of Paradise
|
||||
manapool:{0}
|
||||
[PLAYER2]
|
||||
graveyard:plague rats,drudge skelettons,El_Hajaj
|
||||
inplay:Air elemental
|
||||
[END]
|
||||
18
projects/mtg/bin/Res/test/momir/overcost.txt
Normal file
18
projects/mtg/bin/Res/test/momir/overcost.txt
Normal file
@@ -0,0 +1,18 @@
|
||||
#Testing That Paying a great cost does not crash momir
|
||||
MOMIR
|
||||
[INIT]
|
||||
FIRSTMAIN
|
||||
[PLAYER1]
|
||||
manapool:{20}
|
||||
hand:plains
|
||||
[PLAYER2]
|
||||
[DO]
|
||||
plains
|
||||
choice 1
|
||||
[ASSERT]
|
||||
FIRSTMAIN
|
||||
[PLAYER1]
|
||||
graveyard:plains
|
||||
inplay:*
|
||||
[PLAYER2]
|
||||
[END]
|
||||
@@ -1350,6 +1350,34 @@ class AForeach:public ListMaintainerAbility{
|
||||
|
||||
};
|
||||
|
||||
//Damage all.... ActivatedAbility
|
||||
class AAllDamager:public ActivatedAbility{
|
||||
public:
|
||||
int damage;
|
||||
AAllDamager(int _id, MTGCardInstance * _source, ManaCost * _cost, int _damage, TargetChooser * _tc ,int doTap =1):ActivatedAbility(_id,_source,_cost,0,doTap),damage(_damage){
|
||||
tc = _tc;
|
||||
|
||||
}
|
||||
|
||||
int resolve(){
|
||||
AbilityFactory af;
|
||||
af.damageAll(tc,damage);
|
||||
return 1;
|
||||
}
|
||||
|
||||
const char * getMenuText(){
|
||||
return "Damage All...";
|
||||
}
|
||||
|
||||
virtual ostream& toString(ostream& out) const
|
||||
{
|
||||
out << "AAllDamager ::: damage : " << damage
|
||||
<< " (";
|
||||
return ActivatedAbility::toString(out) << ")";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
/* Standard Damager, can choose a NEW target each time the price is paid */
|
||||
class ADamager:public TargetAbility{
|
||||
|
||||
@@ -565,7 +565,12 @@ int AbilityFactory::magicText(int id, Spell * spell, MTGCardInstance * card){
|
||||
}
|
||||
if (tc){
|
||||
if (all){
|
||||
damageAll(tc,damage);
|
||||
if (cost){
|
||||
MTGAbility * a = NEW AAllDamager(id, card, cost, damage, tc,doTap);
|
||||
game->addObserver(a);
|
||||
}else{
|
||||
damageAll(tc,damage);
|
||||
}
|
||||
}else{
|
||||
MTGAbility * a = NEW ADamager(id, card, cost, damage, tc,doTap);
|
||||
if (multi){
|
||||
@@ -578,7 +583,6 @@ int AbilityFactory::magicText(int id, Spell * spell, MTGCardInstance * card){
|
||||
if (multi){
|
||||
Damageable * target = parseCollateralTarget(card, s);
|
||||
if (!target) target = spell->getNextDamageableTarget();
|
||||
if (!target)OutputDebugString("NO TARGET FOR DAMAGE\n");
|
||||
multi->Add(NEW DamageEvent(card,target,damage));
|
||||
}else{
|
||||
game->mLayers->stackLayer()->addDamage(card,spell->getNextDamageableTarget(), damage);
|
||||
|
||||
@@ -241,11 +241,17 @@ MTGCardInstance * MTGMomirRule::genCreature( int id){
|
||||
}
|
||||
|
||||
int MTGMomirRule::genRandomCreatureId(int convertedCost){
|
||||
if (convertedCost > 20) convertedCost = 20;
|
||||
if (convertedCost >= 20) convertedCost = 19;
|
||||
int total_cards = 0;
|
||||
int i = convertedCost;
|
||||
while (!total_cards && i >=0){
|
||||
#ifdef WIN32
|
||||
char buf[4096];
|
||||
sprintf(buf,"Converted Cost in momir: %i\n", i);
|
||||
OutputDebugString(buf);
|
||||
#endif
|
||||
total_cards = pool[i].size();
|
||||
convertedCost = i;
|
||||
i--;
|
||||
}
|
||||
if (!total_cards) return 0;
|
||||
|
||||
@@ -19,6 +19,7 @@ TestSuiteAI::TestSuiteAI(TestSuite * _suite, int playerId):AIPlayer(_suite->buil
|
||||
int TestSuite::getMTGId(string cardName){
|
||||
int cardnb = atoi(cardName.c_str());
|
||||
if (cardnb) return cardnb;
|
||||
if (cardName.compare("*") == 0) return -1; //Any card
|
||||
MTGCard * card = collection->getCardByName(cardName);
|
||||
if (card) return card->getMTGId();
|
||||
return 0;
|
||||
@@ -329,13 +330,15 @@ int TestSuite::assertGame(){
|
||||
return 0;
|
||||
}
|
||||
for (int k = 0; k < endState.playerData[i].zones[j].nbitems; k++){
|
||||
int cardid = endState.playerData[i].zones[j].cards[k];
|
||||
MTGCardInstance * card = getCardByMTGId(cardid);
|
||||
if (!card || !zone->hasCard(card)){
|
||||
sprintf(result, "<span class=\"error\">==Card ID not the same. Didn't find %i</span><br />", cardid);
|
||||
Log(result);
|
||||
error++;
|
||||
}
|
||||
int cardid = endState.playerData[i].zones[j].cards[k];
|
||||
if (cardid != -1){
|
||||
MTGCardInstance * card = getCardByMTGId(cardid);
|
||||
if (!card || !zone->hasCard(card)){
|
||||
sprintf(result, "<span class=\"error\">==Card ID not the same. Didn't find %i</span><br />", cardid);
|
||||
Log(result);
|
||||
error++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user