Explorar o código

Fix another bug in target type ENEMY.

Fixed a bug in target type ENEMY where players with karma couldn't be
attacked without holding down CTRL.
HorridoJoho %!s(int64=3) %!d(string=hai) anos
pai
achega
a2ae246a6f

+ 8 - 0
src/main/java/com/l2jserver/gameserver/model/actor/L2Playable.java

@@ -180,6 +180,14 @@ public abstract class L2Playable extends L2Character {
 		return true;
 	}
 	
+	public boolean doesSkillNeedCtrl(L2Character target, Skill skill) {
+		if (target.isPlayable()) {
+			return !checkIfPvP(target) && target.getActingPlayer().getKarma() == 0;
+		}
+		
+		return false;
+	}
+	
 	public boolean checkIfPvP(L2Character target) {
 		if (target == null) {
 			return false; // Target is null

+ 1 - 1
src/main/java/com/l2jserver/gameserver/model/skills/targets/TargetType.java

@@ -104,7 +104,7 @@ public enum TargetType {
 			
 			final var player = caster.getActingPlayer();
 			if (player != null) {
-				if (!player.checkIfPvP((L2Character) target) && !getCurrentPlayableSkill(caster).isCtrlPressed()) {
+				if (player.doesSkillNeedCtrl((L2Character) target, skill) && !getCurrentPlayableSkill(caster).isCtrlPressed()) {
 					caster.sendPacket(INCORRECT_TARGET);
 					return null;
 				}