From 1a95f0679504850e2cacd7cadd57790586551270 Mon Sep 17 00:00:00 2001 From: ImperialSympathizer Date: Mon, 15 Jul 2024 14:01:47 -0400 Subject: [PATCH 1/6] implement max spawns per run for individual encounters, tweak spawn rates --- src/battle-scene.ts | 30 ++++++++++++++----- .../mystery-encounters/mystery-encounter.ts | 18 +++++++++-- .../utils/encounter-phase-utils.ts | 2 +- 3 files changed, 38 insertions(+), 12 deletions(-) diff --git a/src/battle-scene.ts b/src/battle-scene.ts index 3e9176430a5..c0a3f0b090a 100644 --- a/src/battle-scene.ts +++ b/src/battle-scene.ts @@ -1071,13 +1071,14 @@ export default class BattleScene extends SceneBase { this.field.add(newTrainer); } - // Check for mystery encounter - // Can only occur in place of a standard wild battle, waves 10-180 + // TODO: remove this once spawn rates are finalized // let testStartingWeight = 0; - // while (testStartingWeight < 20) { + // while (testStartingWeight < 3) { // calculateMEAggregateStats(this, testStartingWeight); // testStartingWeight += 1; // } + // Check for mystery encounter + // Can only occur in place of a standard wild battle, waves 10-180 if (this.gameMode.hasMysteryEncounters && newBattleType === BattleType.WILD && !this.gameMode.isBoss(newWaveIndex) && newWaveIndex < 180 && newWaveIndex > 10) { const roll = Utils.randSeedInt(256); @@ -2651,7 +2652,7 @@ export default class BattleScene extends SceneBase { } // Common / Uncommon / Rare / Super Rare - const tierWeights = [61, 40, 21, 6]; + const tierWeights = [64, 40, 21, 3]; // Adjust tier weights by previously encountered events to lower odds of only common/uncommons in run this.mysteryEncounterData.encounteredEvents.forEach(val => { @@ -2681,10 +2682,23 @@ export default class BattleScene extends SceneBase { // If no valid encounters exist at tier, checks next tier down, continuing until there are some encounters available while (availableEncounters.length === 0 && tier >= 0) { availableEncounters = biomeMysteryEncounters - .filter((encounterType) => - allMysteryEncounters[encounterType]?.meetsRequirements(this) && - allMysteryEncounters[encounterType].encounterTier === tier && - (isNullOrUndefined(previousEncounter) || encounterType !== previousEncounter)) + .filter((encounterType) => { + if (allMysteryEncounters[encounterType].encounterTier !== tier) { // Encounter is in tier + return false; + } + if (!allMysteryEncounters[encounterType]?.meetsRequirements(this)) { // Meets encounter requirements + return false; + } + if (!isNullOrUndefined(previousEncounter) && encounterType === previousEncounter) { // Previous encounter was not this one + return false; + } + if (this.mysteryEncounterData.encounteredEvents?.length > 0 && // Encounter has not exceeded max allowed encounters + allMysteryEncounters[encounterType].maxAllowedEncounters > 0 + && this.mysteryEncounterData.encounteredEvents.filter(e => e[0] === encounterType).length >= allMysteryEncounters[encounterType].maxAllowedEncounters) { + return false; + } + return true; + }) .map((m) => (allMysteryEncounters[m])); tier--; } diff --git a/src/data/mystery-encounters/mystery-encounter.ts b/src/data/mystery-encounters/mystery-encounter.ts index 45ff955bc33..c0c8b1e5aaf 100644 --- a/src/data/mystery-encounters/mystery-encounter.ts +++ b/src/data/mystery-encounters/mystery-encounter.ts @@ -50,6 +50,7 @@ export default interface IMysteryEncounter { hideBattleIntroMessage?: boolean; hideIntroVisuals?: boolean; catchAllowed?: boolean; + maxAllowedEncounters?: number; doEncounterExp?: (scene: BattleScene) => boolean; doEncounterRewards?: (scene: BattleScene) => boolean; onInit?: (scene: BattleScene) => boolean; @@ -144,6 +145,8 @@ export default class IMysteryEncounter implements IMysteryEncounter { } this.encounterTier = this.encounterTier ? this.encounterTier : MysteryEncounterTier.COMMON; this.dialogue = this.dialogue ?? {}; + // Default max is 1 for ROGUE encounters, 3 for others + this.maxAllowedEncounters = this.maxAllowedEncounters ?? this.encounterTier === MysteryEncounterTier.ROGUE ? 1 : 3; this.encounterVariant = MysteryEncounterVariant.DEFAULT; this.requirements = this.requirements ? this.requirements : []; this.hideBattleIntroMessage = !isNullOrUndefined(this.hideBattleIntroMessage) ? this.hideBattleIntroMessage : false; @@ -435,9 +438,9 @@ export class MysteryEncounterBuilder implements Partial { * If not specified, defaults to COMMON * Tiers are: * COMMON 32/64 odds - * UNCOMMON 16/64 odds - * RARE 10/64 odds - * SUPER_RARE 6/64 odds + * GREAT 16/64 odds + * ULTRA 10/64 odds + * ROGUE 6/64 odds * ULTRA_RARE Not currently used * @param encounterTier * @returns @@ -446,6 +449,15 @@ export class MysteryEncounterBuilder implements Partial { return Object.assign(this, { encounterTier: encounterTier }); } + /** + * Sets the maximum number of times that an encounter can spawn in a given Classic run + * @param maxAllowedEncounters + * @returns + */ + withMaxAllowedEncounters(maxAllowedEncounters: number): this & Required> { + return Object.assign(this, { maxAllowedEncounters: maxAllowedEncounters }); + } + /** * Specifies a requirement for an encounter * For example, passing requirement as "new WaveCountRequirement([2, 180])" would create a requirement that the encounter can only be spawned between waves 2 and 180 diff --git a/src/data/mystery-encounters/utils/encounter-phase-utils.ts b/src/data/mystery-encounters/utils/encounter-phase-utils.ts index 100c25aa45d..c9c3e980456 100644 --- a/src/data/mystery-encounters/utils/encounter-phase-utils.ts +++ b/src/data/mystery-encounters/utils/encounter-phase-utils.ts @@ -632,7 +632,7 @@ export function calculateMEAggregateStats(scene: BattleScene, baseSpawnWeight: n // Calculate encounter rarity // Common / Uncommon / Rare / Super Rare (base is out of 128) - const tierWeights = [61, 40, 21, 6]; + const tierWeights = [64, 40, 21, 3]; // Adjust tier weights by currently encountered events (pity system that lowers odds of multiple common/uncommons) tierWeights[0] = tierWeights[0] - 6 * numEncounters[0]; From dc299275aca8f662a44375d4edabb211c98cf653 Mon Sep 17 00:00:00 2001 From: InnocentGameDev Date: Mon, 15 Jul 2024 20:26:15 +0200 Subject: [PATCH 2/6] testing form changes --- .github/ISSUE_TEMPLATE/mystery_event copy.yml | 170 ++++++++++++++++++ 1 file changed, 170 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/mystery_event copy.yml diff --git a/.github/ISSUE_TEMPLATE/mystery_event copy.yml b/.github/ISSUE_TEMPLATE/mystery_event copy.yml new file mode 100644 index 00000000000..e471037dd8a --- /dev/null +++ b/.github/ISSUE_TEMPLATE/mystery_event copy.yml @@ -0,0 +1,170 @@ +name: Mystery Event Test +description: Don't use this one +title: "[Event] " +labels: ["event proposal", "balance review"] +projects: ["AsdarDevelops/1"] +body: + - type: input + id: name + attributes: + label: Event Name + description: Name of the event + placeholder: e.g "Fight or Flight" + validations: + required: true + - type: markdown # SEPARATOR + attributes: + value: | + --- + - type: dropdown + id: rarity + attributes: + label: Rarity Tier + multiple: false + options: + - Common + - Great + - Ultra + - Rogue + - Other or unsure (please specify) + validations: + required: true + + - type: input + id: other_rarity_specify + attributes: + label: Please specify other rarity + visible: false # Initially hidden + validations: + required: true + +- type: script + content: | + document.getElementById('rarity').addEventListener('change', function() { + var otherInput = document.getElementById('other_rarity_specify'); + if (this.value === 'Other or unsure (please specify)') { + otherInput.style.display = 'block'; + } else { + otherInput.style.display = 'none'; + } + }); + + - type: markdown # SEPARATOR + attributes: + value: | + --- + - type: input + id: waves + attributes: + label: Waves + description: Classic/Challenge is 1 -200. Currently only 11-179 is supported. + placeholder: 1-200 + validations: + required: true + - type: markdown # SEPARATOR + attributes: + value: | + --- + - type: textarea + id: description + attributes: + label: Description + description: Describe the event you are proposing + placeholder: What is it? + validations: + required: true + - type: markdown # SEPARATOR + attributes: + value: | + --- + - type: dropdown + id: biomes + attributes: + label: Biomes + description: Select all biomes where the event can occur + multiple: true + options: + - ANY (no need to select all) + - NON-EXTREME (almost all except Space, Seabed, etc...) + - TOWN + - PLAINS + - GRASS + - TALL_GRASS + - METROPOLIS + - FOREST + - SEA + - SWAMP + - BEACH + - LAKE + - SEABED + - MOUNTAIN + - BADLANDS + - CAVE + - DESERT + - ICE_CAVE + - MEADOW + - POWER_PLANT + - VOLCANO + - GRAVEYARD + - DOJO + - FACTORY + - RUINS + - WASTELAND + - ABYSS + - SPACE + - CONSTRUCTION_SITE + - JUNGLE + - FAIRY_CAVE + - TEMPLE + - SLUM + - SNOWY_FOREST + - ISLAND + - LABORATORY + - END + - OTHER (please specify) + validations: + required: true + - type: markdown # SEPARATOR + attributes: + value: | + --- + - type: textarea + id: options + attributes: + label: Options offered to the player + description: A maximum of four options can be displayed at a time + placeholder: Remember that only up to four options can be displayed at a time + value: | + - [ ] OPTION-1 Label + - _OPTION-1 description._ + - [ ] OPTION-2 Label + - _OPTION-2 description._ + - [ ] OPTION-3 Label + - _OPTION-3 description._ + - [ ] OPTION-4 Label + - _OPTION-4 description._ + validations: + required: true + - type: markdown # SEPARATOR + attributes: + value: | + --- + - type: textarea + id: design-notes + attributes: + label: Explanation/Notes on Design + description: Explain why you think this design is right and what this Event brings to the table + placeholder: Explain why you think this design is right and what this Event brings to the table + validations: + required: true + - type: markdown # SEPARATOR + attributes: + value: | + --- + - type: textarea + id: dev-notes + attributes: + label: Notes to Developers + placeholder: If necessary + validations: + required: false From 5b9cc1eb8d23eae4614dbe492c82c068ef9312b4 Mon Sep 17 00:00:00 2001 From: Asdar Date: Mon, 15 Jul 2024 20:32:21 +0200 Subject: [PATCH 3/6] Update mystery_event.yml Referring to the guide --- .github/ISSUE_TEMPLATE/mystery_event.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/ISSUE_TEMPLATE/mystery_event.yml b/.github/ISSUE_TEMPLATE/mystery_event.yml index be7b98eda78..f26886c5a1a 100644 --- a/.github/ISSUE_TEMPLATE/mystery_event.yml +++ b/.github/ISSUE_TEMPLATE/mystery_event.yml @@ -20,6 +20,7 @@ body: id: rarity attributes: label: Rarity Tier + description: Check out the [Event Proposal Guide](https://github.com/AsdarDevelops/PokeRogue-Events/blob/mystery-battle-events/MEs_Proposal_Guide.md#do-tiers-mean-anything) if you have not yet! multiple: false options: - Common From 543cb70323caa758429e475ee7409ed577d06d5f Mon Sep 17 00:00:00 2001 From: InnocentGameDev Date: Mon, 15 Jul 2024 21:51:38 +0200 Subject: [PATCH 4/6] included art request in the form and made some more minor changes --- .github/ISSUE_TEMPLATE/mystery_event copy.yml | 170 ------------------ .github/ISSUE_TEMPLATE/mystery_event.yml | 34 ++-- 2 files changed, 24 insertions(+), 180 deletions(-) delete mode 100644 .github/ISSUE_TEMPLATE/mystery_event copy.yml diff --git a/.github/ISSUE_TEMPLATE/mystery_event copy.yml b/.github/ISSUE_TEMPLATE/mystery_event copy.yml deleted file mode 100644 index e471037dd8a..00000000000 --- a/.github/ISSUE_TEMPLATE/mystery_event copy.yml +++ /dev/null @@ -1,170 +0,0 @@ -name: Mystery Event Test -description: Don't use this one -title: "[Event] " -labels: ["event proposal", "balance review"] -projects: ["AsdarDevelops/1"] -body: - - type: input - id: name - attributes: - label: Event Name - description: Name of the event - placeholder: e.g "Fight or Flight" - validations: - required: true - - type: markdown # SEPARATOR - attributes: - value: | - --- - - type: dropdown - id: rarity - attributes: - label: Rarity Tier - multiple: false - options: - - Common - - Great - - Ultra - - Rogue - - Other or unsure (please specify) - validations: - required: true - - - type: input - id: other_rarity_specify - attributes: - label: Please specify other rarity - visible: false # Initially hidden - validations: - required: true - -- type: script - content: | - document.getElementById('rarity').addEventListener('change', function() { - var otherInput = document.getElementById('other_rarity_specify'); - if (this.value === 'Other or unsure (please specify)') { - otherInput.style.display = 'block'; - } else { - otherInput.style.display = 'none'; - } - }); - - - type: markdown # SEPARATOR - attributes: - value: | - --- - - type: input - id: waves - attributes: - label: Waves - description: Classic/Challenge is 1 -200. Currently only 11-179 is supported. - placeholder: 1-200 - validations: - required: true - - type: markdown # SEPARATOR - attributes: - value: | - --- - - type: textarea - id: description - attributes: - label: Description - description: Describe the event you are proposing - placeholder: What is it? - validations: - required: true - - type: markdown # SEPARATOR - attributes: - value: | - --- - - type: dropdown - id: biomes - attributes: - label: Biomes - description: Select all biomes where the event can occur - multiple: true - options: - - ANY (no need to select all) - - NON-EXTREME (almost all except Space, Seabed, etc...) - - TOWN - - PLAINS - - GRASS - - TALL_GRASS - - METROPOLIS - - FOREST - - SEA - - SWAMP - - BEACH - - LAKE - - SEABED - - MOUNTAIN - - BADLANDS - - CAVE - - DESERT - - ICE_CAVE - - MEADOW - - POWER_PLANT - - VOLCANO - - GRAVEYARD - - DOJO - - FACTORY - - RUINS - - WASTELAND - - ABYSS - - SPACE - - CONSTRUCTION_SITE - - JUNGLE - - FAIRY_CAVE - - TEMPLE - - SLUM - - SNOWY_FOREST - - ISLAND - - LABORATORY - - END - - OTHER (please specify) - validations: - required: true - - type: markdown # SEPARATOR - attributes: - value: | - --- - - type: textarea - id: options - attributes: - label: Options offered to the player - description: A maximum of four options can be displayed at a time - placeholder: Remember that only up to four options can be displayed at a time - value: | - - [ ] OPTION-1 Label - - _OPTION-1 description._ - - [ ] OPTION-2 Label - - _OPTION-2 description._ - - [ ] OPTION-3 Label - - _OPTION-3 description._ - - [ ] OPTION-4 Label - - _OPTION-4 description._ - validations: - required: true - - type: markdown # SEPARATOR - attributes: - value: | - --- - - type: textarea - id: design-notes - attributes: - label: Explanation/Notes on Design - description: Explain why you think this design is right and what this Event brings to the table - placeholder: Explain why you think this design is right and what this Event brings to the table - validations: - required: true - - type: markdown # SEPARATOR - attributes: - value: | - --- - - type: textarea - id: dev-notes - attributes: - label: Notes to Developers - placeholder: If necessary - validations: - required: false diff --git a/.github/ISSUE_TEMPLATE/mystery_event.yml b/.github/ISSUE_TEMPLATE/mystery_event.yml index f26886c5a1a..dbc262d31f7 100644 --- a/.github/ISSUE_TEMPLATE/mystery_event.yml +++ b/.github/ISSUE_TEMPLATE/mystery_event.yml @@ -9,7 +9,7 @@ body: attributes: label: Event Name description: Name of the event - placeholder: e.g Fight or Flight + placeholder: ie. "Fight or Flight" validations: required: true - type: markdown # SEPARATOR @@ -20,7 +20,7 @@ body: id: rarity attributes: label: Rarity Tier - description: Check out the [Event Proposal Guide](https://github.com/AsdarDevelops/PokeRogue-Events/blob/mystery-battle-events/MEs_Proposal_Guide.md#do-tiers-mean-anything) if you have not yet! + description: Check out the [Event Proposal Guide](https://github.com/AsdarDevelops/PokeRogue-Events/blob/mystery-battle-events/MEs_Proposal_Guide.md) if you have not yet! multiple: false options: - Common @@ -38,8 +38,8 @@ body: id: waves attributes: label: Waves - description: Classic/Challenge is 1 -200. Currently only 11-179 is supported. - placeholder: 1-200 + description: Classic/Challenge ranges 1-200. Currently only 11-179 is supported. + placeholder: 11-179 validations: required: true - type: markdown # SEPARATOR @@ -50,8 +50,8 @@ body: id: description attributes: label: Description - description: Describe the event you are proposing - placeholder: What is it? + description: Describe the event you are proposing. Explain its theme and how it's different from others. + placeholder: ie. "Fight or Flight is a common event where the player can fight a boss PKMN of the biome. The PKMN is stronger than usual, but also holds an item that's better than usual." validations: required: true - type: markdown # SEPARATOR @@ -62,11 +62,13 @@ body: id: biomes attributes: label: Biomes - description: Select all biomes where the event can occur + description: Select all biomes where the event can occur. "ANY, NON-EXTREME, CIVILIZATION and HUMAN are groups of biomes. Check the [Biomes part of the guide](https://github.com/AsdarDevelops/PokeRogue-Events/blob/mystery-battle-events/MEs_Proposal_Guide.md#biomes)." multiple: true options: - - ANY (no need to select all) - - NON-EXTREME (almost all except Space, Seabed, etc...) + - ANY + - NON-EXTREME + - HUMAN + - CIVILIZATION - TOWN - PLAINS - GRASS @@ -135,13 +137,25 @@ body: attributes: label: Explanation/Notes on Design description: Explain why you think this design is right and what this Event brings to the table - placeholder: Explain why you think this design is right and what this Event brings to the table + placeholder: ie. "We need more simple Events that mix slightly higher stakes with slightly better rewards" validations: required: true - type: markdown # SEPARATOR attributes: value: | --- + - type: textarea + id: artist-notes + attributes: + label: Notes to Artists + description: Does your Event need custom spriting? If so, please detail them here (reference screenshots are helpful) + placeholder: Ie. "We currently don't have a Cynthia sprite while dressed in a Garchomp costume. RAWR! This is highly needed for my Event!" + validations: + required: false + - type: markdown # SEPARATOR + attributes: + value: | + --- - type: textarea id: dev-notes attributes: From 87f7408117fd57c06692dbf3118417849c8a4e62 Mon Sep 17 00:00:00 2001 From: InnocentGameDev Date: Mon, 15 Jul 2024 22:02:36 +0200 Subject: [PATCH 5/6] template modifications --- .github/ISSUE_TEMPLATE/mystery_event.yml | 27 +++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/mystery_event.yml b/.github/ISSUE_TEMPLATE/mystery_event.yml index dbc262d31f7..b336eea0ee3 100644 --- a/.github/ISSUE_TEMPLATE/mystery_event.yml +++ b/.github/ISSUE_TEMPLATE/mystery_event.yml @@ -27,6 +27,7 @@ body: - Great - Ultra - Rogue + - Part of a "Quest" - Other or unsure (please specify) validations: required: true @@ -34,6 +35,18 @@ body: attributes: value: | --- + - type: input + id: rarity-other + attributes: + label: Rarity Tier - Other. Please Specify + description: If you chose `Other` on the `Rarity Tier` please specify it here + placeholder: e.g. "I'm unsure of whether this should be Common or Great" + validations: + required: false + - type: markdown # SEPARATOR + attributes: + value: | + --- - type: input id: waves attributes: @@ -50,7 +63,7 @@ body: id: description attributes: label: Description - description: Describe the event you are proposing. Explain its theme and how it's different from others. + description: Describe the event you are proposing. Explain its theme and how it's different from others. If the Event has any requirements to even trigger, detail them here too. placeholder: ie. "Fight or Flight is a common event where the player can fight a boss PKMN of the biome. The PKMN is stronger than usual, but also holds an item that's better than usual." validations: required: true @@ -111,6 +124,18 @@ body: attributes: value: | --- + - type: input + id: biome-other + attributes: + label: Biome - Other. Please Specify + description: If you chose `Other` on the `Biome` please specify it here + placeholder: e.g. "I would like to only trigger at Graveyard at night!" + validations: + required: false + - type: markdown # SEPARATOR + attributes: + value: | + --- - type: textarea id: options attributes: From c685d3b7382d07b0ee626b7c6623f9ecab0f3d4f Mon Sep 17 00:00:00 2001 From: InnocentGameDev Date: Tue, 16 Jul 2024 02:16:39 +0200 Subject: [PATCH 6/6] template formatting --- .github/ISSUE_TEMPLATE/mystery_event.yml | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/mystery_event.yml b/.github/ISSUE_TEMPLATE/mystery_event.yml index b336eea0ee3..3791026e778 100644 --- a/.github/ISSUE_TEMPLATE/mystery_event.yml +++ b/.github/ISSUE_TEMPLATE/mystery_event.yml @@ -9,7 +9,7 @@ body: attributes: label: Event Name description: Name of the event - placeholder: ie. "Fight or Flight" + placeholder: e.g. "Fight or Flight" validations: required: true - type: markdown # SEPARATOR @@ -29,12 +29,7 @@ body: - Rogue - Part of a "Quest" - Other or unsure (please specify) - validations: - required: true - - type: markdown # SEPARATOR - attributes: - value: | - --- + - type: input id: rarity-other attributes: @@ -64,7 +59,7 @@ body: attributes: label: Description description: Describe the event you are proposing. Explain its theme and how it's different from others. If the Event has any requirements to even trigger, detail them here too. - placeholder: ie. "Fight or Flight is a common event where the player can fight a boss PKMN of the biome. The PKMN is stronger than usual, but also holds an item that's better than usual." + placeholder: e.g. "Fight or Flight is a common event where the player can fight a boss PKMN of the biome. The PKMN is stronger than usual, but also holds an item that's better than usual." validations: required: true - type: markdown # SEPARATOR @@ -120,10 +115,7 @@ body: - OTHER (please specify) validations: required: true - - type: markdown # SEPARATOR - attributes: - value: | - --- + - type: input id: biome-other attributes: @@ -162,7 +154,7 @@ body: attributes: label: Explanation/Notes on Design description: Explain why you think this design is right and what this Event brings to the table - placeholder: ie. "We need more simple Events that mix slightly higher stakes with slightly better rewards" + placeholder: e.g. "We need more simple Events that mix slightly higher stakes with slightly better rewards" validations: required: true - type: markdown # SEPARATOR