mirror of
https://gitlab.com/2009scape/2009scape.git
synced 2025-12-11 09:00:23 -07:00
ironman drop fix: get drop if npcs delt damage.
Currenly the check is done against the entire ImpactLog, which includes NPC damage. This becomes very annoying when it comes to places like god wars where npcs constantly attach each other. This change makes the loot check only look at other players, and not npcs. The ironman player in question still has to do the most damage (including npcs) to get the drop.
This commit is contained in:
parent
4c073b8534
commit
21e2851d1b
2 changed files with 13 additions and 1 deletions
|
|
@ -19,6 +19,7 @@ import java.util.HashMap;
|
|||
import java.util.LinkedList;
|
||||
import java.util.Map;
|
||||
import java.util.Queue;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* Class used for handling combat impacts.
|
||||
|
|
@ -262,6 +263,15 @@ public final class ImpactHandler {
|
|||
return impactLog;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the impact log filtered for Player objects
|
||||
* @return The impact log of each Player and their damage
|
||||
*/
|
||||
public Map<Player, Integer> getPlayerImpactLog() {
|
||||
return impactLog.entrySet().stream().filter(entry -> entry.getKey() instanceof Player).collect(
|
||||
Collectors.toMap(m -> m.getKey().asPlayer(), m -> m.getValue()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the entity needs a hit update.
|
||||
* @return {@code True} if so.
|
||||
|
|
|
|||
|
|
@ -38,6 +38,8 @@ import rs09.game.system.config.ShopParser;
|
|||
import rs09.game.world.GameWorld;
|
||||
import rs09.game.world.repository.Repository;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import static rs09.game.node.entity.player.info.stats.StatAttributeKeysKt.STATS_BASE;
|
||||
import static rs09.game.node.entity.player.info.stats.StatAttributeKeysKt.STATS_ENEMIES_KILLED;
|
||||
|
||||
|
|
@ -543,7 +545,7 @@ public class NPC extends Entity {
|
|||
if (getAttribute("disable:drop", false)) {
|
||||
return;
|
||||
}
|
||||
if (killer instanceof Player && p != null && p.getIronmanManager().isIronman() && getImpactHandler().getImpactLog().size() > 1) {
|
||||
if (killer instanceof Player && p != null && p.getIronmanManager().isIronman() && getImpactHandler().getPlayerImpactLog().size() > 1) {
|
||||
return;
|
||||
}
|
||||
if (definition == null || definition.getDropTables() == null) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue