Olympiad support for Player onPlayerKill method.
This commit is contained in:
@@ -175,6 +175,7 @@ public abstract class Playable extends Creature
|
||||
qs.getQuest().notifyDeath((killer == null ? this : killer), this, qs);
|
||||
}
|
||||
}
|
||||
|
||||
// Notify instance
|
||||
if (isPlayer())
|
||||
{
|
||||
@@ -188,7 +189,7 @@ public abstract class Playable extends Creature
|
||||
if (killer != null)
|
||||
{
|
||||
final Player killerPlayer = killer.getActingPlayer();
|
||||
if ((killerPlayer != null) && isPlayable())
|
||||
if (killerPlayer != null)
|
||||
{
|
||||
killerPlayer.onPlayerKill(this);
|
||||
}
|
||||
|
@@ -5111,11 +5111,15 @@ public class Player extends Playable
|
||||
}
|
||||
}
|
||||
|
||||
public void onPlayerKill(Playable killedPlayable)
|
||||
public void onPlayerKill(Playable target)
|
||||
{
|
||||
final Player killedPlayer = killedPlayable.getActingPlayer();
|
||||
if ((target == null) || !target.isPlayable())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Avoid nulls && check if player != killedPlayer
|
||||
final Player killedPlayer = target.getActingPlayer();
|
||||
if ((killedPlayer == null) || (this == killedPlayer))
|
||||
{
|
||||
return;
|
||||
@@ -5128,6 +5132,12 @@ public class Player extends Playable
|
||||
return;
|
||||
}
|
||||
|
||||
// Olympiad support
|
||||
if (isInOlympiadMode() || killedPlayer.isInOlympiadMode())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Duel support
|
||||
if (isInDuel() && killedPlayer.isInDuel())
|
||||
{
|
||||
@@ -5181,13 +5191,13 @@ public class Player extends Playable
|
||||
{
|
||||
if ((_isGood && killedPlayer.isGood()) || (_isEvil && killedPlayer.isEvil()))
|
||||
{
|
||||
setReputation(getReputation() - Formulas.calculateKarmaGain(getPkKills(), killedPlayable.isSummon()));
|
||||
setReputation(getReputation() - Formulas.calculateKarmaGain(getPkKills(), target.isSummon()));
|
||||
setPkKills(getPkKills() + 1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
setReputation(getReputation() - Formulas.calculateKarmaGain(getPkKills(), killedPlayable.isSummon()));
|
||||
setReputation(getReputation() - Formulas.calculateKarmaGain(getPkKills(), target.isSummon()));
|
||||
setPkKills(getPkKills() + 1);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user