53 lines
1.5 KiB
Plaintext
53 lines
1.5 KiB
Plaintext
//69_hench_heall
|
|
//Henchman will attempt to heal the most injured in party
|
|
//Created by: 69MEH69
|
|
|
|
#include "nw_i0_generic"
|
|
#include "prc_inc_racial"
|
|
|
|
void main()
|
|
{
|
|
ResetHenchmenState();
|
|
SetCommandable(TRUE, OBJECT_SELF);
|
|
|
|
object oTarget = GetFactionMostDamagedMember(OBJECT_SELF);
|
|
talent tUse;
|
|
if(GetIsObjectValid(oTarget))
|
|
{
|
|
int nCurrent = GetCurrentHitPoints(oTarget);
|
|
int nBase = GetMaxHitPoints(oTarget);
|
|
|
|
if(MyPRCGetRacialType(oTarget) == RACIAL_TYPE_UNDEAD)
|
|
{
|
|
if(nCurrent < nBase && !GetIsDead(oTarget))
|
|
{
|
|
tUse = GetCreatureTalentBest(TALENT_CATEGORY_HARMFUL_TOUCH, TALENT_ANY);
|
|
if(GetIsTalentValid(tUse))
|
|
{
|
|
ClearAllActions();
|
|
ActionUseTalentOnObject(tUse, oTarget);
|
|
}
|
|
}
|
|
}
|
|
else if(MyPRCGetRacialType(oTarget) != RACIAL_TYPE_UNDEAD)
|
|
{
|
|
if(nCurrent < nBase && !GetIsDead(oTarget))
|
|
{
|
|
tUse = GetCreatureTalentBest(TALENT_CATEGORY_BENEFICIAL_HEALING_TOUCH, TALENT_ANY);
|
|
if(GetIsTalentValid(tUse))
|
|
{
|
|
ClearAllActions();
|
|
ActionUseTalentOnObject(tUse, oTarget);
|
|
}
|
|
else
|
|
{
|
|
ActionSpeakString("I'm out of healing spells.", TALKVOLUME_TALK);
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
else
|
|
ActionSpeakString("Everyone seems to be in good health.", TALKVOLUME_TALK);
|
|
}
|