Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5fabbaf7ab | ||
|
|
215dc42294 | ||
|
|
314916279a | ||
|
|
dbf1a1bb36 | ||
|
|
8f2b8dd013 | ||
|
|
ec90df9c58 | ||
|
|
0245e7d1af |
@@ -344,7 +344,7 @@ server:
|
||||
USE_ENHANCED_CRAFTING: false #Apply chaos scroll on every equip crafted.
|
||||
SCROLL_CHANCE_ROLLS: 1 #Number of rolls for success on a scroll, set 1 for default.
|
||||
CHSCROLL_STAT_RATE: 1 #Number of rolls of stat upgrade on a successfully applied chaos scroll, set 1 for default.
|
||||
CHSCROLL_STAT_RANGE: 6 #Stat upgrade range (-N, N) on chaos scrolls.
|
||||
CHSCROLL_STAT_RANGE: 5 #Stat upgrade range (-N, N) on chaos scrolls.
|
||||
|
||||
#Beginner Skills Configuration
|
||||
USE_ULTRA_NIMBLE_FEET: false #Massive speed & jump upgrade.
|
||||
|
||||
@@ -58,8 +58,8 @@ function action(mode, type, selection) {
|
||||
}
|
||||
}
|
||||
if (cm.getChar().getGender() == 1) {
|
||||
for (var i = 0; i < fface.length; i++) {
|
||||
pushIfItemExists(facenew, fface[i] + cm.getChar().getFace()
|
||||
for (var i = 0; i < fface_v.length; i++) {
|
||||
pushIfItemExists(facenew, fface_v[i] + cm.getChar().getFace()
|
||||
% 1000 - (cm.getChar().getFace()
|
||||
% 100));
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ public class MonsterInformationProvider {
|
||||
|
||||
private final Map<Integer, List<MonsterDropEntry>> drops = new HashMap<>();
|
||||
private final List<MonsterGlobalDropEntry> globaldrops = new ArrayList<>();
|
||||
private final Map<Integer, List<MonsterGlobalDropEntry>> continentdrops = new HashMap<>();
|
||||
private final Map<Integer, List<MonsterGlobalDropEntry>> continentDrops = new HashMap<>();
|
||||
|
||||
private final Map<Integer, List<Integer>> dropsChancePool = new HashMap<>(); // thanks to ronan
|
||||
private final Set<Integer> hasNoMultiEquipDrops = new HashSet<>();
|
||||
@@ -76,23 +76,15 @@ public class MonsterInformationProvider {
|
||||
retrieveGlobal();
|
||||
}
|
||||
|
||||
public final List<MonsterGlobalDropEntry> getRelevantGlobalDrops(int mapid) {
|
||||
int continentid = mapid / 100000000;
|
||||
public final List<MonsterGlobalDropEntry> getRelevantGlobalDrops(int mapId) {
|
||||
final int continentId = mapId / 100000000;
|
||||
return continentDrops.computeIfAbsent(continentId, this::loadContinentDrops);
|
||||
}
|
||||
|
||||
List<MonsterGlobalDropEntry> contiItems = continentdrops.get(continentid);
|
||||
if (contiItems == null) { // continent separated global drops found thanks to marcuswoon
|
||||
contiItems = new ArrayList<>();
|
||||
|
||||
for (MonsterGlobalDropEntry e : globaldrops) {
|
||||
if (e.continentid < 0 || e.continentid == continentid) {
|
||||
contiItems.add(e);
|
||||
}
|
||||
}
|
||||
|
||||
continentdrops.put(continentid, contiItems);
|
||||
}
|
||||
|
||||
return contiItems;
|
||||
private List<MonsterGlobalDropEntry> loadContinentDrops(int continentId) {
|
||||
return globaldrops.stream()
|
||||
.filter(dropEntry -> dropEntry.continentid < 0 || dropEntry.continentid == continentId)
|
||||
.toList();
|
||||
}
|
||||
|
||||
private void retrieveGlobal() {
|
||||
@@ -291,7 +283,7 @@ public class MonsterInformationProvider {
|
||||
extraMultiEquipDrops.clear();
|
||||
dropsChancePool.clear();
|
||||
globaldrops.clear();
|
||||
continentdrops.clear();
|
||||
continentDrops.clear();
|
||||
retrieveGlobal();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -751,7 +751,7 @@ public class MapleMap {
|
||||
}
|
||||
|
||||
final MonsterInformationProvider mi = MonsterInformationProvider.getInstance();
|
||||
final List<MonsterGlobalDropEntry> globalEntry = mi.getRelevantGlobalDrops(this.getId());
|
||||
final List<MonsterGlobalDropEntry> globalEntry = new ArrayList<>(mi.getRelevantGlobalDrops(mapid));
|
||||
|
||||
final List<MonsterDropEntry> dropEntry = new ArrayList<>();
|
||||
final List<MonsterDropEntry> visibleQuestEntry = new ArrayList<>();
|
||||
|
||||
@@ -35,6 +35,6 @@ public class Randomizer {
|
||||
}
|
||||
|
||||
public static int rand(final int lbound, final int ubound) {
|
||||
return (int) ((rand.nextDouble() * (ubound - lbound + 1)) + lbound);
|
||||
return ((int) (rand.nextDouble() * (ubound - lbound + 1))) + lbound;
|
||||
}
|
||||
}
|
||||
37
src/test/java/tools/RandomizerTest.java
Normal file
37
src/test/java/tools/RandomizerTest.java
Normal file
@@ -0,0 +1,37 @@
|
||||
package tools;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
public class RandomizerTest {
|
||||
|
||||
@Test
|
||||
void randShouldIncludeEntireRange() {
|
||||
Map<Integer, Integer> rands = new HashMap<>();
|
||||
|
||||
final int rounds = 100_000;
|
||||
for (int i = 0; i < rounds; i++) {
|
||||
int randomValue = Randomizer.rand(-5, 5);
|
||||
rands.compute(randomValue, (k, v) -> v == null ? 0 : v + 1);
|
||||
}
|
||||
|
||||
assertFalse(rands.containsKey(-6));
|
||||
assertTrue(rands.containsKey(-5));
|
||||
assertTrue(rands.containsKey(-4));
|
||||
assertTrue(rands.containsKey(-3));
|
||||
assertTrue(rands.containsKey(-2));
|
||||
assertTrue(rands.containsKey(-1));
|
||||
assertTrue(rands.containsKey(0));
|
||||
assertTrue(rands.containsKey(1));
|
||||
assertTrue(rands.containsKey(2));
|
||||
assertTrue(rands.containsKey(3));
|
||||
assertTrue(rands.containsKey(4));
|
||||
assertTrue(rands.containsKey(5));
|
||||
assertFalse(rands.containsKey(6));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user