本文整理汇总了C++中LPCHARACTER::SetRotationToXY方法的典型用法代码示例。如果您正苦于以下问题:C++ LPCHARACTER::SetRotationToXY方法的具体用法?C++ LPCHARACTER::SetRotationToXY怎么用?C++ LPCHARACTER::SetRotationToXY使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LPCHARACTER
的用法示例。
在下文中一共展示了LPCHARACTER::SetRotationToXY方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: battle_melee_attack
int battle_melee_attack(LPCHARACTER ch, LPCHARACTER victim)
{
if (test_server&&ch->IsPC())
sys_log(0, "battle_melee_attack : [%s] attack to [%s]", ch->GetName(), victim->GetName());
if (!victim || ch == victim)
return BATTLE_NONE;
if (test_server&&ch->IsPC())
sys_log(0, "battle_melee_attack : [%s] attack to [%s]", ch->GetName(), victim->GetName());
if (!battle_is_attackable(ch, victim))
return BATTLE_NONE;
if (test_server&&ch->IsPC())
sys_log(0, "battle_melee_attack : [%s] attack to [%s]", ch->GetName(), victim->GetName());
// 거리 체크
int distance = DISTANCE_APPROX(ch->GetX() - victim->GetX(), ch->GetY() - victim->GetY());
if (!victim->IsBuilding())
{
int max = 300;
if (false == ch->IsPC())
{
// 몬스터의 경우 몬스터 공격 거리를 사용
max = (int) (ch->GetMobAttackRange() * 1.15f);
}
else
{
// PC일 경우 상대가 melee 몹일 경우 몹의 공격 거리가 최대 공격 거리
if (false == victim->IsPC() && BATTLE_TYPE_MELEE == victim->GetMobBattleType())
max = MAX(300, (int) (victim->GetMobAttackRange() * 1.15f));
}
if (distance > max)
{
if (test_server)
sys_log(0, "VICTIM_FAR: %s distance: %d max: %d", ch->GetName(), distance, max);
return BATTLE_NONE;
}
}
if (timed_event_cancel(ch))
ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("전투가 시작 되어 취소 되었습니다."));
if (timed_event_cancel(victim))
victim->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("전투가 시작 되어 취소 되었습니다."));
ch->SetPosition(POS_FIGHTING);
ch->SetVictim(victim);
const PIXEL_POSITION & vpos = victim->GetXYZ();
ch->SetRotationToXY(vpos.x, vpos.y);
int dam;
int ret = battle_hit(ch, victim, dam);
return (ret);
}
示例2: SendMessage
void CParty::SendMessage(LPCHARACTER ch, BYTE bMsg, DWORD dwArg1, DWORD dwArg2)
{
if (ch->GetParty() != this)
{
sys_err("%s is not member of this party %p", ch->GetName(), this);
return;
}
switch (bMsg)
{
case PM_ATTACK:
break;
case PM_RETURN:
{
TMemberMap::iterator it = m_memberMap.begin();
while (it != m_memberMap.end())
{
TMember & rMember = it->second;
++it;
LPCHARACTER pkChr;
if ((pkChr = rMember.pCharacter) && ch != pkChr)
{
DWORD x = dwArg1 + number(-500, 500);
DWORD y = dwArg2 + number(-500, 500);
pkChr->SetVictim(NULL);
pkChr->SetRotationToXY(x, y);
if (pkChr->Goto(x, y))
{
LPCHARACTER victim = pkChr->GetVictim();
sys_log(0, "%s %p RETURN victim %p", pkChr->GetName(), get_pointer(pkChr), get_pointer(victim));
pkChr->SendMovePacket(FUNC_WAIT, 0, 0, 0, 0);
}
}
}
}
break;
case PM_ATTACKED_BY: // 공격 받았음, 리더에게 도움을 요청
{
// 리더가 없을 때
LPCHARACTER pkChrVictim = ch->GetVictim();
if (!pkChrVictim)
return;
TMemberMap::iterator it = m_memberMap.begin();
while (it != m_memberMap.end())
{
TMember & rMember = it->second;
++it;
LPCHARACTER pkChr;
if ((pkChr = rMember.pCharacter) && ch != pkChr)
{
if (pkChr->CanBeginFight())
pkChr->BeginFight(pkChrVictim);
}
}
}
break;
case PM_AGGRO_INCREASE:
{
LPCHARACTER victim = CHARACTER_MANAGER::instance().Find(dwArg2);
if (!victim)
return;
TMemberMap::iterator it = m_memberMap.begin();
while (it != m_memberMap.end())
{
TMember & rMember = it->second;
++it;
LPCHARACTER pkChr;
if ((pkChr = rMember.pCharacter) && ch != pkChr)
{
pkChr->UpdateAggrPoint(victim, DAMAGE_TYPE_SPECIAL, dwArg1);
}
}
}
break;
}
}