From cdce176a5aaced2e259be8044d343785f3b391b1 Mon Sep 17 00:00:00 2001 From: nurufu Date: Sat, 16 Nov 2024 23:15:05 -0500 Subject: [PATCH] Added antishiny support --- scripts/background.css | 4 +++ scripts/background.js | 65 +++++++++++++++++++++++++++++++++--------- 2 files changed, 56 insertions(+), 13 deletions(-) diff --git a/scripts/background.css b/scripts/background.css index 5f62f6f..57919c9 100644 --- a/scripts/background.css +++ b/scripts/background.css @@ -20,6 +20,10 @@ img { -moz-animation: spin linear 5s infinite; } +.anti { + filter: invert(1); +} + .wailordnone { image-rendering: crisp-edges; max-width: 500px; diff --git a/scripts/background.js b/scripts/background.js index a9627a1..a50bd76 100644 --- a/scripts/background.js +++ b/scripts/background.js @@ -8,7 +8,10 @@ const config = { swarmOdds: 1 / 64, fakemonOdds: 1 / 128, // Chance to add a single "fakemon" from Smogon's CAP - https://www.smogon.com/dex/ss/formats/cap/ bigWailords: true, // BIG FUCKINF WAILORD - sphealSpin: true // Spinny boi + sphealSpin: true, // Spinny boi + antiShiny: false, // Enables the chance for an anti shiny Pokémon to appear + antiShinySplit: true, // Enables shiny Pokémon having a 50% chance of appearing as an anti shiny, if disabled uses antiOdds instead + antiOdds: 1 / 128 // Odds of an anti shiny Pokémon appearing if antiShinySplit is false }; // Create background elements on load @@ -48,7 +51,26 @@ function create() { } const isShiny = Math.random() < config.shinyOdds; - const sparkleClass = isShiny ? "sparkle" : "none"; + if(config.antiShiny) + { + const isAnti = Math.random() < config.antiOdds; + if(config.antiShinySplit && Math.random() < 0.5) + { + sparkleColor = isShiny ? "anti" : "none"; + } + else if(!config.antiShinySplit && !isShiny) + { + sparkleColor = isAnti ? "anti" : "none"; + } + else + { + sparkleColor = isShiny ? "sparkle" : "none"; + } + } + else{ + sparkleColor = isShiny ? "sparkle" : "none"; + } + const sparkleClass = sparkleColor const spritePath = isShiny ? "shiny/" : "normal/"; const area = floating_pokemon.includes(form) ? "sky" : "ground"; @@ -108,21 +130,38 @@ function randomOrder() { `; // Add sparkle images - if (sprite.classList.contains("sparkle") || sprite.classList.contains("wailordsparkle")) { + if (sprite.classList.contains("sparkle") || sprite.classList.contains("wailordsparkle") || sprite.classList.contains("anti")) { const offset = sprite.offsetWidth / 6; const sparkleSize = sprite.offsetWidth * 1.3; const sparkleMaxSize = sprite.classList.contains("wailordsparkle") ? 1000 : 150; - sparklesHTML += ` - Sparkle - `; - } + if(sprite.classList.contains("anti")) + { + sparklesHTML += ` + Sparkle + `; + } + else{ + sparklesHTML += ` + Sparkle + `; + } + } }); }