54 lines
		
	
	
		
			2.7 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			54 lines
		
	
	
		
			2.7 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
| /*//////////////////////////////////////////////////////////////////////////////
 | |
|  Script Name: ai_a_taunter
 | |
| ////////////////////////////////////////////////////////////////////////////////
 | |
|  ai script for creatures using defined to use the taunt skill.
 | |
|  OBJECT_SELF is the creature running the ai.
 | |
| ////////////////////////////////////////////////////////////////////////////////
 | |
|  Programmer: Philos
 | |
| *///////////////////////////////////////////////////////////////////////////////
 | |
| #include "0i_actions"
 | |
| void main()
 | |
| {
 | |
|     object oCreature = OBJECT_SELF;
 | |
|     // Get the number of enemies that we are in melee combat with.
 | |
|     int nInMelee = ai_GetNumOfEnemiesInRange(oCreature);
 | |
|     //***************************  HEALING & CURES  ****************************
 | |
|     if(ai_TryHealingTalent(oCreature, nInMelee)) return;
 | |
|     if(ai_TryCureConditionTalent(oCreature, nInMelee)) return;
 | |
|     int nDifficulty = ai_GetDifficulty(oCreature);
 | |
|     int nMaxLevel;
 | |
|     // Check for moral and get the maximum spell level we should use.
 | |
|     if(nDifficulty >= AI_COMBAT_EFFORTLESS)
 | |
|     {
 | |
|         if(nInMelee && ai_MoralCheck(oCreature)) return;
 | |
|         nMaxLevel = ai_GetAssociateTalentMaxLevel(oCreature, nDifficulty);
 | |
|     }
 | |
|     // Skill, Class, Offensive AOE's, and Defensive talents.
 | |
|     if(nDifficulty >= AI_COMBAT_MODERATE)
 | |
|     {
 | |
|         //**************************  SKILL FEATURES  **************************
 | |
|         if(ai_TryAnimalEmpathy(oCreature)) return;
 | |
|         // ************************** CLASS FEATURES ***************************
 | |
|         if(ai_TryBarbarianRageFeat(oCreature)) return;
 | |
|         if(ai_TryBardSongFeat(oCreature)) return;
 | |
|         // *************************** SPELL TALENTS ***************************
 | |
|         if(ai_CheckForAssociateSpellTalent(oCreature, nInMelee, nMaxLevel)) return;
 | |
|     }
 | |
|     // Class and Offensive single target talents.
 | |
|     if(nDifficulty >= AI_COMBAT_EFFORTLESS)
 | |
|     {
 | |
|         // ************************** CLASS FEATURES ***************************
 | |
|         if(ai_TryTurningTalent(oCreature)) return;
 | |
|         // *************************** SPELL TALENTS ***************************
 | |
|         if(!ai_GetMagicMode(oCreature, AI_MAGIC_DEFENSIVE_CASTING))
 | |
|         {
 | |
|             if(nInMelee > 0 && ai_UseCreatureTalent(oCreature, AI_TALENT_TOUCH, nInMelee, nMaxLevel)) return;
 | |
|             if(ai_UseCreatureTalent(oCreature, AI_TALENT_RANGED, nInMelee, nMaxLevel)) return;
 | |
|         }
 | |
|     }
 | |
|     // Taunt the nearest target!
 | |
|     if (ai_TryTaunt (oCreature, ai_GetNearestTargetForMeleeCombat (oCreature, nInMelee))) return;
 | |
|     // PHYSICAL ATTACKS - Either we don't have talents or we are saving them.
 | |
|     ai_DoPhysicalAttackOnLowestCR(oCreature, nInMelee, !ai_GetAIMode(oCreature, AI_MODE_CHECK_ATTACK));
 | |
| }
 |