Erwan
- fix a segfault with Shivan Gorge - Fix a memory leak in the AI - Commit a test for issue 265
This commit is contained in:
@@ -338,7 +338,7 @@ subtype=Aura
|
|||||||
[card]
|
[card]
|
||||||
text=Until end of turn, permanents you control gain "{T}: This permanent deals 1 damage to target creature or player."
|
text=Until end of turn, permanents you control gain "{T}: This permanent deals 1 damage to target creature or player."
|
||||||
id=83912
|
id=83912
|
||||||
auto=lord(creature|myBattlefield) {T}:damage:1 target(*)
|
auto=lord(creature|myBattlefield) {T}:damage:1 target(creature,player)
|
||||||
name=Flame Fusillade
|
name=Flame Fusillade
|
||||||
rarity=R
|
rarity=R
|
||||||
type=Sorcery
|
type=Sorcery
|
||||||
|
|||||||
21
projects/mtg/bin/Res/test/bugs/flame_fusillade_i265.txt
Normal file
21
projects/mtg/bin/Res/test/bugs/flame_fusillade_i265.txt
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
#Bug: Flame Fusillade
|
||||||
|
[INIT]
|
||||||
|
FIRSTMAIN
|
||||||
|
[PLAYER1]
|
||||||
|
hand:Flame fusillade
|
||||||
|
inplay:grizzly bears
|
||||||
|
manapool:{3}{R}
|
||||||
|
[PLAYER2]
|
||||||
|
inplay:raging goblin
|
||||||
|
[DO]
|
||||||
|
flame fusillade
|
||||||
|
grizzly bears
|
||||||
|
raging goblin
|
||||||
|
[ASSERT]
|
||||||
|
FIRSTMAIN
|
||||||
|
[PLAYER1]
|
||||||
|
graveyard:Flame fusillade
|
||||||
|
inplay:grizzly bears
|
||||||
|
[PLAYER2]
|
||||||
|
graveyard:raging goblin
|
||||||
|
[END]
|
||||||
@@ -1926,8 +1926,8 @@ AADamager(int _id, MTGCardInstance * _source, Targetable * _target, WParsedInt *
|
|||||||
}
|
}
|
||||||
|
|
||||||
int resolve(){
|
int resolve(){
|
||||||
if(target){
|
Damageable * _target = (Damageable *) getTarget();
|
||||||
Damageable * _target = (Damageable *) getTarget();
|
if(_target){
|
||||||
game->mLayers->stackLayer()->addDamage(source,_target, damage->getValue());
|
game->mLayers->stackLayer()->addDamage(source,_target, damage->getValue());
|
||||||
game->mLayers->stackLayer()->resolve();
|
game->mLayers->stackLayer()->resolve();
|
||||||
return 1;
|
return 1;
|
||||||
|
|||||||
@@ -176,6 +176,12 @@ int AIAction::getEfficiency(){
|
|||||||
case MTGAbility::DAMAGER:
|
case MTGAbility::DAMAGER:
|
||||||
{
|
{
|
||||||
AADamager * aad = (AADamager *) a;
|
AADamager * aad = (AADamager *) a;
|
||||||
|
if (!target){
|
||||||
|
Targetable * _t = aad->getTarget();
|
||||||
|
if (_t == p->opponent()) efficiency = 90;
|
||||||
|
else efficiency = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
if ( p == target->controller()){
|
if ( p == target->controller()){
|
||||||
efficiency = 0;
|
efficiency = 0;
|
||||||
}else if (aad->damage->getValue() >= target->toughness){
|
}else if (aad->damage->getValue() >= target->toughness){
|
||||||
@@ -215,6 +221,10 @@ int AIAction::getEfficiency(){
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (p->game->hand->nb_cards == 0) efficiency = (int) ((float) efficiency * 1.3); //increase chance of using ability if hand is empty
|
if (p->game->hand->nb_cards == 0) efficiency = (int) ((float) efficiency * 1.3); //increase chance of using ability if hand is empty
|
||||||
|
if (ability->cost){
|
||||||
|
ExtraCosts * ec = ability->cost->extraCosts;
|
||||||
|
if (ec) efficiency = efficiency / 3; //Decrease chance of using ability if there is an extra cost to use the ability
|
||||||
|
}
|
||||||
return efficiency;
|
return efficiency;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -952,7 +952,8 @@ int AbilityFactory::magicText(int id, Spell * spell, MTGCardInstance * card, int
|
|||||||
MTGAbility * a = v[i];
|
MTGAbility * a = v[i];
|
||||||
if (dryMode){
|
if (dryMode){
|
||||||
result = abilityEfficiency(a, card->controller(),mode,tc);
|
result = abilityEfficiency(a, card->controller(),mode,tc);
|
||||||
SAFE_DELETE(a);
|
for (size_t i = 0; i < v.size(); ++i)
|
||||||
|
SAFE_DELETE(v[i]);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user