// ==UserScript== // @name [Pokechill] Dummy Target in VS (木桩对战) // @namespace https://play-pokechill.github.io/ // @version 1.2.1 // @description 在对战VS中添加一个无限血量的图图犬测试木桩。 // @author 人民当家做主 // @icon https://play-pokechill.github.io/img/icons/icon.png // @match https://play-pokechill.github.io/* // @match https://g1tyx.github.io/play-pokechill/* // @grant none // ==/UserScript== (function() { 'use strict'; const dummyAreaId = 'dummyTarget'; // 等待游戏核心加载 function waitForGame() { if (typeof areas === 'undefined' || typeof pkmn === 'undefined' || typeof move === 'undefined') { setTimeout(waitForGame, 200); return; } console.log('[DummyVS] 游戏核心已加载,开始注入(单卡片修复版)...'); injectDummyTarget(); } waitForGame(); function injectDummyTarget() { // ---------- 1. 注册木桩区域 ---------- if (!areas[dummyAreaId]) { areas[dummyAreaId] = { name: `🪵 Dummy Target`, background: 'gym', sprite: 'smeargle', trainer: true, type: 'vs', level: 100, team: { slot1: pkmn.smeargle, slot1Moves: [move.tackle.id, undefined, undefined, undefined] }, dummy: true, defeated: false, unlockRequirement: () => true, reward: [] }; } // ---------- 2. 备份原函数 ---------- const originalSetWildPkmn = setWildPkmn; const originalExploreCombatPlayer = exploreCombatPlayer; const originalExploreCombatWild = exploreCombatWild; // ---------- 3. 重写 setWildPkmn ---------- setWildPkmn = function() { if (saved.currentArea === dummyAreaId) { barProgressWild = 0; exploreCombatWildTurn = 1; // 隐藏无关指示器 ['team-indicator', 'spiraling-indicator', 'factory-indicator', 'training-indicator', 'raid-timer-indicator'] .forEach(id => document.getElementById(id) && (document.getElementById(id).style.display = 'none')); const dummyPkmnId = 'smeargle'; saved.currentPkmn = dummyPkmnId; wildLevel = 100; wildPkmnHp = 200000; // 正常血量,可自行修改 wildPkmnHpMax = 200000; // 更新UI document.getElementById('explore-wild-name').innerHTML = format(dummyPkmnId) + ' lvl 100'; const sprite = document.getElementById('explore-wild-sprite'); sprite.src = `img/pkmn/sprite/${dummyPkmnId}.png`; if (pkmn[dummyPkmnId]?.float) sprite.classList.add('floating-pkmn'); else sprite.classList.remove('floating-pkmn'); document.getElementById('explore-wild-sprite-data').dataset.pkmn = dummyPkmnId; // 设置招式(仅撞击) const moves = [move.tackle.id, undefined, undefined, undefined]; const container = document.getElementById('explore-header-moves-wild'); container.innerHTML = ''; for (let i = 0; i < 4; i++) { const moveId = moves[i]; if (!moveId) { const emptyDiv = document.createElement('div'); emptyDiv.className = 'pkmn-movebox'; emptyDiv.style.pointerEvents = 'none'; emptyDiv.style.opacity = '0.3'; container.appendChild(emptyDiv); continue; } const moveDiv = document.createElement('div'); moveDiv.className = 'pkmn-movebox'; moveDiv.style.borderColor = returnTypeColor(move[moveId].type); moveDiv.id = `pkmn-movebox-wild-${i+1}`; moveDiv.innerHTML = `
${format(moveId)} `; moveDiv.dataset.move = moveId; container.appendChild(moveDiv); } updateWildPkmn(); voidAnimation('explore-wild-sprite', 'wildPokemonSpawn 0.5s 1'); return; } originalSetWildPkmn(); }; // ---------- 4. 重写玩家攻击逻辑 ---------- exploreCombatPlayer = function() { originalExploreCombatPlayer(); if (saved.currentArea === dummyAreaId && wildPkmnHp !== undefined) { if (wildPkmnHp <= 0) { wildPkmnHp = wildPkmnHpMax; updateWildPkmn(); } } }; // ---------- 5. 重写野生攻击逻辑(木桩攻击后回血) ---------- exploreCombatWild = function() { originalExploreCombatWild(); if (saved.currentArea === dummyAreaId && wildPkmnHp !== undefined) { wildPkmnHp = wildPkmnHpMax; updateWildPkmn(); } }; // ---------- 6. 修改VS菜单,添加唯一木桩卡片 ---------- const originalUpdateVS = updateVS; updateVS = function() { originalUpdateVS(); const vsListing = document.getElementById('vs-listing'); if (!vsListing) return; // 彻底清除所有已有的木桩卡片(基于 data-trainer 属性) 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 = `
木桩测试 Level 100 · ∞血量
`; 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); }; } })();