Exemplo n.º 1
0
bool Item::isTwoHandedWeapon() const
{
  switch( getWeaponType() ) {
  case WeaponType::TWOHAND_AXE:
    return true;
    break;
  case WeaponType::TWOHAND_CLUB:
    break;
    return true;
  case WeaponType::TWOHAND_MACE:
    break;
    return true;
  case WeaponType::TWOHAND_SWORD:
    return true;
    break;
  case WeaponType::BOW:
    return true;
    break;
  case WeaponType::CROSSBOW:
    return true;
    break;
  case WeaponType::STAFF:
    return true;
    break;
  default:
    return false;
    break;
  }

  return false;
}
Exemplo n.º 2
0
bool CCharacter::CanAttack( ) // updated by Core
{

    // we cannot attack while sleeping or stunned
    if (Status->Sleep != 0xff || Status->Stun != 0xff)
    {
        return false;
    }

     clock_t etime = clock() - Battle->lastAtkTime;
    //if( etime < CLOCKS_PER_SEC * 100 / Stats->Attack_Speed ) return false;   for the time being let's just let it be unsynced to avoid disbalanced
    int weapontype = IsPlayer()?getWeaponType():0;
    //the fix: not much but it works ;)
    if (weapontype == 212)
        return true;

    //MZ
    //it's my fix, to protect from exception divide by zero
    //During fight, at change of the weapon it happens
    if (0 == Stats->Attack_Speed) return false;
    //MZ

    if ( weapontype == BOW || weapontype == GUN || weapontype == LAUNCHER || weapontype == CROSSBOW)
    {
       if( (etime < CLOCKS_PER_SEC * (GServer->ATTK_SPEED_MODIF*4/3) / Stats->Attack_Speed) || Status->Stun != 0xff )
       {
            /*
            //LMA: logs
           if(Position->Map==8)
           {
               Log(MSG_INFO,"CanAttack false weapontype %i stun %i etime %u ATTK_SPEED_MODIF %u aspeed %u",weapontype,Status->Stun,etime,GServer->ATTK_SPEED_MODIF,Stats->Attack_Speed);
           }
           //end of logs.
           */

           return false;
       }
    }
    else
    {
       if( (etime < CLOCKS_PER_SEC * GServer->ATTK_SPEED_MODIF / Stats->Attack_Speed) || Status->Stun != 0xff )
       {
           /*
           //LMA: logs
           if(Position->Map==8)
           {
               Log(MSG_INFO,"CanAttack false weapontype %i stun %i etime %u ATTK_SPEED_MODIF %u aspeed %u",weapontype,Status->Stun,etime,GServer->ATTK_SPEED_MODIF,Stats->Attack_Speed);
           }
           //end of logs.
           */

           return false;
       }
    }
    return true;
}
Exemplo n.º 3
0
//----------------------------------------------------------------------
// get debug string
//----------------------------------------------------------------------
string PCSlayerInfo::toString () const 
	throw()
{
	StringStream msg;

	msg << "PCSlayerInfo("
		<< "NSize:" << m_Name.size()
		<< ",Name:" << m_Name 
		<< ",Slot:" << Slot2String[m_Slot]
		<< ",Alignment:" << m_Alignment
		<< ",Rank:" << m_Rank
		<< ",STR[BASIC]:" << (int)m_STR 
		<< ",DEX[BASIC]:" << (int)m_DEX
		<< ",INT[BASIC]:" << (int)m_INT
		<< ",HP:" << m_HP[ATTR_CURRENT] << "/" << m_HP[ATTR_MAX]
		<< ",MP:" << m_MP[ATTR_CURRENT] << "/" << m_MP[ATTR_MAX]
		<< ",Fame:" << m_Fame;
//		<< ",Gold:" << m_Gold;

	for (uint i = 0 ; i < SKILL_DOMAIN_VAMPIRE ; i ++ )
		msg << "," << SkillDomain2String[i] << ":" << (int)m_DomainLevels[i];

//	msg << ",ZoneID:" << m_ZoneID 
	msg	<< ",Sex:" << Sex2String[getSex()]
		<< ",HairStyle:" << HairStyle2String[getHairStyle()]
		<< ",HairColor:" << (int)getHairColor()
		<< ",SkinColor:" << (int)getSkinColor()
		<< " ,Helmet:" << (int)getHelmetType()
		<< ",HelmetColor:" << (int)getHelmetColor()
		<< " ,Jacket:" << (int)getJacketType()
		<< ",JacketColor:" << (int)getJacketColor()
		<< " ,Pants:" << (int)getPantsType()
		<< ",PantsColor:" << (int)getPantsColor()
		<< " ,Weapon:" << (int)getWeaponType()
		<< ",WeaponColor:" << (int)getWeaponColor()
		<< " ,Shield:" << (int)getShieldType()
		<< ",ShieldColor:" << (int)getShieldColor()
		<< ")";
	
	return msg.toString();
}
Exemplo n.º 4
0
bool CCharacter::CanAttack( ) // updated by Core
{
    clock_t etime = clock() - Battle->lastAtkTime;
    int weapontype = IsPlayer()?getWeaponType():0;
    //the fix: not much but it works ;)
    if (weapontype == 212)
    {
        return true;
    }

    if (Battle->lastcastspeed <= 0 || Battle->lastcastspeed == Stats->Attack_Speed)
    {
        if (etime < CLOCKS_PER_SEC * 1)
            return false;
    }
    else
    {
        if(etime < CLOCKS_PER_SEC * (Battle->lastcastspeed / 100))
            return false;
    }

    return true;
}