mirror of
https://github.com/2006-Scape/apollo.git
synced 2026-07-03 00:38:21 +00:00
Add proper mob health deduction when they are damaged.
This commit is contained in:
@@ -116,8 +116,11 @@ public abstract class Mob extends Entity {
|
||||
*/
|
||||
public void damage(int damage, int type, boolean secondary) {
|
||||
Skill hitpoints = skillSet.getSkill(Skill.HITPOINTS);
|
||||
blockSet.add(SynchronizationBlock.createHitUpdateBlock(damage, type, hitpoints.getCurrentLevel(),
|
||||
hitpoints.getMaximumLevel(), secondary));
|
||||
int current = hitpoints.getCurrentLevel() - damage, maximum = hitpoints.getMaximumLevel();
|
||||
current = current < 0 ? 0 : current;
|
||||
|
||||
blockSet.add(SynchronizationBlock.createHitUpdateBlock(damage, type, current, maximum, secondary));
|
||||
skillSet.setSkill(Skill.HITPOINTS, new Skill(hitpoints.getExperience(), current, maximum));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user