近接戦闘マスター
by
cutfloss
04/29 [2026/04/29 23:30:27]
アイコンサイズを小さくして近接戦闘を非運ゲー化する
@@ -4,42 +4,59 @@
* @private
*/
javascript:(function(){
- /* 1. 描画コンテキストを取得 */
const cvs = document.querySelector('canvas');
if(!cvs) return;
const ctx = cvs.getContext('2d');
- /* 2. 円を描く関数(arc)を一時的に縮小するハック */
- /* プレイヤーの本体は arc で描かれていることが多いので、ここを狙います */
- const originalArc = ctx.arc;
- ctx.arc = function(x, y, radius, startAngle, endAngle, anticlockwise) {
- let newRadius = radius;
-
- /* プレイヤーアイコンと思われるサイズ(例: 10〜40px程度)なら縮小 */
- /* 線の太さや背景の巨大な円には干渉しないように調整 */
- if (radius > 5 && radius < 60) {
- newRadius = radius * 0.5; // ★ここでサイズを半分(0.5)にしています
+ /* --- 設定値(お好みで調整してください) --- */
+ const SCALE = 0.5; /* アイコン・画像・絵文字の大きさ (0.5 = 半分) */
+ const LINE_SCALE = 0.4; /* 線の太さ (0.4 = 本来の40%の細さに) */
+
+ /* 1. 線の太さをハック */
+ const originalStroke = ctx.stroke;
+ ctx.stroke = function() {
+ /* 現在の線の太さを取得して、一定以上の太さ(トレイル等)なら細くする */
+ const oldWidth = this.lineWidth;
+ if (oldWidth > 2) {
+ this.lineWidth = oldWidth * LINE_SCALE;
}
-
- return originalArc.call(this, x, y, newRadius, startAngle, endAngle, anticlockwise);
+ const result = originalStroke.apply(this, arguments);
+ this.lineWidth = oldWidth; /* 他の描画に影響しないよう戻す */
+ return result;
};
- /* 3. 画像(drawImage)も縮小するハック */
- /* アイコンに画像を使っているプレイヤー対策 */
+ /* 2. アイコン(円)をハック */
+ const originalArc = ctx.arc;
+ ctx.arc = function(x, y, radius, sAngle, eAngle, counterclockwise) {
+ let r = radius;
+ if (radius > 5 && radius < 100) r = radius * SCALE;
+ return originalArc.call(this, x, y, r, sAngle, eAngle, counterclockwise);
+ };
+
+ /* 3. 画像(プレイヤーアイコン画像)をハック */
const originalDrawImage = ctx.drawImage;
ctx.drawImage = function(img, sx, sy, sw, sh, dx, dy, dw, dh) {
- /* 引数の数によって挙動が変わるため、描画先のサイズ(dw, dh)を調整 */
if (arguments.length >= 9) {
- let newDW = dw * 0.5;
- let newDH = dh * 0.5;
- /* 縮小した分、中心がズレないように位置を補正 */
- let newDX = dx + (dw - newDW) / 2;
- let newDY = dy + (dh - newDH) / 2;
- return originalDrawImage.call(this, img, sx, sy, sw, sh, newDX, newDY, newDW, newDH);
+ let nDW = dw * SCALE, nDH = dh * SCALE;
+ let nDX = dx + (dw - nDW) / 2, nDY = dy + (dh - nDH) / 2;
+ return originalDrawImage.call(this, img, sx, sy, sw, sh, nDX, nDY, nDW, nDH);
}
return originalDrawImage.apply(this, arguments);
};
- console.log('近接特化パッチ:アイコンを50%に縮小しました。');
- alert('【視界クリア】プレイヤーアイコンを小さくしました。\n短い線が見やすくなっているはずです!');
+ /* 4. 絵文字(テキスト)をハック */
+ const originalFillText = ctx.fillText;
+ ctx.fillText = function(text, x, y, maxWidth) {
+ const oldFont = this.font;
+ /* フォントサイズを抽出して小さく書き換える */
+ this.font = oldFont.replace(/(\d+)px/, (match, size) => {
+ return (parseFloat(size) * SCALE) + 'px';
+ });
+ const result = originalFillText.apply(this, arguments);
+ this.font = oldFont; /* 元に戻す */
+ return result;
+ };
+
+ console.log('視界最大確保パッチ:適用完了');
+ alert('【究極の視界】\nアイコン・絵文字を小さく、線を細くしました!\nこれで敵の根元が丸見えです!');
})();
/*
* @title 近接戦闘マスター
* @description アイコンサイズを小さくして近接戦闘を非運ゲー化する
* @private
*/
javascript:(function(){
const cvs = document.querySelector('canvas');
if(!cvs) return;
const ctx = cvs.getContext('2d');
/* --- 設定値(お好みで調整してください) --- */
const SCALE = 0.5; /* アイコン・画像・絵文字の大きさ (0.5 = 半分) */
const LINE_SCALE = 0.4; /* 線の太さ (0.4 = 本来の40%の細さに) */
/* 1. 線の太さをハック */
const originalStroke = ctx.stroke;
ctx.stroke = function() {
/* 現在の線の太さを取得して、一定以上の太さ(トレイル等)なら細くする */
const oldWidth = this.lineWidth;
if (oldWidth > 2) {
this.lineWidth = oldWidth * LINE_SCALE;
}
const result = originalStroke.apply(this, arguments);
this.lineWidth = oldWidth; /* 他の描画に影響しないよう戻す */
return result;
};
/* 2. アイコン(円)をハック */
const originalArc = ctx.arc;
ctx.arc = function(x, y, radius, sAngle, eAngle, counterclockwise) {
let r = radius;
if (radius > 5 && radius < 100) r = radius * SCALE;
return originalArc.call(this, x, y, r, sAngle, eAngle, counterclockwise);
};
/* 3. 画像(プレイヤーアイコン画像)をハック */
const originalDrawImage = ctx.drawImage;
ctx.drawImage = function(img, sx, sy, sw, sh, dx, dy, dw, dh) {
if (arguments.length >= 9) {
let nDW = dw * SCALE, nDH = dh * SCALE;
let nDX = dx + (dw - nDW) / 2, nDY = dy + (dh - nDH) / 2;
return originalDrawImage.call(this, img, sx, sy, sw, sh, nDX, nDY, nDW, nDH);
}
return originalDrawImage.apply(this, arguments);
};
/* 4. 絵文字(テキスト)をハック */
const originalFillText = ctx.fillText;
ctx.fillText = function(text, x, y, maxWidth) {
const oldFont = this.font;
/* フォントサイズを抽出して小さく書き換える */
this.font = oldFont.replace(/(\d+)px/, (match, size) => {
return (parseFloat(size) * SCALE) + 'px';
});
const result = originalFillText.apply(this, arguments);
this.font = oldFont; /* 元に戻す */
return result;
};
console.log('視界最大確保パッチ:適用完了');
alert('【究極の視界】\nアイコン・絵文字を小さく、線を細くしました!\nこれで敵の根元が丸見えです!');
})();
- Permalink
- このページへの個別リンクです。
- RAW
- 書かれたコードへの直接のリンクです。
- Packed
- 文字列が圧縮された書かれたコードへのリンクです。
- Userscript
- Greasemonkey 等で利用する場合の .user.js へのリンクです。
- Loader
- @require やソースコードが長い場合に多段ロードする Loader コミのコードへのリンクです。
- Metadata
- コード中にコメントで @xxx と書かれたメタデータの JSON です。