Basic Configurable Dungeon Chains
Completed a basic version of configurable dungeon chains. Almost all of the final funcionality is present. However, the configuration is hardcoded at the moment, not read from a file. This was done for testing purposes. I'll add reading from config files soon. Dungeon packs are partially implemented. Built-in and custom dungeons are currently thrown into the default pack, Ruins. The next step is to generalize the dungeon registration code in DungeonHelper so that we can detect dungeon packs, read their config files, and register dungeons with their corresponding pack. dd-export will need to support packs as well. dd-rift will have issues dealing with duplicate dungeon names across packs, but this isn't a major concern and can be dealt with in the long term.
This commit is contained in:
@@ -15,12 +15,13 @@ public class DungeonChainRule
|
||||
ArrayList<String> conditionNames = source.getCondition();
|
||||
ArrayList<WeightedContainer<String>> productNames = source.getProducts();
|
||||
|
||||
//Obtain the IDs of dungeon types in reverse order. Reverse order makes comparing against chain histories easy.
|
||||
condition = new int[conditionNames.size()];
|
||||
for (int k = 0; k < condition.length; k++)
|
||||
for (int src = 0, dst = condition.length - 1; src < condition.length; src++, dst--)
|
||||
{
|
||||
condition[k] = nameToTypeMapping.get(conditionNames.get(k)).ID;
|
||||
condition[dst] = nameToTypeMapping.get(conditionNames.get(src)).ID;
|
||||
}
|
||||
products = new ArrayList<WeightedContainer<DungeonType>>();
|
||||
products = new ArrayList<WeightedContainer<DungeonType>>(productNames.size());
|
||||
for (WeightedContainer<String> product : productNames)
|
||||
{
|
||||
products.add(new WeightedContainer<DungeonType>(nameToTypeMapping.get(product.getData()), product.itemWeight ));
|
||||
|
||||
@@ -162,11 +162,11 @@ public class DungeonPack
|
||||
{
|
||||
excludedDungeons = new HashSet<DungeonGenerator>(history);
|
||||
}
|
||||
|
||||
|
||||
//List which dungeons are allowed
|
||||
ArrayList<DungeonGenerator> candidates;
|
||||
ArrayList<DungeonGenerator> group = groupedDungeons.get(nextType.ID);
|
||||
if (excludedDungeons != null)
|
||||
if (excludedDungeons != null && !excludedDungeons.isEmpty())
|
||||
{
|
||||
candidates = new ArrayList<DungeonGenerator>(group.size());
|
||||
for (DungeonGenerator dungeon : group)
|
||||
|
||||
Reference in New Issue
Block a user