few things here,

first, tweaked some ai checks a bit.
small changes.

2nd, i removed the following classes,
APowerToughnessModifierUntilEndOfTurn
APowerToughnessModifierUntilEOT
ADragonWhelp
i replaced these with soft coded support for dragon whelps "sideffects" of using a ability more then a certain number of times...
syntax limit^the effect you want^the use it triggers on.
replaced both powertoughnessueot classes with a class which falls more along the lines of how we handle ueot abilitys...PTInstant, creates the wrapper with the ability and adds it to the game, rather then that jumbled mess that was previous version.

added support for "phaseaction[" phase words "my" and "opponent" so you can denote which players phases it will happen on. by default it automatically happens on both players turns when the phase matches.

modified a few things in phaseaction class...which correct a memory leak which could be created if the source of the phaseaction is destroyed before the phase action resolved. rather then storing an ability which is left floating in memory if phaseaction is destroy...i took a much safer route of passing the string of the ability directly to the phaseaction class...and i build the ability right when it is being used instead. makes much more sense.

angry mob is now fully supported. yay to removing nasty ugly workarounds!!!! and i mean UGLY.

dragon whelp is now fully soft coded. added the 5 or six other cards which do similar effects.
This commit is contained in:
omegablast2002@yahoo.com
2011-04-14 15:02:17 +00:00
parent 502bd280d8
commit 0fe7a46676
6 changed files with 280 additions and 261 deletions

View File

@@ -386,25 +386,32 @@ int AIAction::getEfficiency()
break;
}
case MTGAbility::STANDARD_PUMP:
{
MTGCardInstance * _target = (MTGCardInstance *) (a->target);
efficiency = 0;
if (!target && !dynamic_cast<ALord*> (a))
break;
{
MTGCardInstance * _target = (MTGCardInstance *) (a->target);
efficiency = 0;
if(!target && !dynamic_cast<ALord*> (a) && (((MTGCardInstance *)a->source)->hasSubtype(Subtypes::TYPE_AURA) || ((MTGCardInstance *)a->source)->hasSubtype(Subtypes::TYPE_EQUIPMENT)))
{
if(((MTGCardInstance *)a->source)->target)
_target = ((MTGCardInstance *)a->source)->target;
target = (MTGCardInstance *)a->source;
}
if (!target && !dynamic_cast<ALord*> (a))
break;
if(dynamic_cast<ALord*> (a) && !target)
{
target = a->source;
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.
if (g->getCurrentGamePhase() == Constants::MTG_PHASE_COMBATBLOCKERS)
int currentPhase = g->getCurrentGamePhase();
if ((currentPhase == Constants::MTG_PHASE_COMBATBLOCKERS) || (currentPhase == Constants::MTG_PHASE_COMBATATTACKERS))
{
if (suggestion == BAKA_EFFECT_GOOD && target->controller()->isAI())
{
if (suggestion == BAKA_EFFECT_GOOD && target->controller()->isAI())
{
if ((_target->defenser || _target->blockers.size()) && ((_target->power < _target->getNextOpponent()->toughness
|| _target->toughness < _target->getNextOpponent()->power) || (_target->has(Constants::TRAMPLE))))
|| _target->toughness < _target->getNextOpponent()->power) || (_target->has(Constants::TRAMPLE))))
{
//this pump is based on a start eff. of 20 multiplied by how good the creature is.
efficiency = 20 * _target->DangerRanking();
@@ -413,13 +420,14 @@ int AIAction::getEfficiency()
{
//this means im heading directly for the player, pump this creature as much as possible.
efficiency = 100;
if(_target->power > 50)
efficiency -= _target->power;//we don't need to go overboard. better to not put all your eggs in a single basket.
}
}
if (suggestion == BAKA_EFFECT_BAD && !target->controller()->isAI())
{
efficiency = 100;
}
}
}
if (suggestion == BAKA_EFFECT_BAD && !target->controller()->isAI())
{
efficiency = 100;
}
break;
}
@@ -736,7 +744,8 @@ int AIPlayer::selectAbility()
int chance = 1;
if (!forceBestAbilityUse)
chance = 1 + WRand() % 100;
if (action.getEfficiency() >= chance)
int actionScore = action.getEfficiency();
if (actionScore >= chance)
{
if (!clickstream.size())
{
@@ -1464,9 +1473,13 @@ int AIPlayerBaka::computeActions()
switch (currentGamePhase)
{
case Constants::MTG_PHASE_COMBATBLOCKERS:
chooseBlockers();
break;
{
chooseBlockers();
selectAbility();
break;
}
default:
selectAbility();
break;
}
return 1;