3440 lines
164 KiB
Plaintext
3440 lines
164 KiB
Plaintext
////////////////////////////////////////////////////////////////////////////////
|
|
// champ_h - Champion support header file
|
|
// By Deva B. Winblood. 09/16/2006
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
#include "prc_inc_util"
|
|
#include "rts_pathing"
|
|
#include "nw_i0_generic"
|
|
//#include "npcact_h_moving"
|
|
#include "prc_inc_racial"
|
|
|
|
///////////////////////////
|
|
// CONSTANTS
|
|
///////////////////////////
|
|
|
|
const int CHAMPION_PATH_SPAWN = 0;
|
|
const int CHAMPION_PATH_EXPLORE = 1;
|
|
const int CHAMPION_PATH_ASSAULT = 2;
|
|
const int CHAMPION_PATH_CONTROL = 3;
|
|
const int CHAMPION_PATH_ESCAPE = 4;
|
|
const int CHAMPION_PATH_RETURN = 5;
|
|
const int CHAMPION_ACTION_NONE = 0;
|
|
const int CHAMPION_ACTION_SEARCH = 1;
|
|
const int CHAMPION_ACTION_REST = 2;
|
|
const int CHAMPION_ACTION_BUFF = 3;
|
|
const int CHAMPION_ACTION_HEAL = 4;
|
|
const int CHAMPION_ACTION_CONDITIONAL_REST = 5;
|
|
const int CHAMPION_ACTION_STEAL = 6;
|
|
const int CHAMPION_ACTION_DEPOSIT = 7;
|
|
const int CHAMPION_ACTION_USE = 8;
|
|
const int CHAMPION_ACTION_RETURN = 9;
|
|
const int CHAMPION_ACTION_RUN = 10;
|
|
const int CHAMPION_ACTION_GATHER = 11;
|
|
const int CHAMPION_ACTION_CONTROL = 12;
|
|
const int CHAMPION_ACTION_ESCAPE1 = 13;
|
|
const int CHAMPION_ACTION_ESCAPE2 = 14;
|
|
const int CHAMPION_ACTION_EQUIP = 15;
|
|
|
|
const int CHAMPION_DEBUG = TRUE;
|
|
const string CHAMPION_DEBUG_SPECIFIC = "SPID";
|
|
|
|
|
|
//////////////////////////
|
|
// PROTOTYPES
|
|
//////////////////////////
|
|
|
|
// FILE: champ_h FUNCTION: Champion_GetNextPath()*
|
|
// This function will return the next node of the path for oChampion of the
|
|
// specified path type CHAMPION_PATH_
|
|
object Champion_GetNextPath(object oChampion,int nType);
|
|
|
|
// FILE: champ_h FUNCTION: Champion_ResetPathing()*
|
|
// This function will reset all pathing variables for this champion.
|
|
void Champion_ResetPathing(object oChampion);
|
|
|
|
// FILE: champ_h FUNCTION: Champion_Gather()*
|
|
// This function will gather troops and set them to follow the champion.
|
|
void Champion_Gather(object oChampion);
|
|
|
|
// FILE: champ_h FUNCTION: Champion_Heal()*
|
|
// This function will cause the champion to do what they can to heal themselves
|
|
// and if capable they will also heal nearby allies.
|
|
object Champion_Heal(object oChampion);
|
|
|
|
// FILE: champ_h FUNCTION: Champion_Rest()*
|
|
// This function will cause the champion to rest.
|
|
void Champion_Rest(object oChampion);
|
|
|
|
// FILE: champ_h FUNCTION: Champion_CondRest()*
|
|
// This function will cause the champion to rest if the control point
|
|
// near them is under their team control.
|
|
void Champion_CondRest(object oChampion);
|
|
|
|
// FILE: champ_h FUNCTION: Champion_Control()*
|
|
// This will cause the champion to release any units following them and set
|
|
// them to guard where they stand, walk.
|
|
void Champion_Control(object oChampion);
|
|
|
|
// FILE: champ_h FUNCTION: Champion_Buff()*
|
|
// This will cause the champion to buff up themselves and if capable they will
|
|
// also buff up any units following them.
|
|
object Champion_Buff(object oChampion);
|
|
|
|
// FILE: champ_h FUNCTION: Champion_Search()*
|
|
// This will make the champion return the nearest object of interest to them.
|
|
void Champion_Search(object oChampion);
|
|
|
|
// FILE: champ_h FUNCTION: Champion_GetFollower()*
|
|
// This will return the nNth follower for oChampion.
|
|
object Champion_GetFollower(object oChampion,int nN=1);
|
|
|
|
|
|
// FILE: champ_h FUNCTION: Champion_Steal()*
|
|
// This will cause the champion to steal mana if near mana vault or, gold and
|
|
// artifact items if near tax chest.
|
|
void Champion_Steal(object oChampion);
|
|
|
|
|
|
// FILE: champ_h FUNCTION: Champion_Deposit()*
|
|
// This will cause the champion to deposit gold in the tax chest if near it.
|
|
void Champion_Deposit(object oChampion);
|
|
|
|
|
|
// FILE: champ_h FUNCTION: Champion_Equip()*
|
|
// This will cause the champion to update their equipment if possible.
|
|
void Champion_Equip(object oChampion);
|
|
|
|
|
|
// FILE: champ_h FUNCTION: Champion_Escape()*
|
|
// This will cause the champion to attempt to escape the outer planes if
|
|
// possible.
|
|
void Champion_Escape(object oChampion);
|
|
|
|
|
|
// FILE: champ_h FUNCTION: Champion_Use()*
|
|
// This will cause the champion to attempt to use an artifact item in their
|
|
// possession if it is appropriate to do so.
|
|
void Champion_Use(object oChampion);
|
|
|
|
// FILE: champ_h FUNCTION: Champion_SetMode()*
|
|
// This will cause the champion to set the appropriate mode based on their
|
|
// current circumstances.
|
|
void Champion_SetMode(object oChampion);
|
|
|
|
// FILE: champ_h FUNCTION: Champion_ProcessAction()*
|
|
// This will process the champion's current mode and will return TRUE when
|
|
// the mode is completed.
|
|
int Champion_ProcessAction(object oChampion,int nAction);
|
|
|
|
// FILE: champ_h FUNCTION: Champion_PathNonHome()*
|
|
// This function will make the champion attempt to follow the specified path
|
|
// and process the commands at the nodes specified.
|
|
void Champion_PathNonHome(object oChampion);
|
|
|
|
|
|
// FILE: champ_h FUNCTION: Champion_PathHome()*
|
|
// This function will make the champion attempt to path home and return to
|
|
// the spawn location where they will complete the command at that location.
|
|
void Champion_PathHome(object oChampion);
|
|
|
|
|
|
// FILE: champ_h FUNCTION: Champion_PathDoCommand()*
|
|
// This function will make sure that the command at current destination is
|
|
// handled.
|
|
void Champion_PathDoCommand(object oChampion);
|
|
|
|
// FILE: champ_h FUNCTION: Champion_SetSentinel()*
|
|
// This sets a value to let the script know that the commands are still being
|
|
// successfully processed.
|
|
void Champion_SetSentinel(object oChampion);
|
|
|
|
// FILE: champ_h FUNCTION: Champion_LevelUp()
|
|
// If the champion is capable of leveling up then do so.
|
|
void Champion_LevelUp(object oChampion);
|
|
|
|
//////////////////////////////////////
|
|
// FUNCTIONS TO MIMIC ITEM ACTIVATION
|
|
//////////////////////////////////////
|
|
|
|
|
|
void fnDMSpeak(object oChampion,string sSay,int bAlways=FALSE)
|
|
{ // PURPOSE: If the DM is near speak sSay
|
|
object oMod=GetModule();
|
|
object oDM=GetLocalObject(oMod,"oDM");
|
|
if (!GetIsObjectValid(oDM))
|
|
{ // find DM
|
|
oDM=GetFirstPC();
|
|
while(GetIsObjectValid(oDM)&&!GetIsObjectValid(GetLocalObject(oMod,"oDM")))
|
|
{ // find DM
|
|
if (GetIsDM(oDM)) SetLocalObject(oMod,"oDM",oDM);
|
|
oDM=GetNextPC();
|
|
} // find DM
|
|
oDM=GetLocalObject(oMod,"oDM");
|
|
} // find DM
|
|
if (GetIsObjectValid(oDM))
|
|
{ // DM exists
|
|
if (GetArea(oDM)==GetArea(oChampion)&&(d4()==1||bAlways)) AssignCommand(oChampion,SpeakString(sSay));
|
|
} // DM exists
|
|
} // fnDMSpeak();
|
|
|
|
|
|
void fnHatch(object oSeed)
|
|
{ // create bugs
|
|
int nL=0;
|
|
int nB=d4();
|
|
int nT;
|
|
location lLoc=GetLocation(oSeed);
|
|
object oBug;
|
|
while(nL<nB)
|
|
{ // create bugs
|
|
nL++;
|
|
nT=d6();
|
|
switch(nT)
|
|
{ // bug type
|
|
case 1:
|
|
case 2: { // fire beetles
|
|
oBug=CreateObject(OBJECT_TYPE_CREATURE,"btlfire001",lLoc,TRUE);
|
|
break;
|
|
} // fire beetles
|
|
case 3:
|
|
case 4:
|
|
case 5:
|
|
{ // stink beetles
|
|
oBug=CreateObject(OBJECT_TYPE_CREATURE,"btlstink001",lLoc,TRUE);
|
|
break;
|
|
} // stink beetles
|
|
case 6: { // stag beetle
|
|
oBug=CreateObject(OBJECT_TYPE_CREATURE,"btlstag001",lLoc,TRUE);
|
|
break;
|
|
} // stag beetle
|
|
} // bug type
|
|
} // create bugs
|
|
DestroyObject(oSeed);
|
|
} // fnHatch()
|
|
|
|
|
|
object fnGetBugTarget()
|
|
{ // find nearest insect or arachnid target
|
|
object oRet=OBJECT_INVALID;
|
|
int nC=1;
|
|
object oMe=OBJECT_SELF;
|
|
object oTest=GetNearestObject(OBJECT_TYPE_CREATURE,oMe,nC);
|
|
float fDist=GetDistanceBetween(oTest,oMe);
|
|
int nType;
|
|
string sTag;
|
|
while (oTest!=OBJECT_INVALID&&fDist<10.1&&oRet==OBJECT_INVALID)
|
|
{ // check creatures within 10 meters
|
|
nType=MyPRCGetRacialType(oTest);
|
|
sTag=GetTag(oTest);
|
|
if (nType==RACIAL_TYPE_VERMIN) oRet=oTest;
|
|
else if (sTag=="GiantAntQueen"||sTag=="GiantAntGuard"||sTag=="GiantAntHiveQueen"||sTag=="GiantAntLarva"||sTag=="GiantAntSoldier"||sTag=="GiantAntWorker"||sTag=="PurpleWorm"||sTag=="SPID28"||sTag=="SPID27") oRet=oTest;
|
|
nC++;
|
|
oTest=GetNearestObject(OBJECT_TYPE_CREATURE,oMe,nC);
|
|
fDist=GetDistanceBetween(oTest,oMe);
|
|
}// check creatures within 10 meters
|
|
return oRet;
|
|
} // fnGetBugTarget()
|
|
|
|
|
|
void fnBugZapper()
|
|
{ // bug zapper routine
|
|
object oMe=OBJECT_SELF;
|
|
int nCh=GetLocalInt(oMe,"nCharges");
|
|
effect eAttack=EffectBeam(VFX_BEAM_LIGHTNING,oMe,BODY_NODE_CHEST,FALSE);
|
|
effect eDmg=EffectDamage(d6(),DAMAGE_TYPE_ELECTRICAL);
|
|
object oTarget=fnGetBugTarget();
|
|
if (oTarget!=OBJECT_INVALID&&!GetIsDead(oTarget))
|
|
{ // we have a target
|
|
ApplyEffectToObject(DURATION_TYPE_TEMPORARY,eAttack,oTarget,2.0);
|
|
ApplyEffectToObject(DURATION_TYPE_INSTANT,eDmg,oTarget,1.0);
|
|
nCh=nCh-1;
|
|
SetLocalInt(oMe,"nCharges",nCh);
|
|
} // we have a target
|
|
if (nCh>0) DelayCommand(2.0,fnBugZapper());
|
|
else
|
|
DestroyObject(oMe);
|
|
} // fnBugZapper()
|
|
|
|
/*
|
|
DelayCommand(5.0,SetLocalInt(oZapper,"nCharges",5));
|
|
DelayCommand(5.1,AssignCommand(oZapper,fnBugZapper()));
|
|
*/
|
|
|
|
|
|
int fnMoveToDestination(object oWho,object oWhere,float fRange=1.0)
|
|
{ // PURPOSE: Simple to the point movement by oWho to destination oWhere
|
|
// Version History
|
|
// mm/dd/yyyy | Modified By | Description
|
|
// 09/18/2006 | Deva B. Winblood | Initial version of this function
|
|
int nRet=0;
|
|
int nStuck=GetLocalInt(oWho,"nStuck");
|
|
int nStuckResets=GetLocalInt(oWho,"nStuckResets");
|
|
float fLast=GetLocalFloat(oWho,"fLast");
|
|
int nRun=GetLocalInt(oWho,"nRun");
|
|
object oNear;
|
|
if (GetIsInCombat(oWho)) return 0;
|
|
if (GetIsObjectValid(oWhere))
|
|
{ // valid destination
|
|
if (GetArea(oWhere)!=GetArea(oWho)||GetDistanceBetween(oWho,oWhere)>fRange)
|
|
{ // movement required
|
|
if (fLast==0.0)
|
|
{ // first move
|
|
AssignCommand(oWho,ActionMoveToObject(oWhere,nRun,fRange));
|
|
} // first move
|
|
else
|
|
{ // should be in motion
|
|
if (fLast==GetDistanceBetween(oWho,oWhere))
|
|
{ // stuck
|
|
nStuck=nStuck+1;
|
|
if (nStuck<5)
|
|
{ // wake up
|
|
AssignCommand(oWho,ClearAllActions());
|
|
AssignCommand(oWho,ActionMoveToObject(oWhere,nRun,fRange));
|
|
} // wake up
|
|
else
|
|
{ // more than a little stuck
|
|
nStuckResets++;
|
|
nStuck=0;
|
|
if (nStuckResets==1)
|
|
{ // move away and try again
|
|
oNear=GetNearestObject(OBJECT_TYPE_WAYPOINT,oWho,d20());
|
|
AssignCommand(oWho,ClearAllActions());
|
|
AssignCommand(oWho,ActionMoveToObject(oNear,TRUE,5.0));
|
|
DelayCommand(5.0,AssignCommand(oWho,ClearAllActions()));
|
|
DelayCommand(5.1,AssignCommand(oWho,ActionMoveToObject(oWhere,TRUE,fRange)));
|
|
} // move away and try again
|
|
else
|
|
{ // jump
|
|
AssignCommand(oWho,ClearAllActions());
|
|
AssignCommand(oWho,JumpToObject(oWhere));
|
|
} // jump
|
|
} // more than a little stuck
|
|
SetLocalInt(oWho,"nStuck",nStuck);
|
|
SetLocalInt(oWho,"nStuckResets",nStuckResets);
|
|
} // stuck
|
|
else
|
|
{ // not stuck
|
|
DeleteLocalInt(oWho,"nStuck");
|
|
} // not stuck
|
|
} // should be in motion
|
|
SetLocalFloat(oWho,"fLast",GetDistanceBetween(oWho,oWhere));
|
|
} // movement required
|
|
else
|
|
{ // arrived
|
|
nRet=1;
|
|
DeleteLocalInt(oWho,"nStuck");
|
|
DeleteLocalInt(oWho,"nStuckResets");
|
|
DeleteLocalFloat(oWho,"fLast");
|
|
} // arrived
|
|
} // valid destination
|
|
else { nRet=-1; }
|
|
return nRet;
|
|
} // fnMoveToDestination()
|
|
|
|
|
|
//////////////////////////
|
|
// FUNCTIONS
|
|
//////////////////////////
|
|
|
|
|
|
int privateHas_ManaCrystal(object oChampion)
|
|
{ // PURPOSE: To return TRUE if the champion has a mana crystal
|
|
// Version History
|
|
// mm/dd/yyyy | Modified By | Description
|
|
// 09/21/2006 | Deva B. Winblood | Initial version of this function
|
|
object oItem;
|
|
oItem=GetItemPossessedBy(oChampion,"MANA_CRYSTAL_5");
|
|
if (GetIsObjectValid(oItem)) return TRUE;
|
|
oItem=GetItemPossessedBy(oChampion,"MANA_CRYSTAL_2");
|
|
if (GetIsObjectValid(oItem)) return TRUE;
|
|
oItem=GetItemPossessedBy(oChampion,"MANA_CRYSTAL_1");
|
|
if (GetIsObjectValid(oItem)) return TRUE;
|
|
return FALSE;
|
|
} // privateHas_ManaCrystal()
|
|
|
|
|
|
string privateGetActionName(int nAction)
|
|
{ // PURPOSE: Return The Action name for the action for debugging
|
|
// Version History
|
|
// mm/dd/yyyy | Modified By | Description
|
|
// 09/17/2006 | Deva B. Winblood | Initial version of this function
|
|
if (nAction==CHAMPION_ACTION_BUFF) return "BUFF";
|
|
else if (nAction==CHAMPION_ACTION_CONDITIONAL_REST) return "CONDITIONAL REST";
|
|
else if (nAction==CHAMPION_ACTION_CONTROL) return "CONTROL";
|
|
else if (nAction==CHAMPION_ACTION_DEPOSIT) return "DEPOSIT";
|
|
else if (nAction==CHAMPION_ACTION_EQUIP) return "EQUIP";
|
|
else if (nAction==CHAMPION_ACTION_ESCAPE1) return "ESCAPE1";
|
|
else if (nAction==CHAMPION_ACTION_ESCAPE2) return "ESCAPE2";
|
|
else if (nAction==CHAMPION_ACTION_GATHER) return "GATHER";
|
|
else if (nAction==CHAMPION_ACTION_HEAL) return "HEAL";
|
|
else if (nAction==CHAMPION_ACTION_NONE) return "--0--";
|
|
else if (nAction==CHAMPION_ACTION_REST) return "REST";
|
|
else if (nAction==CHAMPION_ACTION_RETURN) return "RETURN";
|
|
else if (nAction==CHAMPION_ACTION_RUN) return "RUN";
|
|
else if (nAction==CHAMPION_ACTION_SEARCH) return "SEARCH";
|
|
else if (nAction==CHAMPION_ACTION_STEAL) return "STEAL";
|
|
else if (nAction==CHAMPION_ACTION_USE) return "USE";
|
|
return "--0--";
|
|
} // privateGetActionName()
|
|
|
|
|
|
void Champion_Debug(object oChampion,string sMsg)
|
|
{ // PURPOSE: To print a debug message to the log
|
|
// Version History
|
|
// mm/dd/yyyy | Modified By | Description
|
|
// 09/17/2006 | Deva B. Winblood | Initial version of this function
|
|
int nLevel;
|
|
if (CHAMPION_DEBUG)
|
|
{ // champion debug is on
|
|
if (GetStringLength(CHAMPION_DEBUG_SPECIFIC)>0&&GetLocalString(oChampion,"sTeamID")!=CHAMPION_DEBUG_SPECIFIC) return;
|
|
nLevel=GetLevelByPosition(1,oChampion)+GetLevelByPosition(2,oChampion)+GetLevelByPosition(3,oChampion);
|
|
PrintString("Champion("+GetLocalString(oChampion,"sTeamID")+":"+GetTag(GetArea(oChampion))+":"+IntToString(nLevel)+" XP="+IntToString(GetLocalInt(oChampion,"nXP"))+"/"+IntToString(nLevel*500)+"): "+sMsg);
|
|
} // champion debug is on
|
|
} // Champion_Debug()
|
|
|
|
|
|
void Champion_Control(object oChampion)
|
|
{ // PURPOSE: To release any followers and set them to guard where they stand
|
|
// and walk
|
|
// Version History
|
|
// mm/dd/yyyy | Modified By | Description
|
|
// 09/17/2006 | Deva B. Winblood | Initial version of this function
|
|
int nN;
|
|
object oFollower;
|
|
object oGArea=GetArea(oChampion);
|
|
vector vV=GetPosition(oChampion);
|
|
Champion_Debug(oChampion,"Champion_Control()");
|
|
fnDMSpeak(oChampion,"I release my followers to control this area.",TRUE);
|
|
nN=1;
|
|
oFollower=Champion_GetFollower(oChampion,nN);
|
|
while(GetIsObjectValid(oFollower))
|
|
{ // set followers to guard where they stand and walk
|
|
DelayCommand(0.4,AssignCommand(oFollower,ClearAllActions(TRUE)));
|
|
DelayCommand(0.5,SetLocalFloat(oFollower,"fGX",vV.x));
|
|
DelayCommand(0.5,SetLocalFloat(oFollower,"fGY",vV.y));
|
|
DelayCommand(0.5,SetLocalFloat(oFollower,"fGZ",vV.z));
|
|
DelayCommand(0.5,SetLocalObject(oFollower,"oGArea",oGArea));
|
|
DelayCommand(0.5,SetLocalInt(oFollower,"nMState",2));
|
|
DelayCommand(0.5,SetLocalInt(oFollower,"nSState",0));
|
|
DelayCommand(0.5,SetLocalInt(oFollower,"nParm",0));
|
|
DelayCommand(0.5,SetLocalObject(oFollower,"oDestWP",OBJECT_INVALID));
|
|
DelayCommand(0.5,DeleteLocalInt(oFollower,"nRun"));
|
|
DelayCommand(0.5,DeleteLocalInt(oFollower,"nGNBRun"));
|
|
SetAILevel(oFollower,AI_LEVEL_DEFAULT);
|
|
if(GetMaster(oFollower)==oChampion) RemoveHenchman(oChampion,oFollower);
|
|
nN++;
|
|
oFollower=Champion_GetFollower(oChampion,nN);
|
|
} // set followers to guard where they stand and walk
|
|
} // Champion_Control()
|
|
|
|
|
|
|
|
void privateCreate_Follower(object oChampion,string sRes)
|
|
{ // PURPOSE: To create a follower that follows oChampion
|
|
// Version History
|
|
// mm/dd/yyyy | Modified By | Description
|
|
// 09/17/2006 | Deva B. Winblood | Initial version of this function
|
|
string sTeamID=GetLocalString(oChampion,"sTeamID");
|
|
object oCreature=CreateObject(OBJECT_TYPE_CREATURE,sRes,GetLocation(oChampion));
|
|
Champion_Debug(oChampion," privateCreate_Follower("+GetName(oCreature)+")");
|
|
SetMaxHenchmen(10);
|
|
AddHenchman(oChampion,oCreature);
|
|
SetLocalString(oCreature,"sTeamID",sTeamID);
|
|
SetAILevel(oCreature,AI_LEVEL_NORMAL);
|
|
SetLocalInt(oCreature,"nMState",4);
|
|
SetLocalInt(oCreature,"nSState",0);
|
|
SetLocalObject(oCreature,"oDestWP",oChampion);
|
|
SetLocalInt(oCreature,"nFollowDist",0);
|
|
} // privateCreate_Follower()
|
|
|
|
|
|
void Champion_Gather(object oChampion)
|
|
{ // PURPOSE: To Gather up units to follow the champion
|
|
// Version History
|
|
// mm/dd/yyyy | Modified By | Description
|
|
// 09/17/2006 | Deva B. Winblood | Initial version of this function
|
|
object oLeader;
|
|
string sID=GetStringUpperCase(GetLocalString(oChampion,"sTeamID"));
|
|
int nN;
|
|
int nR;
|
|
string sRes;
|
|
object oFollower;
|
|
object oItem;
|
|
int nLevel=0;
|
|
int nCount=0;
|
|
Champion_Debug(oChampion,"Champion_Gather()");
|
|
fnDMSpeak(oChampion,"Come with me!",TRUE);
|
|
oLeader=GetLocalObject(GetModule(),"oTeamLead"+sID);
|
|
if (GetIsObjectValid(oLeader)) nLevel=GetLevelByPosition(1,oLeader)+GetLevelByPosition(2,oLeader)+GetLevelByPosition(3,oLeader);
|
|
Champion_SetSentinel(oChampion);
|
|
nN=1;
|
|
oFollower=GetAssociate(ASSOCIATE_TYPE_HENCHMAN,oChampion,nN);
|
|
while(GetIsObjectValid(oFollower)||nCount>4)
|
|
{ // count
|
|
nCount++;
|
|
oFollower=GetAssociate(ASSOCIATE_TYPE_HENCHMAN,oChampion,nN);
|
|
} // count
|
|
if (nCount>4) return; // no need to gather
|
|
if (sID=="UND")
|
|
{ // undead
|
|
oItem=GetItemPossessedBy(oChampion,"rts_it_mag33");
|
|
if (GetIsObjectValid(oItem))
|
|
{ // has grave digger
|
|
if (nLevel<6)
|
|
{ // level 0-5
|
|
privateCreate_Follower(oChampion,"und24"); // skeleton archer
|
|
//Champion_SetSentinel(oChampion);
|
|
privateCreate_Follower(oChampion,"und24"); // skeleton archer
|
|
privateCreate_Follower(oChampion,"und24"); // skeleton archer
|
|
//Champion_SetSentinel(oChampion);
|
|
privateCreate_Follower(oChampion,"und24"); // skeleton archer
|
|
privateCreate_Follower(oChampion,"und30"); // flaming skeleton
|
|
} // level 0-5
|
|
else if (nLevel<9)
|
|
{ // level 6-8
|
|
privateCreate_Follower(oChampion,"und24"); // skeleton archer
|
|
//Champion_SetSentinel(oChampion);
|
|
privateCreate_Follower(oChampion,"und24"); // skeleton archer
|
|
privateCreate_Follower(oChampion,"und30"); // flaming skeleton
|
|
//Champion_SetSentinel(oChampion);
|
|
privateCreate_Follower(oChampion,"und31"); // frost skeleton
|
|
privateCreate_Follower(oChampion,"und29"); // acidic skeleton
|
|
} // level 6-8
|
|
else if (nLevel<11)
|
|
{ // level 9-10
|
|
privateCreate_Follower(oChampion,"und30"); // flaming skeleton
|
|
//Champion_SetSentinel(oChampion);
|
|
privateCreate_Follower(oChampion,"und31"); // frost skeleton
|
|
privateCreate_Follower(oChampion,"und29"); // acidic skeleton
|
|
//Champion_SetSentinel(oChampion);
|
|
privateCreate_Follower(oChampion,"und11"); // wights
|
|
privateCreate_Follower(oChampion,"und11"); // wights
|
|
} // level 9-10
|
|
else if (nLevel<14)
|
|
{ // level 11-13
|
|
privateCreate_Follower(oChampion,"und7"); // wraiths
|
|
//Champion_SetSentinel(oChampion);
|
|
} // level 11-13
|
|
else if (nLevel<17)
|
|
{ // level 14-16
|
|
privateCreate_Follower(oChampion,"und8"); // spectres
|
|
//Champion_SetSentinel(oChampion);
|
|
} // level 14-16
|
|
else if (nLevel<19)
|
|
{ // level 17-18
|
|
privateCreate_Follower(oChampion,"und17"); // skeleton warrior
|
|
privateCreate_Follower(oChampion,"und17"); // skeleton warrior
|
|
//Champion_SetSentinel(oChampion);
|
|
privateCreate_Follower(oChampion,"und19"); // skeletal devourer
|
|
privateCreate_Follower(oChampion,"und34"); // skeleton mage
|
|
// Champion_SetSentinel(oChampion);
|
|
privateCreate_Follower(oChampion,"und34"); // skeleton mage
|
|
} // level 17-18
|
|
else
|
|
{ // level 19+
|
|
privateCreate_Follower(oChampion,"und25"); // Necromancer
|
|
privateCreate_Follower(oChampion,"und22"); // Mohrg
|
|
// Champion_SetSentinel(oChampion);
|
|
privateCreate_Follower(oChampion,"und22"); // Mohrg
|
|
privateCreate_Follower(oChampion,"und22"); // Mohrg
|
|
// Champion_SetSentinel(oChampion);
|
|
privateCreate_Follower(oChampion,"und19"); // skeletal devourer
|
|
} // level 19+
|
|
} // has grave digger
|
|
else
|
|
{ // no grave digger
|
|
if (nLevel<6)
|
|
{ // level 0-5
|
|
privateCreate_Follower(oChampion,"und24"); // skeleton archer
|
|
privateCreate_Follower(oChampion,"und1"); // skeleton
|
|
// Champion_SetSentinel(oChampion);
|
|
privateCreate_Follower(oChampion,"und1"); // skeleton
|
|
privateCreate_Follower(oChampion,"und1"); // skeleton
|
|
// Champion_SetSentinel(oChampion);
|
|
privateCreate_Follower(oChampion,"und1"); // skeleton
|
|
} // level 0-5
|
|
else if (nLevel<9)
|
|
{ // level 6-8
|
|
privateCreate_Follower(oChampion,"und24"); // skeleton archer
|
|
privateCreate_Follower(oChampion,"und24"); // skeleton archer
|
|
//Champion_SetSentinel(oChampion);
|
|
privateCreate_Follower(oChampion,"und3"); // ghoul
|
|
// Champion_SetSentinel(oChampion);
|
|
privateCreate_Follower(oChampion,"und3"); // ghoul
|
|
privateCreate_Follower(oChampion,"und3"); // ghoul
|
|
} // level 6-8
|
|
else if (nLevel<11)
|
|
{ // level 9-10
|
|
privateCreate_Follower(oChampion,"und24"); // skeleton archer
|
|
privateCreate_Follower(oChampion,"und24"); // skeleton archer
|
|
privateCreate_Follower(oChampion,"und11"); // wights
|
|
privateCreate_Follower(oChampion,"und11"); // wights
|
|
privateCreate_Follower(oChampion,"und11"); // wights
|
|
} // level 9-10
|
|
else if (nLevel<14)
|
|
{ // level 11-13
|
|
privateCreate_Follower(oChampion,"und7"); // wraiths
|
|
} // level 11-13
|
|
else if (nLevel<17)
|
|
{ // level 14-16
|
|
privateCreate_Follower(oChampion,"und8"); // spectres
|
|
} // level 14-16
|
|
else if (nLevel<19)
|
|
{ // level 17-18
|
|
privateCreate_Follower(oChampion,"und17"); // skeleton warrior
|
|
privateCreate_Follower(oChampion,"und17"); // skeleton warrior
|
|
privateCreate_Follower(oChampion,"und19"); // skeletal devourer
|
|
privateCreate_Follower(oChampion,"und34"); // skeleton mage
|
|
privateCreate_Follower(oChampion,"und34"); // skeleton mage
|
|
} // level 17-18
|
|
else
|
|
{ // level 19+
|
|
privateCreate_Follower(oChampion,"und25"); // Necromancer
|
|
privateCreate_Follower(oChampion,"und22"); // Mohrg
|
|
privateCreate_Follower(oChampion,"und22"); // Mohrg
|
|
privateCreate_Follower(oChampion,"und22"); // Mohrg
|
|
privateCreate_Follower(oChampion,"und19"); // skeletal devourer
|
|
} // level 19+
|
|
} // no grave digger
|
|
} // undead
|
|
else if (sID=="SPID")
|
|
{ // spiders
|
|
oItem=GetItemPossessedBy(oChampion,"rts_it_mag34");
|
|
if (GetIsObjectValid(oItem))
|
|
{ // has plague of spiders
|
|
if (nLevel<7)
|
|
{ // level 0-6
|
|
privateCreate_Follower(oChampion,"spid3ai"); // Small Spider
|
|
privateCreate_Follower(oChampion,"spid3ai"); // Small Spider
|
|
//Champion_SetSentinel(oChampion);
|
|
privateCreate_Follower(oChampion,"spid3ai"); // Small Spider
|
|
privateCreate_Follower(oChampion,"spid3ai"); // Small Spider
|
|
// Champion_SetSentinel(oChampion);
|
|
privateCreate_Follower(oChampion,"spid3ai"); // Small Spider
|
|
} // level 0-6
|
|
else if (nLevel<10)
|
|
{ // level 7-9
|
|
privateCreate_Follower(oChampion,"spid19"); // Huge Sword Spider
|
|
privateCreate_Follower(oChampion,"spid19"); // Huge Sword Spider
|
|
// Champion_SetSentinel(oChampion);
|
|
privateCreate_Follower(oChampion,"spid19"); // Huge Sword Spider
|
|
privateCreate_Follower(oChampion,"spid19"); // Huge Sword Spider
|
|
privateCreate_Follower(oChampion,"spid31"); // Huge Blackwidow Spider
|
|
} // level 7-9
|
|
else if (nLevel<16)
|
|
{ // level 10-15
|
|
privateCreate_Follower(oChampion,"spid19"); // Huge Sword Spider
|
|
privateCreate_Follower(oChampion,"spid15"); // Huge Phase Spider
|
|
privateCreate_Follower(oChampion,"spid23"); // Huge Wraith Spider
|
|
privateCreate_Follower(oChampion,"spid31"); // Huge Blackwidow Spider
|
|
privateCreate_Follower(oChampion,"spid30"); // Huge Bloodback Spider
|
|
} // level 10-15
|
|
else if (nLevel<19)
|
|
{ // level 16-18
|
|
privateCreate_Follower(oChampion,"spid27"); // Drider Warrior
|
|
privateCreate_Follower(oChampion,"spid27"); // Drider Warrior
|
|
privateCreate_Follower(oChampion,"spid27"); // Drider Warrior
|
|
} // level 16-18
|
|
else
|
|
{ // level 19+
|
|
privateCreate_Follower(oChampion,"spid27"); // Drider Warrior
|
|
privateCreate_Follower(oChampion,"spidai12");// Gargantuan Dire Spider
|
|
} // level 19+
|
|
} // has plague of spiders
|
|
else
|
|
{ // does not have plague of spiders
|
|
if (nLevel<7)
|
|
{ // level 0-6
|
|
privateCreate_Follower(oChampion,"spid3ai"); // Small Spider
|
|
// Champion_SetSentinel(oChampion);
|
|
privateCreate_Follower(oChampion,"spid3ai"); // Small Spider
|
|
privateCreate_Follower(oChampion,"spid3ai"); // Small Spider
|
|
} // level 0-6
|
|
else if (nLevel<10)
|
|
{ // level 7-9
|
|
privateCreate_Follower(oChampion,"spid6"); // Huge Spider
|
|
// Champion_SetSentinel(oChampion);
|
|
privateCreate_Follower(oChampion,"spid6"); // Huge Spider
|
|
privateCreate_Follower(oChampion,"spid6"); // Huge Spider
|
|
privateCreate_Follower(oChampion,"spid6"); // Huge Spider
|
|
} // level 7-9
|
|
else if (nLevel<16)
|
|
{ // level 10-15
|
|
privateCreate_Follower(oChampion,"spid19"); // Huge Sword Spider
|
|
// Champion_SetSentinel(oChampion);
|
|
privateCreate_Follower(oChampion,"spid19"); // Huge Sword Spider
|
|
privateCreate_Follower(oChampion,"spid15"); // Huge Phase Spider
|
|
privateCreate_Follower(oChampion,"spid23"); // Huge Wraith Spider
|
|
} // level 10-15
|
|
else if (nLevel<19)
|
|
{ // level 16-18
|
|
privateCreate_Follower(oChampion,"spid27"); // Drider Warrior
|
|
privateCreate_Follower(oChampion,"spid27"); // Drider Warrior
|
|
} // level 16-18
|
|
else
|
|
{ // level 19+
|
|
privateCreate_Follower(oChampion,"spidai12");// Gargantuan Dire Spider
|
|
} // level 19+
|
|
} // does not have plague of spiders
|
|
} // spiders
|
|
else if (sID=="UNC")
|
|
{ // unclean
|
|
if (nLevel<6)
|
|
{ // level 0-5
|
|
privateCreate_Follower(oChampion,"unc1"); // goblin
|
|
privateCreate_Follower(oChampion,"unc1"); // goblin
|
|
privateCreate_Follower(oChampion,"unc1"); // goblin
|
|
privateCreate_Follower(oChampion,"unc1"); // goblin
|
|
privateCreate_Follower(oChampion,"unc1"); // goblin
|
|
privateCreate_Follower(oChampion,"unc1"); // goblin
|
|
} // level 0-5
|
|
else if (nLevel<9)
|
|
{ // level 6-8
|
|
privateCreate_Follower(oChampion,"unc1"); // goblin
|
|
privateCreate_Follower(oChampion,"unc1"); // goblin
|
|
privateCreate_Follower(oChampion,"unc1"); // goblin
|
|
privateCreate_Follower(oChampion,"unc4"); // goblin elite
|
|
privateCreate_Follower(oChampion,"unc2"); // bugbear
|
|
privateCreate_Follower(oChampion,"unc2"); // bugbear
|
|
} // level 6-8
|
|
else if (nLevel<13)
|
|
{ // level 9-12
|
|
privateCreate_Follower(oChampion,"unc4"); // goblin elite
|
|
privateCreate_Follower(oChampion,"unc4"); // goblin elite
|
|
privateCreate_Follower(oChampion,"unc4"); // goblin elite
|
|
privateCreate_Follower(oChampion,"unc5"); // ogre
|
|
privateCreate_Follower(oChampion,"unc5"); // ogre
|
|
privateCreate_Follower(oChampion,"unc5"); // ogre
|
|
} // level 9-12
|
|
else if (nLevel<16)
|
|
{ // level 13-15
|
|
privateCreate_Follower(oChampion,"unc5"); // ogre
|
|
privateCreate_Follower(oChampion,"unc5"); // ogre
|
|
privateCreate_Follower(oChampion,"unc5"); // ogre
|
|
privateCreate_Follower(oChampion,"unc5"); // ogre
|
|
privateCreate_Follower(oChampion,"unc5"); // ogre
|
|
privateCreate_Follower(oChampion,"unc11"); // hill giant
|
|
} // level 13-15
|
|
else if (nLevel<19)
|
|
{ // level 16-18
|
|
privateCreate_Follower(oChampion,"unc11"); // hill giant
|
|
privateCreate_Follower(oChampion,"unc11"); // hill giant
|
|
privateCreate_Follower(oChampion,"unc10"); // ettin
|
|
privateCreate_Follower(oChampion,"unc7"); // Ogre Berserkers
|
|
privateCreate_Follower(oChampion,"unc7"); // Ogre Berserkers
|
|
privateCreate_Follower(oChampion,"unc7"); // Ogre Berserkers
|
|
} // level 16-18
|
|
else
|
|
{ // level 19+
|
|
privateCreate_Follower(oChampion,"unc9"); // Ogre High Mage
|
|
privateCreate_Follower(oChampion,"unc14"); // Troll Berserkers
|
|
privateCreate_Follower(oChampion,"unc14"); // Troll Berserkers
|
|
privateCreate_Follower(oChampion,"unc14"); // Troll Berserkers
|
|
privateCreate_Follower(oChampion,"unc14"); // Troll Berserkers
|
|
privateCreate_Follower(oChampion,"unc14"); // Troll Berserkers
|
|
} // level 19+
|
|
} // unclean
|
|
else if (sID=="DWF")
|
|
{ // dwarves
|
|
oItem=GetObjectByTag("rts_pl_mag35",0);
|
|
if (GetIsObjectValid(oItem)&&GetObjectType(oItem)!=OBJECT_TYPE_PLACEABLE) oItem=GetObjectByTag("rts_pl_mag35",1);
|
|
if (GetIsObjectValid(oItem)&&GetLocalString(GetArea(oItem),"sTeamID")=="DWF")
|
|
{ // Mithril forge is in play
|
|
if (nLevel<7)
|
|
{ // level 0-6
|
|
privateCreate_Follower(oChampion,"dwf1"); // Fighter 1st
|
|
privateCreate_Follower(oChampion,"dwf1"); // Fighter 1st
|
|
privateCreate_Follower(oChampion,"dwf12"); // Skirmisher 1st
|
|
privateCreate_Follower(oChampion,"dwf12"); // Skirmisher 1st
|
|
privateCreate_Follower(oChampion,"dwf17"); // Cleric 1st
|
|
} // level 0-6
|
|
else if (nLevel<11)
|
|
{ // level 7-10
|
|
privateCreate_Follower(oChampion,"dwf4"); // Fighter 4th
|
|
privateCreate_Follower(oChampion,"dwf4"); // Fighter 4th
|
|
privateCreate_Follower(oChampion,"dwf13"); // Skirmisher 3rd
|
|
privateCreate_Follower(oChampion,"dwf13"); // Skirmisher 3rd
|
|
privateCreate_Follower(oChampion,"dwf18"); // Cleric 5th
|
|
} // level 7-10
|
|
else if (nLevel<16)
|
|
{ // level 11-15
|
|
privateCreate_Follower(oChampion,"dwf7"); // Fighter 7th
|
|
privateCreate_Follower(oChampion,"dwf7"); // Fighter 7th
|
|
privateCreate_Follower(oChampion,"dwf14"); // Skirmisher 6th
|
|
privateCreate_Follower(oChampion,"dwf14"); // Skirmisher 6th
|
|
privateCreate_Follower(oChampion,"dwf19"); // Cleric 10th
|
|
} // level 11-15
|
|
else if (nLevel<19)
|
|
{ // level 16-18
|
|
privateCreate_Follower(oChampion,"dwf9"); // Fighter 9th
|
|
privateCreate_Follower(oChampion,"dwf20"); // Cleric hero
|
|
privateCreate_Follower(oChampion,"dwf23"); // night scout
|
|
privateCreate_Follower(oChampion,"dwf24"); // stone golem
|
|
} // level 16-18
|
|
else
|
|
{ // level 19+
|
|
privateCreate_Follower(oChampion,"dwf20"); // Cleric hero
|
|
privateCreate_Follower(oChampion,"dwf11"); // fighter hero
|
|
privateCreate_Follower(oChampion,"dwf16"); // skirmisher hero
|
|
privateCreate_Follower(oChampion,"dwf25"); // Iron Golem
|
|
} // level 19+
|
|
} // Mithril forge is in play
|
|
else
|
|
{ // no mithril forge
|
|
if (nLevel<7)
|
|
{ // level 0-6
|
|
privateCreate_Follower(oChampion,"dwf22"); // militia
|
|
privateCreate_Follower(oChampion,"dwf22"); // militia
|
|
privateCreate_Follower(oChampion,"dwf27"); // dog
|
|
privateCreate_Follower(oChampion,"dwf12"); // skirmisher 1st
|
|
} // level 0-6
|
|
else if (nLevel<11)
|
|
{ // level 7-10
|
|
privateCreate_Follower(oChampion,"dwf28"); // war dog
|
|
privateCreate_Follower(oChampion,"dwf4"); // fighter 4th
|
|
privateCreate_Follower(oChampion,"dwf13"); // skirmisher 3rd
|
|
privateCreate_Follower(oChampion,"dwf13"); // skirmisher 3rd
|
|
} // level 7-10
|
|
else if (nLevel<16)
|
|
{ // level 11-15
|
|
privateCreate_Follower(oChampion,"dwf18"); // cleric 5th
|
|
privateCreate_Follower(oChampion,"dwf7"); // fighter 7th
|
|
privateCreate_Follower(oChampion,"dwf7"); // fighter 7th
|
|
privateCreate_Follower(oChampion,"dwf14"); // skirmisher 6th
|
|
} // level 11-15
|
|
else if (nLevel<19)
|
|
{ // level 16-18
|
|
privateCreate_Follower(oChampion,"dwf19"); // cleric 10th
|
|
privateCreate_Follower(oChampion,"dwf23"); // night scout
|
|
privateCreate_Follower(oChampion,"dwf9"); // fighter 9th
|
|
} // level 16-18
|
|
else
|
|
{ // level 19+
|
|
privateCreate_Follower(oChampion,"dwf20"); // cleric hero
|
|
privateCreate_Follower(oChampion,"dwf11"); // fighter hero
|
|
privateCreate_Follower(oChampion,"dwf16"); // skirmisher hero
|
|
} // level 19+
|
|
} // no mithril forge
|
|
} // dwarves
|
|
} // Champion_Gather()
|
|
|
|
|
|
|
|
void Champion_CondRest(object oChampion)
|
|
{ // PURPOSE: Check nearby control point. If it is controlled by this team then
|
|
// Rest.
|
|
// Version History
|
|
// mm/dd/yyyy | Modified By | Description
|
|
// 09/17/2006 | Deva B. Winblood | Initial version of this function
|
|
object oControl=OBJECT_INVALID;
|
|
string sID=GetStringUpperCase(GetLocalString(oChampion,"sTeamID"));
|
|
string sTag="CONTROL"+sID;
|
|
Champion_Debug(oChampion,"Champion_CondRest()");
|
|
fnDMSpeak(oChampion,"I must rest.",TRUE);
|
|
oControl=GetNearestObjectByTag(sTag,oChampion,1);
|
|
if (GetIsObjectValid(oControl))
|
|
{ // control point is near
|
|
SetLocalInt(oChampion,"bRestAction",TRUE);
|
|
DelayCommand(40.0,DeleteLocalInt(oChampion,"bRestAction"));
|
|
SetLocalInt(oChampion,"bRested",TRUE);
|
|
DelayCommand(60.0,DeleteLocalInt(oChampion,"bRested"));
|
|
AssignCommand(oChampion,ClearAllActions());
|
|
AssignCommand(oChampion,PRCForceRest(oChampion));
|
|
AssignCommand(oChampion,ActionPlayAnimation(ANIMATION_LOOPING_SIT_CROSS,1.0,25.0));
|
|
SetLocalInt(oChampion,"nProcessActionDelay",14);
|
|
} // control point is near
|
|
} // Champion_CondRest()
|
|
|
|
|
|
void Champion_Rest(object oChampion)
|
|
{ // PURPOSE: To make the champion rest
|
|
// Version History
|
|
// mm/dd/yyyy | Modified By | Description
|
|
// 09/17/2006 | Deva B. Winblood | Initial version of this function
|
|
Champion_Debug(oChampion,"Champion_Rest()");
|
|
fnDMSpeak(oChampion,"I am resting.");
|
|
SetLocalInt(oChampion,"bRestAction",TRUE);
|
|
DelayCommand(24.0,DeleteLocalInt(oChampion,"bRestAction"));
|
|
SetLocalInt(oChampion,"bRested",TRUE);
|
|
DelayCommand(30.0,DeleteLocalInt(oChampion,"bRested"));
|
|
AssignCommand(oChampion,ClearAllActions());
|
|
AssignCommand(oChampion,PRCForceRest(oChampion));
|
|
AssignCommand(oChampion,ActionPlayAnimation(ANIMATION_LOOPING_SIT_CROSS,1.0,24.0));
|
|
SetLocalInt(oChampion,"nProcessActionDelay",7);
|
|
} // Champion_Rest()
|
|
|
|
|
|
|
|
void privateHandle_Buffing(object oChampion,object oTarget)
|
|
{ // PURPOSE: This handles the actual buffing of oTarget by oChampion
|
|
// Version History
|
|
// mm/dd/yyyy | Modified By | Description
|
|
// 09/17/2006 | Deva B. Winblood | Initial version of this function
|
|
int nRT=MyPRCGetRacialType(oTarget);
|
|
int nN;
|
|
object oItem;
|
|
Champion_Debug(oChampion," privateHandle_Buffing("+GetName(oTarget)+")");
|
|
//AssignCommand(oChampion,ClearAllActions());
|
|
if (oChampion==oTarget)
|
|
{ // self
|
|
if (GetIsObjectValid(GetItemPossessedBy(oChampion,"NW_IT_MPOTION005"))&&!GetHasSpellEffect(SPELL_BARKSKIN,oChampion))
|
|
{ // okay to use barkskin potion
|
|
oItem=GetItemPossessedBy(oChampion,"NW_IT_MPOTION005");
|
|
nN=GetItemStackSize(oItem);
|
|
if (nN==1) DestroyObject(oItem);
|
|
else { SetItemStackSize(oItem,nN-1); }
|
|
AssignCommand(oChampion,ActionPlayAnimation(ANIMATION_FIREFORGET_DRINK,1.0,2.0));
|
|
AssignCommand(oChampion,ActionCastSpellAtObject(SPELL_BARKSKIN,oTarget,METAMAGIC_ANY,TRUE,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE));
|
|
} // okay to use barkskin potion
|
|
else if (GetIsObjectValid(GetItemPossessedBy(oChampion,"NW_IT_MPOTION009"))&&!GetHasSpellEffect(SPELL_BLESS,oChampion))
|
|
{ // okay to use bless potion
|
|
oItem=GetItemPossessedBy(oChampion,"NW_IT_MPOTION009");
|
|
nN=GetItemStackSize(oItem);
|
|
if (nN==1) DestroyObject(oItem);
|
|
else { SetItemStackSize(oItem,nN-1); }
|
|
AssignCommand(oChampion,ActionPlayAnimation(ANIMATION_FIREFORGET_DRINK,1.0,2.0));
|
|
AssignCommand(oChampion,ActionCastSpellAtObject(SPELL_BLESS,oTarget,METAMAGIC_ANY,TRUE,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE));
|
|
} // okay to use bless potion
|
|
else if (GetIsObjectValid(GetItemPossessedBy(oChampion,"NW_IT_MPOTION015"))&&!GetHasSpellEffect(SPELL_BULLS_STRENGTH,oChampion))
|
|
{ // okay to use bulls strength potion
|
|
oItem=GetItemPossessedBy(oChampion,"NW_IT_MPOTION015");
|
|
nN=GetItemStackSize(oItem);
|
|
if (nN==1) DestroyObject(oItem);
|
|
else { SetItemStackSize(oItem,nN-1); }
|
|
AssignCommand(oChampion,ActionPlayAnimation(ANIMATION_FIREFORGET_DRINK,1.0,2.0));
|
|
AssignCommand(oChampion,ActionCastSpellAtObject(SPELL_BULLS_STRENGTH,oTarget,METAMAGIC_ANY,TRUE,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE));
|
|
} // okay to use bulls strength potion
|
|
else if (GetIsObjectValid(GetItemPossessedBy(oChampion,"NW_IT_MPOTION007"))&&!GetHasSpellEffect(SPELL_CLARITY,oChampion))
|
|
{ // okay to use clarity potion
|
|
oItem=GetItemPossessedBy(oChampion,"NW_IT_MPOTION007");
|
|
nN=GetItemStackSize(oItem);
|
|
if (nN==1) DestroyObject(oItem);
|
|
else { SetItemStackSize(oItem,nN-1); }
|
|
AssignCommand(oChampion,ActionPlayAnimation(ANIMATION_FIREFORGET_DRINK,1.0,2.0));
|
|
AssignCommand(oChampion,ActionCastSpellAtObject(SPELL_CLARITY,oTarget,METAMAGIC_ANY,TRUE,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE));
|
|
} // okay to use clarity potion
|
|
else if (GetIsObjectValid(GetItemPossessedBy(oChampion,"NW_IT_MPOTION002"))&&!GetHasSpellEffect(SPELL_DEATH_ARMOR,oChampion))
|
|
{ // okay to use death armor potion
|
|
oItem=GetItemPossessedBy(oChampion,"NW_IT_MPOTION002");
|
|
nN=GetItemStackSize(oItem);
|
|
if (nN==1) DestroyObject(oItem);
|
|
else { SetItemStackSize(oItem,nN-1); }
|
|
AssignCommand(oChampion,ActionPlayAnimation(ANIMATION_FIREFORGET_DRINK,1.0,2.0));
|
|
AssignCommand(oChampion,ActionCastSpellAtObject(SPELL_DEATH_ARMOR,oTarget,METAMAGIC_ANY,TRUE,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE));
|
|
} // okay to use death armor potion
|
|
else if (GetIsObjectValid(GetItemPossessedBy(oChampion,"NW_IT_MPOTION013"))&&!GetHasSpellEffect(SPELL_ENDURANCE,oChampion))
|
|
{ // okay to use endurance potion
|
|
oItem=GetItemPossessedBy(oChampion,"NW_IT_MPOTION013");
|
|
nN=GetItemStackSize(oItem);
|
|
if (nN==1) DestroyObject(oItem);
|
|
else { SetItemStackSize(oItem,nN-1); }
|
|
AssignCommand(oChampion,ActionPlayAnimation(ANIMATION_FIREFORGET_DRINK,1.0,2.0));
|
|
AssignCommand(oChampion,ActionCastSpellAtObject(SPELL_ENDURANCE,oTarget,METAMAGIC_ANY,TRUE,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE));
|
|
} // okay to use endurance potion
|
|
else if (GetIsObjectValid(GetItemPossessedBy(oChampion,"NW_IT_MPOTION008"))&&!GetHasSpellEffect(SPELL_INVISIBILITY,oChampion))
|
|
{ // okay to use invisibility potion
|
|
oItem=GetItemPossessedBy(oChampion,"NW_IT_MPOTION008");
|
|
nN=GetItemStackSize(oItem);
|
|
if (nN==1) DestroyObject(oItem);
|
|
else { SetItemStackSize(oItem,nN-1); }
|
|
AssignCommand(oChampion,ActionPlayAnimation(ANIMATION_FIREFORGET_DRINK,1.0,2.0));
|
|
AssignCommand(oChampion,ActionCastSpellAtObject(SPELL_INVISIBILITY,oTarget,METAMAGIC_ANY,TRUE,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE));
|
|
} // okay to use invisibility potion
|
|
else if (GetIsObjectValid(GetItemPossessedBy(oChampion,"NW_IT_MPOTION001"))&&!GetHasSpellEffect(SPELL_IRONGUTS,oChampion))
|
|
{ // okay to use ironguts potion
|
|
oItem=GetItemPossessedBy(oChampion,"NW_IT_MPOTION001");
|
|
nN=GetItemStackSize(oItem);
|
|
if (nN==1) DestroyObject(oItem);
|
|
else { SetItemStackSize(oItem,nN-1); }
|
|
AssignCommand(oChampion,ActionPlayAnimation(ANIMATION_FIREFORGET_DRINK,1.0,2.0));
|
|
AssignCommand(oChampion,ActionCastSpellAtObject(SPELL_IRONGUTS,oTarget,METAMAGIC_ANY,TRUE,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE));
|
|
} // okay to use ironguts potion
|
|
else if (GetIsObjectValid(GetItemPossessedBy(oChampion,"NW_IT_MPOTION004"))&&!GetHasSpellEffect(SPELL_HASTE,oChampion))
|
|
{ // okay to use speed potion
|
|
oItem=GetItemPossessedBy(oChampion,"NW_IT_MPOTION004");
|
|
nN=GetItemStackSize(oItem);
|
|
if (nN==1) DestroyObject(oItem);
|
|
else { SetItemStackSize(oItem,nN-1); }
|
|
AssignCommand(oChampion,ActionPlayAnimation(ANIMATION_FIREFORGET_DRINK,1.0,2.0));
|
|
AssignCommand(oChampion,ActionCastSpellAtObject(SPELL_HASTE,oTarget,METAMAGIC_ANY,TRUE,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE));
|
|
} // okay to use speed potion
|
|
else
|
|
{ // spells
|
|
if (GetHasSpell(SPELL_BLESS,oChampion)&&!GetHasSpellEffect(SPELL_BLESS,oTarget))
|
|
{ // cast spell
|
|
AssignCommand(oChampion,ActionCastSpellAtObject(SPELL_BLESS,oTarget,METAMAGIC_ANY,FALSE,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE));
|
|
} // cast spell
|
|
else if (GetHasSpell(SPELL_BLESS_WEAPON,oChampion)&&!GetHasSpellEffect(SPELL_BLESS_WEAPON,oTarget))
|
|
{ // cast spell
|
|
AssignCommand(oChampion,ActionCastSpellAtObject(SPELL_BLESS_WEAPON,oTarget,METAMAGIC_ANY,FALSE,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE));
|
|
} // cast spell
|
|
else if (GetHasSpell(SPELL_CLARITY,oChampion)&&!GetHasSpellEffect(SPELL_CLARITY,oTarget))
|
|
{ // cast spell
|
|
AssignCommand(oChampion,ActionCastSpellAtObject(SPELL_CLARITY,oTarget,METAMAGIC_ANY,FALSE,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE));
|
|
} // cast spell
|
|
else if (GetHasSpell(SPELL_DARKFIRE,oChampion)&&!GetHasSpellEffect(SPELL_DARKFIRE,oTarget))
|
|
{ // cast spell
|
|
AssignCommand(oChampion,ActionCastSpellAtObject(SPELL_DARKFIRE,oTarget,METAMAGIC_ANY,FALSE,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE));
|
|
} // cast spell
|
|
else if (GetHasSpell(SPELL_DEATH_ARMOR,oChampion)&&!GetHasSpellEffect(SPELL_DEATH_ARMOR,oTarget))
|
|
{ // cast spell
|
|
AssignCommand(oChampion,ActionCastSpellAtObject(SPELL_DEATH_ARMOR,oTarget,METAMAGIC_ANY,FALSE,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE));
|
|
} // cast spell
|
|
else if (GetHasSpell(SPELL_DISPLACEMENT,oChampion)&&!GetHasSpellEffect(SPELL_DISPLACEMENT,oTarget))
|
|
{ // cast spell
|
|
AssignCommand(oChampion,ActionCastSpellAtObject(SPELL_DISPLACEMENT,oTarget,METAMAGIC_ANY,FALSE,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE));
|
|
} // cast spell
|
|
else if (GetHasSpell(SPELL_DIVINE_FAVOR,oChampion)&&!GetHasSpellEffect(SPELL_DIVINE_FAVOR,oTarget))
|
|
{ // cast spell
|
|
AssignCommand(oChampion,ActionCastSpellAtObject(SPELL_DIVINE_FAVOR,oTarget,METAMAGIC_ANY,FALSE,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE));
|
|
} // cast spell
|
|
else if (GetHasSpell(SPELL_DIVINE_MIGHT,oChampion)&&!GetHasSpellEffect(SPELL_DIVINE_MIGHT,oTarget))
|
|
{ // cast spell
|
|
AssignCommand(oChampion,ActionCastSpellAtObject(SPELL_DIVINE_MIGHT,oTarget,METAMAGIC_ANY,FALSE,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE));
|
|
} // cast spell
|
|
else if (GetHasSpell(SPELL_DIVINE_POWER,oChampion)&&!GetHasSpellEffect(SPELL_DIVINE_POWER,oTarget))
|
|
{ // cast spell
|
|
AssignCommand(oChampion,ActionCastSpellAtObject(SPELL_DIVINE_POWER,oTarget,METAMAGIC_ANY,FALSE,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE));
|
|
} // cast spell
|
|
else if (GetHasSpell(SPELL_DIVINE_SHIELD,oChampion)&&!GetHasSpellEffect(SPELL_DIVINE_SHIELD,oTarget))
|
|
{ // cast spell
|
|
AssignCommand(oChampion,ActionCastSpellAtObject(SPELL_DIVINE_SHIELD,oTarget,METAMAGIC_ANY,FALSE,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE));
|
|
} // cast spell
|
|
else if (GetHasSpell(SPELL_ENDURANCE,oChampion)&&!GetHasSpellEffect(SPELL_ENDURANCE,oTarget))
|
|
{ // cast spell
|
|
AssignCommand(oChampion,ActionCastSpellAtObject(SPELL_ENDURANCE,oTarget,METAMAGIC_ANY,FALSE,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE));
|
|
} // cast spell
|
|
else if (GetHasSpell(SPELL_ENDURE_ELEMENTS,oChampion)&&!GetHasSpellEffect(SPELL_ENDURE_ELEMENTS,oTarget))
|
|
{ // cast spell
|
|
AssignCommand(oChampion,ActionCastSpellAtObject(SPELL_ENDURE_ELEMENTS,oTarget,METAMAGIC_ANY,FALSE,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE));
|
|
} // cast spell
|
|
else if (GetHasSpell(SPELL_ENTROPIC_SHIELD,oChampion)&&!GetHasSpellEffect(SPELL_ENTROPIC_SHIELD,oTarget))
|
|
{ // cast spell
|
|
AssignCommand(oChampion,ActionCastSpellAtObject(SPELL_ENTROPIC_SHIELD,oTarget,METAMAGIC_ANY,FALSE,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE));
|
|
} // cast spell
|
|
else if (GetHasSpell(SPELL_EPIC_MAGE_ARMOR,oChampion)&&!GetHasSpellEffect(SPELL_EPIC_MAGE_ARMOR,oTarget))
|
|
{ // cast spell
|
|
AssignCommand(oChampion,ActionCastSpellAtObject(SPELL_EPIC_MAGE_ARMOR,oTarget,METAMAGIC_ANY,FALSE,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE));
|
|
} // cast spell
|
|
else if (GetHasSpell(SPELL_FREEDOM_OF_MOVEMENT,oChampion)&&!GetHasSpellEffect(SPELL_FREEDOM_OF_MOVEMENT,oTarget))
|
|
{ // cast spell
|
|
AssignCommand(oChampion,ActionCastSpellAtObject(SPELL_FREEDOM_OF_MOVEMENT,oTarget,METAMAGIC_ANY,FALSE,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE));
|
|
} // cast spell
|
|
else if (GetHasSpell(SPELL_GHOSTLY_VISAGE,oChampion)&&!GetHasSpellEffect(SPELL_GHOSTLY_VISAGE,oTarget))
|
|
{ // cast spell
|
|
AssignCommand(oChampion,ActionCastSpellAtObject(SPELL_GHOSTLY_VISAGE,oTarget,METAMAGIC_ANY,FALSE,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE));
|
|
} // cast spell
|
|
else if (GetHasSpell(SPELL_GREATER_BULLS_STRENGTH,oChampion)&&!GetHasSpellEffect(SPELL_GREATER_BULLS_STRENGTH,oTarget))
|
|
{ // cast spell
|
|
AssignCommand(oChampion,ActionCastSpellAtObject(SPELL_GREATER_BULLS_STRENGTH,oTarget,METAMAGIC_ANY,FALSE,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE));
|
|
} // cast spell
|
|
else if (GetHasSpell(SPELL_GREATER_ENDURANCE,oChampion)&&!GetHasSpellEffect(SPELL_GREATER_ENDURANCE,oTarget))
|
|
{ // cast spell
|
|
AssignCommand(oChampion,ActionCastSpellAtObject(SPELL_GREATER_ENDURANCE,oTarget,METAMAGIC_ANY,FALSE,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE));
|
|
} // cast spell
|
|
else if (GetHasSpell(SPELL_GREATER_MAGIC_WEAPON,oChampion)&&!GetHasSpellEffect(SPELL_GREATER_MAGIC_WEAPON,oTarget))
|
|
{ // cast spell
|
|
AssignCommand(oChampion,ActionCastSpellAtObject(SPELL_GREATER_MAGIC_WEAPON,oTarget,METAMAGIC_ANY,FALSE,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE));
|
|
} // cast spell
|
|
else if (GetHasSpell(SPELL_GREATER_STONESKIN,oChampion)&&!GetHasSpellEffect(SPELL_GREATER_STONESKIN,oTarget))
|
|
{ // cast spell
|
|
AssignCommand(oChampion,ActionCastSpellAtObject(SPELL_GREATER_STONESKIN,oTarget,METAMAGIC_ANY,FALSE,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE));
|
|
} // cast spell
|
|
else if (GetHasSpell(SPELL_GREATER_SPELL_MANTLE,oChampion)&&!GetHasSpellEffect(SPELL_GREATER_SPELL_MANTLE,oTarget))
|
|
{ // cast spell
|
|
AssignCommand(oChampion,ActionCastSpellAtObject(SPELL_GREATER_SPELL_MANTLE,oTarget,METAMAGIC_ANY,FALSE,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE));
|
|
} // cast spell
|
|
else if (GetHasSpell(SPELL_HASTE,oChampion)&&!GetHasSpellEffect(SPELL_HASTE,oTarget))
|
|
{ // cast spell
|
|
AssignCommand(oChampion,ActionCastSpellAtObject(SPELL_HASTE,oTarget,METAMAGIC_ANY,FALSE,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE));
|
|
} // cast spell
|
|
else if (GetHasSpell(SPELL_HOLY_AURA,oChampion)&&!GetHasSpellEffect(SPELL_HOLY_AURA,oTarget))
|
|
{ // cast spell
|
|
AssignCommand(oChampion,ActionCastSpellAtObject(SPELL_HOLY_AURA,oTarget,METAMAGIC_ANY,FALSE,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE));
|
|
} // cast spell
|
|
else if (GetHasSpell(SPELL_HOLY_SWORD,oChampion)&&!GetHasSpellEffect(SPELL_HOLY_SWORD,oTarget))
|
|
{ // cast spell
|
|
AssignCommand(oChampion,ActionCastSpellAtObject(SPELL_HOLY_SWORD,oTarget,METAMAGIC_ANY,FALSE,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE));
|
|
} // cast spell
|
|
else if (GetHasSpell(SPELL_IMPROVED_INVISIBILITY,oChampion)&&!GetHasSpellEffect(SPELL_IMPROVED_INVISIBILITY,oTarget))
|
|
{ // cast spell
|
|
AssignCommand(oChampion,ActionCastSpellAtObject(SPELL_IMPROVED_INVISIBILITY,oTarget,METAMAGIC_ANY,FALSE,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE));
|
|
} // cast spell
|
|
else if (GetHasSpell(SPELL_INVISIBILITY_SPHERE,oChampion)&&!GetHasSpellEffect(SPELL_INVISIBILITY_SPHERE,oTarget))
|
|
{ // cast spell
|
|
AssignCommand(oChampion,ActionCastSpellAtObject(SPELL_INVISIBILITY_SPHERE,oTarget,METAMAGIC_ANY,FALSE,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE));
|
|
} // cast spell
|
|
else if (GetHasSpell(SPELL_IRONGUTS,oChampion)&&!GetHasSpellEffect(SPELL_IRONGUTS,oTarget))
|
|
{ // cast spell
|
|
AssignCommand(oChampion,ActionCastSpellAtObject(SPELL_IRONGUTS,oTarget,METAMAGIC_ANY,FALSE,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE));
|
|
} // cast spell
|
|
else if (GetHasSpell(SPELL_KEEN_EDGE,oChampion)&&!GetHasSpellEffect(SPELL_KEEN_EDGE,oTarget))
|
|
{ // cast spell
|
|
AssignCommand(oChampion,ActionCastSpellAtObject(SPELL_KEEN_EDGE,oTarget,METAMAGIC_ANY,FALSE,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE));
|
|
} // cast spell
|
|
else if (GetHasSpell(SPELL_LESSER_MIND_BLANK,oChampion)&&!GetHasSpellEffect(SPELL_LESSER_MIND_BLANK,oTarget))
|
|
{ // cast spell
|
|
AssignCommand(oChampion,ActionCastSpellAtObject(SPELL_LESSER_MIND_BLANK,oTarget,METAMAGIC_ANY,FALSE,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE));
|
|
} // cast spell
|
|
else if (GetHasSpell(SPELL_LESSER_SPELL_MANTLE,oChampion)&&!GetHasSpellEffect(SPELL_LESSER_SPELL_MANTLE,oTarget))
|
|
{ // cast spell
|
|
AssignCommand(oChampion,ActionCastSpellAtObject(SPELL_LESSER_SPELL_MANTLE,oTarget,METAMAGIC_ANY,FALSE,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE));
|
|
} // cast spell
|
|
else if (GetHasSpell(SPELL_MAGE_ARMOR,oChampion)&&!GetHasSpellEffect(SPELL_MAGE_ARMOR,oTarget))
|
|
{ // cast spell
|
|
AssignCommand(oChampion,ActionCastSpellAtObject(SPELL_MAGE_ARMOR,oTarget,METAMAGIC_ANY,FALSE,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE));
|
|
} // cast spell
|
|
else if (GetHasSpell(SPELL_MAGIC_VESTMENT,oChampion)&&!GetHasSpellEffect(SPELL_MAGIC_VESTMENT,oTarget))
|
|
{ // cast spell
|
|
AssignCommand(oChampion,ActionCastSpellAtObject(SPELL_MAGIC_VESTMENT,oTarget,METAMAGIC_ANY,FALSE,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE));
|
|
} // cast spell
|
|
else if (GetHasSpell(SPELL_MAGIC_WEAPON,oChampion)&&!GetHasSpellEffect(SPELL_MAGIC_WEAPON,oTarget))
|
|
{ // cast spell
|
|
AssignCommand(oChampion,ActionCastSpellAtObject(SPELL_MAGIC_WEAPON,oTarget,METAMAGIC_ANY,FALSE,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE));
|
|
} // cast spell
|
|
else if (GetHasSpell(SPELL_MIND_BLANK,oChampion)&&!GetHasSpellEffect(SPELL_MIND_BLANK,oTarget))
|
|
{ // cast spell
|
|
AssignCommand(oChampion,ActionCastSpellAtObject(SPELL_MIND_BLANK,oTarget,METAMAGIC_ANY,FALSE,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE));
|
|
} // cast spell
|
|
else if (GetHasSpell(SPELL_PREMONITION,oChampion)&&!GetHasSpellEffect(SPELL_PREMONITION,oTarget))
|
|
{ // cast spell
|
|
AssignCommand(oChampion,ActionCastSpellAtObject(SPELL_PREMONITION,oTarget,METAMAGIC_ANY,FALSE,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE));
|
|
} // cast spell
|
|
else if (GetHasSpell(SPELL_PRAYER,oChampion)&&!GetHasSpellEffect(SPELL_PRAYER,oTarget))
|
|
{ // cast spell
|
|
AssignCommand(oChampion,ActionCastSpellAtObject(SPELL_PRAYER,oTarget,METAMAGIC_ANY,FALSE,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE));
|
|
} // cast spell
|
|
else if (GetHasSpell(SPELL_SHIELD,oChampion)&&!GetHasSpellEffect(SPELL_SHIELD,oTarget))
|
|
{ // cast spell
|
|
AssignCommand(oChampion,ActionCastSpellAtObject(SPELL_SHIELD,oTarget,METAMAGIC_ANY,FALSE,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE));
|
|
} // cast spell
|
|
else if (GetHasSpell(SPELL_SPELL_MANTLE,oChampion)&&!GetHasSpellEffect(SPELL_SPELL_MANTLE,oTarget))
|
|
{ // cast spell
|
|
AssignCommand(oChampion,ActionCastSpellAtObject(SPELL_SPELL_MANTLE,oTarget,METAMAGIC_ANY,FALSE,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE));
|
|
} // cast spell
|
|
else if (GetHasSpell(SPELL_MINOR_GLOBE_OF_INVULNERABILITY,oChampion)&&!GetHasSpellEffect(SPELL_MINOR_GLOBE_OF_INVULNERABILITY,oTarget))
|
|
{ // cast spell
|
|
AssignCommand(oChampion,ActionCastSpellAtObject(SPELL_MINOR_GLOBE_OF_INVULNERABILITY,oTarget,METAMAGIC_ANY,FALSE,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE));
|
|
} // cast spell
|
|
else if (GetHasSpell(SPELL_GLOBE_OF_INVULNERABILITY,oChampion)&&!GetHasSpellEffect(SPELL_GLOBE_OF_INVULNERABILITY,oTarget))
|
|
{ // cast spell
|
|
AssignCommand(oChampion,ActionCastSpellAtObject(SPELL_GLOBE_OF_INVULNERABILITY,oTarget,METAMAGIC_ANY,FALSE,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE));
|
|
} // cast spell
|
|
else if (GetHasSpell(SPELL_SPELL_RESISTANCE,oChampion)&&!GetHasSpellEffect(SPELL_SPELL_RESISTANCE,oTarget))
|
|
{ // cast spell
|
|
AssignCommand(oChampion,ActionCastSpellAtObject(SPELL_SPELL_RESISTANCE,oTarget,METAMAGIC_ANY,FALSE,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE));
|
|
} // cast spell
|
|
else
|
|
{ // done buffing
|
|
SetLocalInt(oTarget,"bDoneBuffing",TRUE);
|
|
DelayCommand(180.3,DeleteLocalInt(oTarget,"bDoneBuffing"));
|
|
} // done buffing
|
|
} // spells
|
|
} // self
|
|
else if (nRT==RACIAL_TYPE_UNDEAD)
|
|
{ // undead
|
|
if (GetHasSpell(SPELL_STONE_BONES,oChampion)&&!GetHasSpellEffect(SPELL_STONE_BONES,oTarget))
|
|
{ // cast spell
|
|
AssignCommand(oChampion,ActionCastSpellAtObject(SPELL_STONE_BONES,oTarget,METAMAGIC_ANY,FALSE,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE));
|
|
} // cast spell
|
|
else if (GetHasSpell(SPELL_BARKSKIN,oChampion)&&!GetHasSpellEffect(SPELL_BARKSKIN,oTarget))
|
|
{ // cast spell
|
|
AssignCommand(oChampion,ActionCastSpellAtObject(SPELL_BARKSKIN,oTarget,METAMAGIC_ANY,FALSE,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE));
|
|
} // cast spell
|
|
else if (GetHasSpell(SPELL_STONESKIN,oChampion)&&!GetHasSpellEffect(SPELL_STONESKIN,oTarget))
|
|
{ // cast spell
|
|
AssignCommand(oChampion,ActionCastSpellAtObject(SPELL_STONESKIN,oTarget,METAMAGIC_ANY,FALSE,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE));
|
|
} // cast spell
|
|
else if (GetHasSpell(SPELL_BULLS_STRENGTH,oChampion)&&!GetHasSpellEffect(SPELL_BULLS_STRENGTH,oTarget))
|
|
{ // cast spell
|
|
AssignCommand(oChampion,ActionCastSpellAtObject(SPELL_BULLS_STRENGTH,oTarget,METAMAGIC_ANY,FALSE,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE));
|
|
} // cast spell
|
|
else if (GetHasSpell(SPELL_DEATH_ARMOR,oChampion)&&!GetHasSpellEffect(SPELL_DEATH_ARMOR,oTarget))
|
|
{ // cast spell
|
|
AssignCommand(oChampion,ActionCastSpellAtObject(SPELL_DEATH_ARMOR,oTarget,METAMAGIC_ANY,FALSE,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE));
|
|
} // cast spell
|
|
else if (GetHasSpell(SPELL_HASTE,oChampion)&&!GetHasSpellEffect(SPELL_HASTE,oTarget))
|
|
{ // cast spell
|
|
AssignCommand(oChampion,ActionCastSpellAtObject(SPELL_HASTE,oTarget,METAMAGIC_ANY,FALSE,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE));
|
|
} // cast spell
|
|
else if (GetHasSpell(SPELL_INVISIBILITY,oChampion)&&!GetHasSpellEffect(SPELL_INVISIBILITY,oTarget))
|
|
{ // cast spell
|
|
AssignCommand(oChampion,ActionCastSpellAtObject(SPELL_INVISIBILITY,oTarget,METAMAGIC_ANY,FALSE,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE));
|
|
} // cast spell
|
|
else if (GetHasSpell(SPELL_MAGIC_VESTMENT,oChampion)&&!GetHasSpellEffect(SPELL_MAGIC_VESTMENT,oTarget))
|
|
{ // cast spell
|
|
AssignCommand(oChampion,ActionCastSpellAtObject(SPELL_MAGIC_VESTMENT,oTarget,METAMAGIC_ANY,FALSE,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE));
|
|
} // cast spell
|
|
else if (GetHasSpell(SPELL_SEE_INVISIBILITY,oChampion)&&!GetHasSpellEffect(SPELL_SEE_INVISIBILITY,oTarget))
|
|
{ // cast spell
|
|
AssignCommand(oChampion,ActionCastSpellAtObject(SPELL_SEE_INVISIBILITY,oTarget,METAMAGIC_ANY,FALSE,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE));
|
|
} // cast spell
|
|
else
|
|
{ // done buffing
|
|
SetLocalInt(oTarget,"bDoneBuffing",TRUE);
|
|
DelayCommand(180.6,DeleteLocalInt(oTarget,"bDoneBuffing"));
|
|
} // done buffing
|
|
} // undead
|
|
else
|
|
{ // other
|
|
if (GetHasSpell(SPELL_BARKSKIN,oChampion)&&!GetHasSpellEffect(SPELL_BARKSKIN,oTarget))
|
|
{ // cast spell
|
|
AssignCommand(oChampion,ActionCastSpellAtObject(SPELL_BARKSKIN,oTarget,METAMAGIC_ANY,FALSE,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE));
|
|
} // cast spell
|
|
else if (GetHasSpell(SPELL_STONESKIN,oChampion)&&!GetHasSpellEffect(SPELL_STONESKIN,oTarget))
|
|
{ // cast spell
|
|
AssignCommand(oChampion,ActionCastSpellAtObject(SPELL_STONESKIN,oTarget,METAMAGIC_ANY,FALSE,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE));
|
|
} // cast spell
|
|
else if (GetHasSpell(SPELL_BULLS_STRENGTH,oChampion)&&!GetHasSpellEffect(SPELL_BULLS_STRENGTH,oTarget))
|
|
{ // cast spell
|
|
AssignCommand(oChampion,ActionCastSpellAtObject(SPELL_BULLS_STRENGTH,oTarget,METAMAGIC_ANY,FALSE,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE));
|
|
} // cast spell
|
|
else if (GetHasSpell(SPELL_DEATH_ARMOR,oChampion)&&!GetHasSpellEffect(SPELL_DEATH_ARMOR,oTarget))
|
|
{ // cast spell
|
|
AssignCommand(oChampion,ActionCastSpellAtObject(SPELL_DEATH_ARMOR,oTarget,METAMAGIC_ANY,FALSE,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE));
|
|
} // cast spell
|
|
else if (GetHasSpell(SPELL_HASTE,oChampion)&&!GetHasSpellEffect(SPELL_HASTE,oTarget))
|
|
{ // cast spell
|
|
AssignCommand(oChampion,ActionCastSpellAtObject(SPELL_HASTE,oTarget,METAMAGIC_ANY,FALSE,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE));
|
|
} // cast spell
|
|
else if (GetHasSpell(SPELL_INVISIBILITY,oChampion)&&!GetHasSpellEffect(SPELL_INVISIBILITY,oTarget))
|
|
{ // cast spell
|
|
AssignCommand(oChampion,ActionCastSpellAtObject(SPELL_INVISIBILITY,oTarget,METAMAGIC_ANY,FALSE,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE));
|
|
} // cast spell
|
|
else if (GetHasSpell(SPELL_MAGIC_VESTMENT,oChampion)&&!GetHasSpellEffect(SPELL_MAGIC_VESTMENT,oTarget))
|
|
{ // cast spell
|
|
AssignCommand(oChampion,ActionCastSpellAtObject(SPELL_MAGIC_VESTMENT,oTarget,METAMAGIC_ANY,FALSE,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE));
|
|
} // cast spell
|
|
else if (GetHasSpell(SPELL_SEE_INVISIBILITY,oChampion)&&!GetHasSpellEffect(SPELL_SEE_INVISIBILITY,oTarget))
|
|
{ // cast spell
|
|
AssignCommand(oChampion,ActionCastSpellAtObject(SPELL_SEE_INVISIBILITY,oTarget,METAMAGIC_ANY,FALSE,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE));
|
|
} // cast spell
|
|
else if (GetHasSpell(SPELL_IRONGUTS,oChampion)&&!GetHasSpellEffect(SPELL_IRONGUTS,oTarget))
|
|
{ // cast spell
|
|
AssignCommand(oChampion,ActionCastSpellAtObject(SPELL_IRONGUTS,oTarget,METAMAGIC_ANY,FALSE,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE));
|
|
} // cast spell
|
|
else if (GetHasSpell(SPELL_MAGIC_WEAPON,oChampion)&&!GetHasSpellEffect(SPELL_MAGIC_WEAPON,oTarget))
|
|
{ // cast spell
|
|
AssignCommand(oChampion,ActionCastSpellAtObject(SPELL_MAGIC_WEAPON,oTarget,METAMAGIC_ANY,FALSE,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE));
|
|
} // cast spell
|
|
else
|
|
{ // done buffing
|
|
SetLocalInt(oTarget,"bDoneBuffing",TRUE);
|
|
DelayCommand(180.9,DeleteLocalInt(oTarget,"bDoneBuffing"));
|
|
} // done buffing
|
|
} // other
|
|
} // privateHandle_Buffing()
|
|
|
|
|
|
object Champion_Buff(object oChampion)
|
|
{ // PURPOSE: To buff up yourself and then to buff up nearby friends if possible
|
|
// Version History
|
|
// mm/dd/yyyy | Modified By | Description
|
|
// 09/17/2006 | Deva B. Winblood | Initial version of this function
|
|
int nBuffCount=GetLocalInt(oChampion,"nProcessBuffCount");
|
|
object oOb=OBJECT_INVALID;
|
|
Champion_Debug(oChampion,"Champion_Buff()");
|
|
fnDMSpeak(oChampion,"I may want to buff something.",TRUE);
|
|
if (nBuffCount==0) oOb=oChampion;
|
|
else
|
|
{ // not champion
|
|
oOb=Champion_GetFollower(oChampion,nBuffCount);
|
|
} // not champion
|
|
if (GetIsObjectValid(oOb))
|
|
{ // champion
|
|
privateHandle_Buffing(oChampion,oOb);
|
|
if (GetLocalInt(oOb,"bDoneBuffing"))
|
|
{ // done buffing
|
|
nBuffCount++;
|
|
SetLocalInt(oChampion,"nProcessBuffCount",nBuffCount);
|
|
} // done buffing
|
|
} // champion
|
|
else { DeleteLocalInt(oChampion,"nProcessBuffCount"); }
|
|
return oOb;
|
|
} // Champion_Buff()
|
|
|
|
|
|
void privateHandle_Healing(object oChampion,object oTarget)
|
|
{ // PURPOSE: Heal oTarget
|
|
// Version History
|
|
// mm/dd/yyyy | Modified By | Description
|
|
// 09/17/2006 | Deva B. Winblood | Initial version of this function
|
|
int nMax=GetMaxHitPoints(oTarget);
|
|
int nCur=GetCurrentHitPoints(oTarget);
|
|
object oItem;
|
|
int nN;
|
|
if (oChampion==oTarget)
|
|
{ // self
|
|
if (nCur<nMax)
|
|
{ // wounded
|
|
if (GetIsObjectValid(GetItemPossessedBy(oChampion,"NW_IT_MPOTION001")))
|
|
{ // use
|
|
oItem=GetItemPossessedBy(oChampion,"NW_IT_MPOTION001");
|
|
nN=GetItemStackSize(oItem);
|
|
if (nN>1) SetItemStackSize(oItem,nN-1);
|
|
else { DestroyObject(oItem); }
|
|
AssignCommand(oChampion,ActionPlayAnimation(ANIMATION_FIREFORGET_DRINK,1.0,2.0));
|
|
AssignCommand(oChampion,ActionCastSpellAtObject(SPELL_CURE_LIGHT_WOUNDS,oTarget,METAMAGIC_ANY,TRUE,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE));
|
|
} // use
|
|
else if (GetIsObjectValid(GetItemPossessedBy(oChampion,"NW_IT_MPOTION020")))
|
|
{ // use
|
|
oItem=GetItemPossessedBy(oChampion,"NW_IT_MPOTION020");
|
|
nN=GetItemStackSize(oItem);
|
|
if (nN>1) SetItemStackSize(oItem,nN-1);
|
|
else { DestroyObject(oItem); }
|
|
AssignCommand(oChampion,ActionPlayAnimation(ANIMATION_FIREFORGET_DRINK,1.0,2.0));
|
|
AssignCommand(oChampion,ActionCastSpellAtObject(SPELL_CURE_MODERATE_WOUNDS,oTarget,METAMAGIC_ANY,TRUE,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE));
|
|
} // use
|
|
else if (GetIsObjectValid(GetItemPossessedBy(oChampion,"NW_IT_MPOTION002")))
|
|
{ // use
|
|
oItem=GetItemPossessedBy(oChampion,"NW_IT_MPOTION002");
|
|
nN=GetItemStackSize(oItem);
|
|
if (nN>1) SetItemStackSize(oItem,nN-1);
|
|
else { DestroyObject(oItem); }
|
|
AssignCommand(oChampion,ActionPlayAnimation(ANIMATION_FIREFORGET_DRINK,1.0,2.0));
|
|
AssignCommand(oChampion,ActionCastSpellAtObject(SPELL_CURE_SERIOUS_WOUNDS,oTarget,METAMAGIC_ANY,TRUE,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE));
|
|
} // use
|
|
else if (GetIsObjectValid(GetItemPossessedBy(oChampion,"NW_IT_MPOTION003")))
|
|
{ // use
|
|
oItem=GetItemPossessedBy(oChampion,"NW_IT_MPOTION003");
|
|
nN=GetItemStackSize(oItem);
|
|
if (nN>1) SetItemStackSize(oItem,nN-1);
|
|
else { DestroyObject(oItem); }
|
|
AssignCommand(oChampion,ActionPlayAnimation(ANIMATION_FIREFORGET_DRINK,1.0,2.0));
|
|
AssignCommand(oChampion,ActionCastSpellAtObject(SPELL_CURE_CRITICAL_WOUNDS,oTarget,METAMAGIC_ANY,TRUE,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE));
|
|
} // use
|
|
else if (GetIsObjectValid(GetItemPossessedBy(oChampion,"NW_IT_MPOTION012")))
|
|
{ // use
|
|
oItem=GetItemPossessedBy(oChampion,"NW_IT_MPOTION012");
|
|
nN=GetItemStackSize(oItem);
|
|
if (nN>1) SetItemStackSize(oItem,nN-1);
|
|
else { DestroyObject(oItem); }
|
|
AssignCommand(oChampion,ActionPlayAnimation(ANIMATION_FIREFORGET_DRINK,1.0,2.0));
|
|
AssignCommand(oChampion,ActionCastSpellAtObject(SPELL_HEAL,oTarget,METAMAGIC_ANY,TRUE,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE));
|
|
} // use
|
|
else if (GetIsObjectValid(GetItemPossessedBy(oChampion,"NW_IT_MEDKIT001")))
|
|
{ // use
|
|
oItem=GetItemPossessedBy(oChampion,"NW_IT_MEDKIT001");
|
|
nN=GetItemStackSize(oItem);
|
|
if (nN>1) SetItemStackSize(oItem,nN-1);
|
|
else { DestroyObject(oItem); }
|
|
AssignCommand(oChampion,ActionPlayAnimation(ANIMATION_FIREFORGET_DRINK,1.0,2.0));
|
|
AssignCommand(oChampion,ActionCastSpellAtObject(SPELL_CURE_LIGHT_WOUNDS,oTarget,METAMAGIC_ANY,TRUE,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE));
|
|
} // use
|
|
else if (GetIsObjectValid(GetItemPossessedBy(oChampion,"NW_IT_MEDKIT002")))
|
|
{ // use
|
|
oItem=GetItemPossessedBy(oChampion,"NW_IT_MEDKIT002");
|
|
nN=GetItemStackSize(oItem);
|
|
if (nN>1) SetItemStackSize(oItem,nN-1);
|
|
else { DestroyObject(oItem); }
|
|
AssignCommand(oChampion,ActionPlayAnimation(ANIMATION_FIREFORGET_DRINK,1.0,2.0));
|
|
AssignCommand(oChampion,ActionCastSpellAtObject(SPELL_CURE_MODERATE_WOUNDS,oTarget,METAMAGIC_ANY,TRUE,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE));
|
|
} // use
|
|
else if (GetIsObjectValid(GetItemPossessedBy(oChampion,"NW_IT_MEDKIT003")))
|
|
{ // use
|
|
oItem=GetItemPossessedBy(oChampion,"NW_IT_MEDKIT003");
|
|
nN=GetItemStackSize(oItem);
|
|
if (nN>1) SetItemStackSize(oItem,nN-1);
|
|
else { DestroyObject(oItem); }
|
|
AssignCommand(oChampion,ActionPlayAnimation(ANIMATION_FIREFORGET_DRINK,1.0,2.0));
|
|
AssignCommand(oChampion,ActionCastSpellAtObject(SPELL_CURE_SERIOUS_WOUNDS,oTarget,METAMAGIC_ANY,TRUE,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE));
|
|
} // use
|
|
else if (GetIsObjectValid(GetItemPossessedBy(oChampion,"NW_IT_MEDKIT004")))
|
|
{ // use
|
|
oItem=GetItemPossessedBy(oChampion,"NW_IT_MEDKIT004");
|
|
nN=GetItemStackSize(oItem);
|
|
if (nN>1) SetItemStackSize(oItem,nN-1);
|
|
else { DestroyObject(oItem); }
|
|
AssignCommand(oChampion,ActionPlayAnimation(ANIMATION_FIREFORGET_DRINK,1.0,2.0));
|
|
AssignCommand(oChampion,ActionCastSpellAtObject(SPELL_CURE_CRITICAL_WOUNDS,oTarget,METAMAGIC_ANY,TRUE,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE));
|
|
} // use
|
|
else if (GetHasSpell(SPELL_CURE_MINOR_WOUNDS,oChampion))
|
|
{ // cast
|
|
AssignCommand(oChampion,ActionCastSpellAtObject(SPELL_CURE_MINOR_WOUNDS,oTarget,METAMAGIC_ANY,FALSE,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE));
|
|
} // cast
|
|
else if (GetHasSpell(SPELL_CURE_LIGHT_WOUNDS,oChampion))
|
|
{ // cast
|
|
AssignCommand(oChampion,ActionCastSpellAtObject(SPELL_CURE_LIGHT_WOUNDS,oTarget,METAMAGIC_ANY,FALSE,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE));
|
|
} // cast
|
|
else if (GetHasSpell(SPELL_CURE_MODERATE_WOUNDS,oChampion))
|
|
{ // cast
|
|
AssignCommand(oChampion,ActionCastSpellAtObject(SPELL_CURE_MODERATE_WOUNDS,oTarget,METAMAGIC_ANY,FALSE,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE));
|
|
} // cast
|
|
else if (GetHasSpell(SPELL_CURE_SERIOUS_WOUNDS,oChampion))
|
|
{ // cast
|
|
AssignCommand(oChampion,ActionCastSpellAtObject(SPELL_CURE_SERIOUS_WOUNDS,oTarget,METAMAGIC_ANY,FALSE,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE));
|
|
} // cast
|
|
else if (GetHasSpell(SPELL_CURE_CRITICAL_WOUNDS,oChampion))
|
|
{ // cast
|
|
AssignCommand(oChampion,ActionCastSpellAtObject(SPELL_CURE_CRITICAL_WOUNDS,oTarget,METAMAGIC_ANY,FALSE,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE));
|
|
} // cast
|
|
else if (GetHasSpell(SPELL_HEALING_STING,oChampion))
|
|
{ // cast
|
|
AssignCommand(oChampion,ActionCastSpellAtObject(SPELL_HEALING_STING,oTarget,METAMAGIC_ANY,FALSE,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE));
|
|
} // cast
|
|
else if (GetHasSpell(SPELL_HEALING_CIRCLE,oChampion))
|
|
{ // cast
|
|
AssignCommand(oChampion,ActionCastSpellAtObject(SPELL_HEALING_CIRCLE,oTarget,METAMAGIC_ANY,FALSE,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE));
|
|
} // cast
|
|
else if (GetHasSpell(SPELL_HEAL,oChampion))
|
|
{ // cast
|
|
AssignCommand(oChampion,ActionCastSpellAtObject(SPELL_HEAL,oTarget,METAMAGIC_ANY,FALSE,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE));
|
|
} // cast
|
|
else if (GetHasSpell(SPELL_MONSTROUS_REGENERATION,oChampion))
|
|
{ // cast
|
|
AssignCommand(oChampion,ActionCastSpellAtObject(SPELL_MONSTROUS_REGENERATION,oTarget,METAMAGIC_ANY,FALSE,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE));
|
|
} // cast
|
|
else if (GetHasSpell(SPELL_REGENERATE,oChampion))
|
|
{ // cast
|
|
AssignCommand(oChampion,ActionCastSpellAtObject(SPELL_REGENERATE,oTarget,METAMAGIC_ANY,FALSE,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE));
|
|
} // cast
|
|
else
|
|
{ // no spells left
|
|
SetLocalInt(oTarget,"bDoneHealing",TRUE);
|
|
DelayCommand(180.9,DeleteLocalInt(oTarget,"bDoneHealing"));
|
|
} // no spells left
|
|
} // wounded
|
|
else
|
|
{ // not wounded
|
|
oItem=GetItemPossessedBy(oChampion,"NW_IT_MPOTION011");
|
|
if (GetIsObjectValid(oItem))
|
|
{ // have potion of lesser restoration
|
|
nN=GetItemStackSize(oItem);
|
|
if (nN>1) SetItemStackSize(oItem,nN-1);
|
|
else { DestroyObject(oItem); }
|
|
AssignCommand(oChampion,ActionPlayAnimation(ANIMATION_FIREFORGET_DRINK,1.0,2.0));
|
|
AssignCommand(oChampion,ActionCastSpellAtObject(SPELL_LESSER_RESTORATION,oTarget,METAMAGIC_ANY,TRUE,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE));
|
|
} // have potion of lesser restoration
|
|
else
|
|
{ // check for spell
|
|
if (GetHasSpell(SPELL_GREATER_RESTORATION,oChampion))
|
|
{ // greater restoration
|
|
AssignCommand(oChampion,ActionCastSpellAtObject(SPELL_GREATER_RESTORATION,oTarget,METAMAGIC_ANY,FALSE,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE));
|
|
} // greater restoration
|
|
else if (GetHasSpell(SPELL_RESTORATION,oChampion))
|
|
{ // restoration
|
|
AssignCommand(oChampion,ActionCastSpellAtObject(SPELL_RESTORATION,oTarget,METAMAGIC_ANY,FALSE,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE));
|
|
} // restoration
|
|
else if (GetHasSpell(SPELL_LESSER_RESTORATION,oChampion))
|
|
{ // lesser restoration
|
|
AssignCommand(oChampion,ActionCastSpellAtObject(SPELL_LESSER_RESTORATION,oTarget,METAMAGIC_ANY,FALSE,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE));
|
|
} // lesser restoration
|
|
} // check for spell
|
|
SetLocalInt(oTarget,"bDoneHealing",TRUE);
|
|
DelayCommand(180.9,DeleteLocalInt(oTarget,"bDoneHealing"));
|
|
} // not wounded
|
|
} // self
|
|
else
|
|
{ // other
|
|
if (nCur<nMax)
|
|
{ // wounded
|
|
if (MyPRCGetRacialType(oTarget)==RACIAL_TYPE_UNDEAD)
|
|
{ // undead
|
|
if (GetHasSpell(SPELL_INFLICT_MINOR_WOUNDS,oChampion))
|
|
{ // cast
|
|
AssignCommand(oChampion,ActionCastSpellAtObject(SPELL_INFLICT_MINOR_WOUNDS,oTarget,METAMAGIC_ANY,FALSE,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE));
|
|
} // cast
|
|
else if (GetHasSpell(SPELL_INFLICT_LIGHT_WOUNDS,oChampion))
|
|
{ // cast
|
|
AssignCommand(oChampion,ActionCastSpellAtObject(SPELL_INFLICT_LIGHT_WOUNDS,oTarget,METAMAGIC_ANY,FALSE,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE));
|
|
} // cast
|
|
else if (GetHasSpell(SPELL_INFLICT_MODERATE_WOUNDS,oChampion))
|
|
{ // cast
|
|
AssignCommand(oChampion,ActionCastSpellAtObject(SPELL_INFLICT_MODERATE_WOUNDS,oTarget,METAMAGIC_ANY,FALSE,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE));
|
|
} // cast
|
|
else if (GetHasSpell(SPELL_INFLICT_SERIOUS_WOUNDS,oChampion))
|
|
{ // cast
|
|
AssignCommand(oChampion,ActionCastSpellAtObject(SPELL_INFLICT_SERIOUS_WOUNDS,oTarget,METAMAGIC_ANY,FALSE,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE));
|
|
} // cast
|
|
else
|
|
{ // spend no more power
|
|
SetLocalInt(oTarget,"bDoneHealing",TRUE);
|
|
DelayCommand(180.9,DeleteLocalInt(oTarget,"bDoneHealing"));
|
|
} // spend no more power
|
|
} // undead
|
|
else
|
|
{ // not undead
|
|
if (GetIsObjectValid(GetItemPossessedBy(oChampion,"NW_IT_MEDKIT001")))
|
|
{ // use
|
|
oItem=GetItemPossessedBy(oChampion,"NW_IT_MEDKIT001");
|
|
nN=GetItemStackSize(oItem);
|
|
if (nN>1) SetItemStackSize(oItem,nN-1);
|
|
else { DestroyObject(oItem); }
|
|
AssignCommand(oChampion,ActionPlayAnimation(ANIMATION_FIREFORGET_DRINK,1.0,2.0));
|
|
AssignCommand(oChampion,ActionCastSpellAtObject(SPELL_CURE_LIGHT_WOUNDS,oTarget,METAMAGIC_ANY,TRUE,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE));
|
|
} // use
|
|
else if (GetIsObjectValid(GetItemPossessedBy(oChampion,"NW_IT_MEDKIT002")))
|
|
{ // use
|
|
oItem=GetItemPossessedBy(oChampion,"NW_IT_MEDKIT002");
|
|
nN=GetItemStackSize(oItem);
|
|
if (nN>1) SetItemStackSize(oItem,nN-1);
|
|
else { DestroyObject(oItem); }
|
|
AssignCommand(oChampion,ActionPlayAnimation(ANIMATION_FIREFORGET_DRINK,1.0,2.0));
|
|
AssignCommand(oChampion,ActionCastSpellAtObject(SPELL_CURE_MODERATE_WOUNDS,oTarget,METAMAGIC_ANY,TRUE,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE));
|
|
} // use
|
|
else if (GetIsObjectValid(GetItemPossessedBy(oChampion,"NW_IT_MEDKIT003")))
|
|
{ // use
|
|
oItem=GetItemPossessedBy(oChampion,"NW_IT_MEDKIT003");
|
|
nN=GetItemStackSize(oItem);
|
|
if (nN>1) SetItemStackSize(oItem,nN-1);
|
|
else { DestroyObject(oItem); }
|
|
AssignCommand(oChampion,ActionPlayAnimation(ANIMATION_FIREFORGET_DRINK,1.0,2.0));
|
|
AssignCommand(oChampion,ActionCastSpellAtObject(SPELL_CURE_SERIOUS_WOUNDS,oTarget,METAMAGIC_ANY,TRUE,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE));
|
|
} // use
|
|
else if (GetIsObjectValid(GetItemPossessedBy(oChampion,"NW_IT_MEDKIT004")))
|
|
{ // use
|
|
oItem=GetItemPossessedBy(oChampion,"NW_IT_MEDKIT004");
|
|
nN=GetItemStackSize(oItem);
|
|
if (nN>1) SetItemStackSize(oItem,nN-1);
|
|
else { DestroyObject(oItem); }
|
|
AssignCommand(oChampion,ActionPlayAnimation(ANIMATION_FIREFORGET_DRINK,1.0,2.0));
|
|
AssignCommand(oChampion,ActionCastSpellAtObject(SPELL_CURE_CRITICAL_WOUNDS,oTarget,METAMAGIC_ANY,TRUE,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE));
|
|
} // use
|
|
else if (GetHasSpell(SPELL_CURE_MINOR_WOUNDS,oChampion))
|
|
{ // cast
|
|
AssignCommand(oChampion,ActionCastSpellAtObject(SPELL_CURE_MINOR_WOUNDS,oTarget,METAMAGIC_ANY,FALSE,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE));
|
|
} // cast
|
|
else if (GetHasSpell(SPELL_CURE_LIGHT_WOUNDS,oChampion))
|
|
{ // cast
|
|
AssignCommand(oChampion,ActionCastSpellAtObject(SPELL_CURE_LIGHT_WOUNDS,oTarget,METAMAGIC_ANY,FALSE,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE));
|
|
} // cast
|
|
else if (GetHasSpell(SPELL_CURE_MODERATE_WOUNDS,oChampion))
|
|
{ // cast
|
|
AssignCommand(oChampion,ActionCastSpellAtObject(SPELL_CURE_MODERATE_WOUNDS,oTarget,METAMAGIC_ANY,FALSE,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE));
|
|
} // cast
|
|
else if (GetHasSpell(SPELL_CURE_SERIOUS_WOUNDS,oChampion))
|
|
{ // cast
|
|
AssignCommand(oChampion,ActionCastSpellAtObject(SPELL_CURE_SERIOUS_WOUNDS,oTarget,METAMAGIC_ANY,FALSE,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE));
|
|
} // cast
|
|
else
|
|
{ // expend no power
|
|
SetLocalInt(oTarget,"bDoneHealing",TRUE);
|
|
DelayCommand(180.9,DeleteLocalInt(oTarget,"bDoneHealing"));
|
|
} // expend no power
|
|
} // not undead
|
|
} // wounded
|
|
else
|
|
{ // not wounded
|
|
SetLocalInt(oTarget,"bDoneHealing",TRUE);
|
|
DelayCommand(180.9,DeleteLocalInt(oTarget,"bDoneHealing"));
|
|
} // not wounded
|
|
} // other
|
|
} // privateHandle_Healing()
|
|
|
|
|
|
object Champion_Heal(object oChampion)
|
|
{ // PURPOSE: To heal the champion and if possible heal companions as well
|
|
// Version History
|
|
// mm/dd/yyyy | Modified By | Description
|
|
// 09/17/2006 | Deva B. Winblood | Initial version of this function
|
|
int nHealCount=GetLocalInt(oChampion,"nHealCount");
|
|
object oOb=OBJECT_INVALID;
|
|
Champion_Debug(oChampion,"Champion_Heal()");
|
|
fnDMSpeak(oChampion,"I may want to heal something.",TRUE);
|
|
if (nHealCount==0) oOb=oChampion;
|
|
else
|
|
{ // not champion
|
|
oOb=Champion_GetFollower(oChampion,nHealCount);
|
|
} // not champion
|
|
if (GetIsObjectValid(oOb))
|
|
{ // handle healing
|
|
privateHandle_Healing(oChampion,oOb);
|
|
if (GetLocalInt(oOb,"bDoneHealing"))
|
|
{ // done healing
|
|
nHealCount++;
|
|
SetLocalInt(oChampion,"nHealCount",nHealCount);
|
|
} // done healing
|
|
} // handle healing
|
|
else { DeleteLocalInt(oChampion,"nHealCount"); }
|
|
return oOb;
|
|
} // Champion_Heal()
|
|
|
|
|
|
object Champion_GetFollower(object oChampion,int nN=1)
|
|
{ // PURPOSE: To return friendly units set to follow mode for this champion
|
|
// Version History
|
|
// mm/dd/yyyy | Modified By | Description
|
|
// 09/17/2006 | Deva B. Winblood | Initial version of this function
|
|
object oRet=OBJECT_INVALID;
|
|
object oCur;
|
|
int nN=1;
|
|
int nCount=0;
|
|
Champion_Debug(oChampion," Champion_GetFollower()");
|
|
fnDMSpeak(oChampion,"Let us continue...",TRUE);
|
|
oCur=GetNearestCreature(CREATURE_TYPE_IS_ALIVE,TRUE,oChampion,nN,CREATURE_TYPE_REPUTATION,REPUTATION_TYPE_FRIEND);
|
|
while(GetIsObjectValid(oCur)&&!GetIsObjectValid(oRet)&&GetDistanceBetween(oCur,oChampion)<20.0)
|
|
{ // check nearby allies
|
|
if (GetLocalString(oCur,"sTeamID")==GetLocalString(oChampion,"sTeamID"))
|
|
{ // same team
|
|
if (GetLocalInt(oCur,"nMState")==2&&GetLocalObject(oCur,"oDest")==oChampion)
|
|
{ // this is a follower
|
|
nCount++;
|
|
if (nCount==nN) oRet=oCur;
|
|
nN++;
|
|
oCur=GetNearestCreature(CREATURE_TYPE_IS_ALIVE,TRUE,oChampion,nN,CREATURE_TYPE_REPUTATION,REPUTATION_TYPE_FRIEND);
|
|
} // this is a follower
|
|
else
|
|
{ // not a follower
|
|
nN++;
|
|
oCur=GetNearestCreature(CREATURE_TYPE_IS_ALIVE,TRUE,oChampion,nN,CREATURE_TYPE_REPUTATION,REPUTATION_TYPE_FRIEND);
|
|
} // not a follower
|
|
} // same team
|
|
else
|
|
{ // not same
|
|
nN++;
|
|
oCur=GetNearestCreature(CREATURE_TYPE_IS_ALIVE,TRUE,oChampion,nN,CREATURE_TYPE_REPUTATION,REPUTATION_TYPE_FRIEND);
|
|
} // not same
|
|
} // check nearby allies
|
|
return oRet;
|
|
} // Champion_GetFollower()
|
|
|
|
|
|
int Champion_ProcessAction(object oChampion,int nAction)
|
|
{ // PURPOSE: To handle the actions and make sure they are processed
|
|
// it will return TRUE... if the action was completed
|
|
// Version History
|
|
// mm/dd/yyyy | Modified By | Description
|
|
// 09/17/2006 | Deva B. Winblood | Initial version of this function
|
|
int bRet=TRUE;
|
|
string sID=GetStringUpperCase(GetLocalString(oChampion,"sTeamID"));
|
|
object oOb;
|
|
string sS;
|
|
int nN;
|
|
Champion_Debug(oChampion,"Champion_ProcessAction("+privateGetActionName(nAction)+")");
|
|
fnDMSpeak(oChampion,"I am thinking...["+privateGetActionName(nAction)+"]");
|
|
switch(nAction)
|
|
{ // switch for action processing
|
|
case CHAMPION_ACTION_BUFF: { // Buff action
|
|
oOb=Champion_Buff(oChampion);
|
|
if (GetIsObjectValid(oOb)) bRet=FALSE;
|
|
break;
|
|
} // Buff Action
|
|
case CHAMPION_ACTION_CONDITIONAL_REST: { // Conditional Rest Action
|
|
if (GetLocalInt(oChampion,"bRestAction"))
|
|
{ // resting
|
|
bRet=FALSE;
|
|
} // resting
|
|
else if (!GetLocalInt(oChampion,"bRested"))
|
|
{ // action
|
|
Champion_CondRest(oChampion);
|
|
if (GetLocalInt(oChampion,"bRestAction")) bRet=FALSE;
|
|
} // action
|
|
break;
|
|
} // Conditional Rest Action
|
|
case CHAMPION_ACTION_CONTROL: { // release control action
|
|
DelayCommand(0.3,Champion_Control(oChampion));
|
|
break;
|
|
} // release control action
|
|
case CHAMPION_ACTION_DEPOSIT: { // deposit action
|
|
DelayCommand(0.3,Champion_Deposit(oChampion));
|
|
break;
|
|
} // deposit action
|
|
case CHAMPION_ACTION_EQUIP: { // equip action
|
|
DelayCommand(0.1,Champion_Equip(oChampion));
|
|
break;
|
|
} // equip action
|
|
case CHAMPION_ACTION_ESCAPE1: { // escape1 action - look for portal
|
|
if (GetArea(oChampion)!=GetArea(GetWaypointByTag("SHADOW_DOWN_THE_WELL")))
|
|
{ // jump
|
|
AssignCommand(oChampion,ClearAllActions(TRUE));
|
|
AssignCommand(oChampion,JumpToObject(GetWaypointByTag("SHADOW_DOWN_THE_WELL")));
|
|
AssignCommand(oChampion,ActionMoveToObject(GetObjectByTag("SHADOW_PORTAL"),TRUE,3.0));
|
|
bRet=FALSE;
|
|
} // jump
|
|
else if (GetDistanceBetween(oChampion,GetObjectByTag("SHADOW_PORTAL"))>3.0)
|
|
{ // keep moving
|
|
AssignCommand(oChampion,ClearAllActions());
|
|
AssignCommand(oChampion,ActionMoveToObject(GetObjectByTag("SHADOW_PORTAL"),TRUE,3.0));
|
|
bRet=FALSE;
|
|
} // keep moving
|
|
else
|
|
{ // arrived
|
|
AssignCommand(oChampion,ClearAllActions(TRUE));
|
|
AssignCommand(oChampion,JumpToObject(GetWaypointByTag("SHADOW_ROUTE_2")));
|
|
} // arrived
|
|
break;
|
|
} // escape1 action - look for portal
|
|
case CHAMPION_ACTION_ESCAPE2: { // escape2 - return to lair
|
|
sS=GetLocalString(oChampion,"sTeamID");
|
|
sS=GetStringUpperCase(sS);
|
|
AssignCommand(oChampion,ClearAllActions(TRUE));
|
|
AssignCommand(oChampion,JumpToObject(GetWaypointByTag(sS+"_START")));
|
|
AssignCommand(oChampion,ActionDoCommand(Champion_ResetPathing(oChampion)));
|
|
break;
|
|
} // escape2 - return to lair
|
|
case CHAMPION_ACTION_GATHER: { // gather troops action
|
|
DelayCommand(0.3,Champion_Gather(oChampion));
|
|
break;
|
|
} // gather troops action
|
|
case CHAMPION_ACTION_HEAL: { // heal action
|
|
oOb=Champion_Heal(oChampion);
|
|
if (GetIsObjectValid(oOb)) bRet=FALSE;
|
|
break;
|
|
} // heal action
|
|
case CHAMPION_ACTION_REST: { // rest action
|
|
if (GetLocalInt(oChampion,"bRestAction"))
|
|
{ // resting
|
|
bRet=FALSE;
|
|
} // resting
|
|
else if (!GetLocalInt(oChampion,"bRested"))
|
|
{ // action
|
|
DelayCommand(0.3,Champion_Rest(oChampion));
|
|
if (GetLocalInt(oChampion,"bRestAction")) bRet=FALSE;
|
|
} // action
|
|
break;
|
|
} // rest action
|
|
case CHAMPION_ACTION_RETURN: { // return action
|
|
DelayCommand(0.3,Champion_LevelUp(oChampion));
|
|
DelayCommand(0.6,Champion_Rest(oChampion));
|
|
DelayCommand(0.9,Champion_ResetPathing(oChampion));
|
|
break;
|
|
} // return action
|
|
case CHAMPION_ACTION_RUN: { // run action
|
|
SetLocalInt(oChampion,"nRun",TRUE);
|
|
SetLocalInt(oChampion,"nGNBRun",TRUE);
|
|
SetLocalInt(oChampion,"bPassive",TRUE);
|
|
break;
|
|
} // run action
|
|
case CHAMPION_ACTION_SEARCH: { // search action
|
|
if (GetLocalInt(oChampion,"nSearchMode")!=3)
|
|
{ // search
|
|
DelayCommand(0.3,Champion_Search(oChampion));
|
|
bRet=FALSE;
|
|
} // search
|
|
else
|
|
{ // end
|
|
DeleteLocalInt(oChampion,"nSearchMode");
|
|
DeleteLocalInt(oChampion,"nSearchParm");
|
|
} // end
|
|
break;
|
|
} // search action
|
|
case CHAMPION_ACTION_STEAL: { // steal action
|
|
DelayCommand(0.3,Champion_Steal(oChampion));
|
|
break;
|
|
} // steal action
|
|
case CHAMPION_ACTION_USE: { // use action
|
|
DelayCommand(0.3,Champion_Use(oChampion));
|
|
break;
|
|
} // use action
|
|
default: break;
|
|
} // switch for action processing
|
|
return bRet;
|
|
} // Champion_ProcessAction()
|
|
|
|
|
|
|
|
object Champion_GetNextPath(object oChampion,int nType)
|
|
{ // PURPOSE: To return the next waypoint for oChampion of the specified type
|
|
// Version History
|
|
// mm/dd/yyyy | Modified By | Description
|
|
// 09/16/2006 | Deva B. Winblood | Initial version of this function
|
|
string sPathType="SPAWN";
|
|
string sTeamID=GetLocalString(oChampion,"sTeamID");
|
|
string sPath;
|
|
object oWP;
|
|
int nInc;
|
|
int nCount;
|
|
Champion_Debug(oChampion,"Champion_GetNextPath("+IntToString(nType)+")");
|
|
sTeamID=GetStringUpperCase(sTeamID);
|
|
if (nType==CHAMPION_PATH_EXPLORE) sPathType="EXP";
|
|
else if (nType==CHAMPION_PATH_ASSAULT) sPathType="ASS";
|
|
else if (nType==CHAMPION_PATH_CONTROL) sPathType="CON";
|
|
else if (nType==CHAMPION_PATH_ESCAPE) sPathType="ESC";
|
|
else
|
|
{ // spawn point
|
|
sPath=sTeamID+"_CHAMP_SPAWN";
|
|
oWP=GetWaypointByTag(sPath);
|
|
Champion_Debug(oChampion," ["+GetTag(oWP)+"]");
|
|
return oWP;
|
|
} // spawn point
|
|
nInc=GetLocalInt(oChampion,"nPathPosition_"+sPathType);
|
|
nInc++;
|
|
SetLocalInt(oChampion,"nPathPosition_"+sPathType,nInc);
|
|
nCount=0;
|
|
sPath=sTeamID+"_CHAMP_"+sPathType+"_"+IntToString(nInc);
|
|
Champion_Debug(oChampion," "+IntToString(nCount)+": "+sPath);
|
|
if (sPathType=="ESC") sPath="CHAMPION_ESCAPE_"+IntToString(nInc);
|
|
oWP=GetWaypointByTag(sPath);
|
|
while(!GetIsObjectValid(oWP)&&nCount<6)
|
|
{ // find a waypoint
|
|
nInc++;
|
|
nCount++;
|
|
SetLocalInt(oChampion,"nPathPosition_"+sPathType,nInc);
|
|
sPath=sTeamID+"_CHAMP_"+sPathType+"_"+IntToString(nInc);
|
|
Champion_Debug(oChampion," "+IntToString(nCount)+": "+sPath);
|
|
if (sPathType=="ESC") sPath="CHAMPION_ESCAPE_"+IntToString(nInc);
|
|
oWP=GetWaypointByTag(sPath);
|
|
} // find a waypoint
|
|
if (!GetIsObjectValid(oWP))
|
|
{ // path fail
|
|
fnDMSpeak(oChampion,"Failed to find path "+sPathType+".",TRUE);
|
|
sPath=sTeamID+"_CHAMP_SPAWN";
|
|
oWP=GetWaypointByTag(sPath);
|
|
Champion_Debug(oChampion," ["+GetTag(oWP)+"]");
|
|
} // path fail
|
|
Champion_Debug(oChampion," ["+GetTag(oWP)+"] Area:["+GetName(GetArea(oWP))+"]");
|
|
return oWP;
|
|
} // Champion_GetNextPath()
|
|
|
|
|
|
void Champion_ResetPathing(object oChampion)
|
|
{ // PURPOSE: To reset pathing variables used by the champion
|
|
// Version History
|
|
// mm/dd/yyyy | Modified By | Description
|
|
// 09/16/2006 | Deva B. Winblood | Initial version of this function
|
|
Champion_Debug(oChampion,"Champion_ResetPathing()******");
|
|
fnDMSpeak(oChampion,"I must rethink this path.");
|
|
DeleteLocalInt(oChampion,"nPathPosition_EXP");
|
|
DeleteLocalInt(oChampion,"nPathPosition_CON");
|
|
DeleteLocalInt(oChampion,"nPathPosition_ASS");
|
|
DeleteLocalInt(oChampion,"nPathPosition_ESC");
|
|
DeleteLocalObject(oChampion,"oPathDest");
|
|
DeleteLocalInt(oChampion,"nPathMode");
|
|
} // Champion_ResetPathing()
|
|
|
|
|
|
void Champion_PathHome(object oChampion)
|
|
{ // PURPOSE: Make the champion move home
|
|
// Version History
|
|
// mm/dd/yyyy | Modified By | Description
|
|
// 09/16/2006 | Deva B. Winblood | Initial version of this function
|
|
object oDest=GetLocalObject(oChampion,"oPathDest");
|
|
string sWP;
|
|
string sTeamID=GetLocalString(oChampion,"sTeamID");
|
|
int nN;
|
|
object oEnd;
|
|
Champion_Debug(oChampion,"Champion_PathHome()");
|
|
Champion_SetSentinel(oChampion);
|
|
fnDMSpeak(oChampion,"I am heading home.");
|
|
SetLocalInt(oChampion,"nRun",TRUE);
|
|
if (!GetIsObjectValid(oDest))
|
|
{ // find next destination
|
|
sTeamID=GetStringUpperCase(sTeamID);
|
|
oEnd=GetWaypointByTag(sTeamID+"_CHAMP_SPAWN");
|
|
if (GetStringUpperCase(GetLocalString(GetArea(oChampion),"sTeamID"))==sTeamID)
|
|
{ // in lair
|
|
oDest=oEnd;
|
|
} // in lair
|
|
else
|
|
{ // outside of lair
|
|
oDest=fnReversePath(GetArea(oChampion),oEnd,sTeamID);
|
|
} // outside of lair
|
|
SetLocalObject(oChampion,"oPathDest",oDest);
|
|
DelayCommand(3.0,Champion_PathHome(oChampion));
|
|
} // find next destination
|
|
else
|
|
{ // move
|
|
if (GetArea(oDest)!=GetArea(oChampion))
|
|
{ // still out of area
|
|
nN=fnMoveToDestination(oChampion,oDest,3.9);
|
|
if (nN==-1)
|
|
{ // cannot reach
|
|
DelayCommand(0.3,Champion_ResetPathing(oChampion));
|
|
} // cannot reach
|
|
else
|
|
{ // working
|
|
DelayCommand(3.1,Champion_PathHome(oChampion));
|
|
} // working
|
|
} // still out of area
|
|
else if (oDest==oEnd)
|
|
{ // in area of end point
|
|
if (GetDistanceBetween(oDest,oChampion)<4.0)
|
|
{ // arrived
|
|
DelayCommand(0.3,Champion_PathDoCommand(oChampion));
|
|
} // arrived
|
|
else
|
|
{ // move
|
|
nN=fnMoveToDestination(oChampion,oDest,3.9);
|
|
if (nN==-1)
|
|
{ // cannot reach
|
|
DelayCommand(0.3,Champion_ResetPathing(oChampion));
|
|
} // cannot reach
|
|
else
|
|
{ // working
|
|
DelayCommand(3.0,Champion_PathHome(oChampion));
|
|
} // working
|
|
} // move
|
|
} // in area of end point
|
|
else
|
|
{ // in area of other area
|
|
DeleteLocalObject(oChampion,"oPathDest");
|
|
DelayCommand(3.0,Champion_PathHome(oChampion));
|
|
} // in area of other area
|
|
} // move
|
|
} // Champion_PathHome()
|
|
|
|
|
|
void Champion_PathDoCommand(object oChampion)
|
|
{ // PURPOSE: Process the command at the destination I have arrived at and
|
|
// determine how to handle next destination
|
|
// mm/dd/yyyy | Modified By | Description
|
|
// 09/17/2006 | Deva B. Winblood | Initial version of this function
|
|
object oDest=GetLocalObject(oChampion,"oPathDest");
|
|
string sWP;
|
|
string sTeamID=GetLocalString(oChampion,"sTeamID");
|
|
int nN;
|
|
int nPathMode=GetLocalInt(oChampion,"nPathMode");
|
|
string sAction=GetName(oDest);
|
|
object oEnemy=GetNearestCreature(CREATURE_TYPE_IS_ALIVE,TRUE,oChampion,1,CREATURE_TYPE_PERCEPTION,PERCEPTION_SEEN,CREATURE_TYPE_REPUTATION,REPUTATION_TYPE_ENEMY);
|
|
int nAction=CHAMPION_ACTION_NONE;
|
|
nN=GetLocalInt(oChampion,"nProcessActionDelay");
|
|
if (nN>0)
|
|
{ // delay
|
|
SetLocalInt(oChampion,"nProcessActionDelay",nN-1);
|
|
DelayCommand(5.0,Champion_PathDoCommand(oChampion));
|
|
} // delay
|
|
fnDMSpeak(oChampion,"There is something here I must do.",TRUE);
|
|
Champion_Debug(oChampion,"Champion_PathDoCommand()");
|
|
sTeamID=GetStringUpperCase(sTeamID);
|
|
Champion_SetSentinel(oChampion);
|
|
if (!GetLocalInt(oChampion,"bPassive")&&(GetIsObjectValid(oEnemy)||IsInConversation(oChampion)||GetIsDMPossessed(oChampion)))
|
|
{ // abort
|
|
DelayCommand(4.0,Champion_PathDoCommand(oChampion));
|
|
Champion_Debug(oChampion," Abort due to DM Possessed, Conversation, or enemy and not passive!");
|
|
return;
|
|
} // abort
|
|
if (nPathMode==CHAMPION_PATH_ASSAULT)
|
|
{ // assault
|
|
if (sAction=="REST") nAction=CHAMPION_ACTION_REST;
|
|
else if (sAction=="SEARCH") nAction=CHAMPION_ACTION_SEARCH;
|
|
else if (sAction=="BUFF") nAction=CHAMPION_ACTION_BUFF;
|
|
else if (sAction=="HEAL") nAction=CHAMPION_ACTION_HEAL;
|
|
else if (sAction=="EQUIP") nAction=CHAMPION_ACTION_EQUIP;
|
|
else if (sAction=="CONDREST") nAction=CHAMPION_ACTION_CONDITIONAL_REST;
|
|
else if (sAction=="STEAL"&&GetStringUpperCase(GetLocalString(GetArea(oChampion),"sTeamID"))==sTeamID) nAction=CHAMPION_ACTION_DEPOSIT;
|
|
else if (sAction=="STEAL") nAction=CHAMPION_ACTION_STEAL;
|
|
else if (sAction=="USE") nAction=CHAMPION_ACTION_USE;
|
|
else if (sAction=="RETURN") nAction=CHAMPION_ACTION_RETURN;
|
|
else if (sAction=="RUN") nAction=CHAMPION_ACTION_RUN;
|
|
else if (sAction=="GATHER") nAction=CHAMPION_ACTION_GATHER;
|
|
else if (sAction=="CONTROL") nAction=CHAMPION_ACTION_CONTROL;
|
|
else if (sAction=="ESCAPE1") nAction=CHAMPION_ACTION_ESCAPE1;
|
|
else if (sAction=="ESCAPE2") nAction=CHAMPION_ACTION_ESCAPE2;
|
|
if (nAction!=CHAMPION_ACTION_NONE)
|
|
{ // action exists
|
|
DeleteLocalInt(oChampion,"bGNBRun");
|
|
DeleteLocalInt(oChampion,"bRun");
|
|
DeleteLocalInt(oChampion,"nGNBRun");
|
|
DeleteLocalInt(oChampion,"nRun");
|
|
DeleteLocalInt(oChampion,"bPassive");
|
|
nN=Champion_ProcessAction(oChampion,nAction);
|
|
if (nN)
|
|
{ // action completed
|
|
Champion_Debug(oChampion," Action completed");
|
|
if(nAction!=CHAMPION_ACTION_RETURN) oDest=Champion_GetNextPath(oChampion,nPathMode);
|
|
if (!GetIsObjectValid(oDest))
|
|
{ // destination not found
|
|
DelayCommand(0.3,Champion_ResetPathing(oChampion));
|
|
} // destination not found
|
|
else
|
|
{ // set next destination
|
|
DelayCommand(1.0,Champion_PathNonHome(oChampion));
|
|
} // set next destination
|
|
SetLocalObject(oChampion,"oPathDest",oDest);
|
|
} // action completed
|
|
else
|
|
{ // actions continue
|
|
DelayCommand(4.0,Champion_PathDoCommand(oChampion));
|
|
} // actions continue
|
|
} // action exists
|
|
else
|
|
{ // get next destination
|
|
if(nAction!=CHAMPION_ACTION_RETURN) oDest=Champion_GetNextPath(oChampion,nPathMode);
|
|
if (!GetIsObjectValid(oDest))
|
|
{ // destination not found
|
|
DelayCommand(0.3,Champion_ResetPathing(oChampion));
|
|
} // destination not found
|
|
else
|
|
{ // set next destination
|
|
DelayCommand(1.0,Champion_PathNonHome(oChampion));
|
|
} // set next destination
|
|
SetLocalObject(oChampion,"oPathDest",oDest);
|
|
} // get next destination
|
|
} // assault
|
|
else if (nPathMode==CHAMPION_PATH_CONTROL)
|
|
{ // control
|
|
if (sAction=="REST") nAction=CHAMPION_ACTION_REST;
|
|
else if (sAction=="SEARCH") nAction=CHAMPION_ACTION_SEARCH;
|
|
else if (sAction=="BUFF") nAction=CHAMPION_ACTION_BUFF;
|
|
else if (sAction=="HEAL") nAction=CHAMPION_ACTION_HEAL;
|
|
else if (sAction=="EQUIP") nAction=CHAMPION_ACTION_EQUIP;
|
|
else if (sAction=="CONDREST") nAction=CHAMPION_ACTION_CONDITIONAL_REST;
|
|
else if (sAction=="STEAL"&&GetStringUpperCase(GetLocalString(GetArea(oChampion),"sTeamID"))==sTeamID) nAction=CHAMPION_ACTION_DEPOSIT;
|
|
else if (sAction=="STEAL") nAction=CHAMPION_ACTION_STEAL;
|
|
else if (sAction=="USE") nAction=CHAMPION_ACTION_USE;
|
|
else if (sAction=="RETURN") nAction=CHAMPION_ACTION_RETURN;
|
|
else if (sAction=="RUN") nAction=CHAMPION_ACTION_RUN;
|
|
else if (sAction=="GATHER") nAction=CHAMPION_ACTION_GATHER;
|
|
else if (sAction=="CONTROL") nAction=CHAMPION_ACTION_CONTROL;
|
|
else if (sAction=="ESCAPE1") nAction=CHAMPION_ACTION_ESCAPE1;
|
|
else if (sAction=="ESCAPE2") nAction=CHAMPION_ACTION_ESCAPE2;
|
|
if (nAction!=CHAMPION_ACTION_NONE)
|
|
{ // action exists
|
|
DeleteLocalInt(oChampion,"bGNBRun");
|
|
DeleteLocalInt(oChampion,"bRun");
|
|
DeleteLocalInt(oChampion,"nGNBRun");
|
|
DeleteLocalInt(oChampion,"nRun");
|
|
DeleteLocalInt(oChampion,"bPassive");
|
|
nN=Champion_ProcessAction(oChampion,nAction);
|
|
if (nN)
|
|
{ // action completed
|
|
Champion_Debug(oChampion," Action completed");
|
|
if(nAction!=CHAMPION_ACTION_RETURN) oDest=Champion_GetNextPath(oChampion,nPathMode);
|
|
if (!GetIsObjectValid(oDest))
|
|
{ // destination not found
|
|
DelayCommand(0.3,Champion_ResetPathing(oChampion));
|
|
} // destination not found
|
|
else
|
|
{ // set next destination
|
|
DelayCommand(1.0,Champion_PathNonHome(oChampion));
|
|
} // set next destination
|
|
SetLocalObject(oChampion,"oPathDest",oDest);
|
|
} // action completed
|
|
else
|
|
{ // actions continue
|
|
DelayCommand(2.0,Champion_PathDoCommand(oChampion));
|
|
} // actions continue
|
|
} // action exists
|
|
else
|
|
{ // get next destination
|
|
if(nAction!=CHAMPION_ACTION_RETURN) oDest=Champion_GetNextPath(oChampion,nPathMode);
|
|
if (!GetIsObjectValid(oDest))
|
|
{ // destination not found
|
|
DelayCommand(0.3,Champion_ResetPathing(oChampion));
|
|
} // destination not found
|
|
else
|
|
{ // set next destination
|
|
DelayCommand(1.0,Champion_PathNonHome(oChampion));
|
|
} // set next destination
|
|
SetLocalObject(oChampion,"oPathDest",oDest);
|
|
} // get next destination
|
|
} // control
|
|
else if (nPathMode==CHAMPION_PATH_ESCAPE)
|
|
{ // escape
|
|
if (sAction=="REST") nAction=CHAMPION_ACTION_REST;
|
|
else if (sAction=="SEARCH") nAction=CHAMPION_ACTION_SEARCH;
|
|
else if (sAction=="BUFF") nAction=CHAMPION_ACTION_BUFF;
|
|
else if (sAction=="HEAL") nAction=CHAMPION_ACTION_HEAL;
|
|
else if (sAction=="EQUIP") nAction=CHAMPION_ACTION_EQUIP;
|
|
else if (sAction=="CONDREST") nAction=CHAMPION_ACTION_CONDITIONAL_REST;
|
|
else if (sAction=="STEAL"&&GetStringUpperCase(GetLocalString(GetArea(oChampion),"sTeamID"))==sTeamID) nAction=CHAMPION_ACTION_DEPOSIT;
|
|
else if (sAction=="STEAL") nAction=CHAMPION_ACTION_STEAL;
|
|
else if (sAction=="USE") nAction=CHAMPION_ACTION_USE;
|
|
else if (sAction=="RETURN") nAction=CHAMPION_ACTION_RETURN;
|
|
else if (sAction=="RUN") nAction=CHAMPION_ACTION_RUN;
|
|
else if (sAction=="GATHER") nAction=CHAMPION_ACTION_GATHER;
|
|
else if (sAction=="CONTROL") nAction=CHAMPION_ACTION_CONTROL;
|
|
else if (sAction=="ESCAPE1") nAction=CHAMPION_ACTION_ESCAPE1;
|
|
else if (sAction=="ESCAPE2") nAction=CHAMPION_ACTION_ESCAPE2;
|
|
if (nAction!=CHAMPION_ACTION_NONE)
|
|
{ // action exists
|
|
DeleteLocalInt(oChampion,"bGNBRun");
|
|
DeleteLocalInt(oChampion,"bRun");
|
|
DeleteLocalInt(oChampion,"nGNBRun");
|
|
DeleteLocalInt(oChampion,"nRun");
|
|
DeleteLocalInt(oChampion,"bPassive");
|
|
nN=Champion_ProcessAction(oChampion,nAction);
|
|
if (nN)
|
|
{ // action completed
|
|
Champion_Debug(oChampion," Action completed");
|
|
if(nAction!=CHAMPION_ACTION_RETURN) oDest=Champion_GetNextPath(oChampion,nPathMode);
|
|
if (!GetIsObjectValid(oDest))
|
|
{ // destination not found
|
|
DelayCommand(0.3,Champion_ResetPathing(oChampion));
|
|
} // destination not found
|
|
else
|
|
{ // set next destination
|
|
DelayCommand(1.0,Champion_PathNonHome(oChampion));
|
|
} // set next destination
|
|
SetLocalObject(oChampion,"oPathDest",oDest);
|
|
} // action completed
|
|
else
|
|
{ // actions continue
|
|
DelayCommand(2.0,Champion_PathDoCommand(oChampion));
|
|
} // actions continue
|
|
} // action exists
|
|
else
|
|
{ // get next destination
|
|
if(nAction!=CHAMPION_ACTION_RETURN) oDest=Champion_GetNextPath(oChampion,nPathMode);
|
|
if (!GetIsObjectValid(oDest))
|
|
{ // destination not found
|
|
DelayCommand(0.3,Champion_ResetPathing(oChampion));
|
|
} // destination not found
|
|
else
|
|
{ // set next destination
|
|
DelayCommand(1.0,Champion_PathNonHome(oChampion));
|
|
} // set next destination
|
|
SetLocalObject(oChampion,"oPathDest",oDest);
|
|
} // get next destination
|
|
} // escape
|
|
else if (nPathMode==CHAMPION_PATH_EXPLORE)
|
|
{ // explore
|
|
if (sAction=="REST") nAction=CHAMPION_ACTION_REST;
|
|
else if (sAction=="SEARCH") nAction=CHAMPION_ACTION_SEARCH;
|
|
else if (sAction=="BUFF") nAction=CHAMPION_ACTION_BUFF;
|
|
else if (sAction=="HEAL") nAction=CHAMPION_ACTION_HEAL;
|
|
else if (sAction=="EQUIP") nAction=CHAMPION_ACTION_EQUIP;
|
|
else if (sAction=="CONDREST") nAction=CHAMPION_ACTION_CONDITIONAL_REST;
|
|
else if (sAction=="STEAL"&&GetStringUpperCase(GetLocalString(GetArea(oChampion),"sTeamID"))==sTeamID) nAction=CHAMPION_ACTION_DEPOSIT;
|
|
else if (sAction=="STEAL") nAction=CHAMPION_ACTION_STEAL;
|
|
else if (sAction=="USE") nAction=CHAMPION_ACTION_USE;
|
|
else if (sAction=="RETURN") nAction=CHAMPION_ACTION_RETURN;
|
|
else if (sAction=="RUN") nAction=CHAMPION_ACTION_RUN;
|
|
else if (sAction=="GATHER") nAction=CHAMPION_ACTION_GATHER;
|
|
else if (sAction=="CONTROL") nAction=CHAMPION_ACTION_CONTROL;
|
|
else if (sAction=="ESCAPE1") nAction=CHAMPION_ACTION_ESCAPE1;
|
|
else if (sAction=="ESCAPE2") nAction=CHAMPION_ACTION_ESCAPE2;
|
|
if (nAction!=CHAMPION_ACTION_NONE)
|
|
{ // action exists
|
|
DeleteLocalInt(oChampion,"bGNBRun");
|
|
DeleteLocalInt(oChampion,"bRun");
|
|
DeleteLocalInt(oChampion,"nGNBRun");
|
|
DeleteLocalInt(oChampion,"nRun");
|
|
DeleteLocalInt(oChampion,"bPassive");
|
|
nN=Champion_ProcessAction(oChampion,nAction);
|
|
if (nN)
|
|
{ // action completed
|
|
Champion_Debug(oChampion," Action completed");
|
|
if(nAction!=CHAMPION_ACTION_RETURN) oDest=Champion_GetNextPath(oChampion,nPathMode);
|
|
if (!GetIsObjectValid(oDest))
|
|
{ // destination not found
|
|
DelayCommand(0.3,Champion_ResetPathing(oChampion));
|
|
} // destination not found
|
|
else
|
|
{ // set next destination
|
|
DelayCommand(1.0,Champion_PathNonHome(oChampion));
|
|
} // set next destination
|
|
SetLocalObject(oChampion,"oPathDest",oDest);
|
|
} // action completed
|
|
else
|
|
{ // actions continue
|
|
DelayCommand(2.0,Champion_PathDoCommand(oChampion));
|
|
} // actions continue
|
|
} // action exists
|
|
else
|
|
{ // get next destination
|
|
if(nAction!=CHAMPION_ACTION_RETURN) oDest=Champion_GetNextPath(oChampion,nPathMode);
|
|
if (!GetIsObjectValid(oDest))
|
|
{ // destination not found
|
|
DelayCommand(0.3,Champion_ResetPathing(oChampion));
|
|
} // destination not found
|
|
else
|
|
{ // set next destination
|
|
DelayCommand(1.0,Champion_PathNonHome(oChampion));
|
|
} // set next destination
|
|
SetLocalObject(oChampion,"oPathDest",oDest);
|
|
} // get next destination
|
|
} // explore
|
|
else if (nPathMode==CHAMPION_PATH_RETURN||nPathMode==CHAMPION_PATH_SPAWN)
|
|
{ // return
|
|
if (sAction=="REST") nAction=CHAMPION_ACTION_REST;
|
|
else if (sAction=="SEARCH") nAction=CHAMPION_ACTION_SEARCH;
|
|
else if (sAction=="BUFF") nAction=CHAMPION_ACTION_BUFF;
|
|
else if (sAction=="HEAL") nAction=CHAMPION_ACTION_HEAL;
|
|
else if (sAction=="EQUIP") nAction=CHAMPION_ACTION_EQUIP;
|
|
else if (sAction=="CONDREST") nAction=CHAMPION_ACTION_CONDITIONAL_REST;
|
|
else if (sAction=="STEAL"&&GetStringUpperCase(GetLocalString(GetArea(oChampion),"sTeamID"))==sTeamID) nAction=CHAMPION_ACTION_DEPOSIT;
|
|
else if (sAction=="STEAL") nAction=CHAMPION_ACTION_STEAL;
|
|
else if (sAction=="USE") nAction=CHAMPION_ACTION_USE;
|
|
else if (sAction=="RETURN") nAction=CHAMPION_ACTION_RETURN;
|
|
else if (sAction=="RUN") nAction=CHAMPION_ACTION_RUN;
|
|
else if (sAction=="GATHER") nAction=CHAMPION_ACTION_GATHER;
|
|
else if (sAction=="CONTROL") nAction=CHAMPION_ACTION_CONTROL;
|
|
else if (sAction=="ESCAPE1") nAction=CHAMPION_ACTION_ESCAPE1;
|
|
else if (sAction=="ESCAPE2") nAction=CHAMPION_ACTION_ESCAPE2;
|
|
if (nAction!=CHAMPION_ACTION_NONE)
|
|
{ // action exists
|
|
DeleteLocalInt(oChampion,"bGNBRun");
|
|
DeleteLocalInt(oChampion,"bRun");
|
|
DeleteLocalInt(oChampion,"nGNBRun");
|
|
DeleteLocalInt(oChampion,"nRun");
|
|
DeleteLocalInt(oChampion,"bPassive");
|
|
nN=Champion_ProcessAction(oChampion,nAction);
|
|
if (nN)
|
|
{ // action completed
|
|
Champion_Debug(oChampion," Action completed");
|
|
DelayCommand(0.3,Champion_ResetPathing(oChampion));
|
|
} // action completed
|
|
else
|
|
{ // actions continue
|
|
DelayCommand(2.0,Champion_PathDoCommand(oChampion));
|
|
} // actions continue
|
|
} // action exists
|
|
else
|
|
{ // get next destination
|
|
DelayCommand(0.3,Champion_ResetPathing(oChampion));
|
|
} // get next destination
|
|
} // return
|
|
} // Champion_PathDoCommand()
|
|
|
|
|
|
void Champion_PathNonHome(object oChampion)
|
|
{ // PURPOSE: Make the champion move somewhere outside of home
|
|
// Version History
|
|
// mm/dd/yyyy | Modified By | Description
|
|
// 09/16/2006 | Deva B. Winblood | Initial version of this function
|
|
object oDest=GetLocalObject(oChampion,"oPathDest");
|
|
string sWP;
|
|
string sTeamID=GetLocalString(oChampion,"sTeamID");
|
|
int nN;
|
|
Champion_Debug(oChampion,"Champion_PathNonHome("+GetTag(oDest)+":"+GetTag(GetArea(oDest))+")");
|
|
Champion_SetSentinel(oChampion);
|
|
fnDMSpeak(oChampion,"I am seeking.");
|
|
sTeamID=GetStringUpperCase(sTeamID);
|
|
if (GetIsObjectValid(oDest))
|
|
{ // path is set
|
|
if (GetArea(oDest)==GetArea(oChampion)&&GetDistanceBetween(oChampion,oDest)<4.0)
|
|
{ // arrived
|
|
Champion_Debug(oChampion," Arrived.");
|
|
DelayCommand(0.3,Champion_PathDoCommand(oChampion));
|
|
} // arrived
|
|
else
|
|
{ // move
|
|
nN=fnMoveToDestination(oChampion,oDest,3.9);
|
|
if (nN==-1)
|
|
{ // failure
|
|
Champion_Debug(oChampion," Pathing failure.");
|
|
DelayCommand(0.3,Champion_ResetPathing(oChampion));
|
|
} // failure
|
|
else
|
|
{ // delay
|
|
DelayCommand(3.0,Champion_PathNonHome(oChampion));
|
|
} // delay
|
|
} // move
|
|
} // path is set
|
|
else
|
|
{ // no path is set... set path as spawn
|
|
sWP=sTeamID+"_CHAMP_SPAWN";
|
|
oDest=GetWaypointByTag(sWP);
|
|
if (GetIsObjectValid(oDest))
|
|
{ // spawn found and known
|
|
SetLocalObject(oChampion,"oPathDest",oDest);
|
|
DelayCommand(3.0,Champion_PathNonHome(oChampion));
|
|
} // spawn found and known
|
|
else
|
|
{ // error
|
|
SendMessageToPC(GetFirstPC(),"ERROR: "+sWP+" waypoint not found!");
|
|
DelayCommand(0.3,Champion_ResetPathing(oChampion));
|
|
} // error
|
|
} // no path is set... set path as spawn
|
|
} // Champion_PathNonHome()
|
|
|
|
|
|
void Champion_Escape(object oChampion)
|
|
{ // PURPOSE: To help the champion manuever through the outer planes
|
|
// Version History
|
|
// mm/dd/yyyy | Modified By | Description
|
|
// 09/16/2006 | Deva B. Winblood | Initial version of this function
|
|
object oDest=GetLocalObject(oChampion,"oPathDest");
|
|
string sWP;
|
|
string sTeamID=GetLocalString(oChampion,"sTeamID");
|
|
int nN;
|
|
Champion_Debug(oChampion,"Champion_Escape()");
|
|
Champion_SetSentinel(oChampion);
|
|
fnDMSpeak(oChampion,"I must escape.");
|
|
if (!GetIsObjectValid(oDest)||!GetLocalInt(GetArea(oDest),"bOP"))
|
|
{ // find a starting waypoint
|
|
oDest=GetWaypointByTag("CHAMPION_ESCAPE_1");
|
|
SetLocalObject(oChampion,"oPathDest",oDest);
|
|
DelayCommand(3.0,Champion_Escape(oChampion));
|
|
} // find a starting waypoint
|
|
else
|
|
{ // move
|
|
if (GetArea(oDest)==GetArea(oChampion)&&GetDistanceBetween(oDest,oChampion)<4.0)
|
|
{ // arrived
|
|
DelayCommand(0.3,Champion_PathDoCommand(oChampion));
|
|
} // arrived
|
|
else
|
|
{ // move
|
|
SetLocalInt(oChampion,"nRun",Random(3));
|
|
SetLocalInt(oChampion,"bPassive",Random(3));
|
|
nN=fnMoveToDestination(oChampion,oDest,3.9);
|
|
if (nN==-1)
|
|
{ // abort - cannot reach
|
|
DelayCommand(0.3,Champion_ResetPathing(oChampion));
|
|
} // abort - cannot reach
|
|
else
|
|
{ // movement is working
|
|
DelayCommand(3.0,Champion_Escape(oChampion));
|
|
} // movement is working
|
|
} // move
|
|
} // move
|
|
} // Champion_Escape()
|
|
|
|
|
|
void Champion_SetMode(object oChampion)
|
|
{ // PURPOSE: To choose the mode that the champion should use
|
|
// Version History
|
|
// mm/dd/yyyy | Modified By | Description
|
|
// 09/16/2006 | Deva B. Winblood | Initial version of this function
|
|
object oEnemy=GetNearestCreature(CREATURE_TYPE_IS_ALIVE,TRUE,oChampion,1,CREATURE_TYPE_PERCEPTION,PERCEPTION_SEEN,CREATURE_TYPE_REPUTATION,REPUTATION_TYPE_ENEMY);
|
|
int bValid=FALSE;
|
|
int nMode;
|
|
int nR;
|
|
string sID=GetLocalString(oChampion,"sTeamID");
|
|
SetAILevel(oChampion,AI_LEVEL_NORMAL);
|
|
Champion_Debug(oChampion,"Champion_SetMode()");
|
|
sID=GetStringUpperCase(sID);
|
|
if (!GetIsDMPossessed(oChampion)&&!IsInConversation(oChampion)&&(GetLocalInt(oChampion,"bPassive")||!GetIsObjectValid(oEnemy)))
|
|
{ // okay to choose
|
|
nMode=GetLocalInt(oChampion,"nPathMode");
|
|
oEnemy=GetLocalObject(oChampion,"oPathDest");
|
|
if (!GetIsObjectValid(oEnemy))
|
|
{ // need to choose a new mode
|
|
Champion_Debug(oChampion," New mode needed.");
|
|
fnDMSpeak(oChampion,"I need a new mode.");
|
|
DelayCommand(0.3,Champion_ResetPathing(oChampion));
|
|
oEnemy=GetArea(oChampion);
|
|
if (GetStringUpperCase(GetLocalString(oEnemy,"sTeamID"))==sID)
|
|
{ // we are in our lair
|
|
nR=d100();
|
|
if (privateHas_ManaCrystal(oChampion))
|
|
{ // deposit it
|
|
fnDMSpeak(oChampion,"I have a mana crystal.");
|
|
Champion_Debug(oChampion,"Forced Mana Crystal depositing");
|
|
oEnemy=GetWaypointByTag(sID+"_VAULT");
|
|
if (GetArea(oEnemy)==GetArea(oChampion))
|
|
{ // move to vault
|
|
fnDMSpeak(oChampion,"Move to mana vault.");
|
|
nR=fnMoveToDestination(oChampion,oEnemy,1.5);
|
|
} // move to vault
|
|
else
|
|
{ // move home
|
|
fnDMSpeak(oChampion,"Return home with crystal.");
|
|
DelayCommand(0.35,Champion_PathHome(oChampion));
|
|
} // move home
|
|
nMode=-1;
|
|
} // deposit it
|
|
else if (sID=="SPID")
|
|
{ // spider cultists
|
|
if (nR<11) nMode=0;
|
|
else if (nR<51) nMode=CHAMPION_PATH_EXPLORE;
|
|
else if (nR<81) nMode=CHAMPION_PATH_CONTROL;
|
|
else { nMode=CHAMPION_PATH_ASSAULT; }
|
|
} // spider cultists
|
|
else if (sID=="UNC")
|
|
{ // unclean
|
|
if (nR<11) nMode=0;
|
|
else if (nR<51) nMode=CHAMPION_PATH_ASSAULT;
|
|
else if (nR<81) nMode=CHAMPION_PATH_CONTROL;
|
|
else { nMode=CHAMPION_PATH_EXPLORE; }
|
|
} // unclean
|
|
else if (sID=="UND")
|
|
{ // undead
|
|
if (nR<11) nMode=0;
|
|
else if (nR<51) nMode=CHAMPION_PATH_EXPLORE;
|
|
else if (nR<81) nMode=CHAMPION_PATH_CONTROL;
|
|
else { nMode=CHAMPION_PATH_ASSAULT; }
|
|
} // undead
|
|
else if (sID=="DWF")
|
|
{ // dwarves
|
|
if (nR<11) nMode=0;
|
|
else if (nR<51) nMode=CHAMPION_PATH_CONTROL;
|
|
else if (nR<81) nMode=CHAMPION_PATH_ASSAULT;
|
|
else { nMode=CHAMPION_PATH_EXPLORE; }
|
|
} // dwarves
|
|
if (nMode!=-1)
|
|
{ // set mode
|
|
nR=d4();
|
|
if (nR==1) SetLocalInt(oChampion,"nRun",TRUE);
|
|
else { DeleteLocalInt(oChampion,"nRun"); }
|
|
SetLocalInt(oChampion,"nPathMode",nMode);
|
|
oEnemy=Champion_GetNextPath(oChampion,nMode);
|
|
SetLocalObject(oChampion,"oPathDest",oEnemy);
|
|
fnDMSpeak(oChampion,"PathNonHome("+IntToString(nMode)+","+GetTag(oEnemy)+")");
|
|
DelayCommand(0.31,Champion_PathNonHome(oChampion));
|
|
} // set mode
|
|
} // we are in our lair
|
|
else
|
|
{ // we are outside of our lair
|
|
oEnemy=GetArea(oChampion);
|
|
if (GetLocalInt(oEnemy,"bOP"))
|
|
{ // in outer planes
|
|
nMode=CHAMPION_PATH_ESCAPE;
|
|
SetLocalInt(oChampion,"nRun",TRUE);
|
|
SetLocalInt(oChampion,"nPathMode",nMode);
|
|
DelayCommand(0.35,Champion_Escape(oChampion));
|
|
} // in outer planes
|
|
else
|
|
{ // not in outer planes
|
|
SetLocalInt(oChampion,"nRun",TRUE);
|
|
DelayCommand(0.35,Champion_PathHome(oChampion));
|
|
SetLocalInt(oChampion,"nPathMode",nMode);
|
|
nMode=CHAMPION_PATH_RETURN;
|
|
} // not in outer planes
|
|
} // we are outside of our lair
|
|
SetLocalInt(oChampion,"nPathMode",nMode);
|
|
} // need to choose a new mode
|
|
else
|
|
{ // mode in use
|
|
nMode=GetLocalInt(oChampion,"bChampionAISentinel");
|
|
if (!nMode)
|
|
{ // sentinel did not fire
|
|
fnDMSpeak(oChampion,"Sentinel failure.");
|
|
nMode=GetLocalInt(oChampion,"nSentinelFailureCount");
|
|
nMode++;
|
|
SetLocalInt(oChampion,"nSentinelFailureCount",nMode);
|
|
if (nMode>4)
|
|
{ // reset - has failed more than 4 times in a row
|
|
DelayCommand(0.3,Champion_ResetPathing(oChampion));
|
|
} // reset - has failed more than 4 times in a row
|
|
} // sentinel did not fire
|
|
else
|
|
{ // delete failure
|
|
DeleteLocalInt(oChampion,"nSentinelFailureCount");
|
|
} // delete failure
|
|
DeleteLocalInt(oChampion,"bChampionAISentinel");
|
|
} // mode in use
|
|
} // okay to choose
|
|
else
|
|
{ // abort
|
|
Champion_Debug(oChampion," DM Possessed, In Conversation, or enemy present and not passive!");
|
|
if (GetIsObjectValid(oEnemy)&&!GetIsDMPossessed(oChampion))
|
|
{ // enemy
|
|
if (GetIsInCombat(oChampion))
|
|
{ // combat
|
|
|
|
} // combat
|
|
else
|
|
{ // attack
|
|
DetermineCombatRound(oChampion);
|
|
} // attack
|
|
} // enemy
|
|
} // abort
|
|
} // Champion_SetMode()
|
|
|
|
|
|
void Champion_SetSentinel(object oChampion)
|
|
{ // PURPOSE: To set sentinel value so, script knows a failure has not occurred
|
|
// this is part of the check to make sure a champion never goes brain dead.
|
|
// Version History
|
|
// mm/dd/yyyy | Modified By | Description
|
|
// 09/16/2006 | Deva B. Winblood | Initial version of this function
|
|
//Champion_Debug(oChampion," Champion_SetSentinel()");
|
|
SetLocalInt(oChampion,"bChampionAISentinel",TRUE);
|
|
} // Champion_SetSentinel()
|
|
|
|
|
|
void Champion_Steal(object oChampion)
|
|
{ // PURPOSE: To steal mana, and items from an opponents chest
|
|
// Version History
|
|
// mm/dd/yyyy | Modified By | Description
|
|
// 09/17/2006 | Deva B. Winblood | Initial version of this function
|
|
int bHasMana=FALSE;
|
|
object oContainer;
|
|
object oItem;
|
|
object oCopy;
|
|
int nN;
|
|
string sS;
|
|
effect eVFX=EffectBeam(VFX_BEAM_SILENT_ODD,oChampion,BODY_NODE_HAND);
|
|
if (GetIsObjectValid(GetItemPossessedBy(oChampion,"MANA_CRYSTAL_5"))) bHasMana=TRUE;
|
|
else if (GetIsObjectValid(GetItemPossessedBy(oChampion,"MANA_CRYSTAL_2"))) bHasMana=TRUE;
|
|
else if (GetIsObjectValid(GetItemPossessedBy(oChampion,"MANA_CRYSTAL_1"))) bHasMana=TRUE;
|
|
fnDMSpeak(oChampion,"I am going to steal something.",TRUE);
|
|
if (!bHasMana)
|
|
{ // see if mana is near to steal
|
|
oItem=GetNearestObjectByTag("MANA_CRYSTAL_5",oChampion);
|
|
if (GetIsObjectValid(oItem)&&GetDistanceBetween(oChampion,oItem)<8.0)
|
|
{ // large mana crystal
|
|
oCopy=CopyObject(oItem,GetLocation(oChampion),oChampion);
|
|
ApplyEffectToObject(DURATION_TYPE_TEMPORARY,eVFX,oItem,1.8);
|
|
DelayCommand(2.0,DestroyObject(oItem));
|
|
} // large mana crystal
|
|
else
|
|
{ // keep looking
|
|
oItem=GetNearestObjectByTag("MANA_CRYSTAL_2",oChampion);
|
|
if (GetIsObjectValid(oItem)&&GetDistanceBetween(oChampion,oItem)<8.0)
|
|
{ // mana crystal
|
|
oCopy=CopyObject(oItem,GetLocation(oChampion),oChampion);
|
|
ApplyEffectToObject(DURATION_TYPE_TEMPORARY,eVFX,oItem,1.8);
|
|
DelayCommand(2.0,DestroyObject(oItem));
|
|
} // mana crystal
|
|
else
|
|
{ // keep looking
|
|
oItem=GetNearestObjectByTag("MANA_CRYSTAL_1",oChampion);
|
|
if (GetIsObjectValid(oItem)&&GetDistanceBetween(oChampion,oItem)<8.0)
|
|
{ // mana crystal
|
|
oCopy=CopyObject(oItem,GetLocation(oChampion),oChampion);
|
|
ApplyEffectToObject(DURATION_TYPE_TEMPORARY,eVFX,oItem,1.8);
|
|
DelayCommand(2.0,DestroyObject(oItem));
|
|
} // mana crystal
|
|
} // keep looking
|
|
} // keep looking
|
|
} // see if mana is near to steal
|
|
sS=GetLocalString(GetArea(oChampion),"sTeamID");
|
|
sS=GetStringUpperCase(sS);
|
|
oContainer=GetNearestObjectByTag(sS+"_CHEST",oChampion);
|
|
if (GetIsObjectValid(oContainer)&&GetDistanceBetween(oChampion,oContainer)<8.0)
|
|
{ // steal from container
|
|
ApplyEffectToObject(DURATION_TYPE_TEMPORARY,eVFX,oContainer,2.0);
|
|
oItem=GetFirstItemInInventory(oContainer);
|
|
while(GetIsObjectValid(oItem))
|
|
{ // check inventory
|
|
if (GetPlotFlag(oItem))
|
|
{ // plot item
|
|
oCopy=CopyObject(oItem,GetLocation(oChampion),oChampion);
|
|
DelayCommand(1.0,DestroyObject(oItem));
|
|
} // plot item
|
|
else if (GetBaseItemType(oItem)==BASE_ITEM_POTIONS)
|
|
{ // potions
|
|
nN=GetItemStackSize(oItem);
|
|
oCopy=CopyObject(oItem,GetLocation(oChampion),oChampion);
|
|
DelayCommand(1.0,DestroyObject(oItem));
|
|
SetItemStackSize(oCopy,nN);
|
|
} // potions
|
|
else if (GetBaseItemType(oItem)==BASE_ITEM_RING)
|
|
{ // ring
|
|
oCopy=CopyObject(oItem,GetLocation(oChampion),oChampion);
|
|
DelayCommand(1.0,DestroyObject(oItem));
|
|
} // ring
|
|
else if (GetBaseItemType(oItem)==BASE_ITEM_GEM)
|
|
{ // gem
|
|
nN=GetItemStackSize(oItem);
|
|
oCopy=CopyObject(oItem,GetLocation(oChampion),oChampion);
|
|
DelayCommand(1.0,DestroyObject(oItem));
|
|
SetItemStackSize(oCopy,nN);
|
|
} // gem
|
|
else if (GetBaseItemType(oItem)==BASE_ITEM_GOLD)
|
|
{ // gold
|
|
nN=GetItemStackSize(oItem);
|
|
DelayCommand(1.0,DestroyObject(oItem));
|
|
GiveGoldToCreature(oChampion,nN);
|
|
} // gold
|
|
oItem=GetNextItemInInventory(oContainer);
|
|
} // check inventory
|
|
} // steal from container
|
|
} // Champion_Steal()
|
|
|
|
|
|
void Champion_Equip(object oChampion)
|
|
{ // PURPOSE: To equip better armor, weapons, and artifacts
|
|
// Version History
|
|
// mm/dd/yyyy | Modified By | Description
|
|
// 09/17/2006 | Deva B. Winblood | Initial version of this function
|
|
object oItem;
|
|
Champion_Debug(oChampion,"Champion_Equip()");
|
|
AssignCommand(oChampion,ActionEquipMostDamagingMelee());
|
|
AssignCommand(oChampion,ActionEquipMostEffectiveArmor());
|
|
oItem=GetItemPossessedBy(oChampion,"rts_it_mag1");
|
|
fnDMSpeak(oChampion,"I must equip myself.",TRUE);
|
|
if (GetIsObjectValid(oItem))
|
|
{ // equip
|
|
AssignCommand(oChampion,ActionEquipItem(oItem,INVENTORY_SLOT_NECK));
|
|
} // equip
|
|
oItem=GetItemPossessedBy(oChampion,"rts_it_mag8");
|
|
if (GetIsObjectValid(oItem))
|
|
{ // equip
|
|
AssignCommand(oChampion,ActionEquipItem(oItem,INVENTORY_SLOT_BOOTS));
|
|
} // equip
|
|
oItem=GetItemPossessedBy(oChampion,"fb1_wintercloak");
|
|
if (GetIsObjectValid(oItem))
|
|
{ // equip
|
|
AssignCommand(oChampion,ActionEquipItem(oItem,INVENTORY_SLOT_CLOAK));
|
|
} // equip
|
|
} // Champion_Equip()
|
|
|
|
|
|
void Champion_Deposit(object oChampion)
|
|
{ // PURPOSE: To deposit items in your team chest
|
|
// Version History
|
|
// mm/dd/yyyy | Modified By | Description
|
|
// 09/17/2006 | Deva B. Winblood | Initial version of this function
|
|
string sID=GetLocalString(oChampion,"sTeamID");
|
|
int nN;
|
|
object oItem;
|
|
object oCopy;
|
|
object oChest;
|
|
string sS;
|
|
Champion_Debug(oChampion,"Champion_Deposit()");
|
|
fnDMSpeak(oChampion,"I need to deposit some things.",TRUE);
|
|
sID=GetStringUpperCase(sID);
|
|
oChest=GetNearestObjectByTag(sID+"_CHEST");
|
|
if (GetIsObjectValid(oChest))
|
|
{ // chest exists
|
|
oItem=GetFirstItemInInventory(oChampion);
|
|
while(GetIsObjectValid(oItem))
|
|
{ // look through inventory
|
|
sS=GetTag(oItem);
|
|
if (sS=="rts_powerres")
|
|
{ // power reservoir
|
|
oCopy=CreateObject(OBJECT_TYPE_PLACEABLE,"RTS_POWER_RES",GetLocation(oChest));
|
|
DelayCommand(1.0,DestroyObject(oItem));
|
|
} // power reservoir
|
|
else if (sS=="rts_it_mag24"&&GetLevelByClass(CLASS_TYPE_SORCERER,oChampion)<1)
|
|
{ // store
|
|
oCopy=CreateItemOnObject(GetResRef(oItem),oChest);
|
|
DelayCommand(1.0,DestroyObject(oItem));
|
|
} // store
|
|
else if (sS=="rts_it_mag17"&&GetLevelByClass(CLASS_TYPE_FIGHTER,oChampion)<1)
|
|
{ // store
|
|
oCopy=CreateItemOnObject(GetResRef(oItem),oChest);
|
|
DelayCommand(1.0,DestroyObject(oItem));
|
|
} // store
|
|
else if (sS=="rts_it_mag11"&&GetLevelByClass(CLASS_TYPE_BARBARIAN,oChampion)<1)
|
|
{ // store
|
|
oCopy=CreateItemOnObject(GetResRef(oItem),oChest);
|
|
DelayCommand(1.0,DestroyObject(oItem));
|
|
} // store
|
|
else if (sS=="rts_it_mag23"&&GetLevelByClass(CLASS_TYPE_WIZARD,oChampion)<1)
|
|
{ // store
|
|
oCopy=CreateItemOnObject(GetResRef(oItem),oChest);
|
|
DelayCommand(1.0,DestroyObject(oItem));
|
|
} // store
|
|
else if (sS=="rts_it_mag14"&&GetLevelByClass(CLASS_TYPE_CLERIC,oChampion)<1)
|
|
{ // store
|
|
oCopy=CreateItemOnObject(GetResRef(oItem),oChest);
|
|
DelayCommand(1.0,DestroyObject(oItem));
|
|
} // store
|
|
else if (sS=="SoulToken")
|
|
{ // soul token
|
|
DelayCommand(1.0,DestroyObject(oItem));
|
|
} // soul token
|
|
else if (sS=="rts_it_mag13"&&MyPRCGetRacialType(oChampion)!=RACIAL_TYPE_HALFORC)
|
|
{ // bracers of the unclean
|
|
oCopy=CreateItemOnObject(GetResRef(oItem),oChest);
|
|
DelayCommand(1.0,DestroyObject(oItem));
|
|
} // bracers of the unclean
|
|
else if (sS=="rts_it_mag3"&&!GetHasFeat(FEAT_WEAPON_PROFICIENCY_MARTIAL,oChampion))
|
|
{ // store
|
|
oCopy=CreateItemOnObject(GetResRef(oItem),oChest);
|
|
DelayCommand(1.0,DestroyObject(oItem));
|
|
} // store
|
|
else if (sS=="rts_it_mag4"&&!GetHasFeat(FEAT_WEAPON_PROFICIENCY_MARTIAL,oChampion))
|
|
{ // store
|
|
oCopy=CreateItemOnObject(GetResRef(oItem),oChest);
|
|
DelayCommand(1.0,DestroyObject(oItem));
|
|
} // store
|
|
else if (sS=="fb1_heavywinter"&&!GetHasFeat(FEAT_ARMOR_PROFICIENCY_HEAVY,oChampion))
|
|
{ // store
|
|
oCopy=CreateItemOnObject(GetResRef(oItem),oChest);
|
|
DelayCommand(1.0,DestroyObject(oItem));
|
|
} // store
|
|
else if (sS=="rts_it_mag36"&&sID!="UNC")
|
|
{ // store
|
|
oCopy=CreateItemOnObject(GetResRef(oItem),oChest);
|
|
DelayCommand(1.0,DestroyObject(oItem));
|
|
} // store
|
|
else if (sS=="rts_it_mag33"&&sID!="UND")
|
|
{ // store
|
|
oCopy=CreateItemOnObject(GetResRef(oItem),oChest);
|
|
DelayCommand(1.0,DestroyObject(oItem));
|
|
} // store
|
|
else if (sS=="rts_it_mag34"&&sID!="SPID")
|
|
{ // store
|
|
oCopy=CreateItemOnObject(GetResRef(oItem),oChest);
|
|
DelayCommand(1.0,DestroyObject(oItem));
|
|
} // store
|
|
else if (sS=="rts_it_mag35"&&sID!="DWF")
|
|
{ // store
|
|
oCopy=CreateItemOnObject(GetResRef(oItem),oChest);
|
|
DelayCommand(1.0,DestroyObject(oItem));
|
|
} // store
|
|
else if (sS=="rts_it_mag25"&&(sID!="SPID"||sID=="UND"))
|
|
{ // store
|
|
oCopy=CreateItemOnObject(GetResRef(oItem),oChest);
|
|
DelayCommand(1.0,DestroyObject(oItem));
|
|
} // store
|
|
else if (GetBaseItemType(oItem)==BASE_ITEM_ARMOR&&GetGoldPieceValue(oItem)<GetGoldPieceValue(GetItemInSlot(INVENTORY_SLOT_CHEST,oChampion)))
|
|
{ // store
|
|
oCopy=CreateItemOnObject(GetResRef(oItem),oChest);
|
|
DelayCommand(1.0,DestroyObject(oItem));
|
|
} // store
|
|
else if (GetBaseItemType(oItem)==BASE_ITEM_CLOAK&&GetGoldPieceValue(oItem)<GetGoldPieceValue(GetItemInSlot(INVENTORY_SLOT_CLOAK,oChampion)))
|
|
{ // store
|
|
oCopy=CreateItemOnObject(GetResRef(oItem),oChest);
|
|
DelayCommand(1.0,DestroyObject(oItem));
|
|
} // store
|
|
else if (GetBaseItemType(oItem)==BASE_ITEM_BOOTS&&GetGoldPieceValue(oItem)<GetGoldPieceValue(GetItemInSlot(INVENTORY_SLOT_BOOTS,oChampion)))
|
|
{ // store
|
|
oCopy=CreateItemOnObject(GetResRef(oItem),oChest);
|
|
DelayCommand(1.0,DestroyObject(oItem));
|
|
} // store
|
|
else if (GetBaseItemType(oItem)==BASE_ITEM_HELMET&&GetGoldPieceValue(oItem)<GetGoldPieceValue(GetItemInSlot(BASE_ITEM_HELMET,oChampion)))
|
|
{ // store
|
|
oCopy=CreateItemOnObject(GetResRef(oItem),oChest);
|
|
DelayCommand(1.0,DestroyObject(oItem));
|
|
} // store
|
|
oItem=GetNextItemInInventory(oChampion);
|
|
} // look through inventory
|
|
} // chest exists
|
|
} // Champion_Deposit()
|
|
|
|
|
|
void Champion_Use(object oChampion)
|
|
{ // PURPOSE: To get the champion to use some artifacts they may be carrying
|
|
// Version History
|
|
// mm/dd/yyyy | Modified By | Description
|
|
// 09/17/2006 | Deva B. Winblood | Initial version of this function
|
|
object oOb;
|
|
string sID=GetLocalString(oChampion,"sTeamID");
|
|
object oItem;
|
|
string sS;
|
|
int nN;
|
|
object oArea=GetArea(oChampion);
|
|
string sTag=GetTag(oArea);
|
|
Champion_Debug(oChampion,"Champion_Use()");
|
|
sS=GetLocalString(oArea,"sTeamID");
|
|
sS=GetStringUpperCase(sS);
|
|
sID=GetStringUpperCase(sID);
|
|
fnDMSpeak(oChampion,"I wonder if I have anything useful.",TRUE);
|
|
if (sS==sID)
|
|
{ // in your own lair
|
|
if (sID=="UNC"&&GetIsObjectValid(GetItemPossessedBy(oChampion,"rts_it_mag36")))
|
|
{ // sludge factory creator
|
|
oItem=GetItemPossessedBy(oChampion,"rts_it_mag36");
|
|
DestroyObject(oItem);
|
|
oOb=CreateObject(OBJECT_TYPE_PLACEABLE,"rts_pl_mag26",GetLocation(oChampion));
|
|
} // sludge factory creator
|
|
else if (sID=="DWF"&&GetIsObjectValid(GetItemPossessedBy(oChampion,"rts_it_mag35")))
|
|
{ // mithril forge creator
|
|
oItem=GetItemPossessedBy(oChampion,"rts_it_mag35");
|
|
DestroyObject(oItem);
|
|
oOb=CreateObject(OBJECT_TYPE_PLACEABLE,"rts_pl_mag35",GetLocation(oChampion));
|
|
} // mithril forge creator
|
|
oItem=GetItemPossessedBy(oChampion,"rts_it_mag28");
|
|
if (GetIsObjectValid(oItem))
|
|
{ // teleportation interdictor
|
|
oOb=GetNearestObjectByTag("rts_pl_mag28",oChampion);
|
|
if (!GetIsObjectValid(oOb))
|
|
{ // create teleportation interdictor
|
|
oOb=CreateObject(OBJECT_TYPE_PLACEABLE,"rts_pl_mag28",GetLocation(oChampion));
|
|
} // create teleportation interdictor
|
|
} // teleportation interdictor
|
|
oItem=GetItemPossessedBy(oChampion,"rts_it_mag42");
|
|
if (GetIsObjectValid(oItem))
|
|
{ // has the tome of ancient evil
|
|
if (sID=="DWF")
|
|
{ // destroy it
|
|
DestroyObject(oItem);
|
|
nN=GetLocalInt(oChampion,"nXP");
|
|
nN=nN+1000; // 1000 experience
|
|
SetLocalInt(oChampion,"nXP",nN);
|
|
} // destroy it
|
|
else
|
|
{ // create big unit
|
|
sS="und19";
|
|
if (sID=="SPID") sS="spid27";
|
|
else if (sID=="UNC") sS="unc14";
|
|
privateCreate_Follower(oChampion,sS);
|
|
ExecuteScript("rts_it_mag42r",oChampion); // replace book
|
|
} // create big unit
|
|
} // has the tome of ancient evil
|
|
} // in your own lair
|
|
else if (GetStringLength(sS)>0)
|
|
{ // in someone elses lair
|
|
oItem=GetItemPossessedBy(oChampion,"rts_it_mag28");
|
|
if (GetIsObjectValid(oItem))
|
|
{ // teleportation interdictor
|
|
oOb=GetNearestObjectByTag("rts_pl_mag28",oChampion);
|
|
if (!GetIsObjectValid(oOb))
|
|
{ // create teleportation interdictor
|
|
oOb=CreateObject(OBJECT_TYPE_PLACEABLE,"rts_pl_mag28",GetLocation(oChampion));
|
|
} // create teleportation interdictor
|
|
} // teleportation interdictor
|
|
oItem=GetItemPossessedBy(oChampion,"rts_it_mag27");
|
|
if (GetIsObjectValid(oItem))
|
|
{ // magic bug eggs
|
|
oOb=GetNearestObjectByTag("rts_pl_mag27",oChampion);
|
|
if (!GetIsObjectValid(oOb))
|
|
{ // create magic bug eggs
|
|
oOb=CreateObject(OBJECT_TYPE_PLACEABLE,"rts_pl_mag27",GetLocation(oChampion));
|
|
DelayCommand(HoursToSeconds(8),fnHatch(oOb));
|
|
} // create magic bug eggs
|
|
} // magic bug eggs
|
|
oItem=GetItemPossessedBy(oChampion,"rts_it_op1");
|
|
if (GetIsObjectValid(oItem))
|
|
{ // mana mine
|
|
DestroyObject(oItem);
|
|
oOb=CreateObject(OBJECT_TYPE_PLACEABLE,"rts_it_op1_pl",GetLocation(oChampion));
|
|
} // mana mine
|
|
} // in someone elses lair
|
|
else
|
|
{ // outside
|
|
oItem=GetItemPossessedBy(oChampion,"rts_it_mag28");
|
|
if (GetIsObjectValid(oItem))
|
|
{ // teleportation interdictor
|
|
oOb=GetNearestObjectByTag("rts_pl_mag28",oChampion);
|
|
if (!GetIsObjectValid(oOb))
|
|
{ // create teleportation interdictor
|
|
oOb=CreateObject(OBJECT_TYPE_PLACEABLE,"rts_pl_mag28",GetLocation(oChampion));
|
|
} // create teleportation interdictor
|
|
} // teleportation interdictor
|
|
if (sID!="SPID")
|
|
{ // not spiders
|
|
oItem=GetItemPossessedBy(oChampion,"rts_it_mag29");
|
|
if (GetIsObjectValid(oItem))
|
|
{ // bug zapper
|
|
oOb=GetNearestObjectByTag("rts_pl_mag29",oChampion);
|
|
if (!GetIsObjectValid(oOb))
|
|
{ // place bug zapper
|
|
oOb=CreateObject(OBJECT_TYPE_PLACEABLE,"rts_pl_mag29",GetLocation(oChampion));
|
|
SetLocalInt(oOb,"nCharges",5);
|
|
DelayCommand(5.0,AssignCommand(oOb,fnBugZapper()));
|
|
} // place bug zapper
|
|
} // bug zapper
|
|
} // not spiders
|
|
} // outside
|
|
} // Champion_Use()
|
|
|
|
|
|
|
|
void privateApothecary(object oChampion, object oApothecary)
|
|
{ // PURPOSE: Buy potions from the apothecary
|
|
// Version History
|
|
// mm/dd/yyyy | Modified By | Description
|
|
// 09/17/2006 | Deva B. Winblood | Initial version of this function
|
|
object oItem;
|
|
int nN;
|
|
string sS;
|
|
int nBT;
|
|
object oCopy;
|
|
Champion_Debug(oChampion," privateApothecary()");
|
|
oItem=GetItemPossessedBy(oChampion,"NW_IT_MPOTION001");
|
|
if (!GetIsObjectValid(oItem)&&GetGold(oItem)>=20)
|
|
{ // buy cure light potion
|
|
nN=GetGold(oItem);
|
|
nN=nN/20;
|
|
if (nN>6) nN=6;
|
|
oItem=CreateItemOnObject("nw_it_mpotion001",oChampion,nN);
|
|
TakeGoldFromCreature(nN*20,oChampion,TRUE);
|
|
} // buy cure light potion
|
|
oItem=GetItemPossessedBy(oChampion,"NW_IT_MPOTION005");
|
|
if (!GetIsObjectValid(oItem)&&GetGold(oItem)>=80)
|
|
{ // buy barkskin
|
|
nN=GetGold(oItem);
|
|
nN=nN/80;
|
|
if (nN>2) nN=2;
|
|
oItem=CreateItemOnObject("nw_it_mpotion005",oChampion,nN);
|
|
TakeGoldFromCreature(nN*80,oChampion,TRUE);
|
|
} // buy barkskin
|
|
oItem=GetItemPossessedBy(oChampion,"NW_IT_MPOTION011");
|
|
if (!GetIsObjectValid(oItem)&&GetGold(oItem)>=120)
|
|
{ // buy lesser restoration
|
|
nN=GetGold(oItem);
|
|
nN=nN/120;
|
|
if (nN>2) nN=2;
|
|
oItem=CreateItemOnObject("nw_it_mpotion011",oChampion,nN);
|
|
TakeGoldFromCreature(nN*120,oChampion,TRUE);
|
|
} // buy lesser restoration
|
|
oItem=GetItemPossessedBy(oChampion,"NW_IT_MPOTION009");
|
|
if (!GetIsObjectValid(oItem)&&GetGold(oItem)>=40)
|
|
{ // buy bless
|
|
nN=GetGold(oItem);
|
|
nN=nN/40;
|
|
if (nN>2) nN=2;
|
|
oItem=CreateItemOnObject("nw_it_mpotion009",oChampion,nN);
|
|
TakeGoldFromCreature(nN*40,oChampion,TRUE);
|
|
} // buy bless
|
|
oItem=GetItemPossessedBy(oChampion,"NW_IT_MPOTION015");
|
|
if (!GetIsObjectValid(oItem)&&GetGold(oItem)>=120)
|
|
{ // buy bulls strength
|
|
nN=GetGold(oItem);
|
|
nN=nN/120;
|
|
if (nN>2) nN=2;
|
|
oItem=CreateItemOnObject("nw_it_mpotion015",oChampion,nN);
|
|
TakeGoldFromCreature(nN*120,oChampion,TRUE);
|
|
} // buy bulls strength
|
|
oItem=GetItemPossessedBy(oChampion,"NW_IT_MPOTION007");
|
|
if (!GetIsObjectValid(oItem)&&GetGold(oItem)>=120)
|
|
{ // buy clarity
|
|
nN=GetGold(oItem);
|
|
nN=nN/120;
|
|
if (nN>1) nN=1;
|
|
oItem=CreateItemOnObject("nw_it_mpotion007",oChampion,nN);
|
|
TakeGoldFromCreature(nN*120,oChampion,TRUE);
|
|
} // buy clarity
|
|
oItem=GetItemPossessedBy(oChampion,"X2_IT_MPOTION002");
|
|
if (!GetIsObjectValid(oItem)&&GetGold(oItem)>=120)
|
|
{ // buy death armor
|
|
nN=GetGold(oItem);
|
|
nN=nN/120;
|
|
if (nN>2) nN=2;
|
|
oItem=CreateItemOnObject("x2_it_mpotion002",oChampion,nN);
|
|
TakeGoldFromCreature(nN*120,oChampion,TRUE);
|
|
} // buy death armor
|
|
oItem=GetItemPossessedBy(oChampion,"NW_IT_MPOTION004");
|
|
if (!GetIsObjectValid(oItem)&&GetGold(oItem)>=300)
|
|
{ // buy speed
|
|
nN=GetGold(oItem);
|
|
nN=nN/300;
|
|
if (nN>3) nN=3;
|
|
oItem=CreateItemOnObject("nw_it_mpotion004",oChampion,nN);
|
|
TakeGoldFromCreature(nN*300,oChampion,TRUE);
|
|
} // buy speed
|
|
} // privateApothecary()
|
|
|
|
|
|
void privateSmith(object oChampion,object oSmith)
|
|
{ // PURPOSE: Trade with the smith
|
|
// Version History
|
|
// mm/dd/yyyy | Modified By | Description
|
|
// 09/17/2006 | Deva B. Winblood | Initial version of this function
|
|
object oItem;
|
|
int nN;
|
|
string sS;
|
|
int nBT;
|
|
object oCopy;
|
|
Champion_Debug(oChampion," privateSmith()");
|
|
sS=GetLocalString(oChampion,"sTeamID");
|
|
sS=GetStringUpperCase(sS);
|
|
if (sS=="UND")
|
|
{ // undead - cleric
|
|
oItem=GetItemInSlot(INVENTORY_SLOT_RIGHTHAND,oChampion);
|
|
if (GetGoldPieceValue(oItem)<13&&GetGold(oChampion)>=10)
|
|
{ // buy a mace
|
|
GiveGoldToCreature(oChampion,GetGoldPieceValue(oItem)/4);
|
|
oCopy=CreateItemOnObject("nw_wblml001",oChampion);
|
|
DestroyObject(oItem);
|
|
TakeGoldFromCreature(10,oChampion,TRUE);
|
|
} // buy a mace
|
|
} // undead - cleric
|
|
else if (sS=="UNC")
|
|
{ // unclean - barbarian
|
|
oItem=GetItemInSlot(INVENTORY_SLOT_RIGHTHAND,oChampion);
|
|
if (GetGoldPieceValue(oItem)<25&&GetGold(oChampion)>=20)
|
|
{ // buy a battle axe
|
|
GiveGoldToCreature(oChampion,GetGoldPieceValue(oItem)/4);
|
|
oCopy=CreateItemOnObject("nw_waxbt001",oChampion);
|
|
DestroyObject(oItem);
|
|
TakeGoldFromCreature(20,oChampion,TRUE);
|
|
} // buy a battle axe
|
|
} // unclean - barbarian
|
|
else if (sS=="DWF")
|
|
{ // dwarves - paladin
|
|
oItem=GetItemInSlot(INVENTORY_SLOT_RIGHTHAND,oChampion);
|
|
if (GetGoldPieceValue(oItem)<28&&GetGold(oChampion)>=24)
|
|
{ // buy a warhammer
|
|
GiveGoldToCreature(oChampion,GetGoldPieceValue(oItem)/4);
|
|
oCopy=CreateItemOnObject("nw_wblhw001",oChampion);
|
|
DestroyObject(oItem);
|
|
TakeGoldFromCreature(24,oChampion,TRUE);
|
|
} // buy a warhammer
|
|
} // dwarves - paladin
|
|
else if (sS=="SPID")
|
|
{ // spiders - fighter
|
|
oItem=GetItemInSlot(INVENTORY_SLOT_RIGHTHAND,oChampion);
|
|
if (GetGoldPieceValue(oItem)<32&&GetGold(oChampion)>=30)
|
|
{ // buy a longsword
|
|
GiveGoldToCreature(oChampion,GetGoldPieceValue(oItem)/4);
|
|
oCopy=CreateItemOnObject("nw_wswls001",oChampion);
|
|
DestroyObject(oItem);
|
|
TakeGoldFromCreature(30,oChampion,TRUE);
|
|
} // buy a longsword
|
|
} // spiders - fighter
|
|
oItem=GetItemInSlot(INVENTORY_SLOT_LEFTHAND,oChampion);
|
|
if (GetGoldPieceValue(oItem)<706&&GetGold(oChampion)>=706)
|
|
{ // buy a large shield
|
|
GiveGoldToCreature(oChampion,GetGoldPieceValue(oItem)/4);
|
|
oCopy=CreateItemOnObject("nw_ashmlw002",oChampion);
|
|
DestroyObject(oItem);
|
|
TakeGoldFromCreature(706,oChampion,TRUE);
|
|
} // buy a large shield
|
|
} // privateSmith()
|
|
|
|
|
|
void privateRotund(object oChampion,object oRotund)
|
|
{ // PURPOSE: Trade with rotund
|
|
// Version History
|
|
// mm/dd/yyyy | Modified By | Description
|
|
// 09/17/2006 | Deva B. Winblood | Initial version of this function
|
|
object oItem;
|
|
int nN;
|
|
string sS;
|
|
int nBT;
|
|
object oCopy;
|
|
object oJackedStore=GetObjectByTag("JackedStore");
|
|
Champion_Debug(oChampion," privateRotund()");
|
|
oItem=GetFirstItemInInventory(oChampion);
|
|
while(GetIsObjectValid(oItem))
|
|
{ // sell items
|
|
if (!GetPlotFlag(oItem))
|
|
{ // worth considering
|
|
sS=GetTag(oItem);
|
|
nBT=GetBaseItemType(oItem);
|
|
nN=GetGoldPieceValue(oItem);
|
|
if (nBT==BASE_ITEM_GEM||nBT==BASE_ITEM_AMULET||nBT==BASE_ITEM_SCROLL||nBT==BASE_ITEM_SPELLSCROLL)
|
|
{ // sell
|
|
nN=nN/4;
|
|
if (nN<1) nN=1;
|
|
oCopy=CreateItemOnObject(GetResRef(oItem),oJackedStore,GetItemStackSize(oItem));
|
|
DelayCommand(1.0,DestroyObject(oItem));
|
|
GiveGoldToCreature(oChampion,nN);
|
|
} // sell
|
|
} // worth considering
|
|
nN++;
|
|
oItem=GetNextItemInInventory(oChampion);
|
|
} // sell items
|
|
oItem=GetItemPossessedBy(oChampion,"NW_IT_MPOTION001");
|
|
if (!GetIsObjectValid(oItem)&&GetGold(oItem)>=50)
|
|
{ // buy cure light potion
|
|
nN=GetGold(oItem);
|
|
nN=nN/50;
|
|
if (nN>3) nN=3;
|
|
oItem=CreateItemOnObject("nw_it_mpotion001",oChampion,nN);
|
|
TakeGoldFromCreature(nN*50,oChampion,TRUE);
|
|
} // buy cure light potion
|
|
oItem=GetItemPossessedBy(oChampion,"NW_IT_MPOTION005");
|
|
if (!GetIsObjectValid(oItem)&&GetGold(oItem)>=200)
|
|
{ // buy cure light potion
|
|
nN=1;
|
|
oItem=CreateItemOnObject("nw_it_mpotion005",oChampion,nN);
|
|
TakeGoldFromCreature(nN*200,oChampion,TRUE);
|
|
} // buy cure light potion
|
|
oItem=GetItemPossessedBy(oChampion,"NW_IT_MPOTION011");
|
|
if (!GetIsObjectValid(oItem)&&GetGold(oItem)>=300)
|
|
{ // buy cure light potion
|
|
nN=1;
|
|
oItem=CreateItemOnObject("nw_it_mpotion011",oChampion,nN);
|
|
TakeGoldFromCreature(nN*300,oChampion,TRUE);
|
|
} // buy cure light potion
|
|
oItem=GetItemPossessedBy(oChampion,"NW_IT_MPOTION009");
|
|
if (!GetIsObjectValid(oItem)&&GetGold(oItem)>=100)
|
|
{ // buy cure light potion
|
|
nN=1;
|
|
oItem=CreateItemOnObject("nw_it_mpotion009",oChampion,nN);
|
|
TakeGoldFromCreature(nN*300,oChampion,TRUE);
|
|
} // buy cure light potion
|
|
oItem=GetItemPossessedBy(oChampion,"NW_IT_MPOTION015");
|
|
if (!GetIsObjectValid(oItem)&&GetGold(oItem)>=300)
|
|
{ // buy cure light potion
|
|
nN=1;
|
|
oItem=CreateItemOnObject("nw_it_mpotion015",oChampion,nN);
|
|
TakeGoldFromCreature(nN*300,oChampion,TRUE);
|
|
} // buy cure light potion
|
|
sS=GetLocalString(oChampion,"sTeamID");
|
|
sS=GetStringUpperCase(sS);
|
|
if (sS=="UND")
|
|
{ // undead - cleric
|
|
oItem=GetItemInSlot(INVENTORY_SLOT_RIGHTHAND,oChampion);
|
|
if (GetGoldPieceValue(oItem)<13&&GetGold(oChampion)>=25)
|
|
{ // buy a mace
|
|
GiveGoldToCreature(oChampion,GetGoldPieceValue(oItem)/4);
|
|
oCopy=CreateItemOnObject("nw_wblml001",oChampion);
|
|
DestroyObject(oItem);
|
|
TakeGoldFromCreature(25,oChampion,TRUE);
|
|
} // buy a mace
|
|
} // undead - cleric
|
|
else if (sS=="UNC")
|
|
{ // unclean - barbarian
|
|
oItem=GetItemInSlot(INVENTORY_SLOT_RIGHTHAND,oChampion);
|
|
if (GetGoldPieceValue(oItem)<25&&GetGold(oChampion)>=50)
|
|
{ // buy a battle axe
|
|
GiveGoldToCreature(oChampion,GetGoldPieceValue(oItem)/4);
|
|
oCopy=CreateItemOnObject("nw_waxbt001",oChampion);
|
|
DestroyObject(oItem);
|
|
TakeGoldFromCreature(50,oChampion,TRUE);
|
|
} // buy a battle axe
|
|
} // unclean - barbarian
|
|
else if (sS=="DWF")
|
|
{ // dwarves - paladin
|
|
oItem=GetItemInSlot(INVENTORY_SLOT_RIGHTHAND,oChampion);
|
|
if (GetGoldPieceValue(oItem)<28&&GetGold(oChampion)>=60)
|
|
{ // buy a warhammer
|
|
GiveGoldToCreature(oChampion,GetGoldPieceValue(oItem)/4);
|
|
oCopy=CreateItemOnObject("nw_wblhw001",oChampion);
|
|
DestroyObject(oItem);
|
|
TakeGoldFromCreature(60,oChampion,TRUE);
|
|
} // buy a warhammer
|
|
} // dwarves - paladin
|
|
else if (sS=="SPID")
|
|
{ // spiders - fighter
|
|
oItem=GetItemInSlot(INVENTORY_SLOT_RIGHTHAND,oChampion);
|
|
if (GetGoldPieceValue(oItem)<32&&GetGold(oChampion)>=75)
|
|
{ // buy a longsword
|
|
GiveGoldToCreature(oChampion,GetGoldPieceValue(oItem)/4);
|
|
oCopy=CreateItemOnObject("nw_wswls001",oChampion);
|
|
DestroyObject(oItem);
|
|
TakeGoldFromCreature(75,oChampion,TRUE);
|
|
} // buy a longsword
|
|
} // spiders - fighter
|
|
oItem=GetItemInSlot(INVENTORY_SLOT_LEFTHAND,oChampion);
|
|
if (GetGoldPieceValue(oItem)<40&&GetGold(oChampion)>=125)
|
|
{ // buy a large shield
|
|
GiveGoldToCreature(oChampion,GetGoldPieceValue(oItem)/4);
|
|
oCopy=CreateItemOnObject("nw_ashlw001",oChampion);
|
|
DestroyObject(oItem);
|
|
TakeGoldFromCreature(125,oChampion,TRUE);
|
|
} // buy a large shield
|
|
} // privateRotund()
|
|
|
|
|
|
void privateHealer(object oChampion,object oHealer)
|
|
{ // PURPOSE: Be healed by the healer
|
|
// Version History
|
|
// mm/dd/yyyy | Modified By | Description
|
|
// 09/17/2006 | Deva B. Winblood | Initial version of this function
|
|
Champion_Debug(oChampion," privateHealer()");
|
|
AssignCommand(oHealer,ClearAllActions());
|
|
AssignCommand(oHealer,ActionCastSpellAtObject(SPELL_RESTORATION,oChampion,METAMAGIC_ANY,TRUE,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE));
|
|
AssignCommand(oHealer,ActionCastSpellAtObject(SPELL_HEAL,oChampion,METAMAGIC_ANY,TRUE,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE));
|
|
} // privateHealer()
|
|
|
|
|
|
void Champion_Search(object oChampion)
|
|
{ // PURPOSE: To search for items, placeables, and creatures of interest and interact
|
|
// with them
|
|
// Version History
|
|
// mm/dd/yyyy | Modified By | Description
|
|
// 09/17/2006 | Deva B. Winblood | Initial version of this function
|
|
effect eVFX=EffectBeam(VFX_BEAM_SILENT_ODD,oChampion,BODY_NODE_HAND);
|
|
object oOb;
|
|
object oItem;
|
|
object oCopy;
|
|
int nN;
|
|
string sS;
|
|
int bB;
|
|
int nBT;
|
|
string sID=GetLocalString(oChampion,"sTeamID");
|
|
int nSearchMode=GetLocalInt(oChampion,"nSearchMode");
|
|
int nSearchParm=GetLocalInt(oChampion,"nSearchParm");
|
|
fnDMSpeak(oChampion,"I need to look around.",TRUE);
|
|
Champion_Debug(oChampion,"Champion_Search()");
|
|
if (nSearchMode==0)
|
|
{ // search for placeables
|
|
Champion_Debug(oChampion," Placeables");
|
|
nN=nSearchParm;
|
|
bB=FALSE;
|
|
if(GetIsObjectValid(GetItemPossessedBy(oChampion,"MANA_CRYSTAL_1"))) bB=TRUE;
|
|
else if(GetIsObjectValid(GetItemPossessedBy(oChampion,"MANA_CRYSTAL_2"))) bB=TRUE;
|
|
else if(GetIsObjectValid(GetItemPossessedBy(oChampion,"MANA_CRYSTAL_5"))) bB=TRUE;
|
|
if (nN<1) nN=1;
|
|
oOb=GetNearestObject(OBJECT_TYPE_PLACEABLE,oChampion,nN);
|
|
while(GetIsObjectValid(oOb)&&GetDistanceBetween(oOb,oChampion)<20.0)
|
|
{ // search placeables
|
|
sS=GetTag(oOb);
|
|
SetIdentified(oItem,TRUE);
|
|
if (sS=="RTS_POWER_RES")
|
|
{ // power reservoir ---------------------------------------
|
|
|
|
} // power reservoir ---------------------------------------
|
|
else if (sS=="pileogold")
|
|
{ // pile of gold
|
|
ApplyEffectToObject(DURATION_TYPE_TEMPORARY,eVFX,oOb,1.9);
|
|
oItem=GetFirstItemInInventory(oOb);
|
|
nSearchParm=GetItemStackSize(oItem);
|
|
if (GetIsObjectValid(oItem)) oCopy=CopyItem(oItem,oChampion,TRUE);
|
|
DestroyObject(oItem);
|
|
DelayCommand(2.0,DestroyObject(oOb));
|
|
GiveGoldToCreature(oChampion,nSearchParm);
|
|
} // pile of gold
|
|
else if (GetHasInventory(oOb))
|
|
{ // container
|
|
ApplyEffectToObject(DURATION_TYPE_TEMPORARY,eVFX,oOb,1.9);
|
|
oItem=GetFirstItemInInventory(oOb);
|
|
while(GetIsObjectValid(oItem))
|
|
{ // items
|
|
oCopy=CopyObject(oItem,GetLocation(oOb));
|
|
DelayCommand(0.2,DestroyObject(oItem));
|
|
oItem=GetNextItemInInventory(oOb);
|
|
} // items
|
|
if(!GetPlotFlag(oOb)) DelayCommand(3.0,DestroyObject(oOb));
|
|
} // container
|
|
else if (!bB&&(sS=="ManaPool"||sS=="MinorManaPool"||sS=="StrongManaPool"))
|
|
{ // mana pools
|
|
ApplyEffectToObject(DURATION_TYPE_TEMPORARY,eVFX,oOb,1.9);
|
|
DelayCommand(2.0,DestroyObject(oOb));
|
|
bB=TRUE;
|
|
if (sS=="ManaPool") oItem=CreateItemOnObject("mana_crystal_2",oChampion);
|
|
else if (sS=="MinorManaPool") oItem=CreateItemOnObject("mana_crystal_1",oChampion);
|
|
else if (sS=="StrongManaPool") oItem=CreateItemOnObject("mana_crystal_5",oChampion);
|
|
} // mana pools
|
|
nN++;
|
|
oOb=GetNearestObject(OBJECT_TYPE_PLACEABLE,oChampion,nN);
|
|
} // search placeables
|
|
SetLocalInt(oChampion,"nSearchMode",1);
|
|
} // search for placeables
|
|
else if (nSearchMode==1)
|
|
{ // search for items
|
|
Champion_Debug(oChampion," Items");
|
|
bB=FALSE;
|
|
if(GetIsObjectValid(GetItemPossessedBy(oChampion,"MANA_CRYSTAL_1"))) bB=TRUE;
|
|
else if(GetIsObjectValid(GetItemPossessedBy(oChampion,"MANA_CRYSTAL_2"))) bB=TRUE;
|
|
else if(GetIsObjectValid(GetItemPossessedBy(oChampion,"MANA_CRYSTAL_5"))) bB=TRUE;
|
|
nN=1;
|
|
oItem=GetNearestObject(OBJECT_TYPE_ITEM,oChampion,nN);
|
|
object oGuardian=GetNearestCreature(CREATURE_TYPE_IS_ALIVE,TRUE,oItem);
|
|
while(GetIsObjectValid(oItem)&&GetDistanceBetween(oItem,oChampion)<20.0)
|
|
{ // search items
|
|
if (GetIsObjectValid(oGuardian)&&GetDistanceBetween(oGuardian,oItem)<3.0&&GetIsEnemy(oGuardian,oChampion))
|
|
{ // do not pickup - guardian present
|
|
} // do not pickup - guardian present
|
|
else if (GetPlotFlag(oItem))
|
|
{ // artifact pick up
|
|
ApplyEffectToObject(DURATION_TYPE_TEMPORARY,eVFX,oItem,1.9);
|
|
oCopy=CopyItem(oItem,oChampion,TRUE);
|
|
DelayCommand(2.0,DestroyObject(oItem));
|
|
} // artifact pick up
|
|
else
|
|
{ // other stuff
|
|
sS=GetTag(oItem);
|
|
nBT=GetBaseItemType(oItem);
|
|
if (nBT==BASE_ITEM_AMULET||nBT==BASE_ITEM_GEM||nBT==BASE_ITEM_POTIONS||nBT==BASE_ITEM_RING)
|
|
{ // pick up items
|
|
ApplyEffectToObject(DURATION_TYPE_TEMPORARY,eVFX,oItem,1.9);
|
|
oCopy=CopyItem(oItem,oChampion,TRUE);
|
|
SetIdentified(oCopy,TRUE);
|
|
DelayCommand(2.0,DestroyObject(oItem));
|
|
} // pick up items
|
|
else if (nBT==BASE_ITEM_GOLD)
|
|
{ // gold
|
|
nBT=GetItemStackSize(oItem);
|
|
GiveGoldToCreature(oChampion,nBT);
|
|
ApplyEffectToObject(DURATION_TYPE_TEMPORARY,eVFX,oItem,1.9);
|
|
DelayCommand(2.0,DestroyObject(oItem));
|
|
} // gold
|
|
else if (nBT==BASE_ITEM_ARMOR)
|
|
{ // armor
|
|
SetIdentified(oItem,TRUE);
|
|
if(GetGoldPieceValue(oItem)>GetGoldPieceValue(GetItemInSlot(INVENTORY_SLOT_CHEST,oChampion)))
|
|
{ // armor is worth more than what I am wearing
|
|
ApplyEffectToObject(DURATION_TYPE_TEMPORARY,eVFX,oItem,1.9);
|
|
oCopy=CopyItem(oItem,oChampion,TRUE);
|
|
DelayCommand(2.0,DestroyObject(oItem));
|
|
} // armor is worth more than what I am wearing
|
|
SetIdentified(oItem,FALSE);
|
|
} // armor
|
|
else if (nBT==BASE_ITEM_SPELLSCROLL||nBT==BASE_ITEM_SCROLL)
|
|
{ // scroll
|
|
ApplyEffectToObject(DURATION_TYPE_TEMPORARY,eVFX,oItem,1.9);
|
|
oCopy=CopyItem(oItem,oChampion,TRUE);
|
|
SetIdentified(oCopy,TRUE);
|
|
DelayCommand(2.0,DestroyObject(oItem));
|
|
} // scroll
|
|
else if (sS=="SoulToken")
|
|
{ // pick up
|
|
ApplyEffectToObject(DURATION_TYPE_TEMPORARY,eVFX,oItem,1.9);
|
|
oCopy=CopyItem(oItem,oChampion);
|
|
DelayCommand(2.0,DestroyObject(oItem));
|
|
} // pick up
|
|
else if (sS=="MANA_CRYSTAL_1"||sS=="MANA_CRYSTAL_2"||sS=="MANA_CRYSTAL_5")
|
|
{ // pick up or convert back to a mana pool
|
|
if (bB)
|
|
{ // already carrying crystal
|
|
if (sS=="MANA_CRYSTAL_2") oCopy=CreateObject(OBJECT_TYPE_PLACEABLE,"ManaPool",GetLocation(oItem));
|
|
else if (sS=="MANA_CRYSTAL_1") oCopy=CreateObject(OBJECT_TYPE_PLACEABLE,"MinorManaPool",GetLocation(oItem));
|
|
else if (sS=="MANA_CRYSTAL_5") oCopy=CreateObject(OBJECT_TYPE_PLACEABLE,"StrongManaPool",GetLocation(oItem));
|
|
DelayCommand(1.0,DestroyObject(oItem));
|
|
} // already carrying crystal
|
|
else
|
|
{ // pick up
|
|
ApplyEffectToObject(DURATION_TYPE_TEMPORARY,eVFX,oItem,1.9);
|
|
oCopy=CopyItem(oItem,oChampion);
|
|
DelayCommand(2.0,DestroyObject(oItem));
|
|
bB=TRUE;
|
|
} // pick up
|
|
} // pick up or convert back to a mana pool
|
|
else if (GetGoldPieceValue(oItem)<10)
|
|
{ // destroy
|
|
GiveGoldToCreature(oChampion,GetGoldPieceValue(oItem)/4);
|
|
DelayCommand(1.0,DestroyObject(oItem));
|
|
} // destroy
|
|
} // other stuff
|
|
SetIdentified(oItem,FALSE);
|
|
nN++;
|
|
oItem=GetNearestObject(OBJECT_TYPE_ITEM,oChampion,nN);
|
|
oGuardian=GetNearestCreature(CREATURE_TYPE_IS_ALIVE,TRUE,oItem);
|
|
} // search items
|
|
SetLocalInt(oChampion,"nSearchMode",2);
|
|
} // search for items
|
|
else if (nSearchMode==2)
|
|
{ // search for npcs
|
|
Champion_Debug(oChampion," NPCs");
|
|
nN=1;
|
|
oOb=GetNearestCreature(CREATURE_TYPE_IS_ALIVE,TRUE,oChampion,nN,CREATURE_TYPE_PERCEPTION,PERCEPTION_SEEN);
|
|
while(GetIsObjectValid(oOb))
|
|
{ // go through creatures that can be seen
|
|
sS=GetTag(oOb);
|
|
if (sS=="Rotund")
|
|
{ // trade with rotund
|
|
privateRotund(oChampion,oOb);
|
|
} // trade with rotund
|
|
else if (sS=="Smith")
|
|
{ // trade with smith
|
|
privateSmith(oChampion,oOb);
|
|
} // trade with smith
|
|
else if (sS=="Fence")
|
|
{ // trade with fence
|
|
} // trade with fence
|
|
else if (sS=="Apothecary")
|
|
{ // trade with apothecary
|
|
privateApothecary(oChampion,oOb);
|
|
} // trade with apothecary
|
|
else if (sS=="Healer")
|
|
{ // get healed
|
|
privateHealer(oChampion,oOb);
|
|
} // get healed
|
|
nN++;
|
|
oOb=GetNearestCreature(CREATURE_TYPE_IS_ALIVE,TRUE,oChampion,nN,CREATURE_TYPE_PERCEPTION,PERCEPTION_SEEN);
|
|
} // go through creatures that can be seen
|
|
SetLocalInt(oChampion,"nSearchMode",3);
|
|
nN=GetLocalInt(oChampion,"nPathMode");
|
|
if(privateHas_ManaCrystal(oChampion)&&nN!=0&&nN!=CHAMPION_PATH_RETURN&&!GetLocalInt(GetArea(oChampion),"bOP"))
|
|
{ // we need to return home with these mana crystals
|
|
DelayCommand(0.3,Champion_ResetPathing(oChampion));
|
|
} // we need to return home with these mana crystals
|
|
} // search for npcs
|
|
} // Champion_Search()
|
|
|
|
|
|
void Champion_LevelUp(object oChampion)
|
|
{ // PURPOSE: To levelup the champion if appropriate
|
|
// Version History
|
|
// mm/dd/yyyy | Modified By | Description
|
|
// 09/20/2006 | Deva B. Winblood | Initial version of this function
|
|
object oNext;
|
|
object oItem;
|
|
string sRes;
|
|
string sID=GetLocalString(oChampion,"sTeamID");
|
|
int nLevel=GetLevelByPosition(1,oChampion)+GetLevelByPosition(2,oChampion)+GetLevelByPosition(3,oChampion);
|
|
int nXP=GetLocalInt(oChampion,"nXP");
|
|
effect eGhost=EffectCutsceneGhost();
|
|
object oCopy;
|
|
Champion_Debug(oChampion,"Champion_LevelUp(XP:"+IntToString(nXP)+" CURRENT LEVEL:"+IntToString(nLevel)+")");
|
|
if (nXP>nLevel*500)
|
|
{ // level
|
|
fnDMSpeak(oChampion,"I have increased in power.",TRUE);
|
|
nXP=nXP-(nLevel*500);
|
|
SetLocalInt(oChampion,"nXP",nXP);
|
|
nLevel++;
|
|
sRes=sID+"_champ"+IntToString(nLevel-3);
|
|
sRes=GetStringLowerCase(sRes);
|
|
ApplyEffectToObject(DURATION_TYPE_TEMPORARY,eGhost,oChampion,10.0);
|
|
oNext=CreateObject(OBJECT_TYPE_CREATURE,sRes,GetLocation(oChampion));
|
|
if (GetIsObjectValid(oNext))
|
|
{ // creature created
|
|
Champion_Debug(oNext," Leveled to Level:"+IntToString(nLevel));
|
|
SetLocalInt(oNext,"nXP",nXP);
|
|
oItem=GetLocalObject(oChampion,"oPathDest");
|
|
SetLocalObject(oNext,"oPathDest",oItem);
|
|
nXP=GetLocalInt(oChampion,"nPathPosition_EXP");
|
|
SetLocalInt(oNext,"nPathPosition_EXP",nXP);
|
|
nXP=GetLocalInt(oChampion,"nPathPosition_CON");
|
|
SetLocalInt(oNext,"nPathPosition_CON",nXP);
|
|
nXP=GetLocalInt(oChampion,"nPathPosition_ASS");
|
|
SetLocalInt(oNext,"nPathPosition_ASS",nXP);
|
|
nXP=GetLocalInt(oChampion,"nPathPosition_ESC");
|
|
SetLocalInt(oNext,"nPathPosition_ESC",nXP);
|
|
nXP=GetLocalInt(oChampion,"nPathMode");
|
|
SetLocalInt(oNext,"nPathMode",nXP);
|
|
oItem=GetFirstItemInInventory(oChampion);
|
|
while(GetIsObjectValid(oItem))
|
|
{ // copy inventory
|
|
oCopy=CopyItem(oItem,oNext,TRUE);
|
|
DelayCommand(0.6,DestroyObject(oItem));
|
|
oItem=GetNextItemInInventory(oChampion);
|
|
} // copy inventory
|
|
SetAILevel(oNext,AI_LEVEL_HIGH);
|
|
AssignCommand(oNext,ClearAllActions());
|
|
AssignCommand(oNext,SetIsDestroyable(FALSE,TRUE,TRUE));
|
|
oItem=GetItemInSlot(INVENTORY_SLOT_ARMS,oChampion);
|
|
if (GetIsObjectValid(oItem))
|
|
{ // copy and equip
|
|
oCopy=CopyItem(oItem,oNext,TRUE);
|
|
DelayCommand(0.7,DestroyObject(oItem));
|
|
AssignCommand(oNext,ActionEquipItem(oItem,INVENTORY_SLOT_ARMS));
|
|
} // copy and equip
|
|
oItem=GetItemInSlot(INVENTORY_SLOT_ARROWS,oChampion);
|
|
if (GetIsObjectValid(oItem))
|
|
{ // copy and equip
|
|
oCopy=CopyItem(oItem,oNext,TRUE);
|
|
DelayCommand(0.7,DestroyObject(oItem));
|
|
AssignCommand(oNext,ActionEquipItem(oItem,INVENTORY_SLOT_ARROWS));
|
|
} // copy and equip
|
|
oItem=GetItemInSlot(INVENTORY_SLOT_BELT,oChampion);
|
|
if (GetIsObjectValid(oItem))
|
|
{ // copy and equip
|
|
oCopy=CopyItem(oItem,oNext,TRUE);
|
|
DelayCommand(0.7,DestroyObject(oItem));
|
|
AssignCommand(oNext,ActionEquipItem(oItem,INVENTORY_SLOT_BELT));
|
|
} // copy and equip
|
|
oItem=GetItemInSlot(INVENTORY_SLOT_BOLTS,oChampion);
|
|
if (GetIsObjectValid(oItem))
|
|
{ // copy and equip
|
|
oCopy=CopyItem(oItem,oNext,TRUE);
|
|
DelayCommand(0.7,DestroyObject(oItem));
|
|
AssignCommand(oNext,ActionEquipItem(oItem,INVENTORY_SLOT_BOLTS));
|
|
} // copy and equip
|
|
oItem=GetItemInSlot(INVENTORY_SLOT_BOOTS,oChampion);
|
|
if (GetIsObjectValid(oItem))
|
|
{ // copy and equip
|
|
oCopy=CopyItem(oItem,oNext,TRUE);
|
|
DelayCommand(0.7,DestroyObject(oItem));
|
|
AssignCommand(oNext,ActionEquipItem(oItem,INVENTORY_SLOT_BOOTS));
|
|
} // copy and equip
|
|
oItem=GetItemInSlot(INVENTORY_SLOT_BULLETS,oChampion);
|
|
if (GetIsObjectValid(oItem))
|
|
{ // copy and equip
|
|
oCopy=CopyItem(oItem,oNext,TRUE);
|
|
DelayCommand(0.7,DestroyObject(oItem));
|
|
AssignCommand(oNext,ActionEquipItem(oItem,INVENTORY_SLOT_BULLETS));
|
|
} // copy and equip
|
|
oItem=GetItemInSlot(INVENTORY_SLOT_CHEST,oChampion);
|
|
if (GetIsObjectValid(oItem))
|
|
{ // copy and equip
|
|
oCopy=CopyItem(oItem,oNext,TRUE);
|
|
DelayCommand(0.7,DestroyObject(oItem));
|
|
AssignCommand(oNext,ActionEquipItem(oItem,INVENTORY_SLOT_CHEST));
|
|
} // copy and equip
|
|
oItem=GetItemInSlot(INVENTORY_SLOT_CLOAK,oChampion);
|
|
if (GetIsObjectValid(oItem))
|
|
{ // copy and equip
|
|
oCopy=CopyItem(oItem,oNext,TRUE);
|
|
DelayCommand(0.7,DestroyObject(oItem));
|
|
AssignCommand(oNext,ActionEquipItem(oItem,INVENTORY_SLOT_CLOAK));
|
|
} // copy and equip
|
|
oItem=GetItemInSlot(INVENTORY_SLOT_HEAD,oChampion);
|
|
if (GetIsObjectValid(oItem))
|
|
{ // copy and equip
|
|
oCopy=CopyItem(oItem,oNext,TRUE);
|
|
DelayCommand(0.7,DestroyObject(oItem));
|
|
AssignCommand(oNext,ActionEquipItem(oItem,INVENTORY_SLOT_HEAD));
|
|
} // copy and equip
|
|
oItem=GetItemInSlot(INVENTORY_SLOT_LEFTHAND,oChampion);
|
|
if (GetIsObjectValid(oItem))
|
|
{ // copy and equip
|
|
oCopy=CopyItem(oItem,oNext,TRUE);
|
|
DelayCommand(0.7,DestroyObject(oItem));
|
|
AssignCommand(oNext,ActionEquipItem(oItem,INVENTORY_SLOT_LEFTHAND));
|
|
} // copy and equip
|
|
oItem=GetItemInSlot(INVENTORY_SLOT_LEFTRING,oChampion);
|
|
if (GetIsObjectValid(oItem))
|
|
{ // copy and equip
|
|
oCopy=CopyItem(oItem,oNext,TRUE);
|
|
DelayCommand(0.7,DestroyObject(oItem));
|
|
AssignCommand(oNext,ActionEquipItem(oItem,INVENTORY_SLOT_LEFTRING));
|
|
} // copy and equip
|
|
oItem=GetItemInSlot(INVENTORY_SLOT_NECK,oChampion);
|
|
if (GetIsObjectValid(oItem))
|
|
{ // copy and equip
|
|
oCopy=CopyItem(oItem,oNext,TRUE);
|
|
DelayCommand(0.7,DestroyObject(oItem));
|
|
AssignCommand(oNext,ActionEquipItem(oItem,INVENTORY_SLOT_NECK));
|
|
} // copy and equip
|
|
oItem=GetItemInSlot(INVENTORY_SLOT_RIGHTHAND,oChampion);
|
|
if (GetIsObjectValid(oItem))
|
|
{ // copy and equip
|
|
oCopy=CopyItem(oItem,oNext,TRUE);
|
|
DelayCommand(0.7,DestroyObject(oItem));
|
|
AssignCommand(oNext,ActionEquipItem(oItem,INVENTORY_SLOT_RIGHTHAND));
|
|
} // copy and equip
|
|
oItem=GetItemInSlot(INVENTORY_SLOT_RIGHTRING,oChampion);
|
|
if (GetIsObjectValid(oItem))
|
|
{ // copy and equip
|
|
oCopy=CopyItem(oItem,oNext,TRUE);
|
|
DelayCommand(0.7,DestroyObject(oItem));
|
|
AssignCommand(oNext,ActionEquipItem(oItem,INVENTORY_SLOT_RIGHTRING));
|
|
} // copy and equip
|
|
AssignCommand(oChampion,SetIsDestroyable(TRUE,FALSE,FALSE));
|
|
DelayCommand(0.9,DestroyObject(oChampion));
|
|
nXP=GetGold(oChampion);
|
|
if (GetGold(oNext)<nXP)
|
|
{ // give gold
|
|
nXP=nXP-GetGold(oNext);
|
|
GiveGoldToCreature(oNext,nXP);
|
|
} // give gold
|
|
} // creature created
|
|
} // level
|
|
} // Champion_LevelUp()
|
|
|
|
//void main(){}
|