本文整理汇总了C++中Creature::CountPctFromMaxHealth方法的典型用法代码示例。如果您正苦于以下问题:C++ Creature::CountPctFromMaxHealth方法的具体用法?C++ Creature::CountPctFromMaxHealth怎么用?C++ Creature::CountPctFromMaxHealth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Creature
的用法示例。
在下文中一共展示了Creature::CountPctFromMaxHealth方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UpdateAI
void UpdateAI(uint32 diff)
{
moveTimer += diff;
if (moveTimer >= 1000)
{
moveTimer = 0;
Creature* Vorpil = ObjectAccessor::GetCreature(*me, VorpilGUID);
if (!Vorpil)
{
me->DespawnOrUnsummon();
return;
}
me->GetMotionMaster()->MoveFollow(Vorpil, 0.0f, 0.0f);
if (sacrificed)
{
me->AddAura(DUNGEON_MODE(SPELL_EMPOWERING_SHADOWS_N, SPELL_EMPOWERING_SHADOWS_H), Vorpil);
Vorpil->ModifyHealth(int32(Vorpil->CountPctFromMaxHealth(4)));
me->CastSpell(me, SPELL_SHADOW_NOVA, true);
Unit::Kill(me, me);
return;
}
if (me->IsWithinDist(Vorpil, 3.0f))
{
me->CastSpell(me, SPELL_SACRIFICE, false);
sacrificed = true;
moveTimer = 500;
}
}
}
示例2: JustDied
void JustDied(Unit* /*who*/)
{
for (int ni=0; ni<3; ++ni)
{
Creature* sent = Unit::GetCreature(*me, NearbyGUID[ni]);
if (!sent)
continue;
if (sent->isDead())
continue;
sent->ModifyHealth(int32(sent->CountPctFromMaxHealth(50)));
CAST_AI(aqsentinelAI, sent->AI())->GainSentinelAbility(ability);
}
}
示例3: JustDied
void JustDied(Unit* /*killer*/) override
{
for (int ni = 0; ni < 3; ++ni)
{
Creature* sent = ObjectAccessor::GetCreature(*me, NearbyGUID[ni]);
if (!sent)
continue;
if (sent->isDead())
continue;
sent->ModifyHealth(int32(sent->CountPctFromMaxHealth(50)));
ENSURE_AI(aqsentinelAI, sent->AI())->GainSentinelAbility(ability);
}
}
示例4: Reset
void Reset() {
me->SetReactState(REACT_PASSIVE);
if (oaf = (me->SummonCreature(NPC_LUMBERING_OAF, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0, TEMPSUMMON_MANUAL_DESPAWN)))
{
if (!me->GetVehicle() && oaf->IsVehicle() && oaf->GetVehicleKit()->HasEmptySeat(0))
{
me->EnterVehicle(oaf);
oaf->SetReactState(REACT_AGGRESSIVE);
oaf->SetHealth(oaf->CountPctFromMaxHealth(100));
oaf->GetMotionMaster()->MoveTargetedHome();
}
}
}
示例5: UpdateAI
void UpdateAI(uint32 const diff)
{
if (!VorpilGUID)
{
me->Kill(me);
return;
}
if (move <= diff)
{
Creature* Vorpil = Unit::GetCreature(*me, VorpilGUID);
if (!Vorpil)
{
VorpilGUID = 0;
return;
}
if (sacrificed)
{
if (Vorpil->isAlive())
{
me->AddAura(DUNGEON_MODE(SPELL_EMPOWERING_SHADOWS, H_SPELL_EMPOWERING_SHADOWS), Vorpil);
Vorpil->ModifyHealth(int32(Vorpil->CountPctFromMaxHealth(4)));
}
DoCast(me, SPELL_SHADOW_NOVA, true);
me->Kill(me);
return;
}
me->GetMotionMaster()->MoveFollow(Vorpil, 0, 0);
if (me->IsWithinDist(Vorpil, 3))
{
DoCast(me, SPELL_SACRIFICE, false);
sacrificed = true;
move = 500;
return;
}
if (!Vorpil->isInCombat() || Vorpil->isDead())
{
me->Kill(me);
return;
}
move = 1000;
}
else
move -= diff;
}
示例6: UpdateAI
void UpdateAI(const uint32 diff)
{
if(!UpdateVictimWithGaze() || !CheckInRoom())
return;
if(me->GetDistance(me->GetHomePosition()) > 80.0f)
{
EnterEvadeMode();
return;
}
events.Update(diff);
while(uint32 eventId = events.ExecuteEvent())
{
switch(eventId)
{
case EVENT_WOUND:
DoCast(me->getVictim(), SPELL_MORTAL_WOUND);
events.ScheduleEvent(EVENT_WOUND, 10000);
break;
case EVENT_ENRAGE:
DoCast(me, SPELL_ENRAGE);
events.ScheduleEvent(EVENT_ENRAGE, 15000);
break;
case EVENT_DECIMATE:
DoCastAOE(SPELL_DECIMATE);
events.ScheduleEvent(EVENT_DECIMATE, RAID_MODE(120000,90000));
for(std::list<uint64>::const_iterator itr = summons.begin(); itr != summons.end(); ++itr)
{
Creature* minion = Unit::GetCreature(*me, *itr);
if(minion && minion->isAlive())
{
int32 damage = int32(minion->GetHealth()) - int32(minion->CountPctFromMaxHealth(5));
if(damage > 0)
me->CastCustomSpell(28375, SPELLVALUE_BASE_POINT0, damage, minion, true);
AttackGluth(minion);
}
}
break;
case EVENT_BERSERK:
if(!me->HasAura(SPELL_BERSERK))
DoCast(me, SPELL_BERSERK);
events.ScheduleEvent(EVENT_BERSERK, 1*60000);
break;
case EVENT_SUMMON:
for(int32 i = 0; i < RAID_MODE(1, 2); ++i)
DoSummon(MOB_ZOMBIE, PosSummon[rand() % RAID_MODE(1,3)]);
events.ScheduleEvent(EVENT_SUMMON, 10000);
break;
}
}
if(me->getVictim() && me->getVictim()->GetEntry() == MOB_ZOMBIE)
{
if(me->IsWithinMeleeRange(me->getVictim()))
{
me->Kill(me->getVictim());
me->ModifyHealth(int32(me->CountPctFromMaxHealth(5)));
}
} else DoMeleeAttackIfReady();
}