Jump to content
Sign in to follow this  
drakola

Исправить Fear

Recommended Posts

Да

я вернул. но теперь моб просто стоит на месте и не убегает от персонажа. фир проходит и моб начинает атаковать. 

Share this post


Link to post
Share on other sites

я вернул. но теперь моб просто стоит на месте и не убегает от персонажа. фир проходит и моб начинает атаковать. 

А если игрока в фир кинуть, он побежит? 

Share this post


Link to post
Share on other sites

А если игрока в фир кинуть, он побежит? 

нет тоже стоит на месте.

Share this post


Link to post
Share on other sites

нет тоже стоит на месте.

Значит в эффект дописывай метод на передвижение (пример я скинул в файле) и всё

Share this post


Link to post
Share on other sites

Значит в эффект дописывай метод на передвижение (пример я скинул в файле) и всё

/*
 * This program is free software: you can redistribute it and/or modify it under
 * the terms of the GNU General Public License as published by the Free Software
 * Foundation, either version 3 of the License, or (at your option) any later
 * version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
 * details.
 *
 * You should have received a copy of the GNU General Public License along with
 * this program. If not, see <http://www.gnu.org/licenses/>.
 */
package ru.catssoftware.gameserver.skills.effects;

import ru.catssoftware.gameserver.ai.CtrlIntention;
import ru.catssoftware.gameserver.geodata.GeoData;
import ru.catssoftware.gameserver.model.L2CharPosition;
import ru.catssoftware.gameserver.model.L2Effect;
import ru.catssoftware.gameserver.model.actor.instance.L2FolkInstance;
import ru.catssoftware.gameserver.model.actor.instance.L2FortCommanderInstance;
import ru.catssoftware.gameserver.model.actor.instance.L2FortSiegeGuardInstance;
import ru.catssoftware.gameserver.model.actor.instance.L2PcInstance;
import ru.catssoftware.gameserver.model.actor.instance.L2PetInstance;
import ru.catssoftware.gameserver.model.actor.instance.L2SiegeFlagInstance;
import ru.catssoftware.gameserver.model.actor.instance.L2SiegeGuardInstance;
import ru.catssoftware.gameserver.model.actor.instance.L2SiegeSummonInstance;
import ru.catssoftware.gameserver.skills.Env;
import ru.catssoftware.gameserver.templates.skills.L2EffectType;
//import java.util.logging.Logger;

import ru.catssoftware.tools.random.Rnd;

/**
 * @[member='Authority'] littlecrow
 *
 * Implementation of the Fear Effect
 */
public final class EffectFear extends L2Effect {

    public static final int FEAR_RANGE = 200;
    //protected static Logger				_log				= Logger.getLogger(EffectFear.class.getName());
    //private static Map<Integer, float[]> _deltas = new FastMap<Integer, float[]>();

    public EffectFear(Env env, EffectTemplate template) {
        super(env, template);
    }

    @[member='override']
    public L2EffectType getEffectType() {
        return L2EffectType.FEAR;
    }

    /** Notify started */
    @[member='override']
    public boolean onStart() {
        // Fear skills cannot be used L2Pcinstance to L2Pcinstance.
        // Heroic Dread, Curse: Fear, Fear, Horror, Sword Symphony, Word of Fear and Mass Curse Fear are the exceptions.
        if (getEffected() instanceof L2PcInstance && getEffector() instanceof L2PcInstance) {
            switch (getSkill().getId()) {
                case 65:
                case 98:
                case 1092:
                case 1169:
                case 1272:
                case 1376:
                case 1381:
                    // all ok
                    break;
                default:
                    return false;
            }
        }

        if (getEffected() instanceof L2FolkInstance || getEffected() instanceof L2SiegeGuardInstance || getEffected() instanceof L2SiegeFlagInstance
                || getEffected() instanceof L2SiegeSummonInstance || getEffected() instanceof L2FortSiegeGuardInstance
                || getEffected() instanceof L2FortCommanderInstance) {
            return false;
        }

        if (!getEffected().isAfraid()) {
            /*float _dX = getEffector().getX() - getEffected().getX();
            float _dY = getEffector().getY() - getEffected().getY();
            
            if (_dX == 0) {
            _dX = 0;
            if (_dY > 0) {
            _dY = -1;
            } else {
            _dY = 1;
            }
            } else if (_dY == 0) {
            _dY = 0;
            if (_dX > 0) {
            _dX = -1;
            } else {
            _dX = 1;
            }
            } else if (_dX > 0 && _dY > 0) {
            //_log.warning("Situation A-NW ("+_dX+";"+_dY+")");
            if (_dX > _dY) {
            _dY = -1 * _dY / _dX;
            _dX = -1;
            } else {
            _dX = -1 * _dX / _dY;
            _dY = -1;
            }
            } else if (_dX > 0 && _dY < 0) {
            //_log.warning("Situation B-SW ("+_dX+";"+_dY+")");
            if (_dX > (-1 * _dY)) {
            _dY = -1 * (_dY / _dX);
            _dX = -1;
            } else {
            _dX = _dX / _dY;
            _dY = 1;
            }
            } else if (_dX < 0 && _dY > 0) {
            //_log.warning("Situation C-NE ("+_dX+";"+_dY+")");
            if ((-1 * _dX) > _dY) {
            _dY = _dY / _dX;
            _dX = 1;
            } else {
            _dX = -1 * (_dX / _dY);
            _dY = -1;
            }
            } else if (_dX < 0 && _dY < 0) {
            //_log.warning("Situation D-SE ("+_dX+";"+_dY+")");
            if (_dX > _dY) {
            _dY = _dY / _dX;
            _dX = 1;
            } else {
            _dX = _dX / _dY;
            _dY = 1;
            }
            } else if (_dX == 0 && _dY == 0) {
            //_log.warning("Situation X");
            _dX = -1;
            _dY = -1;
            }
            _deltas.put(getEffected().getObjectId(), new float[]{_dX, _dY});*/
            getEffected().startFear();
            onActionTime();
            return true;
        }
        return false;
    }

    /** Notify exited */
    @[member='override']
    public void onExit() {
        getEffected().stopFear(this);
        getEffected().setTarget(null);
        getEffected().getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
        //_deltas.remove(getEffected().getObjectId());
    }

    @[member='override']
    public boolean onActionTime() {
        if (getEffected().getFirstEffect(getId()) == null) {
            onExit();
        }

        int posX = getEffected().getX();
        int posY = getEffected().getY();
        int posZ = getEffected().getZ();
        //float[] delta = _deltas.get(getEffected().getObjectId());
        /*float _dX = -1;
        float _dY = -1;
        if (delta != null) {
        _dX = delta[0];
        _dY = delta[1];
        }
        //_log.warning("Start Position on Fear. X: " + posX + "  Y: " + posY);
        if (_dX != 0) {
        posX += _dX * FEAR_RANGE;
        }
        if (_dY != 0) {
        posY += _dY * FEAR_RANGE;
        }*/
        //_log.warning("Next Position on Fear. X: " + posX + "  Y: " + posY);
        //Location destiny = GeoData.getInstance().moveCheck(getEffected().getX(), getEffected().getY(), getEffected().getZ(), posX, posY, posZ, getEffected().getInstanceId());
        if (!(getEffected() instanceof L2PetInstance)) {
            getEffected().setRunning();
        }
        switch (Rnd.get(1, 6)) {
            case 1:
                posX += 40;
                posY += 180;
                break;
            case 2:
                posX += 150;
                posY += 50;
                break;
            case 3:
                posX += 69;
                posY -= 100;
                break;
            case 4:
                posX += 10;
                posY -= 100;
                break;
            case 5:
                posX -= 150;
                posY -= 20;
                break;
            case 6:
                posX -= 100;
                posY += 60;
                break;
        }

        if (GeoData.getInstance().canSeeTarget(getEffected().getX(), getEffected().getY(), getEffected().getZ(), posX, posY, posZ)/*GeoData.getInstance().canMoveFromToTarget(getEffected().getX(), getEffected().getY(), getEffected().getZ(), posX, posY, posZ, getEffected().getInstanceId())*/) {
            getEffected().getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new L2CharPosition(posX, posY, posZ, 0));
        }

        // Give damage if "val" > 0
        double damage = calc();
        if (damage != 0) {
            getEffected().reduceCurrentHp(damage, getEffector(), true, true, getSkill());
        }
        return true;
    }
}

Что тут дописывать ? 

Share this post


Link to post
Share on other sites

Что тут дописывать ? 

 

Вы издеваетесь? Если у вас нет знаний, платите за фиксы.

За вас никто бесплатно делать не будет. Вам дали 100 наводок, а вы спрашиваете "Что тут фиксить?", "А тут что делать?", "А как это делать?"

Зачем вы вообще взялись за исходники?Если у вас нет знаний java, то не нужно морочить себе и другим голову.

Как говорится не умеешь ходить в туалет, не мучай заднее место.

  • Upvote 1

Share this post


Link to post
Share on other sites
/*
 * This program is free software: you can redistribute it and/or modify it under
 * the terms of the GNU General Public License as published by the Free Software
 * Foundation, either version 3 of the License, or (at your option) any later
 * version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
 * details.
 *
 * You should have received a copy of the GNU General Public License along with
 * this program. If not, see <http://www.gnu.org/licenses/>.
 */
package ru.catssoftware.gameserver.skills.effects;

import ru.catssoftware.gameserver.ai.CtrlIntention;
import ru.catssoftware.gameserver.geodata.GeoData;
import ru.catssoftware.gameserver.model.L2CharPosition;
import ru.catssoftware.gameserver.model.L2Effect;
import ru.catssoftware.gameserver.model.actor.instance.L2FolkInstance;
import ru.catssoftware.gameserver.model.actor.instance.L2FortCommanderInstance;
import ru.catssoftware.gameserver.model.actor.instance.L2FortSiegeGuardInstance;
import ru.catssoftware.gameserver.model.actor.instance.L2PcInstance;
import ru.catssoftware.gameserver.model.actor.instance.L2PetInstance;
import ru.catssoftware.gameserver.model.actor.instance.L2SiegeFlagInstance;
import ru.catssoftware.gameserver.model.actor.instance.L2SiegeGuardInstance;
import ru.catssoftware.gameserver.model.actor.instance.L2SiegeSummonInstance;
import ru.catssoftware.gameserver.skills.Env;
import ru.catssoftware.gameserver.templates.skills.L2EffectType;
//import java.util.logging.Logger;

import ru.catssoftware.tools.random.Rnd;

/**
 * @[member='Authority'] littlecrow
 *
 * Implementation of the Fear Effect
 */
public final class EffectFear extends L2Effect {

    public static final int FEAR_RANGE = 200;
    //protected static Logger				_log				= Logger.getLogger(EffectFear.class.getName());
    //private static Map<Integer, float[]> _deltas = new FastMap<Integer, float[]>();

    public EffectFear(Env env, EffectTemplate template) {
        super(env, template);
    }

    @[member='override']
    public L2EffectType getEffectType() {
        return L2EffectType.FEAR;
    }

    /** Notify started */
    @[member='override']
    public boolean onStart() {
        // Fear skills cannot be used L2Pcinstance to L2Pcinstance.
        // Heroic Dread, Curse: Fear, Fear, Horror, Sword Symphony, Word of Fear and Mass Curse Fear are the exceptions.
        if (getEffected() instanceof L2PcInstance && getEffector() instanceof L2PcInstance) {
            switch (getSkill().getId()) {
                case 65:
                case 98:
                case 1092:
                case 1169:
                case 1272:
                case 1376:
                case 1381:
                    // all ok
                    break;
                default:
                    return false;
            }
        }

        if (getEffected() instanceof L2FolkInstance || getEffected() instanceof L2SiegeGuardInstance || getEffected() instanceof L2SiegeFlagInstance
                || getEffected() instanceof L2SiegeSummonInstance || getEffected() instanceof L2FortSiegeGuardInstance
                || getEffected() instanceof L2FortCommanderInstance) {
            return false;
        }

        if (!getEffected().isAfraid()) {
            /*float _dX = getEffector().getX() - getEffected().getX();
            float _dY = getEffector().getY() - getEffected().getY();
            
            if (_dX == 0) {
            _dX = 0;
            if (_dY > 0) {
            _dY = -1;
            } else {
            _dY = 1;
            }
            } else if (_dY == 0) {
            _dY = 0;
            if (_dX > 0) {
            _dX = -1;
            } else {
            _dX = 1;
            }
            } else if (_dX > 0 && _dY > 0) {
            //_log.warning("Situation A-NW ("+_dX+";"+_dY+")");
            if (_dX > _dY) {
            _dY = -1 * _dY / _dX;
            _dX = -1;
            } else {
            _dX = -1 * _dX / _dY;
            _dY = -1;
            }
            } else if (_dX > 0 && _dY < 0) {
            //_log.warning("Situation B-SW ("+_dX+";"+_dY+")");
            if (_dX > (-1 * _dY)) {
            _dY = -1 * (_dY / _dX);
            _dX = -1;
            } else {
            _dX = _dX / _dY;
            _dY = 1;
            }
            } else if (_dX < 0 && _dY > 0) {
            //_log.warning("Situation C-NE ("+_dX+";"+_dY+")");
            if ((-1 * _dX) > _dY) {
            _dY = _dY / _dX;
            _dX = 1;
            } else {
            _dX = -1 * (_dX / _dY);
            _dY = -1;
            }
            } else if (_dX < 0 && _dY < 0) {
            //_log.warning("Situation D-SE ("+_dX+";"+_dY+")");
            if (_dX > _dY) {
            _dY = _dY / _dX;
            _dX = 1;
            } else {
            _dX = _dX / _dY;
            _dY = 1;
            }
            } else if (_dX == 0 && _dY == 0) {
            //_log.warning("Situation X");
            _dX = -1;
            _dY = -1;
            }
            _deltas.put(getEffected().getObjectId(), new float[]{_dX, _dY});*/
            getEffected().startFear();
            onActionTime();
            return true;
        }
        return false;
    }

    /** Notify exited */
    @[member='override']
    public void onExit() {
        getEffected().stopFear(this);
        getEffected().setTarget(null);
        getEffected().getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
        //_deltas.remove(getEffected().getObjectId());
    }

    @[member='override']
    public boolean onActionTime() {
        if (getEffected().getFirstEffect(getId()) == null) {
            onExit();
        }

        int posX = getEffected().getX();
        int posY = getEffected().getY();
        int posZ = getEffected().getZ();
        //float[] delta = _deltas.get(getEffected().getObjectId());
        /*float _dX = -1;
        float _dY = -1;
        if (delta != null) {
        _dX = delta[0];
        _dY = delta[1];
        }
        //_log.warning("Start Position on Fear. X: " + posX + "  Y: " + posY);
        if (_dX != 0) {
        posX += _dX * FEAR_RANGE;
        }
        if (_dY != 0) {
        posY += _dY * FEAR_RANGE;
        }*/
        //_log.warning("Next Position on Fear. X: " + posX + "  Y: " + posY);
        //Location destiny = GeoData.getInstance().moveCheck(getEffected().getX(), getEffected().getY(), getEffected().getZ(), posX, posY, posZ, getEffected().getInstanceId());
        if (!(getEffected() instanceof L2PetInstance)) {
            getEffected().setRunning();
        }
        switch (Rnd.get(1, 6)) {
            case 1:
                posX += 40;
                posY += 180;
                break;
            case 2:
                posX += 150;
                posY += 50;
                break;
            case 3:
                posX += 69;
                posY -= 100;
                break;
            case 4:
                posX += 10;
                posY -= 100;
                break;
            case 5:
                posX -= 150;
                posY -= 20;
                break;
            case 6:
                posX -= 100;
                posY += 60;
                break;
        }

        if (GeoData.getInstance().canSeeTarget(getEffected().getX(), getEffected().getY(), getEffected().getZ(), posX, posY, posZ)/*GeoData.getInstance().canMoveFromToTarget(getEffected().getX(), getEffected().getY(), getEffected().getZ(), posX, posY, posZ, getEffected().getInstanceId())*/) {
            getEffected().getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new L2CharPosition(posX, posY, posZ, 0));
        }

        // Give damage if "val" > 0
        double damage = calc();
        if (damage != 0) {
            getEffected().reduceCurrentHp(damage, getEffector(), true, true, getSkill());
        }
        return true;
    }
}

Что тут дописывать ? 

 

Повторяю фикс:

 

private void fearAction(BuffInfo info, boolean start)
{
double radians = Math.toRadians(start ? Util.calculateAngleFrom(info.getEffector(), info.getEffected()) : Util.convertHeadingToDegree(info.getEffected().getHeading()));

int posX = (int) (info.getEffected().getX() + (FEAR_RANGE * Math.cos(radians)));
int posY = (int) (info.getEffected().getY() + (FEAR_RANGE * Math.sin(radians)));
int posZ = info.getEffected().getZ();

if (!info.getEffected().isPet())
{
info.getEffected().setRunning();
}

// If pathfinding enabled the creature will go to the defined destination (retail like).
// Otherwise it will go to the nearest obstacle.
final Location destination;
if (Config.PATHFINDING > 0)
{
destination = GeoData.getInstance().moveCheck(info.getEffected().getX(), info.getEffected().getY(), info.getEffected().getZ(), posX, posY, posZ, info.getEffected().getInstanceId());
}
else
{
destination = new Location(posX, posY, posZ, info.getEffected().getInstanceId());
}
info.getEffected().getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, destination);}

 

 

Edited by zGosu

Share this post


Link to post
Share on other sites

Повторяю фикс:

 

private void fearAction(BuffInfo info, boolean start)
{
double radians = Math.toRadians(start ? Util.calculateAngleFrom(info.getEffector(), info.getEffected()) : Util.convertHeadingToDegree(info.getEffected().getHeading()));

int posX = (int) (info.getEffected().getX() + (FEAR_RANGE * Math.cos(radians)));
int posY = (int) (info.getEffected().getY() + (FEAR_RANGE * Math.sin(radians)));
int posZ = info.getEffected().getZ();

if (!info.getEffected().isPet())
{
info.getEffected().setRunning();
}

// If pathfinding enabled the creature will go to the defined destination (retail like).
// Otherwise it will go to the nearest obstacle.
final Location destination;
if (Config.PATHFINDING > 0)
{
destination = GeoData.getInstance().moveCheck(info.getEffected().getX(), info.getEffected().getY(), info.getEffected().getZ(), posX, posY, posZ, info.getEffected().getInstanceId());
}
else
{
destination = new Location(posX, posY, posZ, info.getEffected().getInstanceId());
}
info.getEffected().getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, destination);}

 

 

так по него еще надо дописывать класс  :help:

Share this post


Link to post
Share on other sites

так по него еще надо дописывать класс  :help:

Ты можешь только ставить "ПАЛЬЧИК ВНИЗ" и больше ничего.

А правда глаза режет? :)

  • Upvote 1

Share this post


Link to post
Share on other sites

так по него еще надо дописывать класс  :help:

никакого нового класса делать не надо. ctrl+c ctr+v (то что внутри метода) и всё. Пример есть. Осталось только подставить. 

Share this post


Link to post
Share on other sites

никакого нового класса делать не надо. ctrl+c ctr+v (то что внутри метода) и всё. Пример есть. Осталось только подставить.

ставлю и у меня прут ошибки  :help:

Share this post


Link to post
Share on other sites

Ты можешь только ставить "ПАЛЬЧИК ВНИЗ" и больше ничего.

А правда глаза режет? :)

не пиши тут если нет желания помогать.

Share this post


Link to post
Share on other sites

ставлю и у меня прут ошибки  :help:

Естественно. Я же скинул код от лыжы, а у Вас ИТ (вроде бы).

Но прикол в том, что язык одинаковый и алгоритм работы программы одинаковый.

Скорей всего там ошибки рода (метод не найден) или (тип данных не совпадает). Всё исправляется простой заменой на свои методы и классы (уже имеющиеся в сборке, а не создание новых), ну и импортов. 

 

Просто уже какой день Вы не можете решить эту элементарную проблему. Заплатите кому-то уже 100р., что бы он за Вас вставил нужный код и всё. (такой сборкой как у Вас мало кто пользуется.... не сложно догадаться почему). У вас просто остается 2 варианта:

1) не страдать фигней и с помощью "поиска в Интернете" иправить баг

2) нанять разработчика, который за "пиво" будет писать Вам код. 

 

Надеюсь, что у Вас всё получиться) 

  • Upvote 1

Share this post


Link to post
Share on other sites

Естественно. Я же скинул код от лыжы, а у Вас ИТ (вроде бы).

Но прикол в том, что язык одинаковый и алгоритм работы программы одинаковый.

Скорей всего там ошибки рода (метод не найден) или (тип данных не совпадает). Всё исправляется простой заменой на свои методы и классы (уже имеющиеся в сборке, а не создание новых), ну и импортов. 

 

Просто уже какой день Вы не можете решить эту элементарную проблему. Заплатите кому-то уже 100р., что бы он за Вас вставил нужный код и всё. (такой сборкой как у Вас мало кто пользуется.... не сложно догадаться почему). У вас просто остается 2 варианта:

1) не страдать фигней и с помощью "поиска в Интернете" иправить баг

2) нанять разработчика, который за "пиво" будет писать Вам код. 

 

Надеюсь, что у Вас всё получиться) 

вы мне сможете помочь за 2 вариант ?

Share this post


Link to post
Share on other sites

вы мне сможете помочь за 2 вариант ?

Да

Share this post


Link to post
Share on other sites

Да

хорошо. я как буду свободен я вам напишу в лк

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...