Merge branch 'brawler-nerf' into 'master'
Brawling gloves now only drop from Revenants (1/100) or Chaos Elemental (1/75) See merge request 2009scape/2009scape!66
This commit is contained in:
@@ -24,6 +24,7 @@ import core.game.world.map.zone.MapZone;
|
|||||||
import core.game.world.map.zone.RegionZone;
|
import core.game.world.map.zone.RegionZone;
|
||||||
import core.game.world.map.zone.ZoneBorders;
|
import core.game.world.map.zone.ZoneBorders;
|
||||||
import core.tools.RandomFunction;
|
import core.tools.RandomFunction;
|
||||||
|
import org.rs09.consts.NPCs;
|
||||||
import rs09.game.system.config.NPCConfigParser;
|
import rs09.game.system.config.NPCConfigParser;
|
||||||
import rs09.game.world.GameWorld;
|
import rs09.game.world.GameWorld;
|
||||||
import rs09.game.world.repository.Repository;
|
import rs09.game.world.repository.Repository;
|
||||||
@@ -160,27 +161,11 @@ public final class WildernessZone extends MapZone {
|
|||||||
player.getInterfaceManager().open(new Component(153));
|
player.getInterfaceManager().open(new Component(153));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (e instanceof NPC && killer instanceof Player && (e.asNpc().getName().contains("Revenant") || e.asNpc().getName().equals("Chaos elemental"))) {
|
|
||||||
int combatLevel = e.asNpc().getDefinition().getCombatLevel();
|
//Roll for PVP gear and Brawling Gloves from revenants
|
||||||
int dropRate = getNewDropRate(combatLevel);
|
if (e instanceof NPC && killer instanceof Player && (e.asNpc().getName().contains("Revenant") || e.getId() == NPCs.CHAOS_ELEMENTAL_3200)) {
|
||||||
for (int i = 0; i < PVP_GEAR.length; i++) {
|
|
||||||
boolean chance = RandomFunction.random(dropRate) == dropRate / 2;
|
boolean gloveDrop = e.getId() == NPCs.CHAOS_ELEMENTAL_3200 ? RandomFunction.roll(75) : RandomFunction.roll(100);
|
||||||
if (chance) {
|
|
||||||
Item reward;
|
|
||||||
if (PVP_GEAR[i] == 13879 || PVP_GEAR[i] == 13883) { // checks if it's a javelin or throwing axe
|
|
||||||
reward = new Item(PVP_GEAR[i], RandomFunction.random(15, 50));
|
|
||||||
} else {
|
|
||||||
reward = new Item(PVP_GEAR[i]);
|
|
||||||
}
|
|
||||||
Repository.sendNews(killer.asPlayer().getUsername() + " has received a " + reward.getName() + " from a " + e.asNpc().getName() + "!");
|
|
||||||
GroundItemManager.create(reward, ((NPC) e).getDropLocation(), killer.asPlayer());
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (killer.isPlayer()) {
|
|
||||||
if (e instanceof NPC) {
|
|
||||||
boolean gloveDrop = RandomFunction.random(1, 100) == 54;
|
|
||||||
if (gloveDrop) {
|
if (gloveDrop) {
|
||||||
byte glove = (byte) RandomFunction.random(1, 13);
|
byte glove = (byte) RandomFunction.random(1, 13);
|
||||||
Item reward = new Item(BrawlingGloves.forIndicator(glove).getId());
|
Item reward = new Item(BrawlingGloves.forIndicator(glove).getId());
|
||||||
@@ -188,11 +173,26 @@ public final class WildernessZone extends MapZone {
|
|||||||
Repository.sendNews(killer.getUsername() + " has received " + reward.getName().toLowerCase() + " from a " + e.asNpc().getName() + "!");
|
Repository.sendNews(killer.getUsername() + " has received " + reward.getName().toLowerCase() + " from a " + e.asNpc().getName() + "!");
|
||||||
}
|
}
|
||||||
e.asNpc().getDefinition().getDropTables().drop(e.asNpc(), killer);
|
e.asNpc().getDefinition().getDropTables().drop(e.asNpc(), killer);
|
||||||
if (((NPC) e).getTask() != null && killer instanceof Player && ((Player) killer).getSlayer().getTask() == e.asNpc().getTask()) {
|
if (((NPC) e).getTask() != null && ((Player) killer).getSlayer().getTask() == e.asNpc().getTask()) {
|
||||||
((Player) killer).getSlayer().finalizeDeath(killer.asPlayer(), e.asNpc());
|
((Player) killer).getSlayer().finalizeDeath(killer.asPlayer(), e.asNpc());
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
int combatLevel = e.asNpc().getDefinition().getCombatLevel();
|
||||||
|
int dropRate = getNewDropRate(combatLevel);
|
||||||
|
for (int j : PVP_GEAR) {
|
||||||
|
boolean chance = RandomFunction.roll(dropRate);
|
||||||
|
if (chance) {
|
||||||
|
Item reward;
|
||||||
|
if (j == 13879 || j == 13883) { // checks if it's a javelin or throwing axe
|
||||||
|
reward = new Item(j, RandomFunction.random(15, 50));
|
||||||
|
} else {
|
||||||
|
reward = new Item(j);
|
||||||
|
}
|
||||||
|
Repository.sendNews(killer.asPlayer().getUsername() + " has received a " + reward.getName() + " from a " + e.asNpc().getName() + "!");
|
||||||
|
GroundItemManager.create(reward, ((NPC) e).getDropLocation(), killer.asPlayer());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (e instanceof NPC) {
|
if (e instanceof NPC) {
|
||||||
|
|||||||
@@ -44,6 +44,15 @@ public class RandomFunction {
|
|||||||
return Math.min(a, b) + (n == 0 ? 0 : random(n));
|
return Math.min(a, b) + (n == 0 ? 0 : random(n));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to roll for a random 1/X chance
|
||||||
|
* @param chance the 1/chance rate for the roll to succeed
|
||||||
|
* @return true if you hit the roll, false otherwise
|
||||||
|
*/
|
||||||
|
public static boolean roll(int chance){
|
||||||
|
return random(chance) == chance / 2;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Calculates the chance of succeeding at a skilling event
|
* Calculates the chance of succeeding at a skilling event
|
||||||
* @param low - Success chance at level 1
|
* @param low - Success chance at level 1
|
||||||
|
|||||||
Reference in New Issue
Block a user