few small items, first since card view are now correctly null'ed, i ran into a few cases while watching demo mode where the game would trigger a stop on the battle hint that uses card views, apon checking the card view would be null at the time. so added a condiational check to prevent the game from trying to alter a null'ed pointer.
2nd, added a block out for optimizedhand in demo mode, ie any time its cpu player vs cpu player, noticed demo was starting matches with no cards. 3rd, added a hackish workaround to allow Ai to get eff returns on abilities using the all(this) lord workaround to target the source. Ai was not getting any returns on these abilities. now basically if the ability is a lord && !target...lets calculate this as tho source == target....
This commit is contained in:
@@ -272,8 +272,18 @@ int AIAction::getEfficiency()
|
||||
case MTGAbility::STANDARD_PREVENT:
|
||||
{
|
||||
efficiency = 0;//starts out low to avoid spamming it when its not needed.
|
||||
if (!target)
|
||||
if (!target && !dynamic_cast<ALord*> (a))
|
||||
break;
|
||||
if(dynamic_cast<ALord*> (a) && !target)
|
||||
{
|
||||
//this is a specail case for all(this) targetting workaround.
|
||||
//adding a direct method for targetting the source is planned for
|
||||
//the coming releases, all(this) workaround prevents eff from being returned
|
||||
//as its not targetted the same as abilities
|
||||
//for now this dirty hack will calculate eff on lords as tho the source is
|
||||
//the target...otherwise these abilities will never be used.
|
||||
target = a->source;
|
||||
}
|
||||
|
||||
bool NeedPreventing;
|
||||
NeedPreventing = false;
|
||||
@@ -376,8 +386,13 @@ int AIAction::getEfficiency()
|
||||
{
|
||||
MTGCardInstance * _target = (MTGCardInstance *) (a->target);
|
||||
efficiency = 0;
|
||||
if (!target)
|
||||
if (!target && !dynamic_cast<ALord*> (a))
|
||||
break;
|
||||
if(dynamic_cast<ALord*> (a) && !target)
|
||||
{
|
||||
target = a->source;
|
||||
}
|
||||
|
||||
AbilityFactory af;
|
||||
int suggestion = af.abilityEfficiency(a, p, MODE_ABILITY);
|
||||
//i do not set a starting eff. on this ability, this allows Ai to sometimes randomly do it as it normally does.
|
||||
@@ -475,8 +490,13 @@ int AIAction::getEfficiency()
|
||||
{
|
||||
efficiency = 0;
|
||||
MTGCardInstance * _target = (MTGCardInstance *) (a->target);
|
||||
if (!target)
|
||||
if (!target && !dynamic_cast<ALord*> (a))
|
||||
break;
|
||||
if(dynamic_cast<ALord*> (a) && !target)
|
||||
{
|
||||
target = a->source;
|
||||
}
|
||||
|
||||
//ensuring that Ai grants abilities to creatures during first main, so it can actually use them in combat.
|
||||
//quick note: the eff is multiplied by creatures ranking then divided by the number of cards in hand.
|
||||
//the reason i do this is to encourage more casting and less waste of mana on abilities.
|
||||
@@ -520,8 +540,12 @@ int AIAction::getEfficiency()
|
||||
//untap things that Ai owns and are tapped.
|
||||
{
|
||||
efficiency = 0;
|
||||
if (!target)
|
||||
if (!target && !dynamic_cast<ALord*> (a))
|
||||
break;
|
||||
if(dynamic_cast<ALord*> (a) && !target)
|
||||
{
|
||||
target = a->source;
|
||||
}
|
||||
|
||||
if (target->isTapped() && target->controller()->isAI())
|
||||
{
|
||||
@@ -533,8 +557,12 @@ int AIAction::getEfficiency()
|
||||
case MTGAbility::TAPPER:
|
||||
//tap things the player owns and that are untapped.
|
||||
{
|
||||
if (!target)
|
||||
if (!target && !dynamic_cast<ALord*> (a))
|
||||
break;
|
||||
if(dynamic_cast<ALord*> (a) && !target)
|
||||
{
|
||||
target = a->source;
|
||||
}
|
||||
|
||||
if (!target->controller()->isAI())
|
||||
efficiency = (20 * target->DangerRanking());
|
||||
|
||||
Reference in New Issue
Block a user