EvoWorld.io autohit

autohit

// ==UserScript==
// @name         EvoWorld.io autohit
// @namespace    http://tampermonkey.net/
// @version      2.1.0
// @description  autohit
// @author       turkish evoworld fucker
// @match        https://evoworld.io/
// @grant        none
// @run-at       document-start
// ==/UserScript==
(function() {
    'use strict';

    // Ayarlar
    const ReaperList = new Set(['grimReaper', 'pumpkinGhost', 'ghostlyReaper']);
    const Height = { 'grimReaper': 133, 'pumpkinGhost': 137, 'ghostlyReaper': 135 };
    const HitRangeX = {
        'grimReaper': { 'grimReaper': 130, 'pumpkinGhost': 133, 'ghostlyReaper': 131 },
        'pumpkinGhost': { 'grimReaper': 133, 'pumpkinGhost': 130, 'ghostlyReaper': 131 },
        'ghostlyReaper': { 'grimReaper': 131, 'pumpkinGhost': 131, 'ghostlyReaper': 130 }
    };
    const DistAdjustmentY = { 'grimReaper': 4.5, 'pumpkinGhost': 3.6, 'ghostlyReaper': 3.6 };

    let hitDelay = 10;
    let lastHitTime = 0;
    let autoHitting = true;
    let ultraMode = true;
    let hitSuccess = 0;
    let totalAttempts = 0;
    let consecutiveMisses = 0;
    let game;
    
    // Düşman hız profilleri ve yön takibi
    const enemySpeedData = new Map();
    const targetHistory = new Map(); // Hedef geçmişi
    let lastTargetId = null;

    // Tuş simulasyonu (sadece Space aktif)
    function skillUse() {
        document.dispatchEvent(new KeyboardEvent('keydown', { key: ' ', code: 'Space', keyCode: 32, which: 32, bubbles: true }));
    }
    function skillStop() {
        document.dispatchEvent(new KeyboardEvent('keyup', { key: ' ', code: 'Space', keyCode: 32, which: 32, bubbles: true }));
    }

    // Düşman yaklaşma yönünü tespit et
    function getApproachDirection(enemy) {
        if (!game || !game.me || !enemy || !enemy.position) return 'unknown';
        
        const myPos = game.me.position;
        const enemyPos = enemy.position;
        const dx = enemyPos.x - myPos.x;
        const dy = enemyPos.y - myPos.y;
        
        const angle = Math.atan2(dy, dx) * (180 / Math.PI);
        
        // 8 yönlü algılama
        if (angle >= -22.5 && angle < 22.5) return 'right';
        if (angle >= 22.5 && angle < 67.5) return 'bottom-right';
        if (angle >= 67.5 && angle < 112.5) return 'bottom';
        if (angle >= 112.5 && angle < 157.5) return 'bottom-left';
        if (angle >= 157.5 || angle < -157.5) return 'left';
        if (angle >= -157.5 && angle < -112.5) return 'top-left';
        if (angle >= -112.5 && angle < -67.5) return 'top';
        if (angle >= -67.5 && angle < -22.5) return 'top-right';
        
        return 'unknown';
    }

    // Düşman hızını ve yönünü hesapla
    function analyzeEnemyMovement(enemy) {
        if (!enemy || !enemy.id || !enemy.moveSpeed || !enemy.position) return null;
        
        const speed = Math.sqrt((enemy.moveSpeed.x ** 2) + (enemy.moveSpeed.y ** 2));
        const direction = getApproachDirection(enemy);
        
        // Düşman bize yaklaşıyor mu?
        const myPos = game.me.position;
        const distance = Math.sqrt((enemy.position.x - myPos.x) ** 2 + (enemy.position.y - myPos.y) ** 2);
        
        if (!targetHistory.has(enemy.id)) {
            targetHistory.set(enemy.id, {
                lastDistance: distance,
                lastPosition: {...enemy.position},
                approaching: false,
                enteredRange: false
            });
        }
        
        const history = targetHistory.get(enemy.id);
        const isApproaching = distance < history.lastDistance;
        
        history.lastDistance = distance;
        history.lastPosition = {...enemy.position};
        history.approaching = isApproaching;
        
        return {
            speed,
            direction,
            isApproaching,
            distance,
            urgency: isApproaching ? Math.max(0, 500 - distance) / 500 : 0 // 0-1 arası aciliyet skoru
        };
    }

    // Hıza göre gelecek pozisyon tahmini (yön bazlı)
    function getFuturePosition(target, delayMs, analysis) {
        if (!target.position || !target.moveSpeed) return target.position;
        
        if (!analysis) {
            analysis = analyzeEnemyMovement(target);
        }
        
        // Yaklaşan düşmanlara daha agresif tahmin
        let predictionMultiplier = 0.3;
        
        if (analysis && analysis.isApproaching) {
            predictionMultiplier = 0.6 + (analysis.urgency * 0.4); // 0.6-1.0 arası
        } else {
            predictionMultiplier = 0.2; // Uzaklaşıyorsa az tahmin
        }
        
        return {
            x: target.position.x + (target.moveSpeed.x || 0) * (delayMs / 1000) * predictionMultiplier,
            y: target.position.y + (target.moveSpeed.y || 0) * (delayMs / 1000) * predictionMultiplier
        };
    }

    // Yön ve hıza göre dinamik gecikme
    function getDynamicDelay(enemy, analysis) {
        if (!analysis) return 0;
        
        // Yaklaşan düşmanlara ANINDA tepki
        if (analysis.isApproaching && analysis.urgency > 0.5) {
            return 0; // SIFIR gecikme
        }
        
        // Hıza göre minimal gecikme
        if (analysis.speed > 400) return 1;
        if (analysis.speed > 250) return 2;
        if (analysis.speed > 150) return 3;
        if (analysis.speed > 50) return 4;
        
        return 5;
    }

    // Hıza ve yöne göre hit delay
    function getAdaptiveHitDelay(enemy, analysis) {
        if (!analysis) return 10;
        
        // Yaklaşan düşmanlara ULTRA hızlı vuruş
        if (analysis.isApproaching) {
            if (analysis.urgency > 0.8) return 3;  // ÇOK ACİL
            if (analysis.urgency > 0.6) return 5;  // ACİL
            if (analysis.urgency > 0.4) return 7;  // HIZLI
            return 10;
        }
        
        // Durağan veya uzaklaşan
        return 15;
    }

    // Mesafe hesaplama
    function getMagnitude(objPos) {
        if (!game || !game.me || !objPos) return Infinity;
        const myPos = game.me.position;
        return Math.abs(myPos.x - objPos.x) + Math.abs(myPos.y - objPos.y) * 0.7;
    }

    // ÖNCELIK BAZLI hedef seçimi
    function getPriorityTarget() {
        if (!game || !game.me) return undefined;
        const list = game.hashMap && game.hashMap.retrieveVisibleByClient ? game.hashMap.retrieveVisibleByClient(game) : [];
        const visible = list.filter(e => e && e.hp != null && !e.deleted && ReaperList.has(e.name) && e !== game.me);
        if (!visible.length) return undefined;
        
        // Tüm düşmanları analiz et
        const analyzed = visible.map(enemy => {
            const analysis = analyzeEnemyMovement(enemy);
            return {
                enemy,
                analysis,
                distance: getMagnitude(enemy.position),
                priority: (analysis.isApproaching ? 1000 : 0) + (analysis.urgency * 500) + (500 - getMagnitude(enemy.position))
            };
        });
        
        // En yüksek önceliği seç
        analyzed.sort((a, b) => b.priority - a.priority);
        
        return analyzed[0];
    }

    // Menzil kontrolü (geliştirilmiş)
    function isWithinRange(attacker, target, analysis) {
        if (!attacker || !target) return false;
        
        const futurePos = getFuturePosition(target, hitDelay, analysis);
        const xDist = Math.abs(attacker.position.x - futurePos.x);
        const yDist = Math.abs(attacker.position.y - futurePos.y);
        let xRange = HitRangeX[attacker.name]?.[target.name] || 135;
        let yRange = Height[target.name] + (DistAdjustmentY[attacker.name] || 0);

        if (ultraMode) {
            xRange += 9; 
            yRange += 7;
            
            // Yaklaşan düşmanlara ekstra menzil
            if (analysis && analysis.isApproaching && analysis.urgency > 0.5) {
                xRange += 5;
                yRange += 5;
            }
        }
        return xDist <= xRange && yDist <= yRange;
    }

    // Saldırı kontrolü (optimize edilmiş)
    function autoHit() {
        if (!game || !game.me) return;
        
        const targetData = getPriorityTarget();
        if (!targetData) return;
        
        const enemy = targetData.enemy;
        const analysis = targetData.analysis;

        // Düşman hızına göre dinamik hit delay
        const adaptiveDelay = getAdaptiveHitDelay(enemy, analysis);
        
        const now = Date.now();
        
        // Hedef değişirse ANINDA vur
        const targetChanged = lastTargetId !== enemy.id;
        if (targetChanged) {
            lastTargetId = enemy.id;
            lastHitTime = 0; // Reset delay
        }
        
        if (now - lastHitTime < adaptiveDelay) return;
        if (!isWithinRange(game.me, enemy, analysis)) return;

        lastHitTime = now;
        totalAttempts++;
        const hpBefore = enemy.hp;

        const dynamicDelay = ultraMode ? getDynamicDelay(enemy, analysis) : 0;

        setTimeout(() => {
            skillUse();
            setTimeout(() => skillStop(), 3); // ÇOK hızlı tuş bırakma
        }, dynamicDelay);

        setTimeout(() => {
            if (enemy.hp < hpBefore || enemy.deleted) {
                hitSuccess++;
                consecutiveMisses = 0;
                hitDelay = Math.max(3, hitDelay - 1);
            } else {
                consecutiveMisses++;
                hitDelay = Math.min(25, hitDelay + 1);
            }
        }, 35);
    }

    // Başlatma
    function start() {
        if (typeof window.game !== 'undefined') game = window.game;
        setInterval(() => { if (autoHitting) autoHit(); }, 3); // ULTRA hızlı kontrol
        console.log('🚀 Otomatik vuruş aktif! Ultra Mod:', ultraMode);
        console.log('⚡ 360° Yön bazlı anında tepki sistemi aktif!');
    }

    // Game hazır olana kadar bekle
    function waitForGame() {
        if (typeof window.game === 'undefined' || !window.game.me) {
            setTimeout(waitForGame, 500);
        } else {
            game = window.game;
            start();
        }
    }

    waitForGame();

    // F12 tuşları
    document.addEventListener('keydown', e => {
        if (e.key === 'U' || e.key === 'u') {
            ultraMode = !ultraMode;
            hitDelay = ultraMode ? 3 : 10;
            console.log('🔥 Ultra Mod:', ultraMode ? 'AÇIK (360° anında tepki)' : 'KAPALI');
        }
        if (e.key === 'R' || e.key === 'r') {
            autoHitting = !autoHitting;
            console.log('🚀 Otomatik vuruş:', autoHitting ? 'AÇIK' : 'KAPALI');
        }
        if (e.key === 'I' || e.key === 'i') {
            const targetData = getPriorityTarget();
            if (targetData) {
                const {enemy, analysis} = targetData;
                console.log('📊 Hedef Bilgisi:', {
                    isim: enemy.name,
                    yön: analysis.direction,
                    yaklaşıyor: analysis.isApproaching ? 'EVET' : 'HAYIR',
                    aciliyet: (analysis.urgency * 100).toFixed(1) + '%',
                    mesafe: analysis.distance.toFixed(1),
                    hız: analysis.speed.toFixed(1),
                    başarıOranı: totalAttempts ? ((hitSuccess/totalAttempts)*100).toFixed(1) + '%' : '0%'
                });
            }
        }
    });
})();