diff --git a/common/src/main/kotlin/com/cobblemon/mod/common/CobblemonMovesetBuilders.kt b/common/src/main/kotlin/com/cobblemon/mod/common/CobblemonMovesetBuilders.kt index a0f4a50dc3..610d142c9b 100644 --- a/common/src/main/kotlin/com/cobblemon/mod/common/CobblemonMovesetBuilders.kt +++ b/common/src/main/kotlin/com/cobblemon/mod/common/CobblemonMovesetBuilders.kt @@ -44,7 +44,7 @@ object CobblemonMovesetBuilders : JsonDataRegistry { ?: throw IllegalArgumentException("Unknown MovesetBuilder id: $id") } - override fun sync(player: ServerPlayer) { /* These don't sync */ } + override fun sync(player: ServerPlayer) { /* These don't sync. But what if they did? Nah probably shouldn't sync. */ } override fun reload(data: Map) { movesetBuilders.clear() diff --git a/common/src/main/kotlin/com/cobblemon/mod/common/CobblemonPartyCompositions.kt b/common/src/main/kotlin/com/cobblemon/mod/common/CobblemonPartyCompositions.kt index 0408ad3fd0..db444e1b41 100644 --- a/common/src/main/kotlin/com/cobblemon/mod/common/CobblemonPartyCompositions.kt +++ b/common/src/main/kotlin/com/cobblemon/mod/common/CobblemonPartyCompositions.kt @@ -34,7 +34,7 @@ object CobblemonPartyCompositions : JsonDataRegistry { val partyCompositions = mutableMapOf() override fun sync(player: ServerPlayer) { - // probably worth syncing which exist, yeah. the deeper details probably not + // probably worth syncing which exist, yeah. the deeper details probably not. I'll get to this eventually. } override fun reload(data: Map) { diff --git a/common/src/main/kotlin/com/cobblemon/mod/common/api/npc/PartyComposition.kt b/common/src/main/kotlin/com/cobblemon/mod/common/api/npc/PartyComposition.kt index ff8b3ecc62..49aacf0d6d 100644 --- a/common/src/main/kotlin/com/cobblemon/mod/common/api/npc/PartyComposition.kt +++ b/common/src/main/kotlin/com/cobblemon/mod/common/api/npc/PartyComposition.kt @@ -20,7 +20,7 @@ import kotlin.random.Random */ class PartyComposition { var id = cobblemonResource("dummy_composition") - val displayName = "cobblemon.party_composition.$id" // dunno if i will use this yet +// val displayName = "cobblemon.party_composition.$id" // dunno if i will use this yet val scrambleOrder: Boolean = false val slot1 = listOf() val slot2 = listOf() @@ -29,12 +29,15 @@ class PartyComposition { val slot5 = listOf() val slot6 = listOf() - fun compose(pool: PartyPool, level: Int, desiredPokemonCount: Int, random: Random = Random.Default): List { + fun compose(pool: PartyPool, level: Int, aspects: Set, desiredPokemonCount: Int, random: Random = Random.Default): List { val chosenEntries = mutableListOf() - val availableEntries = pool.entries.filter { level in it.npcLevels } + val availableEntries = pool.entries.filter { level in it.npcLevels && (it.npcAspects.isEmpty() || it.npcAspects.all(aspects::contains)) } - for (labelSet in listOf(slot1, slot2, slot3, slot4, slot5, slot6).take(desiredPokemonCount)) { + for (labelSet in listOf(slot1, slot2, slot3, slot4, slot5, slot6)) { pool.tryChoosingEntry(labelSet, random, availableEntries, chosenEntries) + if (chosenEntries.size >= desiredPokemonCount) { + break + } } val finalEntries = if (scrambleOrder) { diff --git a/common/src/main/kotlin/com/cobblemon/mod/common/api/npc/PartyPool.kt b/common/src/main/kotlin/com/cobblemon/mod/common/api/npc/PartyPool.kt index 87d4662ef0..06d37ea3ee 100644 --- a/common/src/main/kotlin/com/cobblemon/mod/common/api/npc/PartyPool.kt +++ b/common/src/main/kotlin/com/cobblemon/mod/common/api/npc/PartyPool.kt @@ -29,6 +29,7 @@ class PartyPool { class PoolEntry( val pokemon: PokemonProperties, val labels: List = emptyList(), + val npcAspects: List = emptyList(), val required: List = emptyList(), val excluded: List = emptyList(), val maxSelectableTimes: Int = 6, diff --git a/common/src/main/kotlin/com/cobblemon/mod/common/api/npc/partyproviders/ComposedPoolPartyProvider.kt b/common/src/main/kotlin/com/cobblemon/mod/common/api/npc/partyproviders/ComposedPoolPartyProvider.kt index 8327f8bca7..25fa55961e 100644 --- a/common/src/main/kotlin/com/cobblemon/mod/common/api/npc/partyproviders/ComposedPoolPartyProvider.kt +++ b/common/src/main/kotlin/com/cobblemon/mod/common/api/npc/partyproviders/ComposedPoolPartyProvider.kt @@ -80,6 +80,7 @@ class ComposedPoolPartyProvider : NPCPartyProvider { val pokemonList = composition.compose( pool = pool, level = level, + aspects = npc.aspects, desiredPokemonCount = desiredPokemonCount, random = random ) diff --git a/docs/composed_pool_parties.md b/docs/composed_pool_parties.md index 093e3bab4e..44daacb7ce 100644 --- a/docs/composed_pool_parties.md +++ b/docs/composed_pool_parties.md @@ -87,6 +87,20 @@ As an example, a trivially small pool might look like: "steelix-ace", "ace" ] + }, + { + "pokemon": "steelix shiny=true", + "labels": [ + "ace", + "strong" + ], + "npcLevels": "15-30", + "npcAspects": ["steel-boots"], + "weight": 10, + "levelVariation": "0-2", + "maxTimesSelectable": 1, + "movesetBuilders": ["cobblemon:offensive_npc_pokemon"], + "requires": [] } ] ``` @@ -95,6 +109,7 @@ As an example, a trivially small pool might look like: | `pokemon` | The guaranteed Pokémon information, such as `geodude shiny=true` | | `labels` | The identifying labels of the Pokémon. These can be anything you want. Definitely shouldn't be empty though. | | `npcLevels` | The seed levels that the NPC can be for which this entry is possible. 1-30 would mean a level 40 NPC cannot use that entry. | +| `npcAspects` | The aspects that the NPC must have for this entry to be possible. If the list is empty, as is the default, then it won't check the NPC aspects. | | `weight` | The relative weight of this entry compared to others in the pool. Defaults to 50. | | `levelVariation` | The possible variation around the NPC's seed level that is possible. `-2-3` would mean the Pokémon's level could be anywhere from 2 levels below the NPC seed level to 3 levels above. | | `maxTimesSelectable` | The maximum number of times this entry can be selected for a party. Defaults to 6. |