Don't boost enemy trainer shiny odds with shiny charm
parent
1a488d421c
commit
ae6d4d0ea0
|
@ -246,7 +246,7 @@ export class EncounterPhase extends BattlePhase {
|
||||||
battle.enemyParty[e] = battle.trainer.genPartyMember(e);
|
battle.enemyParty[e] = battle.trainer.genPartyMember(e);
|
||||||
else {
|
else {
|
||||||
const enemySpecies = this.scene.randomSpecies(battle.waveIndex, level, null, true);
|
const enemySpecies = this.scene.randomSpecies(battle.waveIndex, level, null, true);
|
||||||
battle.enemyParty[e] = new EnemyPokemon(this.scene, enemySpecies, level);
|
battle.enemyParty[e] = new EnemyPokemon(this.scene, enemySpecies, level, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const enemyPokemon = this.scene.getEnemyParty()[e];
|
const enemyPokemon = this.scene.getEnemyParty()[e];
|
||||||
|
|
|
@ -521,7 +521,7 @@ function getGymLeaderPartyTemplate(scene: BattleScene) {
|
||||||
function getRandomPartyMemberFunc(speciesPool: Species[], postProcess?: (enemyPokemon: EnemyPokemon) => void): PartyMemberFunc {
|
function getRandomPartyMemberFunc(speciesPool: Species[], postProcess?: (enemyPokemon: EnemyPokemon) => void): PartyMemberFunc {
|
||||||
return (scene: BattleScene, level: integer) => {
|
return (scene: BattleScene, level: integer) => {
|
||||||
const species = getPokemonSpecies(Phaser.Math.RND.pick(speciesPool)).getSpeciesForLevel(level, true);
|
const species = getPokemonSpecies(Phaser.Math.RND.pick(speciesPool)).getSpeciesForLevel(level, true);
|
||||||
const ret = new EnemyPokemon(scene, getPokemonSpecies(species), level);
|
const ret = new EnemyPokemon(scene, getPokemonSpecies(species), level, true);
|
||||||
if (postProcess)
|
if (postProcess)
|
||||||
postProcess(ret);
|
postProcess(ret);
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -532,7 +532,7 @@ function getSpeciesFilterRandomPartyMemberFunc(speciesFilter: PokemonSpeciesFilt
|
||||||
const originalSpeciesFilter = speciesFilter;
|
const originalSpeciesFilter = speciesFilter;
|
||||||
speciesFilter = (species: PokemonSpecies) => allowLegendaries || (!species.legendary && !species.pseudoLegendary && !species.mythical) && originalSpeciesFilter(species);
|
speciesFilter = (species: PokemonSpecies) => allowLegendaries || (!species.legendary && !species.pseudoLegendary && !species.mythical) && originalSpeciesFilter(species);
|
||||||
return (scene: BattleScene, level: integer) => {
|
return (scene: BattleScene, level: integer) => {
|
||||||
const ret = new EnemyPokemon(scene, scene.randomSpecies(scene.currentBattle.waveIndex, level, speciesFilter), level);
|
const ret = new EnemyPokemon(scene, scene.randomSpecies(scene.currentBattle.waveIndex, level, speciesFilter), level, true);
|
||||||
if (postProcess)
|
if (postProcess)
|
||||||
postProcess(ret);
|
postProcess(ret);
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -125,23 +125,8 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const rand1 = Utils.binToDec(Utils.decToBin(this.id).substring(0, 16));
|
if (this.shiny === undefined)
|
||||||
const rand2 = Utils.binToDec(Utils.decToBin(this.id).substring(16, 32));
|
this.trySetShiny();
|
||||||
|
|
||||||
const E = this.scene.gameData.trainerId ^ this.scene.gameData.secretId;
|
|
||||||
const F = rand1 ^ rand2;
|
|
||||||
|
|
||||||
if (this.shiny === undefined) {
|
|
||||||
let shinyThreshold = new Utils.IntegerHolder(32);
|
|
||||||
this.scene.applyModifiers(ShinyRateBoosterModifier, true, shinyThreshold);
|
|
||||||
console.log(shinyThreshold.value);
|
|
||||||
|
|
||||||
this.shiny = (E ^ F) < shinyThreshold.value;
|
|
||||||
if ((E ^ F) < 32)
|
|
||||||
console.log('REAL SHINY!!');
|
|
||||||
if (this.shiny)
|
|
||||||
console.log((E ^ F), shinyThreshold.value);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.winCount = 0;
|
this.winCount = 0;
|
||||||
this.pokerus = false;
|
this.pokerus = false;
|
||||||
|
@ -207,6 +192,8 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||||
|
|
||||||
abstract isPlayer(): boolean;
|
abstract isPlayer(): boolean;
|
||||||
|
|
||||||
|
abstract hasTrainer(): boolean;
|
||||||
|
|
||||||
abstract getFieldIndex(): integer;
|
abstract getFieldIndex(): integer;
|
||||||
|
|
||||||
abstract getBattlerIndex(): BattlerIndex;
|
abstract getBattlerIndex(): BattlerIndex;
|
||||||
|
@ -507,6 +494,26 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||||
this.summonData.moveset[moveIndex] = move;
|
this.summonData.moveset[moveIndex] = move;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
trySetShiny(): boolean {
|
||||||
|
const rand1 = Utils.binToDec(Utils.decToBin(this.id).substring(0, 16));
|
||||||
|
const rand2 = Utils.binToDec(Utils.decToBin(this.id).substring(16, 32));
|
||||||
|
|
||||||
|
const E = this.scene.gameData.trainerId ^ this.scene.gameData.secretId;
|
||||||
|
const F = rand1 ^ rand2;
|
||||||
|
|
||||||
|
let shinyThreshold = new Utils.IntegerHolder(32);
|
||||||
|
if (!this.hasTrainer()) {
|
||||||
|
this.scene.applyModifiers(ShinyRateBoosterModifier, true, shinyThreshold);
|
||||||
|
console.log(shinyThreshold.value);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.shiny = (E ^ F) < shinyThreshold.value;
|
||||||
|
if ((E ^ F) < 32)
|
||||||
|
console.log('REAL SHINY!!');
|
||||||
|
|
||||||
|
return this.shiny;
|
||||||
|
}
|
||||||
|
|
||||||
generateAndPopulateMoveset(): void {
|
generateAndPopulateMoveset(): void {
|
||||||
this.moveset = [];
|
this.moveset = [];
|
||||||
const movePool = [];
|
const movePool = [];
|
||||||
|
@ -1097,6 +1104,10 @@ export class PlayerPokemon extends Pokemon {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hasTrainer(): boolean {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
getFieldIndex(): integer {
|
getFieldIndex(): integer {
|
||||||
return this.scene.getPlayerField().indexOf(this);
|
return this.scene.getPlayerField().indexOf(this);
|
||||||
}
|
}
|
||||||
|
@ -1165,12 +1176,15 @@ export class PlayerPokemon extends Pokemon {
|
||||||
}
|
}
|
||||||
|
|
||||||
export class EnemyPokemon extends Pokemon {
|
export class EnemyPokemon extends Pokemon {
|
||||||
|
public trainer: boolean;
|
||||||
public aiType: AiType;
|
public aiType: AiType;
|
||||||
|
|
||||||
constructor(scene: BattleScene, species: PokemonSpecies, level: integer, dataSource?: PokemonData) {
|
constructor(scene: BattleScene, species: PokemonSpecies, level: integer, trainer: boolean, dataSource?: PokemonData) {
|
||||||
super(scene, 236, 84, species, level, dataSource?.abilityIndex, dataSource ? dataSource.formIndex : scene.arena.getFormIndex(species),
|
super(scene, 236, 84, species, level, dataSource?.abilityIndex, dataSource ? dataSource.formIndex : scene.arena.getFormIndex(species),
|
||||||
dataSource?.gender, dataSource?.shiny, dataSource);
|
dataSource?.gender, dataSource?.shiny, dataSource);
|
||||||
|
|
||||||
|
this.trainer = trainer;
|
||||||
|
|
||||||
if (!dataSource) {
|
if (!dataSource) {
|
||||||
let prevolution: Species;
|
let prevolution: Species;
|
||||||
let speciesId = species.speciesId;
|
let speciesId = species.speciesId;
|
||||||
|
@ -1323,6 +1337,10 @@ export class EnemyPokemon extends Pokemon {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hasTrainer(): boolean {
|
||||||
|
return this.trainer;
|
||||||
|
}
|
||||||
|
|
||||||
getFieldIndex(): integer {
|
getFieldIndex(): integer {
|
||||||
return this.scene.getEnemyField().indexOf(this);
|
return this.scene.getEnemyField().indexOf(this);
|
||||||
}
|
}
|
||||||
|
|
|
@ -253,7 +253,7 @@ export class GameData {
|
||||||
scene.newArena(sessionData.arena.biome, true);
|
scene.newArena(sessionData.arena.biome, true);
|
||||||
|
|
||||||
sessionData.enemyParty.forEach((enemyData, e) => {
|
sessionData.enemyParty.forEach((enemyData, e) => {
|
||||||
const enemyPokemon = enemyData.toPokemon(scene) as EnemyPokemon;
|
const enemyPokemon = enemyData.toPokemon(scene, battleType) as EnemyPokemon;
|
||||||
battle.enemyParty[e] = enemyPokemon;
|
battle.enemyParty[e] = enemyPokemon;
|
||||||
if (battleType === BattleType.WILD)
|
if (battleType === BattleType.WILD)
|
||||||
battle.seenEnemyPartyMemberIds.add(enemyPokemon.id);
|
battle.seenEnemyPartyMemberIds.add(enemyPokemon.id);
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { BattleType } from "../battle";
|
||||||
import BattleScene from "../battle-scene";
|
import BattleScene from "../battle-scene";
|
||||||
import { Gender } from "../data/gender";
|
import { Gender } from "../data/gender";
|
||||||
import { PokeballType } from "../data/pokeball";
|
import { PokeballType } from "../data/pokeball";
|
||||||
|
@ -69,10 +70,10 @@ export default class PokemonData {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
toPokemon(scene: BattleScene): Pokemon {
|
toPokemon(scene: BattleScene, battleType?: BattleType): Pokemon {
|
||||||
const species = getPokemonSpecies(this.species);
|
const species = getPokemonSpecies(this.species);
|
||||||
if (this.player)
|
if (this.player)
|
||||||
return new PlayerPokemon(scene, species, this.level, this.abilityIndex, this.formIndex, this.gender, this.shiny, this);
|
return new PlayerPokemon(scene, species, this.level, this.abilityIndex, this.formIndex, this.gender, this.shiny, this);
|
||||||
return new EnemyPokemon(scene, species, this.level, this);
|
return new EnemyPokemon(scene, species, this.level, battleType === BattleType.TRAINER, this);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -131,7 +131,7 @@ export default class Trainer extends Phaser.GameObjects.Container {
|
||||||
? getPokemonSpecies(battle.enemyParty[offset].species.getSpeciesForLevel(level))
|
? getPokemonSpecies(battle.enemyParty[offset].species.getSpeciesForLevel(level))
|
||||||
: this.genNewPartyMemberSpecies(level);
|
: this.genNewPartyMemberSpecies(level);
|
||||||
|
|
||||||
ret = new EnemyPokemon(this.scene, species, level);
|
ret = new EnemyPokemon(this.scene, species, level, true);
|
||||||
}, this.config.hasStaticParty ? this.config.getDerivedType() + ((index + 1) << 8) : this.scene.currentBattle.waveIndex + (this.config.getDerivedType() << 10) + ((index + 1) << 8));
|
}, this.config.hasStaticParty ? this.config.getDerivedType() + ((index + 1) << 8) : this.scene.currentBattle.waveIndex + (this.config.getDerivedType() << 10) + ((index + 1) << 8));
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
Loading…
Reference in New Issue