2025/12/16 Update
Updated PEPS Hooked up new GUI module event. Updated classes.2da Updated baseitems.2da Updated nim tools. Full compile.
This commit is contained in:
@@ -149,12 +149,12 @@ void ai_SetupAllyHealingTargets(object oCaster, object oPC);
|
||||
// Clears the casters buff targets.
|
||||
void ai_ClearBuffTargets(object oCaster, string sVariable);
|
||||
// Cycles through a casters spells casting all buffs via actions.
|
||||
void ai_ActionCastMemorizedBuff(struct stSpell stSpell);
|
||||
void ai_ActionCastMemorizedBuff(struct stSpell stSpell, float fDelay, int bInstantSpell);
|
||||
// Cycles through a casters spells casting all buffs via actions.
|
||||
void ai_ActionCastKnownBuff(struct stSpell stSpell);
|
||||
void ai_ActionCastKnownBuff(struct stSpell stSpell, float fDelay, int bInstantSpell);
|
||||
// Checks oCaster for buffing spells and casts them based on nTarget;
|
||||
// These are cast as actions and will happen at the speed based on
|
||||
// AI_HENCHMAN_BUFF_DELAY, but are still actions.
|
||||
// These are cast as actions and will happen at the speed based on the delay set
|
||||
// by the player. 6.0 seconds to 0.1 second. Default 0.1 second.
|
||||
// nTarget is 0-9 where 0 is all targets, 1 is oPC, 2 is the caster
|
||||
// 3 Familiar, 4 is Animal Companion, 5 is Summons, 6 is Dominated, and 7+ is henchman.
|
||||
// Targets must be defined in variable AI_ALLY_TARGET_* where * is 1 to #.
|
||||
@@ -1314,7 +1314,7 @@ int ai_CheckAndCastSpell(object oCaster, int nSpell, int nSpellGroup, float fDel
|
||||
// Search all memorized spells for the spell.
|
||||
if(Get2DAString("classes", "MemorizesSpells", nClass) == "1")
|
||||
{
|
||||
// Check each level starting with the highest to lowest.
|
||||
// Check each level starting with the lowest to the highest.
|
||||
nSpellLevel = 0;
|
||||
while(nSpellLevel < 10)
|
||||
{
|
||||
@@ -1326,6 +1326,8 @@ int ai_CheckAndCastSpell(object oCaster, int nSpell, int nSpellGroup, float fDel
|
||||
if(GetMemorizedSpellReady(oCaster, nClass, nSpellLevel, nSpellSlot))
|
||||
{
|
||||
nMemorizedSpell = GetMemorizedSpellId(oCaster, nClass, nSpellLevel, nSpellSlot);
|
||||
if(AI_DEBUG) ai_Debug("0i_spells", "1326", "nMemorizedSpell: " + IntToString(nMemorizedSpell) +
|
||||
" nSpell: " + IntToString(nSpell));
|
||||
if(nMemorizedSpell == nSpell)
|
||||
{
|
||||
ai_CastMemorizedSpell(oCaster, nClass, nSpellLevel, nSpellSlot, oTarget, FALSE, oPC);
|
||||
@@ -1564,7 +1566,7 @@ void ai_CheckForPerDayItems(object oCreature, object oPC, int nBuffType)
|
||||
nCntr++;
|
||||
}
|
||||
}
|
||||
void ai_CheckForBuffSpells(struct stSpell stSpell)
|
||||
void ai_CheckForBuffSpells(struct stSpell stSpell, float fDelay, int bInstantSpell)
|
||||
{
|
||||
ai_SetupAllyTargets(stSpell.oCaster, stSpell.oPC);
|
||||
stSpell.nPosition = 1;
|
||||
@@ -1585,13 +1587,13 @@ void ai_CheckForBuffSpells(struct stSpell stSpell)
|
||||
if(Get2DAString("classes", "MemorizesSpells", stSpell.nClass) == "1")
|
||||
{
|
||||
stSpell.nMaxSlots = GetMemorizedSpellCountByLevel(stSpell.oCaster, stSpell.nClass, stSpell.nLevel);
|
||||
AssignCommand(stSpell.oCaster, ai_ActionCastMemorizedBuff(stSpell));
|
||||
AssignCommand(stSpell.oCaster, ai_ActionCastMemorizedBuff(stSpell, fDelay, bInstantSpell));
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
stSpell.nMaxSlots = GetKnownSpellCount(stSpell.oCaster, stSpell.nClass, stSpell.nLevel);
|
||||
AssignCommand(stSpell.oCaster, ai_ActionCastKnownBuff(stSpell));
|
||||
AssignCommand(stSpell.oCaster, ai_ActionCastKnownBuff(stSpell, fDelay, bInstantSpell));
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -1599,7 +1601,7 @@ void ai_CheckForBuffSpells(struct stSpell stSpell)
|
||||
}
|
||||
ai_CheckForPerDayItems(stSpell.oCaster, stSpell.oPC, stSpell.nBuffType);
|
||||
}
|
||||
void ai_ActionCastMemorizedSummons(struct stSpell stSpell)
|
||||
void ai_ActionCastMemorizedSummons(struct stSpell stSpell, float fDelay, int bInstantSpell)
|
||||
{
|
||||
if(AI_DEBUG) ai_Debug("0i_spells", "1122", "Start of ActionCastMemorizedSummons!");
|
||||
int nSpell;
|
||||
@@ -1625,14 +1627,14 @@ void ai_ActionCastMemorizedSummons(struct stSpell stSpell)
|
||||
if(Get2DAString("ai_spells", "Category", nSpell) == "S")
|
||||
{
|
||||
SetLocalInt(stSpell.oCaster, "AI_USED_SPELL_GROUP_-2", TRUE);
|
||||
ai_CastMemorizedSpell(stSpell.oCaster, stSpell.nClass, stSpell.nLevel, stSpell.nSlot, stSpell.oCaster, TRUE, stSpell.oPC);
|
||||
ai_CastMemorizedSpell(stSpell.oCaster, stSpell.nClass, stSpell.nLevel, stSpell.nSlot, stSpell.oCaster, bInstantSpell, stSpell.oPC);
|
||||
stSpell.nPosition = 1;
|
||||
stSpell.nClass = GetClassByPosition(stSpell.nPosition, stSpell.oCaster);
|
||||
stSpell.nLevel = (GetLevelByPosition(stSpell.nPosition, stSpell.oCaster) + 1) / 2;
|
||||
stSpell.nMaxSlots = GetMemorizedSpellCountByLevel(stSpell.oCaster, stSpell.nClass, stSpell.nLevel);
|
||||
stSpell.nSlot = 0;
|
||||
DelayCommand(2.0, ai_SetupAllyTargets(stSpell.oCaster, stSpell.oPC));
|
||||
DelayCommand(2.0 + 0.5, AssignCommand(stSpell.oCaster, ai_ActionCastMemorizedBuff(stSpell)));
|
||||
DelayCommand(2.0 + 0.5, AssignCommand(stSpell.oCaster, ai_ActionCastMemorizedBuff(stSpell, fDelay, bInstantSpell)));
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -1662,14 +1664,14 @@ void ai_ActionCastMemorizedSummons(struct stSpell stSpell)
|
||||
else
|
||||
{
|
||||
stSpell.nMaxSlots = GetKnownSpellCount(stSpell.oCaster, stSpell.nClass, stSpell.nLevel);
|
||||
AssignCommand(stSpell.oCaster, ai_ActionCastKnownBuff(stSpell));
|
||||
AssignCommand(stSpell.oCaster, ai_ActionCastKnownBuff(stSpell, fDelay, bInstantSpell));
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
ai_CheckForBuffSpells(stSpell);
|
||||
ai_CheckForBuffSpells(stSpell, fDelay, bInstantSpell);
|
||||
}
|
||||
void ai_ActionCastKnownSummons(struct stSpell stSpell)
|
||||
void ai_ActionCastKnownSummons(struct stSpell stSpell, float fDelay, int bInstantSpell)
|
||||
{
|
||||
//ai_Debug("0i_spells", "1184", "Start of ActionCastKnownSummons!");
|
||||
int nSpell;
|
||||
@@ -1697,14 +1699,14 @@ void ai_ActionCastKnownSummons(struct stSpell stSpell)
|
||||
{
|
||||
SetLocalInt(stSpell.oCaster, "AI_USED_SPELL_GROUP_S", TRUE);
|
||||
//ai_Debug("0i_spells", "1209", "nSpell: " + IntToString(nSpell));
|
||||
ai_CastKnownSpell(stSpell.oCaster, stSpell.nClass, nSpell, stSpell.oCaster, TRUE, stSpell.oPC);
|
||||
ai_CastKnownSpell(stSpell.oCaster, stSpell.nClass, nSpell, stSpell.oCaster, bInstantSpell, stSpell.oPC);
|
||||
stSpell.nPosition = 1;
|
||||
stSpell.nClass = GetClassByPosition(stSpell.nPosition, stSpell.oCaster);
|
||||
stSpell.nLevel = (GetLevelByPosition(stSpell.nPosition, stSpell.oCaster) + 1) / 2;
|
||||
stSpell.nMaxSlots = GetMemorizedSpellCountByLevel(stSpell.oCaster, stSpell.nClass, stSpell.nLevel);
|
||||
stSpell.nMaxSlots = GetKnownSpellCount(stSpell.oCaster, stSpell.nClass, stSpell.nLevel);
|
||||
stSpell.nSlot = 0;
|
||||
ai_SetupAllyTargets(stSpell.oCaster, stSpell.oPC);
|
||||
DelayCommand(AI_HENCHMAN_BUFF_DELAY, AssignCommand(stSpell.oCaster, ai_ActionCastKnownBuff(stSpell)));
|
||||
DelayCommand(fDelay, AssignCommand(stSpell.oCaster, ai_ActionCastKnownBuff(stSpell, fDelay, bInstantSpell)));
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -1731,15 +1733,15 @@ void ai_ActionCastKnownSummons(struct stSpell stSpell)
|
||||
if(Get2DAString("classes", "MemorizesSpells", stSpell.nClass) == "1")
|
||||
{
|
||||
stSpell.nMaxSlots = GetMemorizedSpellCountByLevel(stSpell.oCaster, stSpell.nClass, stSpell.nLevel);
|
||||
AssignCommand(stSpell.oCaster, ai_ActionCastMemorizedBuff(stSpell));
|
||||
AssignCommand(stSpell.oCaster, ai_ActionCastMemorizedBuff(stSpell, fDelay, bInstantSpell));
|
||||
return;
|
||||
}
|
||||
else stSpell.nMaxSlots = GetKnownSpellCount(stSpell.oCaster, stSpell.nClass, stSpell.nLevel);
|
||||
}
|
||||
}
|
||||
ai_CheckForBuffSpells(stSpell);
|
||||
ai_CheckForBuffSpells(stSpell, fDelay, bInstantSpell);
|
||||
}
|
||||
void ai_ActionCastMemorizedBuff(struct stSpell stSpell)
|
||||
void ai_ActionCastMemorizedBuff(struct stSpell stSpell, float fDelay, int bInstantSpell)
|
||||
{
|
||||
int nSpell;
|
||||
string sBuffGroup, sBuffTarget;
|
||||
@@ -1782,9 +1784,9 @@ void ai_ActionCastMemorizedBuff(struct stSpell stSpell)
|
||||
" oTarget: " + GetName(oTarget));
|
||||
if(oTarget != OBJECT_INVALID)
|
||||
{
|
||||
ai_CastMemorizedSpell(stSpell.oCaster, stSpell.nClass, stSpell.nLevel, stSpell.nSlot, oTarget, TRUE, stSpell.oPC);
|
||||
ai_CastMemorizedSpell(stSpell.oCaster, stSpell.nClass, stSpell.nLevel, stSpell.nSlot, oTarget, bInstantSpell, stSpell.oPC);
|
||||
stSpell.nSlot++;
|
||||
DelayCommand(AI_HENCHMAN_BUFF_DELAY, AssignCommand(stSpell.oCaster, ai_ActionCastMemorizedBuff(stSpell)));
|
||||
DelayCommand(fDelay, AssignCommand(stSpell.oCaster, ai_ActionCastMemorizedBuff(stSpell, fDelay, bInstantSpell)));
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -1815,14 +1817,14 @@ void ai_ActionCastMemorizedBuff(struct stSpell stSpell)
|
||||
else
|
||||
{
|
||||
stSpell.nMaxSlots = GetKnownSpellCount(stSpell.oCaster, stSpell.nClass, stSpell.nLevel);
|
||||
AssignCommand(stSpell.oCaster, ai_ActionCastKnownBuff(stSpell));
|
||||
AssignCommand(stSpell.oCaster, ai_ActionCastKnownBuff(stSpell, fDelay, bInstantSpell));
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
ai_CheckForPerDayItems(stSpell.oCaster, stSpell.oPC, stSpell.nBuffType);
|
||||
}
|
||||
void ai_ActionCastKnownBuff(struct stSpell stSpell)
|
||||
void ai_ActionCastKnownBuff(struct stSpell stSpell, float fDelay, int bInstantSpell)
|
||||
{
|
||||
int nSpell;
|
||||
string sBuffGroup, sBuffTarget;
|
||||
@@ -1867,9 +1869,9 @@ void ai_ActionCastKnownBuff(struct stSpell stSpell)
|
||||
// " oTarget: " + GetName(oTarget));
|
||||
if(oTarget != OBJECT_INVALID)
|
||||
{
|
||||
ai_CastKnownSpell(stSpell.oCaster, stSpell.nClass, nSpell, oTarget, TRUE, stSpell.oPC);
|
||||
ai_CastKnownSpell(stSpell.oCaster, stSpell.nClass, nSpell, oTarget, bInstantSpell, stSpell.oPC);
|
||||
stSpell.nSlot++;
|
||||
DelayCommand(AI_HENCHMAN_BUFF_DELAY, AssignCommand(stSpell.oCaster, ai_ActionCastKnownBuff(stSpell)));
|
||||
DelayCommand(fDelay, AssignCommand(stSpell.oCaster, ai_ActionCastKnownBuff(stSpell, fDelay, bInstantSpell)));
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -1897,7 +1899,7 @@ void ai_ActionCastKnownBuff(struct stSpell stSpell)
|
||||
if(Get2DAString("classes", "MemorizesSpells", stSpell.nClass) == "1")
|
||||
{
|
||||
stSpell.nMaxSlots = GetMemorizedSpellCountByLevel(stSpell.oCaster, stSpell.nClass, stSpell.nLevel);
|
||||
AssignCommand(stSpell.oCaster, ai_ActionCastMemorizedBuff(stSpell));
|
||||
AssignCommand(stSpell.oCaster, ai_ActionCastMemorizedBuff(stSpell, fDelay, bInstantSpell));
|
||||
return;
|
||||
}
|
||||
else stSpell.nMaxSlots = GetKnownSpellCount(stSpell.oCaster, stSpell.nClass, stSpell.nLevel);
|
||||
@@ -1919,8 +1921,12 @@ void ai_CastBuffs(object oCaster, int nBuffType, int nTarget, object oPC)
|
||||
stSpell.nBuffType = nBuffType;
|
||||
stSpell.nTarget = nTarget;
|
||||
stSpell.nPosition = 1;
|
||||
float fDelay = GetLocalFloat(stSpell.oCaster, AI_DELAY_BUFF_CASTING);
|
||||
int bInstantSpell;
|
||||
if(fDelay < 4.9) bInstantSpell = TRUE;
|
||||
else fDelay = 6.0;
|
||||
// Look for summons spells on All, Long durations and the whole party.
|
||||
if((nBuffType == 1 || nBuffType == 3) && nTarget == 0)
|
||||
if((nBuffType == 1 || nBuffType == 3) && nTarget == 0 && GetAssociate(ASSOCIATE_TYPE_SUMMONED, oCaster) == OBJECT_INVALID)
|
||||
{
|
||||
while(stSpell.nPosition <= AI_MAX_CLASSES_PER_CHARACTER)
|
||||
{
|
||||
@@ -1935,13 +1941,13 @@ void ai_CastBuffs(object oCaster, int nBuffType, int nTarget, object oPC)
|
||||
if(Get2DAString("classes", "MemorizesSpells", stSpell.nClass) == "1")
|
||||
{
|
||||
stSpell.nMaxSlots = GetMemorizedSpellCountByLevel(stSpell.oCaster, stSpell.nClass, stSpell.nLevel);
|
||||
AssignCommand(stSpell.oCaster, ai_ActionCastMemorizedSummons(stSpell));
|
||||
AssignCommand(stSpell.oCaster, ai_ActionCastMemorizedSummons(stSpell, fDelay, bInstantSpell));
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
stSpell.nMaxSlots = GetKnownSpellCount(stSpell.oCaster, stSpell.nClass, stSpell.nLevel);
|
||||
AssignCommand(stSpell.oCaster, ai_ActionCastKnownSummons(stSpell));
|
||||
AssignCommand(stSpell.oCaster, ai_ActionCastKnownSummons(stSpell, fDelay, bInstantSpell));
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -1950,7 +1956,7 @@ void ai_CastBuffs(object oCaster, int nBuffType, int nTarget, object oPC)
|
||||
// Exit here; if we summoned a monster then it linked off of that spell
|
||||
// cast to continue the action queue for all buff spell cast actions.
|
||||
}
|
||||
ai_CheckForBuffSpells(stSpell);
|
||||
ai_CheckForBuffSpells(stSpell, fDelay, bInstantSpell);
|
||||
}
|
||||
int ai_CastSpontaneousCure(object oCreature, object oTarget, object oPC)
|
||||
{
|
||||
@@ -2349,7 +2355,7 @@ void ai_CastWidgetSpell(object oPC, object oAssociate, object oTarget, location
|
||||
// " oTarget: " + GetName(oTarget) +
|
||||
// " nMetaMagic: " + IntToString(nMetaMagic) +
|
||||
// " nDomain: " + IntToString(nDomain));
|
||||
if(GetCurrentAction(oAssociate) != ACTION_CASTSPELL) AssignCommand(oAssociate, ai_ClearCreatureActions(TRUE));
|
||||
if(GetCurrentAction(oAssociate) != ACTION_CASTSPELL) AssignCommand(oAssociate, ai_ClearCreatureActions(FALSE));
|
||||
if(!GetIsObjectValid(oTarget))
|
||||
{
|
||||
AssignCommand(oAssociate, ActionCastSpellAtLocation(nSpell, lLocation, nMetaMagic, FALSE, 0, FALSE, -1, FALSE, nDomain));
|
||||
@@ -2371,7 +2377,7 @@ void ai_UseWidgetFeat(object oPC, object oAssociate, object oTarget, location lL
|
||||
// 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));
|
||||
if(ai_GetIsInCombat(oAssociate)) AssignCommand(oAssociate, ai_ClearCreatureActions(FALSE));
|
||||
//SendMessageToPC(oPC, "0i_spells, 2104, nFeat: " + IntToString(nFeat) + " oTarget: " + GetName(oTarget));
|
||||
if(!GetIsObjectValid(oTarget))
|
||||
{
|
||||
@@ -2392,7 +2398,7 @@ void ai_UseWidgetItem(object oPC, object oAssociate, object oTarget, location lL
|
||||
int nIprpSubType = JsonGetInt(JsonArrayGet(jItem, 4));
|
||||
object oItem = GetObjectByUUID(JsonGetString(JsonArrayGet(jItem, 5)));
|
||||
itemproperty ipProperty;
|
||||
if(ai_GetIsInCombat(oAssociate)) AssignCommand(oAssociate, ai_ClearCreatureActions(TRUE));
|
||||
if(ai_GetIsInCombat(oAssociate)) AssignCommand(oAssociate, ai_ClearCreatureActions(FALSE));
|
||||
if(nSpell == SPELL_HEALINGKIT)
|
||||
{
|
||||
ipProperty = GetFirstItemProperty(oItem);
|
||||
@@ -2409,9 +2415,9 @@ void ai_UseWidgetItem(object oPC, object oAssociate, object oTarget, location lL
|
||||
if(nIprpSubType == GetItemPropertySubType(ipProperty)) break;
|
||||
ipProperty = GetNextItemProperty(oItem);
|
||||
}
|
||||
if(!GetIsObjectValid(oTarget))
|
||||
if(GetIsObjectValid(oTarget))
|
||||
{
|
||||
AssignCommand(oAssociate, ActionUseItemAtLocation(oItem, ipProperty, lLocation));
|
||||
AssignCommand(oAssociate, ActionUseItemOnObject(oItem, ipProperty, oTarget));
|
||||
}
|
||||
else AssignCommand(oAssociate, ActionUseItemOnObject(oItem, ipProperty, oTarget));
|
||||
else AssignCommand(oAssociate, ActionUseItemAtLocation(oItem, ipProperty, lLocation));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user