GriffonSpade
Member
First off, I'm going to point out that module is only called in:
BaseAI.cs's AcquireFocusMob module
SpellHelper.cs's ValidIndirectTarget module (This use happens when both attacker and target are creatures, to see if AOE spells should cause damage)
MeerMage's OnThink module (used to change target for summoning rabid animals and to target stinging insects)
MeerEternal's DoAreaLeech_Finish (used to check for valid targets to steal life from)
Betrayer's OnActionCombat (used for valid targets to area poison)
Next, the following checks have become redundant because both checks are now made in AcquireFocusMob for all FightModes:
line 1017.
line 1027:
It should have no effect on mobile-to-mobile AOE damage, but in theory, some mobiles might be struck inadvertantly that weren't before. Is this issue relevant enough to block their removal?
Next, is a little more theoretical: Should ALL AIs have their enemy determinations moved to BaseCreature.cs?
For reference, that's all the 'bValid' checks in AcquireFocusMob: the positive check on enemy factions/ethic, the positive check on Good and Evil karma enemy checks, and the summoned creature check.
Have a separate IsSpecialEnemy sub-module in BaseCreature.cs for evaluating passive/karma specific enemies. (including the positive faction/ethic enemy check). This would be referenced immediately after the XML check at the beginning of IsEnemy. Summoned Creatures would also use this module directly instead of the normal IsEnemy module.
Result would be that IsEnemy would more accurately represent enemy target determination(e.g. when a FightMode Evil mob uses an AOE spell, it would also hit negative karma mobiles), while AcquireFocusMob would grow correspondingly shorter and be simplified.
New module in BaseCreature.cs would be IsSpecialEnemy:
Then, in BaseCreature.cs's IsEnemy, right below the XML check, the following check would be added:
Then, in BaseAI's AcquireFocusMob, the the checks would also be changed. (relevant section only)
Thoughts? Criticisms? Approval? Please discuss
BaseAI.cs's AcquireFocusMob module
SpellHelper.cs's ValidIndirectTarget module (This use happens when both attacker and target are creatures, to see if AOE spells should cause damage)
MeerMage's OnThink module (used to change target for summoning rabid animals and to target stinging insects)
MeerEternal's DoAreaLeech_Finish (used to check for valid targets to steal life from)
Betrayer's OnActionCombat (used for valid targets to area poison)
Next, the following checks have become redundant because both checks are now made in AcquireFocusMob for all FightModes:
line 1017.
Code:
if (m is PlayerMobile && ((PlayerMobile)m).HonorActive)
{
return false;
}
Code:
if (TransformationSpellHelper.UnderTransformation(m, typeof(EtherealVoyageSpell)))
{
return false;
}
Next, is a little more theoretical: Should ALL AIs have their enemy determinations moved to BaseCreature.cs?
For reference, that's all the 'bValid' checks in AcquireFocusMob: the positive check on enemy factions/ethic, the positive check on Good and Evil karma enemy checks, and the summoned creature check.
Have a separate IsSpecialEnemy sub-module in BaseCreature.cs for evaluating passive/karma specific enemies. (including the positive faction/ethic enemy check). This would be referenced immediately after the XML check at the beginning of IsEnemy. Summoned Creatures would also use this module directly instead of the normal IsEnemy module.
Result would be that IsEnemy would more accurately represent enemy target determination(e.g. when a FightMode Evil mob uses an AOE spell, it would also hit negative karma mobiles), while AcquireFocusMob would grow correspondingly shorter and be simplified.
New module in BaseCreature.cs would be IsSpecialEnemy:
Code:
public virtual bool IsSpecialEnemy(Mobile m)
{
// We want a faction/ethic enemy
if (GetFactionAllegiance(m) == BaseCreature.Allegiance.Enemy || GetEthicAllegiance(m) == BaseCreature.Allegiance.Enemy)
{
return true;
}
BaseCreature c = m as BaseCreature;
// We want a karma enemy
if (FightMode == FightMode.Evil)
{
if (c != null && c.Controlled && c.ControlMaster != null)
{
if (c.ControlMaster.Karma < 0)
{
return true;
}
}
else if (m.Karma < 0)
{
return true;
}
}
// We want a karma enemy
else if (FightMode == FightMode.Good)
{
if (c != null && c.Controlled && c.ControlMaster != null)
{
if (c.ControlMaster.Karma > 0)
{
return true;
}
}
else if (m.Karma > 0)
{
return true;
}
}
return false;
}
Then, in BaseCreature.cs's IsEnemy, right below the XML check, the following check would be added:
Code:
if (IsSpecialEnemy(m)))
{
return true;
}
Then, in BaseAI's AcquireFocusMob, the the checks would also be changed. (relevant section only)
Code:
if (!IsHostile(m))
{
// Ignore anyone if we don't want enemies
if (!bFacFoe)
{
continue;
}
//Ignore anyone under EtherealVoyage
if (TransformationSpellHelper.UnderTransformation(m, typeof(EtherealVoyageSpell)))
{
continue;
}
// Ignore players with activated honor
if (m is PlayerMobile && ((PlayerMobile)m).HonorActive && !(m_Mobile.Combatant == m))
{
continue;
}
// Xmlspawner faction check
// Ignore mob faction ranked players, more highly more often
//if (!Server.Engines.XmlSpawner2.XmlMobFactions.CheckAcquire(this.m_Mobile, m))
//continue;
// Ignore anyone who is not a Special Enemy (We are a Passive FightMode)
if (acqType == FightMode.Good || acqType == FightMode.Evil || acqType == FightMode.Aggressor)
{
if (!m_Mobile.IsSpecialEnemy(m))
{
continue;
}
}
// Ignore anyone who is not a Special Enemy (We are an Uncontrolled Summon)
else if (c != null && c.Summoned)
{
if (!m_Mobile.IsSpecialEnemy(m))
{
continue;
}
}
// Ignore anyone who is not an Enemy (We are an Aggressive FightMode)
else if (!m_Mobile.IsEnemy(m))
{
continue;
}
}
Thoughts? Criticisms? Approval? Please discuss
Last edited: