示例#1
0
void Game::cancelAttackAndFollow()
{
    if(!canPerformGameAction())
        return;

    if(isAttacking())
        setAttackingCreature(nullptr);
    if(isFollowing())
        setFollowingCreature(nullptr);

    m_protocolGame->sendCancelAttackAndFollow();
}
示例#2
0
void Game::attack(const CreaturePtr& creature)
{
    if(!canPerformGameAction() || creature == m_localPlayer)
        return;

    if(creature && creature == m_attackingCreature) {
        cancelAttack();
        return;
    }

    if(creature && isFollowing())
        cancelFollow();

    setAttackingCreature(creature);
    m_protocolGame->sendAttack(creature ? creature->getId() : 0, ++m_seq);
}
示例#3
0
void Game::cancelAttackAndFollow()
{
    if(!canPerformGameAction())
        return;

    if(isFollowing())
        setFollowingCreature(nullptr);
    if(isAttacking())
        setAttackingCreature(nullptr);

    m_localPlayer->stopAutoWalk();

    m_protocolGame->sendCancelAttackAndFollow();

    g_lua.callGlobalField("g_game", "onCancelAttackAndFollow");
}
示例#4
0
void Game::attack(CreaturePtr creature)
{
    if(!canPerformGameAction() || creature == m_localPlayer)
        return;

    // cancel when attacking again
    if(creature && creature == m_attackingCreature)
        creature = nullptr;

    if(creature && isFollowing())
        cancelFollow();

    setAttackingCreature(creature);
    m_localPlayer->stopAutoWalk();

    if(m_protocolVersion >= 963) {
        if(creature)
            m_seq = creature->getId();
    } else
        m_seq++;

    m_protocolGame->sendAttack(creature ? creature->getId() : 0, m_seq);
}
示例#5
0
void Game::processAttackCancel(uint seq)
{
    if(isAttacking() && (seq == 0 || m_seq == seq))
        setAttackingCreature(nullptr);
}