// ==UserScript== // @name Pokechill 餐厅新菜品及全战斗生效 // @namespace http://tampermonkey.net/ // @version 1 // @description 添加金坷垃(黄金之躯)和银坷垃(顺手牵羊),烹饪效果全战斗生效 // @author 人民当家做主 // @match https://play-pokechill.github.io/* // @match https://g1tyx.github.io/play-pokechill/* // @grant none // @run-at document-start // ==/UserScript== (function() { 'use strict'; function waitForGlobals() { if (typeof ingredient !== 'undefined' && typeof ability !== 'undefined' && typeof testAbility === 'function') { applyPatch(); } else { setTimeout(waitForGlobals, 500); } } function applyPatch() { // 添加新食材(英文键名,避免错误图片请求) ingredient.goldenFertilizer = { ability: ability.goodAsGold.id, price: 80, name: "金坷垃", icon: "goldenBottleCap" }; ingredient.silverFertilizer = { ability: ability.pickPocket.id, price: 30, name: "银坷垃", icon: "bottleCap" }; // 覆盖商店显示,确保中文名和图标 const originalUpdateIngredientShop = window.updateIngredientShop; window.updateIngredientShop = function() { originalUpdateIngredientShop(); const shopListing = document.getElementById("shop-listing"); if (!shopListing) return; const items = shopListing.querySelectorAll("div"); items.forEach(div => { const abilityId = div.dataset.ability; if (!abilityId) return; if (abilityId === ability.goodAsGold.id) { // 金坷垃 const img = div.querySelector("img"); if (img) img.src = "img/items/goldenBottleCap.png"; // 强制重新加载图片(防止缓存) if (img.complete) img.src = img.src; const nameSpan = div.querySelector("span:first-of-type"); if (nameSpan) { const match = nameSpan.innerText.match(/\(([^)]+)\)/); const abilityName = match ? match[1] : "黄金之躯"; nameSpan.innerText = `金坷垃 (${abilityName})`; } } else if (abilityId === ability.pickPocket.id) { // 银坷垃 const img = div.querySelector("img"); if (img) img.src = "img/items/bottleCap.png"; if (img.complete) img.src = img.src; const nameSpan = div.querySelector("span:first-of-type"); if (nameSpan) { const match = nameSpan.innerText.match(/\(([^)]+)\)/); const abilityName = match ? match[1] : "顺手牵羊"; nameSpan.innerText = `银坷垃 (${abilityName})`; } } }); }; // 烹饪界面图标修复 const originalUpdateCurry = window.updateCurry; window.updateCurry = function() { originalUpdateCurry(); const container = document.getElementById("curry-ingredients"); if (!container) return; const imgs = container.querySelectorAll("img"); imgs.forEach(img => { const src = img.src; if (src.includes("goldenFertilizer.png")) { img.src = "img/items/goldenBottleCap.png"; } else if (src.includes("silverFertilizer.png")) { img.src = "img/items/bottleCap.png"; } // 强制刷新 if (img.complete) img.src = img.src; }); }; // 全战斗生效 const originalTestAbility = testAbility; window.testAbility = function(target, id) { const originalResult = originalTestAbility(target, id); if (originalResult) return originalResult; if (saved.curry && saved.curry.time > 0 && saved.curry.effect.includes(id)) { if (saved.currentArea !== undefined) { return true; } } return false; }; console.log('[Pokechill] 插件已生效:添加金坷垃、银坷垃,中文名和图标已强制修复,效果全战斗生效'); } window.addEventListener('load', waitForGlobals); })();