2025/07/21 Update
Updated PEPS AI. Full compile.
This commit is contained in:
@@ -69,6 +69,8 @@ struct stSpell
|
||||
int nMaxSlots;
|
||||
int nSlot;
|
||||
};
|
||||
// Gets the total caster levels for nClass for oCreature.
|
||||
int ai_GetCasterTotalLevel(object oCreature, int nClass);
|
||||
// Returns TRUE if oCreature can cast nSpell from nLevel.
|
||||
int ai_GetCanCastSpell(object oCreature, int nSpell, int nClass, int nLevel, int nMetaMagic = 0, int nDomain = 0);
|
||||
// Returns TRUE if oCreature is immune to petrification.
|
||||
@@ -184,6 +186,23 @@ void ai_CastWidgetSpell(object oPC, object oAssociate, object oTarget, location
|
||||
void ai_UseWidgetFeat(object oPC, object oAssociate, object oTarget, location lLocation);
|
||||
// Uses the item on the current target for oAssociate.
|
||||
void ai_UseWidgetItem(object oPC, object oAssociate, object oTarget, location lLocation);
|
||||
int ai_GetCasterTotalLevel(object oCreature, int nClass)
|
||||
{
|
||||
int nIndex, nCheckClass;
|
||||
int nLevel = GetLevelByClass(nClass, oCreature);
|
||||
if(nClass == CLASS_TYPE_BARD || nClass == CLASS_TYPE_SORCERER || nClass == CLASS_TYPE_WIZARD)
|
||||
{
|
||||
for(nIndex = 1; nIndex <= AI_MAX_CLASSES_PER_CHARACTER; nIndex ++)
|
||||
{
|
||||
nCheckClass = GetClassByPosition(nIndex, oCreature);
|
||||
if(nCheckClass == CLASS_TYPE_PALE_MASTER)
|
||||
{
|
||||
nLevel += (GetLevelByClass(CLASS_TYPE_PALE_MASTER, oCreature) + 1) / 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
return nLevel;
|
||||
}
|
||||
int ai_GetCanCastSpell(object oCreature, int nSpell, int nClass, int nLevel, int nMetaMagic = 0, int nDomain = 0)
|
||||
{
|
||||
int nIndex, nSpellCount, nClassPosition, nSlot, nMaxSlots, nPosition = 1;
|
||||
@@ -2111,13 +2130,17 @@ void ai_UseWidgetFeat(object oPC, object oAssociate, object oTarget, location lL
|
||||
json jWidget = JsonArrayGet(jSpells, 2);
|
||||
json jFeat = JsonArrayGet(jWidget, nIndex);
|
||||
int nFeat = JsonGetInt(JsonArrayGet(jFeat, 5));
|
||||
int nLevel = JsonGetInt(JsonArrayGet(jFeat, 2));
|
||||
// We use nLevel at -1 to denote this is a feat with a subradial spell.
|
||||
int nSubSpell;
|
||||
if(nLevel == -1) nSubSpell = JsonGetInt(JsonArrayGet(jFeat, 0));
|
||||
if(ai_GetIsInCombat(oAssociate)) AssignCommand(oAssociate, ai_ClearCreatureActions(TRUE));
|
||||
//SendMessageToPC(oPC, "0i_spells, 2104, nFeat: " + IntToString(nFeat) + " oTarget: " + GetName(oTarget));
|
||||
if(!GetIsObjectValid(oTarget))
|
||||
{
|
||||
AssignCommand(oAssociate, ActionUseFeat(nFeat, OBJECT_INVALID, 0, lLocation));
|
||||
AssignCommand(oAssociate, ActionUseFeat(nFeat, OBJECT_INVALID, nSubSpell, lLocation));
|
||||
}
|
||||
else AssignCommand(oAssociate, ActionUseFeat(nFeat, oTarget));
|
||||
else AssignCommand(oAssociate, ActionUseFeat(nFeat, oTarget, nSubSpell));
|
||||
}
|
||||
void ai_UseWidgetItem(object oPC, object oAssociate, object oTarget, location lLocation)
|
||||
{
|
||||
|
Reference in New Issue
Block a user