Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // commented to point out logic related to angle and phase
- void ZMyCharacter::OnDelayedWork(ZDELAYEDWORKITEM *pItem)
- {
- ZMyCharaterStatusBitPacking & zStatus = m_statusFlags.Ref();
- switch(pItem->nWork) {
- case ZDW_SHOT :
- {
- for (ZCharacterManager::iterator itor = ZGetCharacterManager()->begin();
- itor != ZGetCharacterManager()->end(); ++itor)
- {
- ZCharacter* pTar = (*itor).second;
- if (this == pTar || pTar->IsDie()) continue;
- // pos + look direction * offset so slash doesnt occur behind you
- // in very early versions, slash originated behind character;
- // tipslash was much harder but you could "phase" slashes
- // by aiming away from your enemy because the slash would
- // originate behind their block, hitting their back
- rvector diff = GetPosition() + m_Direction * 10.f - pTar->GetPosition();
- diff.z *= .5f;
- float fDist = Magnitude(diff);
- // within recoil (and massive) range
- if (fDist < 200.0f)
- {
- bool bCheck = false;
- if (ZGetGame()->GetMatch()->IsTeamPlay())
- {
- if(IsTeam(pTar) == false)
- bCheck = true;
- }
- else bCheck = true;
- // collision check
- if (ZGetGame()->CheckWall(this,pTar)==true)
- bCheck = false;
- // this section is what is responsible for Angle and Phase
- if (bCheck)
- {
- rvector fTarDir = pTar->GetPosition() - GetPosition();
- Normalize(fTarDir);
- float fDot = D3DXVec3Dot(&m_Direction, &fTarDir);
- if (fDot > 0.1 && DotProduct(m_Direction, pTar->m_Direction) < 0)
- { // if looking in the direction of the attack
- if (pTar->IsGuard()) // if blocking
- ShotBlocked(); // no damage
- }
- }
- }
- }
- }
- break;
- case ZDW_UPPERCUT :
- // logic for flipping
- case ZDW_DASH :
- // dash logic?
- case ZDW_SLASH:
- // something about "splashshot", I believe is something to do with executing a massive
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement