本文整理汇总了C++中CCharacter::GetAttackType方法的典型用法代码示例。如果您正苦于以下问题:C++ CCharacter::GetAttackType方法的具体用法?C++ CCharacter::GetAttackType怎么用?C++ CCharacter::GetAttackType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCharacter
的用法示例。
在下文中一共展示了CCharacter::GetAttackType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: do_Attack
//.........这里部分代码省略.........
#ifdef MONSTER_AI
if (tch != NULL && IS_NPC(tch))
{
CNPC * pTemp = TO_NPC(tch);
if (pTemp != NULL)
{
if (ch->m_level - tch->m_level <= 5 && pTemp->m_proto->m_index != 303 /*악마의 묘지*/)
{
bAttackedPet = true;
}
if (pTemp->m_bMoveLock || pTemp->m_bMoveToRegen)
{
pTemp->m_bMoveToRegen = false;
pTemp->m_bMoveLock = false;
pTemp->m_pulseMoveLock = 0;
pTemp->m_postregendelay = 0;
}
}
}
#else
if (tch != NULL && IS_NPC(tch) && ch->m_level - tch->m_level <= 5)
{
CNPC * pTemp = TO_NPC(tch);
if (pTemp != NULL && pTemp->m_proto->m_index != 303 /*악마의 묘지*/)
{
bAttackedPet = true;
}
}
#endif
}
listMultiTarget.insert(tch->m_index);
ret = ProcAttack(ch, tch, ch->GetAttackType(NULL), NULL, 0);
}
if (ret == -1 || tch->m_index == -1) // ProcAttack()안에서 Character 객체가 소멸된 경우도 포함
{
tch = NULL;
continue ;
}
//공격 발동형 스킬 추가
if( pc->m_optionAttSkillList.count() > 0 )
{
//공격 할 시에 적에게 스킬 적용
void* pos = pc->m_optionAttSkillList.GetHeadPosition();
bool bApply = false;
while (pos)
{
CSkill* skill = pc->m_passiveSkillList.GetNext(pos);
if (skill && skill->m_proto)
{
int rand = GetRandom(1, 10000);
if( rand < skill->m_optionSkillProb )
{
ApplySkill(ch, tch, skill, -1, bApply);
if(bApply == false)
{
GAMELOG << init("EVENT_PCBANG_2NDS SKILL FAILED (LOGIN) ", pc ) << end;// 스킬 적용 실패
}
}
}
}
}
示例2: do_pd_Attack
//.........这里部分代码省略.........
}
// multi target의 중복 검사
if (packet->multicount > 1)
{
std::set<int> tset;
for (int i = 0; i < packet->multicount; ++i)
{
if (tset.insert(packet->list[i].index).second == false)
{
LOG_ERROR("HACKING : duplicate multi target[%d]. charIndex[%d]", packet->list[i].index, pc->m_index);
pc->m_desc->Close("duplicate multi target");
return;
}
}
}
// 대상 검색 : 인접 셀에서만
CArea* area = pc->m_pArea;
if (area == NULL)
{
LOG_ERROR("HACKING : not found area. charIndex[%d]", pc->m_index);
pc->m_desc->Close("not found area");
return;
}
CCharacter* tch = area->FindCharInCell(pc, packet->tIndex, (MSG_CHAR_TYPE)packet->tCharType);
if (tch == NULL)
return;
int preIndex = -1;
for (int i = 0; i < packet->multicount; ++i)
{
if(preIndex == packet->list[i].index)
{
// 가까운 마을로
int nearZone;
int nearZonePos;
CZone* pZone = gserver->FindNearestZone(pc->m_pZone->m_index, GET_X(pc), GET_Z(pc), &nearZone, &nearZonePos);
if (pZone == NULL)
return;
GoZone(pc, nearZone,
pZone->m_zonePos[nearZonePos][0], // ylayer
GetRandom(pZone->m_zonePos[nearZonePos][1], pZone->m_zonePos[nearZonePos][3]) / 2.0f, // x
GetRandom(pZone->m_zonePos[nearZonePos][2], pZone->m_zonePos[nearZonePos][4]) / 2.0f); // z
return;
}
preIndex = packet->list[i].index;
CCharacter* ch = area->FindCharInCell(pc, packet->list[i].index, (MSG_CHAR_TYPE) MSG_CHAR_NPC);
if(!ch) continue;
if( !IS_NPC(ch) )
{
CPC* bugPC = NULL;
if( IS_ELEMENTAL(ch) )
{
CElemental *ele = TO_ELEMENTAL(ch);
bugPC = ele->GetOwner();
}
if( IS_PET(ch) )
{
CPet* pet = TO_PET(ch);
bugPC = pet->GetOwner();
}
if( IS_PC(ch) )
{
bugPC = TO_PC(ch);
}
if( !bugPC )
return;
// 가까운 마을로
int nearZone;
int nearZonePos;
CZone* pZone = gserver->FindNearestZone(bugPC->m_pZone->m_index, GET_X(bugPC), GET_Z(bugPC), &nearZone, &nearZonePos);
if (pZone == NULL)
return;
GoZone(bugPC, nearZone,
pZone->m_zonePos[nearZonePos][0], // ylayer
GetRandom(pZone->m_zonePos[nearZonePos][1], pZone->m_zonePos[nearZonePos][3]) / 2.0f, // x
GetRandom(pZone->m_zonePos[nearZonePos][2], pZone->m_zonePos[nearZonePos][4]) / 2.0f); // z
GAMELOG << init("PD_BUG", bugPC)
<< end;
return;
}
int ret = ProcAttack(ch, tch, ch->GetAttackType(NULL), NULL, 0);
if (ret == -1)
return ;
}
}