beliar34
Member
- Joined
- Feb 28, 2012
- Messages
- 307
- Solutions
- 7
- Reaction score
- 11
Code:
if(combatType == COMBAT_PHYSICALDAMAGE && target && target->getPlayer())
{
double absorbPower = 0, damageChange = 0;
int32_t hape = target->getPlayer()->getHealth();
int32_t skillShield = target->getPlayer()->getSkill(SKILL_SHIELD, SKILL_LEVEL);
if(damage < hape)
if(skillShield >= 10)
{
absorbPower = (std::floor(skillShield / 5) - 2) * 1;
damageChange = std::ceil((damage * absorbPower) / 100);
}
if((int32_t)damageChange != 0)
{
damage -= (int32_t)damageChange + 1;
char buffer[150];
sprintf(buffer, "%d hitpoint%s has been absorbed by your defense.", (int32_t)damageChange, ((int32_t)damageChange == 1 ? "" : "s"));
target->getPlayer()->sendTextMessage(MSG_EVENT_DEFAULT, buffer);
}
}
I got little problem wit hthis code without this string : if(damage < hape) when people got low health they are immortals, if player normal hits to other players 5k and then hit player who has 2k health and 30% reduce he hits only by 1700 and then when player had 100 health he hit by 70 and it goes till player got 1 health and he became immortal
With this string that i add problem with immortal and low hits is deleted but when player got 10k health and he got absorbtion lets say 60% and get hited by 10k and 1 dmg (10001) abso would not help him
How to setup that to reduce DMG from DMG that player should recieve not player will recieve becouse he got low health
becouse i got low english skills i will post quick example :
How it works now :
With : if(damage < hape)
if player got 100 health and reduce dmg 10% :
if he get hited by 50 he recieve 45 DMG
if he get hited by 60 he recieve 54 dmg
if he het hited by 90 he recieve 81 dmg
But when he get hited by 100 he recieve 100 dmg < this is not good he should recieve 90 reduced dmg
Without if(damage < hape):
if player got 100 health and reduce dmg 10% :
if he get hited by 50 he recieve 45 DMG
if he get hited by 60 he recieve 54 dmg
if he het hited by 90 he recieve 81 dmg
But when he get hited by 100 he recieve 90 dmg < damage is still reduced he recieve 90 dmg
There start problem with script
Now he got 10 health
Player hits now shoul hits him more than 50, but damage and reduce is based on his "gethealth" so he get hited by 10 becouse this is how many health he got left, damage is being reduced to 9
Now he got 1 health
and now all damage is reduced to 0, becouse 1*0.9 is less than 1 and in tibia we cant hit less than 1 !
i want to make Reduced damage based on damage that should be hitted not on damage that player will recieve becouse he got low health
LONG POST
Edit : Can i setup diffrent health range for players ? now its 0 to infinity, if i would change health range from -1000 to infinity (all player is dead when health >=0 so no problem here if player would get - health) where i had to search a health range ? in player.cpp or game.cpp ?
Last edited: