示例#1
0
文件: CRole.cpp 项目: Gamex/GameX
void CRole::damage(float damagePoint, CRole* attacker)
{
    float curHP = getCurHP();
    curHP = curHP - damagePoint;
    if (FLT_LE(curHP, 0.f))
    {
        setCurHP(0.f);
        FIGHT_RELATION->removeAllRelation(dynamic_cast<IFightingRelation*>(this));
        changeState(ROLE_STATE_DYING);
    }
    else
    {
        setCurHP(curHP);
        
        if (attacker)
        {
            if (getMovetarget().equals(Point(-1.f, -1.f)))
            {
                setMoveTarget(attacker->getLogicGrid()->getGridPos());
            }
        }
    }
    
    m_pHPBar->setPercentage(getCurHP() / getMaxHP());
    
    BF_MANAGER->wakeUpAllDefender();
}
示例#2
0
FUNCTION void Q5VC(obj attacker)
{
  obj n = createGlobalNPCAtSpecificLoc(0x0232, getLocation(this));
  setHue(n, getHue(this));
  int Q4XB = getCurHP(this);
  Q4XB = Q4XB / 0x02;
  setCurHP(n, Q4XB);
  setCurHP(this, Q4XB);
  attack(n, attacker);
  sfx(getLocation(this), random(0x01C8, 0x01CC), 0x00);
  bark(n, "*The slime splits when struck!*");
  return;
}