// ==UserScript== // @name PokeChill Plus: 超级挑战+战斗飘字+自定义木桩+银币换金币 // @namespace http://tampermonkey.net/ // @version 1.0 // @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, spicyLeg: 'spicyDuckLeg', // 麻辣鸭腿ID 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; 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(); } // ========== 战斗伤害飘字系统 ========== let damageFloatEnabled = settings.enableDamageFloat; if (damageFloatEnabled) { 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; } // 监控野生HP (我方攻击) 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; } } // 监控玩家HP (我方受到伤害) 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'; // 进入Boss战消耗的道具ID 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; // --- 核心修改:硬编码Mega精灵与Mega Stone的对应关系 --- 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', 'megaRayquaza': 'rayquazite', 'megaSableye': 'sablenite', 'megaSalamence': 'salamencite', 'megaSceptile': 'sceptilite', 'megaScizor': 'scizorite', 'megaSharpedo': 'sharpedonite', 'megaSlowbro': 'slowbronite', 'megaSteelix': 'steelixite', 'megaSwampert': 'swampertite', 'megaTyranitar': 'tyranitarite', 'megaVenusaur': 'venusaurite', }; const ITEMS_FOR_EVOLUTION_SHOP = new Map(); // --- Boss顺序列表 --- const ALL_BOSSES_IN_ORDER = [ { id: 'burmySandy', price: 5, stars: 2 }, { id: 'burmyTrash', price: 5, stars: 2 }, { id: 'galarianMrmime', price: 20, stars: 4 }, { id: 'megaSableye', price: 50, stars: 5 }, { id: 'megaAudino', price: 50, stars: 6 }, { id: 'megaBanette', price: 55, stars: 6 }, { id: 'megaSharpedo', price: 55, stars: 6 }, { id: 'megaHoundoom', price: 60, stars: 6 }, { id: 'megaAmpharos', price: 60, stars: 6 }, { id: 'megaSlowbro', price: 65, stars: 7 }, { id: 'megaAltaria', price: 65, stars: 7 }, { id: 'megaLopunny', price: 65, stars: 7 }, { id: 'megaMedicham', price: 55, stars: 6 }, { id: 'megaGardevoir', price: 75, stars: 8 }, { id: 'megaAbsol', price: 70, stars: 7 }, { id: 'megaKangaskhan', price: 70, stars: 7 }, { id: 'megaSalamence', price: 80, stars: 8 }, { id: 'kyuremWhite', price: 90, stars: 9 }, { id: 'megaRayquaza', price: 99, stars: 10 }, { id: 'arceus', price: 9999, stars: 10 } ]; // --- 生成带有前置Boss依赖的配置 --- 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, info: function() { return '超级挑战中掉落的稀有物品,可用于兑换强力宝可梦。'; } }; } if (item[SPICY_LEG].got === undefined) item[SPICY_LEG].got = 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, hpPercentage: 100, 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; } 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(); } // ========== 商店部分(不变,但已自动使用 SPICY_LEG 作为货币) ========== 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() {} }; 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); } 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-line: 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 (saved.currentArea && saved.currentArea.startsWith('superChallenge_')) { wildPkmnHp = wildPkmnHpMax; } if (originalLeaveCombat) originalLeaveCombat(); }; function bindShopEvents() { const shopListing = document.getElementById('shop-listing'); if (shopListing) { shopListing.removeEventListener('click', customClickHandler, true); shopListing.addEventListener('click', function(event) { let target = event.target; while (target && target !== this) { if (target.matches && target.matches('#shop-listing > div[data-pkmn]')) { const id = target.dataset.pkmn; if (priceMap[id] !== undefined) { event.stopPropagation(); event.preventDefault(); const price = priceMap[id]; if (item[SPICY_LEG].got < price) { alert('麻辣鸭腿不足!'); return; } item[SPICY_LEG].got -= price; givePkmn(pkmn[id], 1); saveGame(); updateItemShop(); const chineseName = getChineseName(id); alert('获得 ' + chineseName); } break; } target = target.parentNode; } }, true); } const evolutionShopListing = document.getElementById('shop-listing'); if (evolutionShopListing) { evolutionShopListing.removeEventListener('click', customEvolutionClickHandler, true); evolutionShopListing.addEventListener('click', function(event) { let target = event.target; while (target && target !== this) { 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]; if (item[SPICY_LEG].got < price) { alert('麻辣鸭腿不足!'); return; } if (item[itemId].got === undefined) item[itemId].got = 0; item[SPICY_LEG].got -= price; item[itemId].got += 1; saveGame(); updateItemShop(); const chineseName = getChineseName(itemId); alert('获得 ' + chineseName); } break; } target = target.parentNode; } }, true); } } waitForGame(); console.log('[超级挑战] 已启用'); } // ========== 自定义木桩系统 ========== 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: [] }; } } // 注入木桩到VS列表 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() { // 增加1个金色瓶盖 item.goldenBottleCap.got += 1; }, description: 'Exchange 5 Silver Crowns for 1 Golden Crown' }; // 修改updateItemShop函数,将兑换商品插入到顶部 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"; // 标识这是兑换商品 // 使用与现有商品完全相同的HTML结构和样式 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("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] 已启动'); })();