非公開 自陣色強調

    
      
  • /*
     * @title 自陣色強調
     * @description 自陣の色が強調されて見えやすくなるぞ
     * @private
     */
    javascript:(function(){
        const cvs = document.querySelector('canvas');
        if(!cvs) return;
        const ctx = cvs.getContext('2d');
    
        /* 1. 自分の色と味方の色を特定する */
        /* myId や players は client-game.js のグローバル変数を使用 */
        const getMyTeamColors = () => {
            if(typeof players === 'undefined' || typeof myId === 'undefined') return [];
            const me = players.find(p => p.id === myId);
            if(!me) return [];
            /* 自分と同じチームのプレイヤーの色をリスト化 */
            return players.filter(p => p.team === me.team).map(p => p.color);
        };
    
        /* 2. 色を「パキッ」とさせる変換関数 */
        /* 明度を上げ、彩度を最大にする。敵との「差」を出すのが目的 */
        const boostColor = (hex) => {
            /* シンプルに白を混ぜるか、輝度を上げる処理 */
            return hex; // ここでは特定の色を「光らせる」処理に変える
        };
    
        /* 3. Canvasの塗りつぶし命令をハック(超軽量) */
        const originalFill = ctx.fill;
        ctx.fill = function() {
            const teamColors = getMyTeamColors();
            const currentColor = this.fillStyle.toString().toLowerCase();
    
            /* 現在塗ろうとしている色が「自分か味方の色」だったら、
               透明度を上げて(0.3→0.6)見やすくし、影(Shadow)を強制追加する */
            const isAlly = teamColors.some(c => currentColor.includes(c.toLowerCase()));
    
            if (isAlly) {
                this.save();
                this.globalAlpha = 0.6; // 味方の領地を濃くする
                if (typeof isLowPerformance !== 'undefined') {
                    this.shadowColor = currentColor;
                    this.shadowBlur = 15; // 味方の領地だけ発光させる
                }
                originalFill.apply(this, arguments);
                this.restore();
            } else {
                originalFill.apply(this, arguments);
            }
        };
    
        alert('【色覚補正】自分と味方の領地を強調しました!\n(自分たちは濃く・発光、敵はそのまま)');
    })();
  • Permalink
    このページへの個別リンクです。
    RAW
    書かれたコードへの直接のリンクです。
    Packed
    文字列が圧縮された書かれたコードへのリンクです。
    Userscript
    Greasemonkey 等で利用する場合の .user.js へのリンクです。
    Loader
    @require やソースコードが長い場合に多段ロードする Loader コミのコードへのリンクです。
    Metadata
    コード中にコメントで @xxx と書かれたメタデータの JSON です。

History

  1. 2026/05/07 18:24:18 - 7 hours ago
  2. 2026/05/07 18:12:26 - 7 hours ago
  3. 2026/05/07 13:48:54 - 12 hours ago
  4. 2026/05/07 13:45:02 - 12 hours ago