本文整理汇总了C++中instance_onyxias_lair::SetData方法的典型用法代码示例。如果您正苦于以下问题:C++ instance_onyxias_lair::SetData方法的具体用法?C++ instance_onyxias_lair::SetData怎么用?C++ instance_onyxias_lair::SetData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类instance_onyxias_lair
的用法示例。
在下文中一共展示了instance_onyxias_lair::SetData方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Aggro
void Aggro(Unit* /*pWho*/) override
{
DoScriptText(SAY_AGGRO, m_creature);
if (m_pInstance)
m_pInstance->SetData(TYPE_ONYXIA, IN_PROGRESS);
}
示例2: JustDied
void JustDied(Unit* /*pKiller*/) override
{
if (m_pInstance)
{
m_pInstance->SetData(TYPE_ONYXIA, DONE);
}
}
示例3: JustReachedHome
void JustReachedHome() override
{
// in case evade in phase 2, see comments for hack where phase 2 is set
m_creature->SetLevitate(false);
m_creature->SetByteFlag(UNIT_FIELD_BYTES_1, 3, 0);
if (m_pInstance)
m_pInstance->SetData(TYPE_ONYXIA, FAIL);
}
示例4: UpdateAI
//.........这里部分代码省略.........
SetCombatMovement(false);
m_creature->GetMotionMaster()->MoveIdle();
m_creature->SetTarget(nullptr);
float fGroundZ = m_creature->GetMap()->GetHeight(aMoveData[POINT_ID_SOUTH].fX, aMoveData[POINT_ID_SOUTH].fY, aMoveData[POINT_ID_SOUTH].fZ);
m_creature->GetMotionMaster()->MovePoint(POINT_ID_LIFTOFF, aMoveData[POINT_ID_SOUTH].fX, aMoveData[POINT_ID_SOUTH].fY, fGroundZ);
return;
}
DoMeleeAttackIfReady();
break;
}
case PHASE_BREATH:
{
if (m_creature->GetHealthPercent() < 40.0f)
{
m_uiPhase = PHASE_BREATH_POST;
DoScriptText(SAY_PHASE_3_TRANS, m_creature);
m_uiSummonWhelpsTimer = 0; // End of Onyxian Whelps summoning
float fGroundZ = m_creature->GetMap()->GetHeight(m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ());
m_creature->GetMotionMaster()->MoveFlyOrLand(POINT_ID_LAND, m_creature->GetPositionX(), m_creature->GetPositionY(), fGroundZ, false);
return;
}
if (m_uiMovementTimer < uiDiff)
{
// 3 possible actions
switch (urand(0, 2))
{
case 0: // breath
DoScriptText(EMOTE_BREATH, m_creature);
DoCastSpellIfCan(m_creature, aMoveData[m_uiMovePoint].uiSpellId, CAST_INTERRUPT_PREVIOUS);
m_uiMovePoint += NUM_MOVE_POINT / 2;
m_uiMovePoint %= NUM_MOVE_POINT;
m_uiMovementTimer = 25000;
return;
case 1: // a point on the left side
{
// C++ is stupid, so add -1 with +7
m_uiMovePoint += NUM_MOVE_POINT - 1;
m_uiMovePoint %= NUM_MOVE_POINT;
break;
}
case 2: // a point on the right side
++m_uiMovePoint %= NUM_MOVE_POINT;
break;
}
m_uiMovementTimer = urand(15000, 25000);
m_creature->GetMotionMaster()->MovePoint(m_uiMovePoint, aMoveData[m_uiMovePoint].fX, aMoveData[m_uiMovePoint].fY, aMoveData[m_uiMovePoint].fZ);
}
else
m_uiMovementTimer -= uiDiff;
if (m_uiFireballTimer < uiDiff)
{
if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0))
{
if (DoCastSpellIfCan(pTarget, SPELL_FIREBALL) == CAST_OK)
m_uiFireballTimer = urand(3000, 5000);
}
}
else
m_uiFireballTimer -= uiDiff; // engulfingflames is supposed to be activated by a fireball but haven't come by
break;
}
default: // Phase-switching phases
if (!m_uiPhaseTimer)
break;
if (m_uiPhaseTimer <= uiDiff)
{
switch (m_uiPhase)
{
case PHASE_TO_LIFTOFF:
m_uiPhase = PHASE_BREATH_PRE;
// Initial Onyxian Whelps spawn
m_uiSummonWhelpsTimer = 3000;
if (m_pInstance)
m_pInstance->SetData(TYPE_ONYXIA, DATA_LIFTOFF);
m_creature->GetMotionMaster()->MoveFlyOrLand(POINT_ID_IN_AIR, aMoveData[POINT_ID_SOUTH].fX, aMoveData[POINT_ID_SOUTH].fY, aMoveData[POINT_ID_SOUTH].fZ, true);
break;
case PHASE_BREATH_PRE:
m_creature->GetMotionMaster()->MovePoint(POINT_ID_INIT_NORTH, aMoveData[POINT_ID_NORTH].fX, aMoveData[POINT_ID_NORTH].fY, aMoveData[POINT_ID_NORTH].fZ);
break;
case PHASE_BREATH_POST:
m_uiPhase = PHASE_END;
m_creature->SetTarget(m_creature->getVictim());
SetCombatMovement(true, true);
DoCastSpellIfCan(m_creature, SPELL_BELLOWINGROAR);
break;
}
m_uiPhaseTimer = 0;
}
else
m_uiPhaseTimer -= uiDiff;
break;
}
}
示例5: UpdateAI
//.........这里部分代码省略.........
m_uiMovePoint %= NUM_MOVE_POINT;
m_uiMovementTimer = 25000;
return;
case 1: // a point on the left side
{
// C++ is stupid, so add -1 with +7
m_uiMovePoint += NUM_MOVE_POINT - 1;
m_uiMovePoint %= NUM_MOVE_POINT;
break;
}
case 2: // a point on the right side
++m_uiMovePoint %= NUM_MOVE_POINT;
break;
}
m_uiMovementTimer = urand(15000, 25000);
m_creature->GetMotionMaster()->MovePoint(m_uiMovePoint, aMoveData[m_uiMovePoint].fX, aMoveData[m_uiMovePoint].fY, aMoveData[m_uiMovePoint].fZ);
}
else
{
m_uiMovementTimer -= uiDiff;
}
if (m_uiFireballTimer < uiDiff)
{
if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0))
{
if (DoCastSpellIfCan(pTarget, SPELL_FIREBALL) == CAST_OK)
{
m_uiFireballTimer = urand(3000, 5000);
}
}
}
else
{
m_uiFireballTimer -= uiDiff; // engulfingflames is supposed to be activated by a fireball but haven't come by
}
if (m_bIsSummoningWhelps)
{
if (DidSummonWhelps(uiDiff))
{
m_bIsSummoningWhelps = false;
m_uiSummonCount = 0;
m_uiSummonWhelpsTimer = 80000; // 90s - 10s for summoning
}
}
else
{
if (m_uiSummonWhelpsTimer < uiDiff)
{
m_bIsSummoningWhelps = true;
}
else
{
m_uiSummonWhelpsTimer -= uiDiff;
}
}
break;
}
case PHASE_BREATH_PRE: // Summon first rounds of whelps
DidSummonWhelps(uiDiff);
// no break here
default: // Phase-switching phases
if (!m_uiPhaseTimer)
{
break;
}
if (m_uiPhaseTimer <= uiDiff)
{
switch (m_uiPhase)
{
case PHASE_TO_LIFTOFF:
m_uiPhase = PHASE_BREATH_PRE;
if (m_pInstance)
{
m_pInstance->SetData(TYPE_ONYXIA, DATA_LIFTOFF);
}
m_creature->GetMotionMaster()->MoveFlyOrLand(POINT_ID_IN_AIR, aMoveData[POINT_ID_SOUTH].fX, aMoveData[POINT_ID_SOUTH].fY, aMoveData[POINT_ID_SOUTH].fZ, true);
break;
case PHASE_BREATH_PRE:
m_creature->GetMotionMaster()->MovePoint(POINT_ID_INIT_NORTH, aMoveData[POINT_ID_NORTH].fX, aMoveData[POINT_ID_NORTH].fY, aMoveData[POINT_ID_NORTH].fZ);
break;
case PHASE_BREATH_POST:
m_uiPhase = PHASE_END;
m_creature->SetTargetGuid(m_creature->getVictim()->GetObjectGuid());
SetCombatMovement(true, true);
DoCastSpellIfCan(m_creature, SPELL_BELLOWINGROAR);
break;
}
m_uiPhaseTimer = 0;
}
else
{
m_uiPhaseTimer -= uiDiff;
}
break;
}
}