// ==UserScript== // @name PokeChill Plus: 超极巨化空间+超级挑战+战斗飘字+自定义木桩+银币换金币 // @namespace http://tampermonkey.net/ // @version 2.2 // @description 集成超极巨化空间、超级挑战、战斗伤害飘字、自定义木桩和银币换金币功能,支持开关控制 // @author 人民当家做主 // @match https://play-pokechill.github.io/* // @match https://g1tyx.github.io/play-pokechill/* // @icon https://play-pokechill.github.io/img/icons/icon.png // @grant none // ==/UserScript== (function() { 'use strict'; // ========== 设置与配置 ========== const SETTINGS_KEY = 'pokechill_plus_settings'; let settings = JSON.parse(localStorage.getItem(SETTINGS_KEY)) || { enableDamageFloat: true, enableSuperChallenge: true, enableCustomDummy: true, enableGmaxDimension: true, spicyLeg: 'spicyDuckLeg', dummyAreaId: 'custom_dummy_area', dummyPkmnId: 'custom_dummy_pkmn' }; function saveSettings() { localStorage.setItem(SETTINGS_KEY, JSON.stringify(settings)); } function createSettingsMenu() { const existing = document.getElementById('pokechill-plus-settings'); if (existing) { existing.remove(); return; } const settingsDiv = document.createElement('div'); settingsDiv.id = 'pokechill-plus-settings'; settingsDiv.style.cssText = ` position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); background: var(--dark1); color: white; border: 2px solid var(--light1); border-radius: 0.5rem; padding: 1.5rem; z-index: 10000; width: 400px; max-width: 90vw; font-family: 'Winky Sans', sans-serif; `; settingsDiv.innerHTML = `

PokeChill Plus 设置

`; document.body.appendChild(settingsDiv); document.getElementById('save-settings-btn').addEventListener('click', () => { settings.enableDamageFloat = document.getElementById('setting-damage-float').checked; settings.enableSuperChallenge = document.getElementById('setting-super-challenge').checked; settings.enableCustomDummy = document.getElementById('setting-custom-dummy').checked; settings.enableGmaxDimension = document.getElementById('setting-gmax-dimension').checked; saveSettings(); settingsDiv.remove(); alert('设置已保存!,刷新界面生效'); }); document.getElementById('close-settings-btn').addEventListener('click', () => { settingsDiv.remove(); }); } function addSettingsButton() { const checkMenu = () => { const menuBtn = document.getElementById('menu-button'); if (menuBtn && !document.getElementById('plus-settings-btn')) { const plusBtn = document.createElement('div'); plusBtn.id = 'plus-settings-btn'; plusBtn.innerHTML = '🔧 Plus 设置'; plusBtn.style.cssText = ` position: absolute; top: 10px; right: 10px; background: var(--dark2); color: white; padding: 0.3rem 0.8rem; border-radius: 0.3rem; font-size: 0.9rem; cursor: pointer; z-index: 100; `; menuBtn.parentElement.appendChild(plusBtn); plusBtn.addEventListener('click', createSettingsMenu); } else { setTimeout(checkMenu, 500); } }; checkMenu(); } // ========== 战斗伤害飘字系统 ========== if (settings.enableDamageFloat) { const style = document.createElement('style'); style.textContent = ` @keyframes floatUp { 0% { opacity: 1; transform: translate(-50%, -50%) scale(1); text-shadow: 0 0 8px rgba(255,255,255, 0.9); } 100% { opacity: 0; transform: translate(-50%, -120%) scale(1.1); text-shadow: none; } } `; document.head.appendChild(style); function showFloatingText(value, isPlayer, element) { if (!element || value <= 0) return; const color = isPlayer ? '#FF0000' : '#00FF00'; const fontWeight = 'bold'; const rect = element.getBoundingClientRect(); const div = document.createElement('div'); div.style.cssText = ` position: fixed; left: ${rect.left + rect.width/2}px; top: ${rect.top + rect.height/2}px; transform: translate(-50%, -50%); color: ${color}; font-weight: ${fontWeight}; font-size: 24px; text-shadow: 3px 3px 6px rgba(0,0,0, 1); z-index: 10001; pointer-events: none; animation: floatUp 2s ease-out forwards; font-family: 'Winky Sans', 'Consolas', monospace; `; div.textContent = `-${Math.round(value)}`; document.body.appendChild(div); setTimeout(() => div.remove(), 2000); } let lastWildHp = null; let lastPlayerHp = null; let lastPlayerId = null; function monitor() { if (typeof saved === 'undefined' || typeof team === 'undefined' || typeof pkmn === 'undefined') { return; } if (!saved.currentArea) { lastWildHp = null; lastPlayerHp = null; lastPlayerId = null; return; } if (typeof wildPkmnHp !== 'undefined') { if (lastWildHp === null) { lastWildHp = wildPkmnHp; } else { const diff = lastWildHp - wildPkmnHp; if (diff > 0.5) { const wildSprite = document.getElementById('explore-wild-sprite'); if (wildSprite) { showFloatingText(diff, false, wildSprite); } } lastWildHp = wildPkmnHp; } } if (typeof exploreActiveMember !== 'undefined' && team[exploreActiveMember] && team[exploreActiveMember].pkmn) { const playerObj = team[exploreActiveMember].pkmn; if (playerObj) { const currentHp = playerObj.playerHp || 0; const playerId = playerObj.id; if (lastPlayerHp === null || lastPlayerId !== playerId) { lastPlayerHp = currentHp; lastPlayerId = playerId; } else { const diff = lastPlayerHp - currentHp; if (diff > 0.5) { const playerSprite = document.getElementById(`explore-team-member-${exploreActiveMember}-sprite`); if (playerSprite) { showFloatingText(diff, true, playerSprite); } } lastPlayerHp = currentHp; } } } } setInterval(monitor, 100); } // ========== 超级挑战系统 ========== if (settings.enableSuperChallenge) { const CARD_VISIBLE_DEX = 1000; const CARD_CLICKABLE_DEX = 1115; const ENTRY_COST_ITEM = 'whiteApricorn'; const ENTRY_COST_AMOUNT = 0; const SPICY_LEG = 'spicyDuckLeg'; const SPICY_LEG_IMAGE_URL = 'https://picui.ogmua.cn/s1/2026/03/10/69b009718818c.webp'; if (typeof afkSeconds === 'undefined') var afkSeconds = 0; const MEGA_POKEMON_TO_STONE_MAP = { 'megaAbsol': 'absolite', 'megaAlakazam': 'alakazite', 'megaAmpharos': 'ampharosite', 'megaAudino': 'audinite', 'megaBanette': 'banettite', 'megaBeedrill': 'beedrillite', 'megaBlastoise': 'blastoisinite', 'megaBlaziken': 'blazikenite', 'megaCamerupt': 'cameruptite', 'megaCharizard': 'charizarditeX', 'megaCharizardFemale': 'charizarditeY', 'megaCharizardX': 'charizarditeX', 'megaCharizardY': 'charizarditeY', 'megaDiancie': 'diancite', 'megaGallade': 'galladite', 'megaGarchomp': 'garchompite', 'megaGardevoir': 'gardevoirite', 'megaGengar': 'gengarite', 'megaGlalie': 'glalitite', 'megaGyarados': 'gyaradosite', 'megaHeracross': 'heracronite', 'megaHoundoom': 'houndoominite', 'megaKangaskhan': 'kangaskhanite', 'megaLatias': 'latiasite', 'megaLatios': 'latiosite', 'megaLopunny': 'lopunnite', 'megaLucario': 'lucarionite', 'megaManectric': 'manectite', 'megaMawile': 'mawilite', 'megaMedicham': 'medichamite', 'megaMetagross': 'metagrossite', 'megaMewtwo': 'mewtwoniteX', 'megaMewtwoX': 'mewtwoniteX', 'megaMewtwoY': 'mewtwoniteY', 'megaPidgeot': 'pidgeotite', 'megaPinsir': 'pinsirite', 'megaSableye': 'sablenite', 'megaSalamence': 'salamencite', 'megaSceptile': 'sceptilite', 'megaScizor': 'scizorite', 'megaSharpedo': 'sharpedonite', 'megaSlowbro': 'slowbronite', 'megaSteelix': 'steelixite', 'megaSwampert': 'swampertite', 'megaTyranitar': 'tyranitarite', 'megaVenusaur': 'venusaurite', 'megaAltaria': 'altarianite', }; const ITEMS_FOR_EVOLUTION_SHOP = new Map(); const ALL_BOSSES_IN_ORDER = [ { id: 'burmySandy', price: 50, stars: 2 }, { id: 'burmyTrash', price: 50, stars: 2 }, { id: 'galarianMrmime', price: 250, stars: 4 }, { id: 'megaSableye', price: 6, stars: 5 }, { id: 'megaAudino', price: 7, stars: 6 }, { id: 'megaBanette', price: 7, stars: 6 }, { id: 'megaSharpedo', price: 7, stars: 6 }, { id: 'megaHoundoom', price: 7, stars: 6 }, { id: 'megaAmpharos', price: 7, stars: 6 }, { id: 'megaSlowbro', price: 8, stars: 7 }, { id: 'megaAltaria', price: 8, stars: 7 }, { id: 'megaLopunny', price: 8, stars: 7 }, { id: 'megaMedicham', price: 7, stars: 6 }, { id: 'megaGardevoir', price: 9, stars: 8 }, { id: 'rayquaza', price: 300, stars: 7 }, { id: 'megaAbsol', price: 8, stars: 7 }, { id: 'megaKangaskhan', price: 8, stars: 7 }, { id: 'megaSalamence', price: 9, stars: 8 }, { id: 'kyuremWhite', price: 500, stars: 9 }, { id: 'megaRayquaza', price: 888, stars: 10 }, { id: 'arceus', price: 9999, stars: 10 } ]; let BOSS_CONFIG = ALL_BOSSES_IN_ORDER.reduce((acc, currentBoss, index) => { const prevBoss = ALL_BOSSES_IN_ORDER[index - 1]; acc.push({ ...currentBoss, prevId: prevBoss ? prevBoss.id : null }); return acc; }, []); console.log('[超级挑战] Boss解锁顺序已配置:', BOSS_CONFIG.map(b => ({ id: b.id, prevId: b.prevId }))); const priceMap = {}; const evolutionPriceMap = {}; function ensureSpicyLeg() { if (!item[SPICY_LEG]) { item[SPICY_LEG] = { id: SPICY_LEG, name: '麻辣鸭腿', rename: '麻辣鸭腿', type: 'key', got: 0, newItem: 0, info: function() { return '超级挑战中掉落的稀有物品...'; } }; } if (item[SPICY_LEG].newItem === undefined) { item[SPICY_LEG].newItem = 0; } } const originalLoadGame = window.loadGame; window.loadGame = function() { const result = originalLoadGame ? originalLoadGame() : undefined; ensureSpicyLeg(); return result; }; const originalSetWildPkmn = window.setWildPkmn; window.setWildPkmn = function() { originalSetWildPkmn(); if (saved.currentArea && saved.currentArea.startsWith('superChallenge_')) { const areaId = saved.currentArea; const bossId = areaId.replace('superChallenge_', ''); const config = BOSS_CONFIG.find(c => c.id === bossId); const stars = config ? config.stars : 5; if (stars >= 4) wildBuffs.atkup1 = 99; if (stars >= 6) wildBuffs.defup1 = 99; if (stars >= 8) wildBuffs.satkup1 = 99; if (stars >= 9) wildBuffs.sdefup1 = 99; if (stars >= 10) wildBuffs.speup1 = 99; updateWildBuffs(); } }; function waitForGame() { if (typeof areas !== 'undefined' && typeof item !== 'undefined' && typeof pkmn !== 'undefined' && typeof givePkmn !== 'undefined' && typeof saveGame !== 'undefined' && typeof updatePreviewTeam !== 'undefined') { init(); } else { setTimeout(waitForGame, 100); } } function init() { ensureSpicyLeg(); defineChallengeAreas(); addMainCardToExploreMenu(); addMainShopItems(); addEvolutionShopItems(); observeMenu(); injectCustomStyles(); hookItemShopImages(); startHealthCheck(); setInterval(updateCardLock, 5000); console.log('[超级挑战] 已启动,奖励修复版 + 商店中文提示。非Mega精灵进主商店,Mega石等进进化商店。Boss需按顺序击败解锁。'); } function generateValidMoves(pokemonId, stars = 5) { const boss = pkmn[pokemonId]; if (!boss) return ['tackle', 'tackle', 'tackle', 'tackle']; const types = Array.isArray(boss.type) ? boss.type : []; const moves = []; const used = new Set(); if (boss.signature && boss.signature.id && move[boss.signature.id]) { moves.push(boss.signature.id); used.add(boss.signature.id); } const candidates = []; for (let moveId in move) { if (used.has(moveId)) continue; const m = move[moveId]; if (!m || m.power === undefined || m.power <= 0) continue; const moveset = Array.isArray(m.moveset) ? m.moveset : []; const canLearn = moveset.includes('all') || types.some(t => moveset.includes(t)); if (!canLearn) continue; candidates.push({ id: moveId, power: m.power, timer: m.timer || 2000 }); } if (stars >= 8) { candidates.sort((a, b) => b.power - a.power); } else if (stars >= 5) { candidates.sort((a, b) => (b.power * 0.7 + (2000 / (b.timer || 2000)) * 0.3) - (a.power * 0.7 + (2000 / (a.timer || 2000)) * 0.3)); } else { candidates.sort(() => Math.random() - 0.5); } for (let cand of candidates) { if (moves.length >= 4) break; if (!used.has(cand.id)) { moves.push(cand.id); used.add(cand.id); } } const defaultMoves = ['hyperBeam', 'earthquake', 'fireBlast', 'thunderbolt']; for (let d of defaultMoves) { if (moves.length >= 4) break; if (!used.has(d) && move[d]) { moves.push(d); used.add(d); } } while (moves.length < 4) moves.push('tackle'); return moves; } function defineChallengeAreas() { const APRICORN_COMMON = ['yellowApricorn', 'pinkApricorn', 'greenApricorn']; const APRICORN_RARE = ['whiteApricorn']; const APRICORN_VERY_RARE = ['blackApricorn']; const ITEM_POOL = { low: ['focusBand', 'kingsRock'], medium: ['lifeOrb', 'choiceBand'], high: ['assaultVest', 'leftovers'], veryHigh: ['choiceSpecs', 'weaknessPolicy'] }; const FIELD_EFFECTS = { low: ['field.heavyWeather'], medium: ['field.weakeningCurse'], high: ['field.fatiguingCurse'], veryHigh: ['field.wonderWard', 'field.neutralisingGas'] }; BOSS_CONFIG.forEach(({ id, stars, prevId }) => { const areaId = `superChallenge_${id}`; const itemReward = { 1: { item: SPICY_LEG, amount: 1 } }; let rewardIndex = 2; if (stars >= 1 && stars <= 3) { const berry = APRICORN_COMMON[Math.floor(Math.random() * APRICORN_COMMON.length)]; itemReward[rewardIndex++] = { item: berry, amount: 1 }; } else if (stars >= 4 && stars <= 6) { for (let i = 0; i < 2; i++) { const berry = APRICORN_COMMON[Math.floor(Math.random() * APRICORN_COMMON.length)]; itemReward[rewardIndex++] = { item: berry, amount: 1 }; } } else if (stars >= 7 && stars <= 9) { for (let i = 0; i < 2; i++) { const berry = APRICORN_COMMON[Math.floor(Math.random() * APRICORN_COMMON.length)]; itemReward[rewardIndex++] = { item: berry, amount: 1 }; } const rareBerry = APRICORN_RARE[Math.floor(Math.random() * APRICORN_RARE.length)]; itemReward[rewardIndex++] = { item: rareBerry, amount: 1 }; itemReward[rewardIndex++] = { item: 'goldenBottleCap', amount: 1 }; } else if (stars === 10) { for (let i = 0; i < 2; i++) { const berry = APRICORN_COMMON[Math.floor(Math.random() * APRICORN_COMMON.length)]; itemReward[rewardIndex++] = { item: berry, amount: 1 }; } const rareBerry = APRICORN_RARE[Math.floor(Math.random() * APRICORN_RARE.length)]; itemReward[rewardIndex++] = { item: rareBerry, amount: 1 }; const veryRareBerry = APRICORN_VERY_RARE[Math.floor(Math.random() * APRICORN_VERY_RARE.length)]; itemReward[rewardIndex++] = { item: veryRareBerry, amount: 1 }; itemReward[rewardIndex++] = { item: 'goldenBottleCap', amount: 2 }; } const difficulty = 300 + stars * 80; let bossItem = undefined; if (stars <= 3) { bossItem = ITEM_POOL.low[Math.floor(Math.random() * ITEM_POOL.low.length)]; } else if (stars <= 5) { bossItem = ITEM_POOL.medium[Math.floor(Math.random() * ITEM_POOL.medium.length)]; } else if (stars <= 7) { bossItem = ITEM_POOL.high[Math.floor(Math.random() * ITEM_POOL.high.length)]; } else { bossItem = ITEM_POOL.veryHigh[Math.floor(Math.random() * ITEM_POOL.veryHigh.length)]; } const fieldEffects = []; if (stars >= 4) fieldEffects.push(FIELD_EFFECTS.low[0]); if (stars >= 6) fieldEffects.push(FIELD_EFFECTS.medium[0]); if (stars >= 8) fieldEffects.push(FIELD_EFFECTS.high[0]); if (stars >= 9) fieldEffects.push(FIELD_EFFECTS.veryHigh[0]); if (stars === 10) fieldEffects.push(FIELD_EFFECTS.veryHigh[1]); let unlockRequirement, unlockDescription; if (prevId) { unlockRequirement = function() { const prevAreaId = `superChallenge_${prevId}`; return item[ENTRY_COST_ITEM] && item[ENTRY_COST_ITEM].got >= ENTRY_COST_AMOUNT && areas[prevAreaId] && areas[prevAreaId].defeated; }; const prevBossName = format(prevId) || prevId; unlockDescription = `需要 ${ENTRY_COST_AMOUNT} 个 ${format(ENTRY_COST_ITEM)},并击败 ${prevBossName}`; } else { unlockRequirement = function() { return item[ENTRY_COST_ITEM] && item[ENTRY_COST_ITEM].got >= ENTRY_COST_AMOUNT; }; unlockDescription = `需要 ${ENTRY_COST_AMOUNT} 个 ${format(ENTRY_COST_ITEM)}`; } areas[areaId] = { id: areaId, name: `超级挑战·${format(id)}`, type: 'event', trainer: true, encounter: true, level: 100, difficulty: difficulty, icon: pkmn[id], background: 'space', unlockRequirement: unlockRequirement, unlockDescription: unlockDescription, encounterEffect: function() { if (item[ENTRY_COST_ITEM]) item[ENTRY_COST_ITEM].got -= ENTRY_COST_AMOUNT; }, team: { slot1: pkmn[id], slot1Moves: generateValidMoves(id, stars) }, ...(bossItem && { slot1Item: bossItem }), fieldEffect: fieldEffects.map(eff => eff.replace('field.', '')), timed: false, ticketIndex: 0, defeated: false, itemReward: itemReward, drops: { common: [] }, spawns: { common: [] }, reward: [] }; }); } function addMainCardToExploreMenu() { const exploreMenu = document.getElementById('explore-menu'); if (!exploreMenu) return; const old = document.getElementById('superChallengeMainCard'); if (old) old.remove(); const card = document.createElement('div'); card.id = 'superChallengeMainCard'; card.className = 'explore-ticket'; card.style.marginBottom = '10px'; card.style.cursor = 'pointer'; card.innerHTML = `
超级挑战
`; exploreMenu.appendChild(card); card.addEventListener('click', openChallengeMenu); updateCardLock(); } function updateCardLock() { const card = document.getElementById('superChallengeMainCard'); if (!card) return; const reqSpan = card.querySelector('#dexRequirement'); if (!reqSpan) return; const dexCount = getDexCount(); if (dexCount >= CARD_CLICKABLE_DEX) { card.style.filter = 'brightness(1)'; card.style.pointerEvents = 'auto'; card.style.display = ''; reqSpan.innerHTML = `已解锁 (${dexCount}/${CARD_CLICKABLE_DEX})`; } else if (dexCount >= CARD_VISIBLE_DEX) { card.style.filter = 'brightness(0.5) grayscale(80%)'; card.style.pointerEvents = 'none'; card.style.display = ''; reqSpan.innerHTML = `需要图鉴数 ${CARD_CLICKABLE_DEX} (当前 ${dexCount})`; } else { card.style.display = 'none'; } } function getDexCount() { return Object.values(pkmn).filter(p => p && p.caught > 0).length; } function getTotalPkmnCount() { return Object.values(pkmn).filter(p => p && !p.hidden && !p.unobtainable).length-1; } let currentOverlay = null; function openChallengeMenu() { if (getDexCount() < CARD_CLICKABLE_DEX) return; if (currentOverlay) closeChallengeMenu(); const overlay = document.createElement('div'); overlay.className = 'super-challenge-overlay'; overlay.id = 'superChallengeOverlay'; overlay.addEventListener('click', e => { if (e.target === overlay) closeChallengeMenu(); }); const container = document.createElement('div'); container.className = 'super-challenge-container'; container.innerHTML = `
🔥超级挑战🔥
`; overlay.appendChild(container); document.body.appendChild(overlay); currentOverlay = overlay; document.getElementById('superChallengeCloseBtn').addEventListener('click', closeChallengeMenu); const listDiv = document.getElementById('superChallengeList'); const sortedBosses = [...BOSS_CONFIG].sort((a, b) => (a.stars || 5) - (b.stars || 5)); sortedBosses.forEach(({ id, stars, prevId }) => { const boss = pkmn[id]; if (!boss) return; const starCount = stars || 5; const starString = '★'.repeat(starCount) + '☆'.repeat(10 - starCount); const areaId = `superChallenge_${id}`; const isUnlocked = areas[areaId]?.unlockRequirement?.(); const isDefeated = areas[areaId]?.defeated; const hasPrev = prevId !== null; const card = document.createElement('div'); card.className = 'super-challenge-card'; if (!isUnlocked) { card.classList.add('locked'); card.style.opacity = '0.5'; card.style.pointerEvents = 'none'; } card.setAttribute('data-boss', id); let statusText = ''; if (isDefeated) { statusText = '[已击败]'; } else if (isUnlocked) { statusText = '[可挑战]'; } else { if (hasPrev) { const prevBossName = format(prevId) || prevId; statusText = `[需先击败 ${prevBossName}]`; } else { statusText = '[未解锁]'; } } let costHtml = ''; if (ENTRY_COST_AMOUNT > 0) { costHtml = `
消耗: ${format(ENTRY_COST_ITEM)} x${ENTRY_COST_AMOUNT}
`; } card.innerHTML = `
${format(id)} ${statusText}
等级100 · 难度 ${starString}
${costHtml}
`; if (isUnlocked) { card.addEventListener('click', e => { e.stopPropagation(); startChallenge(id); closeChallengeMenu(); }); } listDiv.appendChild(card); }); replaceSpicyLegImages(); } function closeChallengeMenu() { if (currentOverlay) { currentOverlay.remove(); currentOverlay = null; } } function startChallenge(bossId) { const areaId = `superChallenge_${bossId}`; if (!areas[areaId]) return; const config = BOSS_CONFIG.find(c => c.id === bossId); const stars = config ? config.stars : 5; const moves = generateValidMoves(bossId, stars); let bossItem = undefined; if (stars <= 3) { bossItem = ['focusBand', 'kingsRock'][Math.floor(Math.random() * 2)]; } else if (stars <= 5) { bossItem = ['lifeOrb', 'choiceBand'][Math.floor(Math.random() * 2)]; } else if (stars <= 7) { bossItem = ['assaultVest', 'leftovers'][Math.floor(Math.random() * 2)]; } else { bossItem = ['choiceSpecs', 'weaknessPolicy'][Math.floor(Math.random() * 2)]; } areas[areaId].team.slot1Moves = moves; if (bossItem) areas[areaId].team.slot1Item = bossItem; saved.currentAreaBuffer = areaId; const previewExit = document.getElementById('preview-team-exit'); const teamMenu = document.getElementById('team-menu'); const menuButton = document.getElementById('menu-button-parent'); const exploreMenu = document.getElementById('explore-menu'); if (previewExit && teamMenu && menuButton && exploreMenu) { previewExit.style.display = 'flex'; teamMenu.style.zIndex = '50'; teamMenu.style.display = 'flex'; menuButton.style.display = 'none'; exploreMenu.style.display = 'none'; } afkSeconds = 0; if (typeof updatePreviewTeam === 'function') updatePreviewTeam(); } function addMainShopItems() { if (typeof shop === 'undefined') { setTimeout(addMainShopItems, 200); return; } BOSS_CONFIG.forEach(({ id, price }) => { const shopId = `shop_super_${id}`; const isMegaPokemon = MEGA_POKEMON_TO_STONE_MAP.hasOwnProperty(id); if (isMegaPokemon) { const stoneId = MEGA_POKEMON_TO_STONE_MAP[id]; ITEMS_FOR_EVOLUTION_SHOP.set(stoneId, price); console.log(`[超级挑战商店] 发现Mega宝可梦 ${id}, 对应石头ID为 ${stoneId}, 加入进化商店队列,价格 ${price}。`); return; } if (shop[shopId]) return; shop[shopId] = { pkmn: id, price: price, currency: SPICY_LEG, category: 'pokemon', effect: function() { givePkmn(pkmn[id], 1); } }; priceMap[id] = price; }); if (typeof updateItemShop === 'function') updateItemShop(); } function addEvolutionShopItems() { if (typeof shop === 'undefined') { setTimeout(addEvolutionShopItems, 200); return; } ITEMS_FOR_EVOLUTION_SHOP.forEach((price, itemId) => { const shopId = `shop_super_evolution_${itemId}`; if (!item[itemId]) { console.warn(`[超级挑战进化商店] 道具 ${itemId} 不存在,无法添加。`); return; } if (shop[shopId]) { console.log(`[超级挑战进化商店] 道具 ${itemId} 的商店项已存在,跳过。`); return; } shop[shopId] = { icon: itemId, price: price, currency: SPICY_LEG, category: 'evolution', effect: function() { item[itemId].got += 1; } }; evolutionPriceMap[itemId] = price; console.log(`[超级挑战进化商店] 添加道具 ${itemId} 到进化商店,价格 ${price}`); }); if (typeof updateItemShop === 'function') updateItemShop(); } function getChineseName(id) { if (!window.format) return id; const displayName = window.format(id); if (window.EN_CN_DICT && window.EN_CN_DICT[displayName]) { return window.EN_CN_DICT[displayName]; } return displayName; } let battleEnded = false; function startHealthCheck() { setInterval(() => { if (!saved.currentArea || !saved.currentArea.startsWith('superChallenge_')) { battleEnded = false; return; } if (battleEnded) return; let hp = window.wildPkmnHp; if (hp === undefined && window.wildPkmn && window.wildPkmn.hp !== undefined) { hp = window.wildPkmn.hp; } if (hp !== undefined && hp <= 0) { battleEnded = true; console.log('[超级挑战] 血量归零,尝试退出'); if (typeof updateWildPkmn === 'function') updateWildPkmn(); setTimeout(() => { const leaveBtn = document.getElementById('explore-leave'); if (leaveBtn) leaveBtn.click(); else if (typeof leaveCombat === 'function') leaveCombat(); }, 500); } }, 500); } function hookItemShopImages() { const originalUpdateItemShop = window.updateItemShop; if (typeof originalUpdateItemShop === 'function') { window.updateItemShop = function() { originalUpdateItemShop(); setTimeout(() => { replaceSpicyLegImages(); bindShopEvents(); }, 50); }; } setInterval(replaceSpicyLegImages, 2000); } let modalOverlay = null; function showFormalMessage(title, content, pkmnId = null) { if (modalOverlay) closeModal(); modalOverlay = document.createElement('div'); modalOverlay.style.position = 'fixed'; modalOverlay.style.top = '0'; modalOverlay.style.left = '0'; modalOverlay.style.width = '100%'; modalOverlay.style.height = '100%'; modalOverlay.style.background = 'rgba(0,0,0,0.8)'; modalOverlay.style.backdropFilter = 'blur(8px)'; modalOverlay.style.zIndex = '30000'; modalOverlay.style.display = 'flex'; modalOverlay.style.justifyContent = 'center'; modalOverlay.style.alignItems = 'center'; modalOverlay.style.animation = 'tooltipBoxAppear 0.2s ease'; modalOverlay.style.padding = '10px'; const modalBox = document.createElement('div'); modalBox.style.background = '#1a1a2e'; modalBox.style.border = '3px solid #4ecca3'; modalBox.style.borderRadius = '30px'; modalBox.style.padding = 'clamp(15px, 5vw, 30px) clamp(20px, 8vw, 50px)'; modalBox.style.boxShadow = '0 0 50px #4ecca3'; modalBox.style.textAlign = 'center'; modalBox.style.color = 'white'; modalBox.style.fontFamily = "'Winky Sans', sans-serif"; modalBox.style.maxWidth = '500px'; modalBox.style.width = '90%'; const titleEl = document.createElement('h2'); titleEl.textContent = title; titleEl.style.marginBottom = '20px'; titleEl.style.fontSize = 'clamp(1.5rem, 6vw, 2rem)'; titleEl.style.background = 'linear-gradient(45deg, #4ecca3, #00adb5)'; titleEl.style.webkitBackgroundClip = 'text'; titleEl.style.webkitTextFillColor = 'transparent'; titleEl.style.backgroundClip = 'text'; const contentWrapper = document.createElement('div'); contentWrapper.style.display = 'flex'; contentWrapper.style.flexDirection = 'column'; contentWrapper.style.alignItems = 'center'; contentWrapper.style.gap = '15px'; if (pkmnId) { const img = document.createElement('img'); img.src = `img/pkmn/sprite/${pkmnId}.png`; img.style.width = 'clamp(64px, 20vw, 96px)'; img.style.height = 'clamp(64px, 20vw, 96px)'; img.style.imageRendering = 'pixelated'; img.style.filter = 'drop-shadow(0 0 10px gold)'; contentWrapper.appendChild(img); } const contentEl = document.createElement('p'); contentEl.textContent = content; contentEl.style.fontSize = 'clamp(1rem, 4vw, 1.3rem)'; contentEl.style.lineHeight = '1.5'; contentEl.style.margin = '0'; contentWrapper.appendChild(contentEl); const confirmBtn = document.createElement('button'); confirmBtn.textContent = '确 定'; confirmBtn.style.background = 'linear-gradient(45deg, #ff6b6b, #ff4757)'; confirmBtn.style.border = 'none'; confirmBtn.style.borderRadius = '40px'; confirmBtn.style.color = 'white'; confirmBtn.style.fontSize = 'clamp(1.2rem, 5vw, 1.5rem)'; confirmBtn.style.padding = 'clamp(8px, 2vw, 10px) clamp(20px, 8vw, 40px)'; confirmBtn.style.cursor = 'pointer'; confirmBtn.style.fontWeight = 'bold'; confirmBtn.style.boxShadow = '0 0 20px #ff6b6b'; confirmBtn.style.transition = '0.2s'; confirmBtn.onmouseover = () => confirmBtn.style.transform = 'scale(1.05)'; confirmBtn.onmouseout = () => confirmBtn.style.transform = 'scale(1)'; confirmBtn.onclick = closeModal; modalBox.appendChild(titleEl); modalBox.appendChild(contentWrapper); modalBox.appendChild(confirmBtn); modalOverlay.appendChild(modalBox); document.body.appendChild(modalOverlay); } function closeModal() { if (modalOverlay) { modalOverlay.remove(); modalOverlay = null; } } function bindShopEvents() { const shopListing = document.getElementById('shop-listing'); if (!shopListing) return; function shopClickHandler(event) { let target = event.target; while (target && target !== shopListing) { // 处理宝可梦购买 (data-pkmn) if (target.matches && target.matches('#shop-listing > div[data-pkmn]')) { const id = target.dataset.pkmn; if (priceMap[id] !== undefined) { event.stopPropagation(); event.preventDefault(); if (id === 'arceus') { const caught = getDexCount(); const total = getTotalPkmnCount(); if (caught < total) { showFormalMessage('无法购买', `需要先收集所有宝可梦 (${caught}/${total}) 才能购买阿尔宙斯!`); return; } } const price = priceMap[id]; if (item[SPICY_LEG].got < price) { showFormalMessage('无法购买', '麻辣鸭腿不足!'); return; } item[SPICY_LEG].got -= price; givePkmn(pkmn[id], 1); saveGame(); const chineseName = getChineseName(id); showFormalMessage('购买成功', `获得 ${chineseName}!`, id); updateItemShop(); } break; } // 处理进化道具购买 (data-item) if (target.matches && target.matches('#shop-listing > div[data-item]')) { const itemId = target.dataset.item; if (evolutionPriceMap[itemId] !== undefined) { event.stopPropagation(); event.preventDefault(); const price = evolutionPriceMap[itemId]; const currency = SPICY_LEG; const maxAffordable = Math.floor(item[currency].got / price); const maxAllowed = 21; // 每个进化石最多购买21个 // 显示自定义数量选择弹框(模仿游戏原生样式) document.getElementById("tooltipTop").style.display = "none"; document.getElementById("tooltipTitle").innerHTML = "选择购买数量"; document.getElementById("tooltipMid").style.display = "none"; document.getElementById("tooltipBottom").innerHTML = `
x21
`; document.querySelectorAll("#tooltipBottom div").forEach(el => { el.addEventListener("click", () => { const amount = +el.dataset.amount; const maxBuy = Math.min(maxAffordable, maxAllowed); if (amount > maxBuy) { showFormalMessage('无法购买', `最多只能购买 ${maxBuy} 个!`); return; } const totalCost = price * amount; if (item[currency].got >= totalCost) { item[currency].got -= totalCost; if (item[itemId].got === undefined) item[itemId].got = 0; item[itemId].got += amount; saveGame(); const chineseName = getChineseName(itemId); showFormalMessage('购买成功', `获得 ${chineseName} x${amount}!`, itemId); updateItemShop(); closeTooltip(); } else { document.getElementById("tooltipTitle").innerHTML = "货币不足"; document.getElementById("tooltipTop").style.display = "none"; document.getElementById("tooltipMid").style.display = "none"; document.getElementById("tooltipBottom").innerHTML = `麻辣鸭腿不足`; } }); }); openTooltip(); } else if (itemId === 'goldenBottleCap' && target.dataset.exchangeItem === "goldenCrown") { // 处理银冠换金冠(保持不变) event.stopPropagation(); event.preventDefault(); const shopItem = shop['shopGoldenCrownExchange']; if (!shopItem) return; document.getElementById("tooltipTop").style.display = "none" document.getElementById("tooltipTitle").innerHTML = "How many will you buy?" document.getElementById("tooltipMid").style.display = "none" document.getElementById("tooltipBottom").innerHTML = `
x1
x5
x10
x25
x50
x100
` document.querySelectorAll("#tooltipBottom div").forEach(el => { el.addEventListener("click", () => { buyItem(+el.dataset.amount) }) }) openTooltip() function buyItem(amount) { const currencyId = shopItem.currency || 'bottleCap'; const price = shopItem.price; const totalCost = price * amount; if (item[currencyId].got >= totalCost) { item[currencyId].got -= totalCost; for (let l = 0; l < amount; l++) { if (shopItem.effect) { shopItem.effect(); } else { item[shopItem.icon].got += 1; } } updateItemShop(); closeTooltip(); } else { document.getElementById("tooltipTitle").innerHTML = "Cant afford"; document.getElementById("tooltipTop").style.display = "none"; document.getElementById("tooltipMid").style.display = "none"; document.getElementById("tooltipBottom").innerHTML = `You cant afford to purchase this`; } } } break; } target = target.parentNode; } } shopListing.removeEventListener('click', shopClickHandler, true); shopListing.addEventListener('click', shopClickHandler, true); } function replaceSpicyLegImages() { document.querySelectorAll(`img[src*="${SPICY_LEG}.png"], .spicy-leg-icon`).forEach(img => { if (img.src !== SPICY_LEG_IMAGE_URL) img.src = SPICY_LEG_IMAGE_URL; img.style.width = '32px'; img.style.height = '32px'; img.classList.add('spicy-leg-icon'); }); } function observeMenu() { const observer = new MutationObserver(() => { const exploreMenu = document.getElementById('explore-menu'); if (exploreMenu && !document.getElementById('superChallengeMainCard')) { addMainCardToExploreMenu(); } }); observer.observe(document.body, { childList: true, subtree: true }); } function injectCustomStyles() { const style = document.createElement('style'); style.textContent = ` .super-challenge-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.7); backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px); z-index: 10000; display: flex; justify-content: center; align-items: center; animation: tooltipBoxAppear 0.2s ease; } .super-challenge-card-cost { font-size: 0.8rem; opacity: 0.8; margin-top: 4px; color: #ffd966; } .super-challenge-container { width: 650px; max-width: 90vw; max-height: 80vh; background: var(--dark1); border: 2px solid var(--light2); border-radius: 12px; box-shadow: 0 0 30px rgba(255, 69, 0, 0.6); display: flex; flex-direction: column; overflow: hidden; animation: tooltipBoxAppear 0.2s ease; color: var(--light2); font-family: 'Winky Sans', sans-serif; } .super-challenge-header { background: var(--dark2); padding: 15px 20px; display: flex; justify-content: space-between; align-items: center; border-bottom: 2px solid var(--light1); } .super-challenge-header span:first-child { font-size: 1.8rem; font-weight: bold; color: #ff9966; text-shadow: 2px 2px 0 #aa3300; } .super-challenge-close { font-size: 2rem; cursor: pointer; color: var(--light1); transition: 0.1s; line-height: 1; } .super-challenge-card.locked { cursor: not-allowed; } .super-challenge-close:hover { color: #ff8888; transform: scale(1.1); } .super-challenge-list { padding: 15px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; background: var(--dark1); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cg fill='white' fill-opacity='0.03'%3E%3Cpolygon fill-rule='evenodd' points='8 4 12 6 8 8 6 12 4 8 0 6 4 4 6 0 8 4'/%3E%3C/g%3E%3C/svg%3E"); } .super-challenge-card { background: rgba(0, 0, 0, 0.45); border: 1px solid var(--light1); border-radius: 10px; padding: 12px 15px; display: flex; align-items: center; gap: 15px; cursor: pointer; transition: 0.1s; color: white; backdrop-filter: blur(2px); } .super-challenge-card:hover { filter: brightness(1.2); border-color: #ffaa66; transform: translateY(-2px); box-shadow: 0 5px 10px rgba(0,0,0,0.5); } .super-challenge-card:active { transform: scale(0.98); } .super-challenge-card img { width: 64px; height: 64px; image-rendering: pixelated; background: rgba(0,0,0,0.2); border-radius: 8px; } .super-challenge-card-info { flex: 1; } .super-challenge-card-name { font-size: 1.3rem; font-weight: 200; margin-bottom: 4px; } .super-challenge-card-desc { font-size: 0.9rem; opacity: 0.7; } @media (max-width: 768px) { .super-challenge-card-stars { display: none !important; } .super-challenge-card .super-challenge-card-info { margin-right: 0; } } .super-challenge-card-stars { background: var(--dark2); padding: 5px 12px; border-radius: 20px; color: #ffd966; border: 1px solid #ffaa33; display: flex; align-items: center; gap: 4px; font-size: 1rem; white-space: nowrap; } .super-challenge-card-stars img { width: 32px !important; height: 32px !important; margin-right: 2px; vertical-align: middle; } #superChallengeMainCard .explore-ticket-left span:first-child { font-size: 1.5rem !important; } #superChallengeMainCard .explore-ticket-left span strong {font-size: 1.2rem !important; padding: 4px 10px !important; } `; document.head.appendChild(style); } const originalLeaveCombat = window.leaveCombat; window.leaveCombat = function() { if (originalLeaveCombat) originalLeaveCombat(); }; waitForGame(); console.log('[超级挑战] 已启用'); } // ========== 超极巨化空间系统 ========== if (settings.enableGmaxDimension) { const REQUIRED_ARCEUS = true; const GMAX_FRAGMENT = 'gmaxFragment'; const GACHA_COST = 30; const ROTATION_HOURS = 12; const BOSS_LEVEL = 150; const BOSS_COUNT = 5; if (typeof afkSeconds === 'undefined') var afkSeconds = 0; let currentGmaxBosses = []; let lastRotationTime = Date.now(); let countdownInterval = null; function getDexCount() { return Object.values(pkmn).filter(p => p && p.caught > 0).length; } function ensureCustomItems() { if (!item[GMAX_FRAGMENT]) { item[GMAX_FRAGMENT] = { id: GMAX_FRAGMENT, rename: '超极巨化碎片', type: 'key', got: 0, newItem: 0, info: function() { return '击败超极巨化宝可梦获得的稀有碎片...'; } }; } if (item[GMAX_FRAGMENT].newItem === undefined) { item[GMAX_FRAGMENT].newItem = 0; } } const originalLoadGame = window.loadGame; window.loadGame = function() { const result = originalLoadGame ? originalLoadGame() : undefined; ensureCustomItems(); return result; }; const originalSaveGame = window.saveGame; window.saveGame = function() { if (originalSaveGame) originalSaveGame(); }; function getAllGmaxPokemon() { const gmaxList = []; for (const id in pkmn) { if (id.toLowerCase().includes('gmax')) { gmaxList.push(id); } } return gmaxList; } function refreshGmaxBosses() { const allGmax = getAllGmaxPokemon(); if (allGmax.length === 0) return; const shuffled = [...allGmax].sort(() => Math.random() - 0.5); currentGmaxBosses = shuffled.slice(0, BOSS_COUNT); console.log('[超极巨化空间] 刷新Boss:', currentGmaxBosses); lastRotationTime = Date.now(); if (document.getElementById('gmax-dimension-menu')?.style.display === 'flex') { updateGmaxPageDisplay(); } } function generateValidMoves(pokemonId) { const boss = pkmn[pokemonId]; if (!boss) return ['tackle', 'tackle', 'tackle', 'tackle']; const types = Array.isArray(boss.type) ? boss.type : []; const moves = []; const used = new Set(); if (boss.signature && boss.signature.id && move[boss.signature.id]) { moves.push(boss.signature.id); used.add(boss.signature.id); } const candidates = []; for (let moveId in move) { if (used.has(moveId)) continue; const m = move[moveId]; if (!m || m.power === undefined || m.power <= 0) continue; const moveset = Array.isArray(m.moveset) ? m.moveset : []; const canLearn = moveset.includes('all') || types.some(t => moveset.includes(t)); if (!canLearn) continue; candidates.push({ id: moveId, power: m.power }); } candidates.sort((a, b) => b.power - a.power); for (let cand of candidates) { if (moves.length >= 4) break; if (!used.has(cand.id)) { moves.push(cand.id); used.add(cand.id); } } const defaultMoves = ['hyperBeam', 'earthquake', 'fireBlast', 'thunderbolt']; for (let d of defaultMoves) { if (moves.length >= 4) break; if (!used.has(d) && move[d]) { moves.push(d); used.add(d); } } while (moves.length < 4) moves.push('tackle'); return moves; } function updateGmaxAreas() { for (const areaId in areas) { if (areaId.startsWith('gmaxChallenge_')) { delete areas[areaId]; } } currentGmaxBosses.forEach(id => { const areaId = `gmaxChallenge_${id}`; if (areas[areaId]) return; areas[areaId] = { id: areaId, name: `超极巨·${format(id)}`, type: 'event', trainer: true, encounter: true, level: BOSS_LEVEL, difficulty: 800, icon: pkmn[id], background: 'space', unlockRequirement: () => true, unlockDescription: '', encounterEffect: () => {}, team: { slot1: pkmn[id], slot1Moves: generateValidMoves(id) }, fieldEffect: [], timed: false, ticketIndex: 0, defeated: false, itemReward: { 1: { item: GMAX_FRAGMENT, amount: 1 } }, reward: [], drops: { common: [] }, spawns: { common: [] } }; }); } const originalSetWildPkmn = window.setWildPkmn; window.setWildPkmn = function() { originalSetWildPkmn(); if (saved.currentArea && saved.currentArea.startsWith('gmaxChallenge_')) { wildBuffs.atkup1 = 99; wildBuffs.defup1 = 99; wildBuffs.satkup1 = 99; wildBuffs.sdefup1 = 99; wildBuffs.speup1 = 99; updateWildBuffs(); } }; function createGmaxPage() { if (document.getElementById('gmax-dimension-menu')) return; const page = document.createElement('div'); page.id = 'gmax-dimension-menu'; page.style.display = 'none'; page.style.position = 'fixed'; page.style.height = '100%'; page.style.width = '50%'; page.style.background = 'url("img/bg/dimension-1.jpg")'; page.style.backgroundSize = 'cover'; page.style.zIndex = '150'; page.style.overflow = 'scroll'; page.style.overflowX = 'hidden'; page.style.flexDirection = 'column'; page.style.paddingBottom = '3rem'; const header = document.createElement('div'); header.style.height = '5rem'; header.style.width = '100%'; header.style.display = 'flex'; header.style.justifyContent = 'space-between'; header.style.alignItems = 'center'; header.style.padding = '0.4rem 2%'; header.style.marginBottom = '1rem'; header.style.zIndex = '3'; const menuButton = document.createElement('div'); menuButton.style.display = 'flex'; menuButton.style.alignItems = 'center'; menuButton.style.gap = '5px'; menuButton.style.background = 'rgba(0,0,0,0.5)'; menuButton.style.border = '1px solid rgba(255,255,255,0.7)'; menuButton.style.borderRadius = '0.5rem'; menuButton.style.padding = '0.5rem 1rem'; menuButton.style.cursor = 'pointer'; menuButton.style.color = 'white'; menuButton.style.fontSize = '1.2rem'; menuButton.innerHTML = ` 菜单 `; menuButton.onclick = () => { page.style.display = 'none'; openMenu(); }; const titleSpan = document.createElement('span'); titleSpan.style.display = 'flex'; titleSpan.style.alignItems = 'center'; titleSpan.style.background = 'rgba(0,0,0,0.5)'; titleSpan.style.border = '1px solid rgba(255,255,255,0.7)'; titleSpan.style.borderRadius = '0.5rem'; titleSpan.style.padding = '0.5rem 1rem'; titleSpan.style.color = 'white'; titleSpan.style.fontSize = '1.5rem'; titleSpan.innerHTML = ` 超极巨化空间 `; header.appendChild(menuButton); header.appendChild(titleSpan); const content = document.createElement('div'); content.style.width = '100%'; content.style.padding = '10px'; content.style.display = 'flex'; content.style.flexDirection = 'column'; content.style.gap = '20px'; const statsBar = document.createElement('div'); statsBar.className = 'gmax-stats'; statsBar.style.display = 'flex'; statsBar.style.flexDirection = window.innerWidth < 768 ? 'column' : 'row'; statsBar.style.justifyContent = 'space-between'; statsBar.style.alignItems = 'center'; statsBar.style.background = 'rgba(0,0,0,0.6)'; statsBar.style.borderRadius = '50px'; statsBar.style.padding = '15px 20px'; statsBar.style.border = '1px solid #4ecca3'; statsBar.style.boxShadow = '0 0 20px rgba(78, 204, 163, 0.5)'; statsBar.style.marginBottom = '10px'; statsBar.style.gap = '10px'; statsBar.innerHTML = `
${item[GMAX_FRAGMENT]?.got || 0}
50%未拥有 / 已拥有时10%闪光
BOSS刷新倒计时: 12:00:00
`; const cardContainer = document.createElement('div'); cardContainer.id = 'gmax-card-container'; cardContainer.style.display = 'flex'; cardContainer.style.flexDirection = 'row'; cardContainer.style.justifyContent = 'center'; cardContainer.style.gap = 'clamp(10px, 2vw, 20px)'; cardContainer.style.flexWrap = 'wrap'; cardContainer.style.padding = '20px 0'; content.appendChild(statsBar); content.appendChild(cardContainer); page.appendChild(header); page.appendChild(content); document.getElementById('main-content').appendChild(page); document.getElementById('gmax-gacha-btn').addEventListener('click', performGacha); } function updateGmaxPageDisplay() { const container = document.getElementById('gmax-card-container'); if (!container) return; container.innerHTML = ''; currentGmaxBosses.forEach(id => { const boss = pkmn[id]; if (!boss) return; const card = document.createElement('div'); card.className = 'dimension-pokemon'; card.style.position = 'relative'; card.style.height = 'clamp(10rem, 30vw, 12rem)'; card.style.width = 'clamp(10rem, 30vw, 12rem)'; card.style.display = 'flex'; card.style.flexDirection = 'column'; card.style.justifyContent = 'center'; card.style.alignItems = 'center'; card.style.cursor = 'pointer'; card.style.transition = '0.1s'; card.style.margin = '0 auto'; card.dataset.pkmn = id; card.dataset.boss = id; card.innerHTML = `
★★★★★★★★★★
`; card.addEventListener('click', e => { e.stopPropagation(); startGmaxChallenge(id); }); container.appendChild(card); }); const fragSpan = document.getElementById('gmax-fragment-count'); if (fragSpan) { fragSpan.textContent = item[GMAX_FRAGMENT]?.got || 0; fragSpan.style.color = 'white'; } } function startPageCountdown() { if (countdownInterval) clearInterval(countdownInterval); const timerEl = document.getElementById('gmax-timer'); if (!timerEl) return; countdownInterval = setInterval(() => { const now = Date.now(); const nextRefresh = lastRotationTime + ROTATION_HOURS * 60 * 60 * 1000; const diff = nextRefresh - now; if (diff <= 0) { refreshGmaxBosses(); updateGmaxAreas(); updateGmaxPageDisplay(); } else { const hours = Math.floor(diff / 3600000); const minutes = Math.floor((diff % 3600000) / 60000); const seconds = Math.floor((diff % 60000) / 1000); timerEl.textContent = `刷新倒计时: ${hours.toString().padStart(2,'0')}:${minutes.toString().padStart(2,'0')}:${seconds.toString().padStart(2,'0')}`; } const fragSpan = document.getElementById('gmax-fragment-count'); if (fragSpan) { fragSpan.textContent = item[GMAX_FRAGMENT]?.got || 0; fragSpan.style.color = 'white'; } }, 1000); } function performGacha() { const fragments = item[GMAX_FRAGMENT]?.got || 0; if (fragments < GACHA_COST) { showFormalMessage('碎片不足', `需要 ${GACHA_COST} 个碎片。`); return; } item[GMAX_FRAGMENT].got -= GACHA_COST; saveGame(); const allPokemon = []; for (const id in pkmn) { if (!pkmn[id].hidden) allPokemon.push(id); } const unowned = allPokemon.filter(id => pkmn[id].caught === 0); let resultPkmn = null; let isShiny = false; if (unowned.length > 0 && Math.random() < 0.5) { resultPkmn = unowned[Math.floor(Math.random() * unowned.length)]; givePkmn(pkmn[resultPkmn], 1); } else { const owned = allPokemon.filter(id => pkmn[id].caught > 0); if (owned.length === 0) { showFormalMessage('抽奖失败', '还没有任何宝可梦,无法抽奖!'); return; } resultPkmn = owned[Math.floor(Math.random() * owned.length)]; if (Math.random() < 0.1) { pkmn[resultPkmn].shiny = true; isShiny = true; } } let message = `恭喜获得:${format(resultPkmn)}`; if (isShiny) message += ` ✦ 闪光! ✦`; showFormalMessage('抽奖结果', message, resultPkmn); const fragSpan = document.getElementById('gmax-fragment-count'); if (fragSpan) { fragSpan.textContent = item[GMAX_FRAGMENT]?.got || 0; fragSpan.style.color = 'white'; } } function startGmaxChallenge(bossId) { const areaId = `gmaxChallenge_${bossId}`; if (!areas[areaId]) return; saved.currentAreaBuffer = areaId; const previewExit = document.getElementById('preview-team-exit'); const teamMenu = document.getElementById('team-menu'); const menuButton = document.getElementById('menu-button-parent'); const exploreMenu = document.getElementById('explore-menu'); const gmaxPage = document.getElementById('gmax-dimension-menu'); if (previewExit && teamMenu && menuButton && exploreMenu && gmaxPage) { previewExit.style.display = 'flex'; teamMenu.style.zIndex = '50'; teamMenu.style.display = 'flex'; menuButton.style.display = 'none'; exploreMenu.style.display = 'none'; gmaxPage.style.display = 'none'; } const menuBtn = document.getElementById('menu-button'); if (menuBtn && menuBtn.classList.contains('menu-button-open')) { menuBtn.classList.remove('menu-button-open'); } afkSeconds = 0; if (typeof updatePreviewTeam === 'function') updatePreviewTeam(); } function openGmaxPage() { const gmaxPage = document.getElementById('gmax-dimension-menu'); if (!gmaxPage) { createGmaxPage(); setTimeout(() => openGmaxPage(), 50); return; } const menus = ['explore-menu', 'vs-menu', 'item-menu', 'team-menu', 'pokedex-menu', 'settings-menu', 'guide-menu', 'genetics-menu', 'shop-menu', 'training-menu', 'dimension-menu']; menus.forEach(id => { const el = document.getElementById(id); if (el) el.style.display = 'none'; }); gmaxPage.style.display = 'flex'; const now = Date.now(); const hoursSince = (now - lastRotationTime) / (1000 * 60 * 60); if (hoursSince >= ROTATION_HOURS) { refreshGmaxBosses(); updateGmaxAreas(); } updateGmaxPageDisplay(); startPageCountdown(); const statsBar = document.querySelector('#gmax-dimension-menu .gmax-stats'); if (statsBar) { const updateLayout = () => { if (window.innerWidth < 768) { statsBar.style.flexDirection = 'column'; } else { statsBar.style.flexDirection = 'row'; } }; window.addEventListener('resize', updateLayout); updateLayout(); } } function addMenuItemToMainMenu() { const menuItems = document.getElementById('menu-items'); if (!menuItems) { setTimeout(addMenuItemToMainMenu, 500); return; } if (document.getElementById('gmax-menu-item')) return; const menuItem = document.createElement('div'); menuItem.id = 'gmax-menu-item'; menuItem.className = 'menu-item'; menuItem.innerHTML = ` 超极巨化空间 `; menuItem.addEventListener('click', () => { if (menuItem.classList.contains('menu-item-locked')) { const dexCount = getDexCount(); showFormalMessage('未解锁', `需要图鉴数达到1137(当前 ${dexCount})`); return; } openGmaxPage(); }); menuItems.appendChild(menuItem); updateMenuItemLock(); } function updateMenuItemLock() { const menuItem = document.getElementById('gmax-menu-item'); if (!menuItem) return; const dexCount = getDexCount(); if (dexCount >= 1137) { menuItem.classList.remove('menu-item-locked'); } else { menuItem.classList.add('menu-item-locked'); } } let battleEnded = false; function startHealthCheck() { setInterval(() => { if (!saved.currentArea || !saved.currentArea.startsWith('gmaxChallenge_')) { battleEnded = false; return; } if (battleEnded) return; let hp = window.wildPkmnHp; if (hp !== undefined && hp <= 0) { battleEnded = true; setTimeout(() => { const leaveBtn = document.getElementById('explore-leave'); if (leaveBtn) leaveBtn.click(); else if (typeof leaveCombat === 'function') leaveCombat(); }, 500); } }, 500); } function injectStyles() { const style = document.createElement('style'); style.textContent = ` #gmax-dimension-menu { background-image: url('img/bg/dimension-1.jpg') !important; background-size: cover; } #gmax-dimension-menu .dimension-pokemon { } @media (max-width: 768px) { #gmax-dimension-menu { width: 100% !important; } #gmax-dimension-menu .gmax-stats { flex-direction: column !important; gap: 10px !important; } } #gmax-menu-item { cursor: pointer; } #gmax-gacha-btn:hover { transform: scale(1.05); box-shadow: 0 0 30px #ff4757; } [data-help="gacha概率说明"] { cursor: help; } `; document.head.appendChild(style); } function waitForGame() { if (typeof areas !== 'undefined' && typeof item !== 'undefined' && typeof pkmn !== 'undefined' && typeof givePkmn !== 'undefined' && typeof saveGame !== 'undefined' && typeof updatePreviewTeam !== 'undefined') { init(); } else { setTimeout(waitForGame, 100); } } function init() { ensureCustomItems(); refreshGmaxBosses(); updateGmaxAreas(); addMenuItemToMainMenu(); startHealthCheck(); setInterval(updateMenuItemLock, 5000); console.log('[超极巨化空间] 正式版已启动,使用自定义超极巨化碎片,点击保存并退出返回活动'); } injectStyles(); waitForGame(); } // ========== 自定义木桩系统 ========== if (settings.enableCustomDummy) { const dummyAreaId = settings.dummyAreaId; const dummyPkmnId = settings.dummyPkmnId; const DUMMY_SPRITE_URL = 'https://picui.ogmua.cn/s1/2026/03/10/69afbe020b09a.webp'; function initDummyPokemon() { if (!pkmn[dummyPkmnId]) { pkmn[dummyPkmnId] = { id: dummyPkmnId, rename: '自定义木桩', type: ['normal'], bst: { hp: 100, atk: 1, def: 200, satk: 1, sdef: 200, spe: 1 }, level: 100, exp: 0, caught: 0, shiny: false, ability: 'sturdy', hiddenAbility: undefined, hiddenAbilityUnlocked: false, moves: { slot1: undefined, slot2: undefined, slot3: undefined, slot4: undefined }, ivs: { hp: 31, atk: 0, def: 31, satk: 0, sdef: 31, spe: 0 }, pokerus: false, ribbons: [], newMoves: [], newPokemon: undefined, newEvolution: undefined, tag: undefined, lockHp: true }; } } function ensureDummyArea() { if (!areas[dummyAreaId]) { areas[dummyAreaId] = { name: `自定义木桩`, background: 'gym', trainer: true, type: 'vs', level: 100, team: { slot1: pkmn[dummyPkmnId], slot1Moves: [undefined, undefined, undefined, undefined] }, dummy: true, defeated: false, unlockRequirement: () => true, reward: [] }; } } const originalUpdateVS = updateVS; updateVS = function() { originalUpdateVS(); const vsListing = document.getElementById('vs-listing'); if (!vsListing) return; const existingCards = vsListing.querySelectorAll(`[data-trainer="${dummyAreaId}"]`); existingCards.forEach(card => card.remove()); const dummyCard = document.createElement('div'); dummyCard.className = 'vs-card'; dummyCard.dataset.trainer = dummyAreaId; dummyCard.innerHTML = `
自定义木桩 测试专用
`; dummyCard.addEventListener('click', () => { saved.currentAreaBuffer = dummyAreaId; document.getElementById('preview-team-exit').style.display = 'flex'; document.getElementById('team-menu').style.zIndex = '50'; document.getElementById('team-menu').style.display = 'flex'; document.getElementById('menu-button-parent').style.display = 'none'; updatePreviewTeam(); afkSeconds = 0; document.getElementById('explore-menu').style.display = 'none'; }); vsListing.appendChild(dummyCard); }; initDummyPokemon(); ensureDummyArea(); console.log('[自定义木桩] 已启用'); } // ========== 新增银币换金币功能 ========== shop.shopGoldenCrownExchange = { icon: item.goldenBottleCap.id, name: `金色王冠 x1`, price: 5, currency: item.bottleCap.id, category: `all`, effect: function() { item.goldenBottleCap.got += 1; }, description: 'Exchange 5 Silver Crowns for 1 Golden Crown' }; const originalUpdateItemShopForExchange = updateItemShop; updateItemShop = function() { const originalShopCategory = shopCategory; originalUpdateItemShopForExchange.apply(this, arguments); if (originalShopCategory !== undefined && originalShopCategory !== null && originalShopCategory !== 'decor' && originalShopCategory !== 'apricorn') { const shopListing = document.getElementById("shop-listing"); if (shopListing) { let existingExchangeItem = document.querySelector('[data-exchange-item="goldenCrown"]'); if (!existingExchangeItem) { const exchangeDiv = document.createElement("div"); exchangeDiv.dataset.item = shop.shopGoldenCrownExchange.icon; exchangeDiv.dataset.exchangeItem = "goldenCrown"; const shopItem = shop.shopGoldenCrownExchange.icon; const currency = shop.shopGoldenCrownExchange.currency || item.bottleCap.id; let name = format(shop.shopGoldenCrownExchange.icon); if (shop.shopGoldenCrownExchange.name) name = shop.shopGoldenCrownExchange.name; let stockTag = ""; let innerHTMLContent = ` ${name}${stockTag} x${shop.shopGoldenCrownExchange.price} `; exchangeDiv.innerHTML = innerHTMLContent; exchangeDiv.addEventListener("click", () => { document.getElementById("tooltipTop").style.display = "none" document.getElementById("tooltipTitle").innerHTML = "How many will you buy?" document.getElementById("tooltipMid").style.display = "none" document.getElementById("tooltipBottom").innerHTML = `
x1
x5
x10
x25
x50
x100
` document.querySelectorAll("#tooltipBottom div").forEach(el => { el.addEventListener("click", () => { buyItem(+el.dataset.amount) }) }) openTooltip() }); function buyItem(amount) { const currencyId = shop.shopGoldenCrownExchange.currency || item.bottleCap.id; const price = shop.shopGoldenCrownExchange.price; const totalCost = price * amount; if (item[currencyId].got >= totalCost) { item[currencyId].got -= totalCost; for (let l = 0; l < amount; l++) { if (shop.shopGoldenCrownExchange.effect) { shop.shopGoldenCrownExchange.effect(); } else { item[shop.shopGoldenCrownExchange.icon].got += 1; } } updateItemShop(); closeTooltip(); } else { document.getElementById("tooltipTitle").innerHTML = "Cant afford"; document.getElementById("tooltipTop").style.display = "none"; document.getElementById("tooltipMid").style.display = "none"; document.getElementById("tooltipBottom").innerHTML = `You cant afford to purchase this`; } } const backButton = shopListing.querySelector('#shop-back'); if (backButton) { shopListing.insertBefore(exchangeDiv, backButton.nextSibling); } else { shopListing.insertBefore(exchangeDiv, shopListing.firstChild); } } } } }; if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', function() { setTimeout(updateItemShop, 100); }); } else { setTimeout(updateItemShop, 100); } // ========== 初始化 ========== addSettingsButton(); console.log('[PokeChill Plus] 已启动'); })();