mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-02 08:39:49 +01:00
Possible fix for negative XP bug.
This commit is contained in:
parent
f87f7f6feb
commit
a4845abc45
@ -83,8 +83,6 @@ public class Combat
|
|||||||
Unarmed.disarmProcCheck(attacker, defender);
|
Unarmed.disarmProcCheck(attacker, defender);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//Modify the event damage if Attacker is Berserk
|
//Modify the event damage if Attacker is Berserk
|
||||||
if(PPa.getBerserkMode())
|
if(PPa.getBerserkMode())
|
||||||
event.setDamage(event.getDamage() + (event.getDamage() / 2));
|
event.setDamage(event.getDamage() + (event.getDamage() / 2));
|
||||||
@ -110,12 +108,22 @@ public class Combat
|
|||||||
int hpLeft = defender.getHealth(), xpinc = 0;
|
int hpLeft = defender.getHealth(), xpinc = 0;
|
||||||
|
|
||||||
if(hpLeft < event.getDamage())
|
if(hpLeft < event.getDamage())
|
||||||
xpinc = hpLeft;
|
{
|
||||||
else
|
if(hpLeft > 0)
|
||||||
|
xpinc = hpLeft;
|
||||||
|
else
|
||||||
|
xpinc = 0;
|
||||||
|
} else
|
||||||
xpinc = event.getDamage();
|
xpinc = event.getDamage();
|
||||||
|
|
||||||
int xp = (int) (xpinc * 2 * LoadProperties.pvpxprewardmodifier);
|
int xp = (int) (xpinc * 2 * LoadProperties.pvpxprewardmodifier);
|
||||||
|
|
||||||
|
if(xp < 0)
|
||||||
|
{
|
||||||
|
//Debug messages here
|
||||||
|
xp = Math.abs(xp); //Temporary fix
|
||||||
|
}
|
||||||
|
|
||||||
if(m.isAxes(attacker.getItemInHand()) && mcPermissions.getInstance().axes(attacker))
|
if(m.isAxes(attacker.getItemInHand()) && mcPermissions.getInstance().axes(attacker))
|
||||||
PPa.addXP(SkillType.AXES, xp*10, attacker);
|
PPa.addXP(SkillType.AXES, xp*10, attacker);
|
||||||
if(m.isSwords(attacker.getItemInHand()) && mcPermissions.getInstance().swords(attacker))
|
if(m.isSwords(attacker.getItemInHand()) && mcPermissions.getInstance().swords(attacker))
|
||||||
@ -411,12 +419,17 @@ public class Combat
|
|||||||
{
|
{
|
||||||
LivingEntity le = (LivingEntity)entity;
|
LivingEntity le = (LivingEntity)entity;
|
||||||
//Prevent a ridiculous amount of XP being granted by capping it at the remaining health of the entity
|
//Prevent a ridiculous amount of XP being granted by capping it at the remaining health of the entity
|
||||||
int hpLeft = le.getHealth(), xpinc = 0;
|
int hpLeft = le.getHealth(), xpinc = 0;
|
||||||
|
|
||||||
if(hpLeft < event.getDamage())
|
if(hpLeft < event.getDamage())
|
||||||
xpinc = hpLeft;
|
{
|
||||||
else
|
if(hpLeft > 0)
|
||||||
xpinc = event.getDamage();
|
xpinc = hpLeft;
|
||||||
|
else
|
||||||
|
xpinc = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
xpinc = event.getDamage();
|
||||||
|
|
||||||
if(entity instanceof Animals)
|
if(entity instanceof Animals)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user