Skip to content

Commit

Permalink
Fix Merge Conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
xsn34kzx committed Jul 8, 2024
2 parents 20c677e + 6c77fcf commit dcf8c87
Show file tree
Hide file tree
Showing 66 changed files with 1,263 additions and 371 deletions.
14 changes: 5 additions & 9 deletions MEs-Roadmap-Documentation.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# 📝 Most immediate things to-do list

- ### High priority
- 🐛 Intimidate and other ETB abilities proc twice at the start of wild MEs (fight or flight, dark deal)
- ⚙️ Add a tag system so MEs don't show where they shouldn't and bricking Challenge runs:
- ⚙️ Add a tag system so MEs to filter or change spawn rates in Challenge runs:
- noChallenge (cant be spawned in challenge runs)
- allChallenge (can spawn in all challenge modes)
- (typespecific)Challenge:
- Example: fireOnly (can only spawn in fire related challenges)

- ### Medium priority
- ⚙️ Update Chest visuals for Mysterious Chest (with animated chest)

- ### Low priority
- 🐛 Mysterious Challengers can spawn two trainers (or three) of the same type [Dev comment: not a bug]
Expand Down Expand Up @@ -106,9 +106,9 @@ Events (referred to as 'Mysterious Encounters, MEs' in the code) aim to be an ad

### 🌟 **Rarity** tier of the ME, common by default.
- ⚪ Common pool
- 🔵 Rare pool
- 🟣 Epic pool
- 🟡 Legendary pool
- 🔵 Uncommon pool
- 🟣 Rare pool
- 🟡 Super Rare pool

### **Optional Requirements** for Mystery Encounters.
- 🛠️ They give granular control over whether encounters will spawn in certain situations
Expand All @@ -135,13 +135,10 @@ Events (referred to as 'Mysterious Encounters, MEs' in the code) aim to be an ad

# 📝 Known bugs (squash 'em all!):
- ## 🔴 __**Really bad ones**__
- 🐛 Picking up certain items in Fight or Flight is still broken. Workaround is leave encounter.
- 🐛 Modifiers that are applied to pokemon get skipped in Fight or Flight.

- ## 🟡 __**Bad ones under certain circumstances**__
- 🐛 Needs further replication : At wave 51, wild PKMN encounter caused a freezed after pressing "ESC" key upon being asked to switch PKMNs
- 🐛 Wave seed generates different encounter data if you roll to a new wave, see the spawned stuff, and refresh the app
- 🐛 Type-buffing items (like Silk Scarf) get swapped around when offered as a reward in Fight or Flight

- ## 🟢 __**Non-game breaking**__
- Both of these bugs seem to have in common that they don't "forget" their last passed string:
Expand All @@ -157,7 +154,6 @@ Events (referred to as 'Mysterious Encounters, MEs' in the code) aim to be an ad
#### More requirements (with helper functions)
- Having X item
- Having Y amount of X item
- Being in a specific Biome
- A Pokémon X in player's party can learn Y move
- A Pokémon X in player's party knows Y move
- A Pokémon X in player's party has Y ability
Expand Down
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<head>
<meta charset="UTF-8" />
<title>%VITE_TITLE%</title>
<meta name="title" content="PokéRogue" />
<meta name="title" content="%VITE_TITLE%" />
<meta name="description" content="A Pokémon fangame heavily inspired by the roguelite genre. Battle endlessly while gathering stacking items, exploring many different biomes, and reaching Pokémon stats you never thought possible." />
<meta name="theme-color" content="#da3838" />
<meta name="keywords" content="pokerogue, pokemon, roguelite" />
Expand Down
82 changes: 41 additions & 41 deletions public/images/pokemon/back/shiny/774.json
Original file line number Diff line number Diff line change
@@ -1,41 +1,41 @@
{
"textures": [
{
"image": "774.png",
"format": "RGBA8888",
"size": {
"w": 37,
"h": 37
},
"scale": 1,
"frames": [
{
"filename": "0001.png",
"rotated": false,
"trimmed": false,
"sourceSize": {
"w": 37,
"h": 35
},
"spriteSourceSize": {
"x": 0,
"y": 0,
"w": 37,
"h": 35
},
"frame": {
"x": 0,
"y": 0,
"w": 37,
"h": 35
}
}
]
}
],
"meta": {
"app": "https://www.codeandweb.com/texturepacker",
"version": "3.0",
"smartupdate": "$TexturePacker:SmartUpdate:fa61a53a0684a1d00e0ed5d6737743af:3e6463caf33bbb58cfba4bd9c20890aa:37281ac0aa1e619ef385b889b64064b7$"
}
}
{
"textures": [
{
"image": "774.png",
"format": "RGBA8888",
"size": {
"w": 37,
"h": 37
},
"scale": 1,
"frames": [
{
"filename": "0001.png",
"rotated": false,
"trimmed": false,
"sourceSize": {
"w": 37,
"h": 37
},
"spriteSourceSize": {
"x": 0,
"y": 0,
"w": 37,
"h": 37
},
"frame": {
"x": 0,
"y": 0,
"w": 37,
"h": 37
}
}
]
}
],
"meta": {
"app": "https://www.codeandweb.com/texturepacker",
"version": "3.0",
"smartupdate": "$TexturePacker:SmartUpdate:241dff4083e172e8503b54a7f0210f8d:982b194223ffeef2ba672b3c5979a426:37281ac0aa1e619ef385b889b64064b7$"
}
}
Binary file modified public/images/pokemon/back/shiny/774.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/images/pokemon/exp/back/shiny/774-blue.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/images/pokemon/exp/back/shiny/774-green.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/images/pokemon/exp/back/shiny/774-indigo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/images/pokemon/exp/back/shiny/774-orange.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/images/pokemon/exp/back/shiny/774-red.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/images/pokemon/exp/back/shiny/774-violet.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/images/pokemon/exp/back/shiny/774-yellow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/images/pokemon/exp/shiny/774-blue.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/images/pokemon/exp/shiny/774-green.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/images/pokemon/exp/shiny/774-indigo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/images/pokemon/exp/shiny/774-orange.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/images/pokemon/exp/shiny/774-red.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/images/pokemon/exp/shiny/774-violet.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/images/pokemon/exp/shiny/774-yellow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
82 changes: 41 additions & 41 deletions public/images/pokemon/shiny/774.json
Original file line number Diff line number Diff line change
@@ -1,41 +1,41 @@
{
"textures": [
{
"image": "774.png",
"format": "RGBA8888",
"size": {
"w": 37,
"h": 37
},
"scale": 1,
"frames": [
{
"filename": "0001.png",
"rotated": false,
"trimmed": false,
"sourceSize": {
"w": 37,
"h": 35
},
"spriteSourceSize": {
"x": 0,
"y": 0,
"w": 37,
"h": 35
},
"frame": {
"x": 0,
"y": 0,
"w": 37,
"h": 35
}
}
]
}
],
"meta": {
"app": "https://www.codeandweb.com/texturepacker",
"version": "3.0",
"smartupdate": "$TexturePacker:SmartUpdate:29265d2eed2689ecb95874383b7e7da7:1339971def468ab6d7c93a72472c7b3d:37281ac0aa1e619ef385b889b64064b7$"
}
}
{
"textures": [
{
"image": "774.png",
"format": "RGBA8888",
"size": {
"w": 37,
"h": 37
},
"scale": 1,
"frames": [
{
"filename": "0001.png",
"rotated": false,
"trimmed": false,
"sourceSize": {
"w": 37,
"h": 37
},
"spriteSourceSize": {
"x": 0,
"y": 0,
"w": 37,
"h": 37
},
"frame": {
"x": 0,
"y": 0,
"w": 37,
"h": 37
}
}
]
}
],
"meta": {
"app": "https://www.codeandweb.com/texturepacker",
"version": "3.0",
"smartupdate": "$TexturePacker:SmartUpdate:566b51540ed595250ead15a4733d98d6:172aa05dcc207383119cd2f2f7977e0e:37281ac0aa1e619ef385b889b64064b7$"
}
}
Binary file modified public/images/pokemon/shiny/774.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
43 changes: 25 additions & 18 deletions src/battle-scene.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,15 @@ import { Species } from "#enums/species";
import { UiTheme } from "#enums/ui-theme";
import { TimedEventManager } from "#app/timed-event-manager.js";
import i18next from "i18next";
import {TrainerType} from "#enums/trainer-type";
import MysteryEncounter, { MysteryEncounterTier, MysteryEncounterVariant } from "./data/mystery-encounter";
import {
mysteryEncountersByBiome,
allMysteryEncounters,
BASE_MYSTERY_ENCOUNTER_WEIGHT,
AVERAGE_ENCOUNTERS_PER_RUN_TARGET
BASE_MYSTERY_ENCOUNTER_SPAWN_WEIGHT,
AVERAGE_ENCOUNTERS_PER_RUN_TARGET, WIGHT_INCREMENT_ON_SPAWN_MISS
} from "./data/mystery-encounters/mystery-encounters";
import {MysteryEncounterFlags} from "#app/data/mystery-encounter-flags";
import {MysteryEncounterData} from "#app/data/mystery-encounter-data";
import { MysteryEncounterType } from "#enums/mystery-encounter-type";

export const bypassLogin = import.meta.env.VITE_BYPASS_LOGIN === "1";
Expand Down Expand Up @@ -301,7 +302,7 @@ export default class BattleScene extends SceneBase {

public eventManager: TimedEventManager;

public mysteryEncounterFlags: MysteryEncounterFlags = new MysteryEncounterFlags(null);
public mysteryEncounterData: MysteryEncounterData = new MysteryEncounterData(null);
public lastMysteryEncounter: MysteryEncounter;

/**
Expand Down Expand Up @@ -1111,39 +1112,43 @@ export default class BattleScene extends SceneBase {
this.applyModifiers(DoubleBattleChanceBoosterModifier, true, doubleChance);
playerField.forEach(p => applyAbAttrs(DoubleBattleChanceAbAttr, p, null, doubleChance));
doubleTrainer = !Utils.randSeedInt(doubleChance.value);
// Add a check that special trainers can't be double except for tate and liza - they should use the normal double chance
if (trainerConfigs[trainerType].trainerTypeDouble && !(trainerType === TrainerType.TATE || trainerType === TrainerType.LIZA)) {
doubleTrainer = false;
}
}
newTrainer = trainerData !== undefined ? trainerData.toTrainer(this) : new Trainer(this, trainerType, doubleTrainer ? TrainerVariant.DOUBLE : Utils.randSeedInt(2) ? TrainerVariant.FEMALE : TrainerVariant.DEFAULT);
this.field.add(newTrainer);
}

// Check for mystery encounter
// Can only occur in place of a standard wild battle, waves 10-180
// let testStartingWeight = 10;
// while (testStartingWeight < 30) {
// let testStartingWeight = 0;
// while (testStartingWeight < 20) {
// calculateMEAggregateStats(this, testStartingWeight);
// testStartingWeight += 2;
// testStartingWeight += 1;
// }
if (this.gameMode.hasMysteryEncounters && newBattleType === BattleType.WILD && !this.gameMode.isBoss(newWaveIndex) && newWaveIndex < 180 && newWaveIndex > 10) {
const roll = Utils.randSeedInt(256);

// Base spawn weight is 3/256, and increases by 1/256 for each missed attempt at spawning an encounter on a valid floor
const sessionEncounterRate = !isNullOrUndefined(this.mysteryEncounterFlags?.encounterSpawnChance) ? this.mysteryEncounterFlags.encounterSpawnChance : BASE_MYSTERY_ENCOUNTER_WEIGHT;
// Base spawn weight is 1/256, and increases by 5/256 for each missed attempt at spawning an encounter on a valid floor
const sessionEncounterRate = !isNullOrUndefined(this.mysteryEncounterData?.encounterSpawnChance) ? this.mysteryEncounterData.encounterSpawnChance : BASE_MYSTERY_ENCOUNTER_SPAWN_WEIGHT;

// If total number of encounters is lower than expected for the run, slightly favor a new encounter spawn
// Do the reverse as well
// Reduces occurrence of runs with very few (<6) and a ton (>10) of encounters
const expectedEncountersByFloor = AVERAGE_ENCOUNTERS_PER_RUN_TARGET / (180 - 10) * newWaveIndex;
const currentRunDiffFromAvg = expectedEncountersByFloor - (this.mysteryEncounterFlags?.encounteredEvents?.length || 0);
const currentRunDiffFromAvg = expectedEncountersByFloor - (this.mysteryEncounterData?.encounteredEvents?.length || 0);
const favoredEncounterRate = sessionEncounterRate + currentRunDiffFromAvg * 5;

const successRate = isNullOrUndefined(Overrides.MYSTERY_ENCOUNTER_RATE_OVERRIDE) ? favoredEncounterRate : Overrides.MYSTERY_ENCOUNTER_RATE_OVERRIDE;

if (roll < successRate) {
newBattleType = BattleType.MYSTERY_ENCOUNTER;
// Reset base spawn weight
this.mysteryEncounterFlags.encounterSpawnChance = BASE_MYSTERY_ENCOUNTER_WEIGHT;
this.mysteryEncounterData.encounterSpawnChance = BASE_MYSTERY_ENCOUNTER_SPAWN_WEIGHT;
} else {
this.mysteryEncounterFlags.encounterSpawnChance = sessionEncounterRate + 1;
this.mysteryEncounterData.encounterSpawnChance = sessionEncounterRate + WIGHT_INCREMENT_ON_SPAWN_MISS;
}
}
}
Expand Down Expand Up @@ -1188,7 +1193,9 @@ export default class BattleScene extends SceneBase {
if (newBattleType === BattleType.MYSTERY_ENCOUNTER) {
// Disable double battle on mystery encounters (it may be re-enabled as part of encounter)
this.currentBattle.double = false;
this.currentBattle.mysteryEncounter = this.getMysteryEncounter(mysteryEncounter);
this.executeWithSeedOffset(() => {
this.currentBattle.mysteryEncounter = this.getMysteryEncounter(mysteryEncounter);
}, this.currentBattle.waveIndex << 4);
}

//this.pushPhase(new TrainerMessageTestPhase(this, TrainerType.RIVAL, TrainerType.RIVAL_2, TrainerType.RIVAL_3, TrainerType.RIVAL_4, TrainerType.RIVAL_5, TrainerType.RIVAL_6));
Expand Down Expand Up @@ -2779,10 +2786,10 @@ export default class BattleScene extends SceneBase {
}

// Check for queued encounters first
if (!encounter && this.mysteryEncounterFlags?.nextEncounterQueue?.length > 0) {
if (!encounter && this.mysteryEncounterData?.nextEncounterQueue?.length > 0) {
let i = 0;
while (i < this.mysteryEncounterFlags.nextEncounterQueue.length && !!encounter) {
const candidate = this.mysteryEncounterFlags.nextEncounterQueue[i];
while (i < this.mysteryEncounterData.nextEncounterQueue.length && !!encounter) {
const candidate = this.mysteryEncounterData.nextEncounterQueue[i];
const forcedChance = candidate[1];
if (Utils.randSeedInt(100) < forcedChance) {
encounter = allMysteryEncounters[candidate[0]];
Expand All @@ -2802,7 +2809,7 @@ export default class BattleScene extends SceneBase {
const tierWeights = [61, 40, 21, 6];

// Adjust tier weights by previously encountered events to lower odds of only common/uncommons in run
this.mysteryEncounterFlags.encounteredEvents.forEach(val => {
this.mysteryEncounterData.encounteredEvents.forEach(val => {
const tier = val[1];
if (tier === MysteryEncounterTier.COMMON) {
tierWeights[0] = tierWeights[0] - 6;
Expand All @@ -2824,7 +2831,7 @@ export default class BattleScene extends SceneBase {

let availableEncounters = [];
// New encounter will never be the same as the most recent encounter
const previousEncounter = this.mysteryEncounterFlags.encounteredEvents?.length > 0 ? this.mysteryEncounterFlags.encounteredEvents[this.mysteryEncounterFlags.encounteredEvents.length - 1][0] : null;
const previousEncounter = this.mysteryEncounterData.encounteredEvents?.length > 0 ? this.mysteryEncounterData.encounteredEvents[this.mysteryEncounterData.encounteredEvents.length - 1][0] : null;
const biomeMysteryEncounters = mysteryEncountersByBiome.get(this.arena.biomeType);
// If no valid encounters exist at tier, checks next tier down, continuing until there are some encounters available
while (availableEncounters.length === 0 && tier >= 0) {
Expand Down
Loading

0 comments on commit dcf8c87

Please sign in to comment.