本文整理汇总了C++中Creature::CastStop方法的典型用法代码示例。如果您正苦于以下问题:C++ Creature::CastStop方法的具体用法?C++ Creature::CastStop怎么用?C++ Creature::CastStop使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Creature
的用法示例。
在下文中一共展示了Creature::CastStop方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HandleAnimation
//.........这里部分代码省略.........
me->GetMotionMaster()->MoveCharge(-8113, 1525, 2.77f, 8);
break;//both run to the gate
case 33:
Talk(ANACHRONOS_SAY_4);
Caelestrasz->GetMotionMaster()->MoveCharge(-8050, 1473, 65, 15);
break; //Text: sands will stop
case 34:
DoCast(player, 23017, true);//Arcane Channeling
break;
case 35:
me->CastSpell(-8088, 1520.43f, 2.67f, 25158, true);
break;
case 36:
DoCast(player, 25159, true);
break;
case 37:
me->SummonGameObject(GO_GATE_OF_AHN_QIRAJ, -8130, 1525, 17.5f, 0, 0, 0, 0, 0, 0);
break;
case 38:
DoCast(player, 25166, true);
me->SummonGameObject(GO_GLYPH_OF_AHN_QIRAJ, -8130, 1525, 17.5f, 0, 0, 0, 0, 0, 0);
break;
case 39:
Talk(ANACHRONOS_SAY_5, Fandral->GetGUID());
break;
case 40:
Fandral->CastSpell(me, 25167, true);
break;
case 41:
Fandral->SummonGameObject(GO_ROOTS_OF_AHN_QIRAJ, -8130, 1525, 17.5f, 0, 0, 0, 0, 0, 0);
Fandral->AI()->Talk(FANDRAL_SAY_3);
break;
case 42:
me->CastStop();
Fandral->AI()->Talk(FANDRAL_EMOTE_1);
break;
case 43:
Fandral->CastStop();
break;
case 44:
Talk(ANACHRONOS_SAY_6);
break;
case 45:
Talk(ANACHRONOS_SAY_7);
break;
case 46:
Talk(ANACHRONOS_SAY_8);
me->GetMotionMaster()->MoveCharge(-8110, 1527, 2.77f, 4);
break;
case 47:
Talk(ANACHRONOS_EMOTE_1);
break;
case 48:
Fandral->AI()->Talk(FANDRAL_SAY_4, me->GetGUID());
break;
case 49:
Fandral->AI()->Talk(FANDRAL_SAY_5, me->GetGUID());
break;
case 50:
Fandral->AI()->Talk(FANDRAL_EMOTE_2);
Fandral->CastSpell(-8127, 1525, 17.5f, 33806, true);
break;
case 51:
{
uint32 entries[4] = { 15423, 15424, 15414, 15422 };
Unit* mob = NULL;
示例2: init
void
RandomMovementGenerator<Creature>::_setRandomLocation(Creature& creature)
{
if (creature.HasUnitState(UNIT_STATE_CASTING) && !creature.CanMoveDuringChannel())
{
creature.CastStop();
return;
}
float X, Y, Z, nx, ny, nz, ori, dist;
creature.GetHomePosition(X, Y, Z, ori);
Map const* map = creature.GetBaseMap();
// For 2D/3D system selection
//bool is_land_ok = creature.canWalk();
//bool is_water_ok = creature.canSwim();
bool is_air_ok = creature.canFly();
const float angle = rand_norm() * (M_PI * 2);
const float range = rand_norm() * wander_distance;
const float distanceX = range * cos(angle);
const float distanceY = range * sin(angle);
nx = X + distanceX;
ny = Y + distanceY;
// prevent invalid coordinates generation
Oregon::NormalizeMapCoord(nx);
Oregon::NormalizeMapCoord(ny);
dist = (nx - X) * (nx - X) + (ny - Y) * (ny - Y);
if (is_air_ok) // 3D system above ground and above water (flying mode)
{
// Limit height change
const float distanceZ = rand_norm() * sqrtf(dist) / 2.0f;
nz = Z + distanceZ;
float tz = map->GetHeight(nx, ny, nz - 2.0f, false); // Map check only, vmap needed here but need to alter vmaps checks for height.
float wz = map->GetWaterLevel(nx, ny);
// Problem here, we must fly above the ground and water, not under. Let's try on next tick
if (tz >= nz || wz >= nz)
return;
}
//else if (is_water_ok) // 3D system under water and above ground (swimming mode)
else // 2D only
{
dist = dist >= 100.0f ? 10.0f : sqrtf(dist); // 10.0 is the max that vmap high can check (MAX_CAN_FALL_DISTANCE)
// The fastest way to get an accurate result 90% of the time.
// Better result can be obtained like 99% accuracy with a ray light, but the cost is too high and the code is too long.
nz = map->GetHeight(nx, ny, Z + dist - 2.0f, false);
if (fabs(nz - Z) > dist) // Map check
{
nz = map->GetHeight(nx, ny, Z - 2.0f, true); // Vmap Horizontal or above
if (fabs(nz - Z) > dist)
{
// Vmap Higher
nz = map->GetHeight(nx, ny, Z + dist - 2.0f, true);
// let's forget this bad coords where a z cannot be find and retry at next tick
if (fabs(nz - Z) > dist)
return;
}
}
}
if (is_air_ok)
i_nextMoveTime.Reset(0);
else
{
if (roll_chance_i(MOVEMENT_RANDOM_MMGEN_CHANCE_NO_BREAK))
i_nextMoveTime.Reset(urand(5000, 10000));
else
i_nextMoveTime.Reset(urand(50, 400));
}
creature.AddUnitState(UNIT_STATE_ROAMING);
Movement::MoveSplineInit init(creature);
init.MoveTo(nx, ny, nz, true);
if (creature.IsPet() && creature.GetOwner() && !creature.IsWithinDist(creature.GetOwner(), PET_FOLLOW_DIST + 2.5f))
init.SetWalk(false);
else
init.SetWalk(true);
init.Launch();
if (roll_chance_i(MOVEMENT_RANDOM_MMGEN_CHANCE_NO_BREAK))
i_nextMoveTime.Reset(50);
else
i_nextMoveTime.Reset(urand(1500, 10000)); // Keep a short wait time
}