Support Digimon Showdown cries (#1273)

This commit is contained in:
AlfaStorm
2019-05-13 00:27:27 -04:00
committed by Guangcong Luo
parent ef530006d1
commit 04598c2d87
2 changed files with 9 additions and 1 deletions

View File

@@ -37,6 +37,7 @@ class BattleScene {
/** Note: Not the actual generation of the battle, but the gen of the sprites/background */
gen = 7;
mod = '';
/** 1 = singles, 2 = doubles, 3 = triples */
activeCount = 1;
@@ -106,6 +107,7 @@ class BattleScene {
let numericId = 0;
if (battle.id) {
numericId = parseInt(battle.id.slice(battle.id.lastIndexOf('-') + 1), 10);
if (this.battle.id.includes('digimon')) this.mod = 'digimon';
}
if (!numericId) {
numericId = Math.floor(Math.random() * 1000000);

View File

@@ -438,7 +438,7 @@ const Dex = new class implements ModdedDex {
document.getElementsByTagName('body')[0].appendChild(el);
}
getSpriteData(pokemon: Pokemon | Template | string, siden: number, options: {
gen?: number, shiny?: boolean, gender?: GenderName, afd?: boolean, noScale?: boolean,
gen?: number, shiny?: boolean, gender?: GenderName, afd?: boolean, noScale?: boolean, mod?: string,
} = {gen: 6}) {
if (!options.gen) options.gen = 6;
if (pokemon instanceof Pokemon) {
@@ -528,6 +528,12 @@ const Dex = new class implements ModdedDex {
return spriteData;
}
// Mod Cries
if (options.mod) {
spriteData.cryurl = `sprites/${options.mod}/audio/${toId(template.baseSpecies)}`;
spriteData.cryurl += (window.nodewebkit ? '.ogg' : '.mp3');
}
if (animationData[facing + 'f'] && options.gender === 'F') facing += 'f';
let allowAnim = !Dex.prefs('noanim') && !Dex.prefs('nogif');
if (allowAnim && genNum >= 6) spriteData.pixelated = false;