*EventAI update:

ACTION_T_SET_ACTIVE             = 101,  //Apply
    ACTION_T_SET_AGGRESSIVE         = 102,  //Apply
    ACTION_T_ATTACK_START_PULSE     = 103,  //Distance

--HG--
branch : trunk
This commit is contained in:
megamage
2008-11-21 16:17:51 -06:00
parent e9d6f1b23a
commit b063480b3f
2 changed files with 26 additions and 21 deletions

View File

@@ -6,12 +6,12 @@
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/* ScriptData
@@ -965,6 +965,17 @@ struct TRINITY_DLL_DECL Mob_EventAI : public ScriptedAI
DoZoneInCombat();
}
break;
// TRINITY ONLY
case ACTION_T_SET_ACTIVE:
m_creature->setActive(param1 ? true : false);
break;
case ACTION_T_SET_AGGRESSIVE:
m_creature->SetAggressive(param1 ? true : false);
break;
case ACTION_T_ATTACK_START_PULSE:
AttackStart(m_creature->SelectNearestTarget((float)param1));
break;
}
}
@@ -1192,24 +1203,12 @@ struct TRINITY_DLL_DECL Mob_EventAI : public ScriptedAI
}
}
if (m_creature->isCivilian() && m_creature->IsNeutralToAll())
return;
// do we need this?
//if (m_creature->isCivilian() && m_creature->IsNeutralToAll())
// return;
if (m_creature->canAttack(who) && who->isInAccessiblePlaceFor(m_creature) && m_creature->IsHostileTo(who))
{
if (!m_creature->canFly() && m_creature->GetDistanceZ(who) > CREATURE_Z_ATTACK_RANGE)
return;
float attackRadius = m_creature->GetAttackDistance(who);
if (m_creature->IsWithinDistInMap(who, attackRadius) && m_creature->IsWithinLOSInMap(who))
{
//if(who->HasStealthAura())
// who->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH);
//Begin melee attack if we are within range
AttackStart(who);
}
}
if(m_creature->canStartAttack(who))
AttackStart(who);
}
void SpellHit(Unit* pUnit, const SpellEntry* pSpell)
@@ -1292,6 +1291,7 @@ struct TRINITY_DLL_DECL Mob_EventAI : public ScriptedAI
//Do not decrement timers if event cannot trigger in this phase
if (!((*i).Event.event_inverse_phase_mask & (1 << Phase)))
(*i).Time -= EventDiff;
//Skip processing of events that have time remaining
continue;
}
@@ -1328,6 +1328,7 @@ struct TRINITY_DLL_DECL Mob_EventAI : public ScriptedAI
//Melee Auto-Attack
if (Combat && MeleeEnabled)
DoMeleeAttackIfReady();
}
};

View File

@@ -1,6 +1,6 @@
/* Copyright (C) 2006 - 2008 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/>
* This program is free software licensed under GPL version 2
* Please see the included DOCS/LICENSE.TXT for more information */
* This program is free software licensed under GPL version 2
* Please see the included DOCS/LICENSE.TXT for more information */
#ifndef SC_EVENTAI_H
#define SC_EVENTAI_H
@@ -76,6 +76,10 @@ enum Action_Types
ACTION_T_DIE = 37, //No Params
ACTION_T_ZONE_COMBAT_PULSE = 38, //No Params
ACTION_T_SET_ACTIVE = 101, //Apply
ACTION_T_SET_AGGRESSIVE = 102, //Apply
ACTION_T_ATTACK_START_PULSE = 103, //Distance
ACTION_T_END,
};