Dionizy
New Member
- Joined
- Mar 18, 2018
- Messages
- 15
- Reaction score
- 0
Hi, I'm replacing the standard tibian skill system with good old stats like strength, etc. and one of the things I'm trying to acheive is attack speed dependent on the kind of weapon the player is wearing and agility (former sword fighting)+ dexterity (former distance fighting) stats. The problem is that attack speed is much faster when the character is moving. You can really see that on high attack speeds, when the character is standing, the damage numbers dont't stack, when he's moving, they stack into one. Also, even when I give a character a very high agi like 2000, the attack is too slow. Max ASPD is 200 so it should be 5 hits per second, but it's not. I have no idea where I should look for solution.
Code:
uint32_t Player::getAttackSpeed()
{
Item* weapon = getWeapon();
int maxASPD = 200;
int clubASPD = 1800;
int swordASPD = 1750;
int spearASPD = 1750;
int wandASPD = 1650;
int distASPD = 1900;
int fistASPD = 1500;
int aspdmultiplier = 8 * (getSkill(SKILL_SWORD, SKILL_LEVEL)) + (getSkill(SKILL_DIST, SKILL_LEVEL));
if(weapon && weapon->getWeaponType() == WEAPON_CLUB)//club/axe
{
if (clubASPD - aspdmultiplier < maxASPD || clubASPD - aspdmultiplier > 100000 )
{
return maxASPD;
}
else
return clubASPD - aspdmultiplier;
}
//sword
if(weapon && weapon->getWeaponType() == WEAPON_SWORD)
{
if (swordASPD - aspdmultiplier < maxASPD || swordASPD - aspdmultiplier > 100000 )
{
return maxASPD;
}
else
return swordASPD - aspdmultiplier;
}
//spear
if(weapon && weapon->getWeaponType() == WEAPON_AXE)
{
if (spearASPD - aspdmultiplier < maxASPD || spearASPD - aspdmultiplier > 100000 )
{
return maxASPD;
}
else
return spearASPD - aspdmultiplier;
}
//wand
if(weapon && weapon->getWeaponType() == WEAPON_WAND)
{
if (wandASPD - aspdmultiplier < maxASPD || wandASPD - aspdmultiplier > 100000 )
{
return maxASPD;
}
else
return wandASPD - aspdmultiplier;
}
if(weapon && weapon->getWeaponType() == WEAPON_AMMO)
{
if (distASPD - aspdmultiplier < maxASPD || distASPD - aspdmultiplier > 100000 )
{
return maxASPD;
}
else
return distASPD - aspdmultiplier;
}
if(!weapon)
{
if (fistASPD - aspdmultiplier < maxASPD || fistASPD - aspdmultiplier > 100000 )
{
return maxASPD;
}
else
return fistASPD - aspdmultiplier;
}
}