Fixed DP increase by auto attacks.

This commit is contained in:
MobiusDevelopment 2020-12-15 23:33:42 +00:00
parent 710b278042
commit ce7a32c0e5
2 changed files with 22 additions and 2 deletions

View File

@ -3828,16 +3828,23 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
if (isPlayer() && !target.isHpBlocked()) if (isPlayer() && !target.isHpBlocked())
{ {
if (((PlayerInstance) this).isCursedWeaponEquipped()) final PlayerInstance player = getActingPlayer();
if (player.isCursedWeaponEquipped())
{ {
// If hit by a cursed weapon, CP is reduced to 0 // If hit by a cursed weapon, CP is reduced to 0
target.setCurrentCp(0); target.setCurrentCp(0);
} }
else if (((PlayerInstance) this).isHero() && target.isPlayer() && target.getActingPlayer().isCursedWeaponEquipped()) else if (player.isHero() && target.isPlayer() && target.getActingPlayer().isCursedWeaponEquipped())
{ {
// If a cursed weapon is hit by a Hero, CP is reduced to 0 // If a cursed weapon is hit by a Hero, CP is reduced to 0
target.setCurrentCp(0); target.setCurrentCp(0);
} }
if (player.isDeathKnight())
{
player.setDeathPoints(player.getDeathPoints() + 1);
}
} }
} }

View File

@ -445,6 +445,7 @@ public class PlayerInstance extends Playable
protected int _baseClass; protected int _baseClass;
protected int _activeClass; protected int _activeClass;
protected int _classIndex = 0; protected int _classIndex = 0;
private boolean _isDeathKnight = false;
/** data for mounted pets */ /** data for mounted pets */
private int _controlItemId; private int _controlItemId;
@ -6568,6 +6569,10 @@ public class PlayerInstance extends Playable
{ {
player._activeClass = activeClassId; player._activeClass = activeClassId;
} }
if ((activeClassId > 195) && (activeClassId < 208))
{
player._isDeathKnight = true;
}
player.setApprentice(rset.getInt("apprentice")); player.setApprentice(rset.getInt("apprentice"));
player.setSponsor(rset.getInt("sponsor")); player.setSponsor(rset.getInt("sponsor"));
@ -8449,6 +8454,14 @@ public class PlayerInstance extends Playable
return getClassId().isMage(); return getClassId().isMage();
} }
/**
* @return True if the PlayerInstance is a Death Knight.
*/
public boolean isDeathKnight()
{
return _isDeathKnight;
}
public boolean isMounted() public boolean isMounted()
{ {
return _mountType != MountType.NONE; return _mountType != MountType.NONE;