File PokemonBox.ts
has 321 lines of code (exceeds 250 allowed). Consider refactoring.
import { SaveFileIterator } from './../SaveFileIterator';
import { SaveFileService } from './../../savefile.service';
import {Pokemon} from '../../../../assets/data/pokemon';
import { GameDataService } from '../../gameData.service';
import { PokemonDBService } from '../../pokemonDB.service';
Function load
has 61 lines of code (exceeds 25 allowed). Consider refactoring.
public load(saveFile: SaveFileService,
startOffset: number,
nicknameStartOffset: number,
otNameStartOffset: number,
index: number,
Function save
has 52 lines of code (exceeds 25 allowed). Consider refactoring.
public save(saveFile: SaveFileService,
startOffset: number,
speciesStartOffset: number | null,
nicknameStartOffset: number,
otNameStartOffset: number,
Function newPokemon
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
static newPokemon(file: SaveFileService, pdb: PokemonDBService, gd: GameDataService) {
const pkmn = new PokemonBox();
const pkmnList = gd.file("randomPkmn").data;
const pkmnData = pdb.pokemon[_.snakeCase(pkmnList[_.random(0, pkmnList.length, false)])];
Function newPokemon
has 35 lines of code (exceeds 25 allowed). Consider refactoring.
static newPokemon(file: SaveFileService, pdb: PokemonDBService, gd: GameDataService) {
const pkmn = new PokemonBox();
const pkmnList = gd.file("randomPkmn").data;
const pkmnData = pdb.pokemon[_.snakeCase(pkmnList[_.random(0, pkmnList.length, false)])];
Function save
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
public save(saveFile: SaveFileService,
startOffset: number,
speciesStartOffset: number | null,
nicknameStartOffset: number,
otNameStartOffset: number,
Similar blocks of code found in 2 locations. Consider refactoring.
pkmn.moves[i].pp = (pkmnData.initial[i]) ? pkmnData.initial[i].pp : 0;
src/app/data/savefile-expanded/fragments/PokemonBox.ts on lines 62..62 Similar blocks of code found in 2 locations. Consider refactoring.
pkmn.moves[i].moveID = (pkmnData.initial[i]) ? pkmnData.initial[i].ind : 0;
src/app/data/savefile-expanded/fragments/PokemonBox.ts on lines 63..63 if statements must be braced
if(this.isValidPokemon === false)
return this.exp;
missing whitespace
exp = (1.2 * Math.pow(level, 3)) - (15 * Math.pow(level, 2)) + (100*level) - 140;
missing whitespace
return Math.floor((((baseStat+dv)*2+Math.floor(Math.floor(Math.sqrt(ev))/4))*this.level)/100) + 5;
missing whitespace
return Math.floor((((baseStat+dv)*2+Math.floor(Math.floor(Math.sqrt(ev))/4))*this.level)/100) + 5;
missing whitespace
return Math.floor((((baseStat+dv)*2+Math.floor(Math.floor(Math.sqrt(ev))/4))*this.level)/100) + 5;
missing whitespace
if(pkmnData.type1 !== undefined)
if statements must be braced
if(pkmnData.type2 !== undefined)
pkmn.type2 = pkmnData.type2.ind;
if statements must be braced
if(pkmnData.initial == undefined)
continue;
if statements must be braced
if(pkmnData.catchRate !== undefined)
pkmn.catchRate = pkmnData.catchRate;
" should be '
if(nickname == "NIDORAN<F>")
" should be '
return this.getNonHPStat("baseSpeed", this.dv.speed, this.speedExp);
missing whitespace
return Math.floor((((record.baseHp+this.hpDV)*2+Math.floor(Math.floor(Math.sqrt(this.hpExp))/4))*this.level)/100) + this.level + 10;
missing whitespace
return Math.floor((((record.baseHp+this.hpDV)*2+Math.floor(Math.floor(Math.sqrt(this.hpExp))/4))*this.level)/100) + this.level + 10;
missing whitespace
return Math.floor((((baseStat+dv)*2+Math.floor(Math.floor(Math.sqrt(ev))/4))*this.level)/100) + 5;
missing whitespace
if(gr == 0)
missing whitespace
if(this.isValidPokemon === false)
missing whitespace
if((this.dv.speed % 2) !== 0)
if statements must be braced
if(record === false)
return exp;
if statements must be braced
if(this.level >= 100)
return 1;
" should be '
return this.getNonHPStat("baseSpecial", this.dv.special, this.specialExp);
if statements must be braced
else if(gr == 3)
exp = (1.2 * Math.pow(level, 3)) - (15 * Math.pow(level, 2)) + (100*level) - 140;
" should be '
const _ = window.require("lodash");
Missing semicolon
nickname = "NIDORAN<f>"
missing whitespace
return Math.floor((((record.baseHp+this.hpDV)*2+Math.floor(Math.floor(Math.sqrt(this.hpExp))/4))*this.level)/100) + this.level + 10;
missing whitespace
return Math.floor((((baseStat+dv)*2+Math.floor(Math.floor(Math.sqrt(ev))/4))*this.level)/100) + 5;
missing whitespace
if(pkmnData.type2 !== undefined)
if statements must be braced
else if(nickname == "NIDORAN<M>")
nickname = "NIDORAN<m>"
missing whitespace
for(let i = 0; i < 4; i++) {
missing whitespace
return Math.floor((((baseStat+dv)*2+Math.floor(Math.floor(Math.sqrt(ev))/4))*this.level)/100) + 5;
missing whitespace
else if(gr == 5)
if statements must be braced
if(record === false)
return 0;
Identifier 'record' is never reassigned; use 'const' instead of 'let'.
let record = this.pkmnArr[this.species - 1];
" should be '
nickname = "NIDORAN<m>"
missing whitespace
return Math.floor((((record.baseHp+this.hpDV)*2+Math.floor(Math.floor(Math.sqrt(this.hpExp))/4))*this.level)/100) + this.level + 10;
missing whitespace
return Math.floor((((record.baseHp+this.hpDV)*2+Math.floor(Math.floor(Math.sqrt(this.hpExp))/4))*this.level)/100) + this.level + 10;
missing whitespace
return Math.floor((((baseStat+dv)*2+Math.floor(Math.floor(Math.sqrt(ev))/4))*this.level)/100) + 5;
missing whitespace
if(pkmnData.initial == undefined)
missing whitespace
if(pkmnData.catchRate !== undefined)
missing whitespace
if((this.dv.attack % 2) !== 0)
if statements must be braced
if((this.dv.defense % 2) !== 0)
hpDv |= 4;
" should be '
return this.getNonHPStat("baseAttack", this.dv.attack, this.attackExp);
missing whitespace
if((this.dv.special % 2) !== 0)
if statements must be braced
if(pkmnData.type1 !== undefined)
pkmn.type1 = pkmnData.type1.ind;
" should be '
const pkmnList = gd.file("randomPkmn").data;
" should be '
nickname = "NIDORAN<f>"
missing whitespace
if(this.isValidPokemon === false)
missing whitespace
exp = (1.2 * Math.pow(level, 3)) - (15 * Math.pow(level, 2)) + (100*level) - 140;
missing whitespace
return Math.floor((((record.baseHp+this.hpDV)*2+Math.floor(Math.floor(Math.sqrt(this.hpExp))/4))*this.level)/100) + this.level + 10;
missing whitespace
return Math.floor((((record.baseHp+this.hpDV)*2+Math.floor(Math.floor(Math.sqrt(this.hpExp))/4))*this.level)/100) + this.level + 10;
missing whitespace
if(this.level >= 100)
missing whitespace
return Math.floor((((baseStat+dv)*2+Math.floor(Math.floor(Math.sqrt(ev))/4))*this.level)/100) + 5;
missing whitespace
if(nickname == "NIDORAN<F>")
missing whitespace
if(speciesStartOffset !== null) {
missing whitespace
if(this.isValidPokemon === false)
if statements must be braced
if(pkmn.type1 == pkmn.type2)
pkmn.type2 = 0xFF;
if statements must be braced
else if(gr == 4)
exp = (4 * Math.pow(level, 3)) / 5
if statements must be braced
if(this.isValidPokemon === false)
return;
if statements must be braced
if((this.dv.attack % 2) !== 0)
hpDv |= 8;
missing whitespace
return Math.floor((((record.baseHp+this.hpDV)*2+Math.floor(Math.floor(Math.sqrt(this.hpExp))/4))*this.level)/100) + this.level + 10;
missing whitespace
return Math.floor((((baseStat+dv)*2+Math.floor(Math.floor(Math.sqrt(ev))/4))*this.level)/100) + 5;
missing whitespace
return Math.floor((((baseStat+dv)*2+Math.floor(Math.floor(Math.sqrt(ev))/4))*this.level)/100) + 5;
missing whitespace
if(record === false)
if statements must be braced
if(gr == 0)
exp = Math.pow(level, 3);
if statements must be braced
else if(gr == 5)
exp = (5 * Math.pow(level, 3)) / 4
if statements must be braced
if((this.dv.speed % 2) !== 0)
hpDv |= 2;
" should be '
return this.getNonHPStat("baseDefense", this.dv.defense, this.defenseExp);
Missing semicolon
exp = (5 * Math.pow(level, 3)) / 4
missing whitespace
return Math.floor((((record.baseHp+this.hpDV)*2+Math.floor(Math.floor(Math.sqrt(this.hpExp))/4))*this.level)/100) + this.level + 10;
missing whitespace
else if(gr == 3)
missing whitespace
else if(gr == 4)
if statements must be braced
if(this.isValidPokemon === false)
return this.exp;
if statements must be braced
if(record === false || record.baseHp == undefined)
return 1;
missing whitespace
return Math.floor((((record.baseHp+this.hpDV)*2+Math.floor(Math.floor(Math.sqrt(this.hpExp))/4))*this.level)/100) + this.level + 10;
missing whitespace
if((this.dv.defense % 2) !== 0)
if statements must be braced
if(nickname == "NIDORAN<F>")
nickname = "NIDORAN<f>"
if statements must be braced
if((this.dv.special % 2) !== 0)
hpDv |= 1;
" should be '
else if(nickname == "NIDORAN<M>")
missing whitespace
else if(nickname == "NIDORAN<M>")
missing whitespace
if(this.isValidPokemon === false)
Identifier 'record' is never reassigned; use 'const' instead of 'let'.
let record = this.isValidPokemon;
missing whitespace
return Math.floor((((baseStat+dv)*2+Math.floor(Math.floor(Math.sqrt(ev))/4))*this.level)/100) + 5;
missing whitespace
if(pkmn.type1 == pkmn.type2)
missing whitespace
if(record == undefined || record.pokedex == null || record.pokedex == undefined)
missing whitespace
if(record === false)
if statements must be braced
if(record == undefined || record.pokedex == null || record.pokedex == undefined)
return false;
if statements must be braced
if(this.isValidPokemon === false)
return 0;
" should be '
this.pkmnArr = this.gd.file("pokemon").data;
Missing semicolon
nickname = "NIDORAN<m>"
missing whitespace
return Math.floor((((record.baseHp+this.hpDV)*2+Math.floor(Math.floor(Math.sqrt(this.hpExp))/4))*this.level)/100) + this.level + 10;
Missing semicolon
exp = (4 * Math.pow(level, 3)) / 5
missing whitespace
return Math.floor((((record.baseHp+this.hpDV)*2+Math.floor(Math.floor(Math.sqrt(this.hpExp))/4))*this.level)/100) + this.level + 10;
missing whitespace
return Math.floor((((baseStat+dv)*2+Math.floor(Math.floor(Math.sqrt(ev))/4))*this.level)/100) + 5;
missing whitespace
if(record === false || record.baseHp == undefined)
There are no issues that match your filters.