Jump to content
  • 0

[Help]Remove skills


Question

Posted

Hallo guys i have problem with remove buffs/dance/songs i had set it to TRUE At the cfg but still in game not working

how i can fix it i tryed to find the jar for cancel buff but ifound only this

* 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 com.l2jserver.gameserver.skills.effects;

import java.util.logging.Logger;

import com.l2jserver.Config;
import com.l2jserver.gameserver.model.L2Effect;
import com.l2jserver.gameserver.model.actor.L2Character;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.skills.Env;
import com.l2jserver.gameserver.skills.Formulas;
import com.l2jserver.gameserver.templates.effects.EffectTemplate;
import com.l2jserver.gameserver.templates.skills.L2EffectType;
import com.l2jserver.util.Rnd;
import com.l2jserver.util.StringUtil;

/**
* 
* @author DS
*
*/
public class EffectCancel extends L2Effect
{
protected static final Logger _log = Logger.getLogger(EffectCancel.class.getName());

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

/**
 * 
 * @see com.l2jserver.gameserver.model.L2Effect#getEffectType()
 */
@Override
public L2EffectType getEffectType()
{
	return L2EffectType.CANCEL;
}

/**
 * 
 * @see com.l2jserver.gameserver.model.L2Effect#onStart()
 */
@Override
public boolean onStart()
{
	return cancel(getEffector(), getEffected(), this);
}

/**
 * 
 * @see com.l2jserver.gameserver.model.L2Effect#onActionTime()
 */
@Override
public boolean onActionTime()
{
	return false;
}

private static boolean cancel(L2Character caster, L2Character target, L2Effect effect)
{
	if (!(target instanceof L2PcInstance)|| target.isDead())
		return false;

	final int cancelLvl = effect.getSkill().getMagicLevel();
	int count = effect.getSkill().getMaxNegatedEffects();

	double rate = effect.getEffectPower();
	final double vulnModifier = Formulas.calcSkillTypeVulnerability(0, target, effect.getSkillType());
	final double profModifier = Formulas.calcSkillTypeProficiency(0, caster, target, effect.getSkillType());
	double res = vulnModifier + profModifier;
	double resMod = 1;
	if (res != 0)
	{
		if (res < 0)
		{
			resMod = 1 - 0.075 * res;
			resMod = 1 / resMod;
		}
		else
			resMod = 1 + 0.02 * res;

		rate *= resMod;
	}

	if (caster.isDebug())
	{
		final StringBuilder stat = new StringBuilder(100);
		StringUtil.append(stat,
				effect.getSkill().getName(),
				" power:", String.valueOf((int)effect.getEffectPower()),
				" lvl:", String.valueOf(cancelLvl),
				" res:", String.format("%1.2f", resMod), "(",
				String.format("%1.2f", profModifier), "/",
				String.format("%1.2f", vulnModifier),
				") total:", String.valueOf(rate)
		);
		final String result = stat.toString();
		if (caster.isDebug())
			caster.sendDebugMessage(result);
		if (Config.DEVELOPER)
			_log.info(result);
	}

	final L2Effect[] effects = target.getAllEffects();

	if (effect.getSkill().getNegateAbnormals() != null) // Cancel for abnormals
	{
		for (L2Effect eff : effects)
		{
			if (eff == null)
				continue;

			for (String negateAbnormalType : effect.getSkill().getNegateAbnormals().keySet())
			{
				if (negateAbnormalType.equalsIgnoreCase(eff.getAbnormalType()) && effect.getSkill().getNegateAbnormals().get(negateAbnormalType) >= eff.getAbnormalLvl())
				{
					if (calcCancelSuccess(eff, cancelLvl, (int)rate))
						eff.exit();
				}
			}
		}
	}
	else
	{
		L2Effect eff;
		int lastCanceledSkillId = 0;

		for (int i = effects.length; --i >= 0;)
		{
			eff = effects[i];
			if (eff == null)
				continue;

			if (!eff.canBeStolen())
			{
				effects[i] = null;
				continue;
			}

			// first pass - dances/songs only
			if (!eff.getSkill().isDance())
				continue;

			if (eff.getSkill().getId() == lastCanceledSkillId)
			{
				eff.exit(); // this skill already canceled
				continue;
			}

			if (!calcCancelSuccess(eff, cancelLvl, (int)rate))
				continue;

			lastCanceledSkillId = eff.getSkill().getId();

			eff.exit();
			count--;

			if (count == 0)
				break;
		}

		if (count != 0)
		{
			lastCanceledSkillId = 0;
			for (int i = effects.length; --i >= 0;)
			{
				eff = effects[i];
				if (eff == null)
					continue;

				// second pass - all except dances/songs
				if (eff.getSkill().isDance())
					continue;

				if (eff.getSkill().getId() == lastCanceledSkillId)
				{
					eff.exit(); // this skill already canceled
					continue;
				}

				if (!calcCancelSuccess(eff, cancelLvl, (int)rate))
					continue;

				lastCanceledSkillId = eff.getSkill().getId();
				eff.exit();
				count--;

				if (count == 0)
					break;
			}
		}
	}

	return true;
}

private static boolean calcCancelSuccess(L2Effect effect, int cancelLvl, int baseRate)
{
	int rate = 2 * (cancelLvl - effect.getSkill().getMagicLevel());
	rate += effect.getAbnormalTime()/120;
	rate += baseRate;

	if (rate < 25)
		rate = 25;
	else if (rate > 75)
		rate = 75;

	return Rnd.get(100) < rate;
}
}

iam really newbiew at java coding

 

l2jfreya PACK

4 answers to this question

Recommended Posts

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


  • Posts

    • wtf is your website lol ai slop
    • who have this files? or info about cached packets?
    • Hi maxcheaters, i am trying to bring back an old server ( L2Revenge) but with my own ideas, i only liked how it was and made the gameplay based on that just putting my own ideas.   So practicly is a PTS C6 with an extender that i work lately    Exp / SP is x45 adena is x200 and drops x5  so safe is +3 , max is unlimited and rate is 65% for both mage and fighter weapons I created a system that you can get on the levels the gear you need based on farm but for S grade theres a little farm to get some armor Tokens to unseal them. As you remember L2Revenge had olympiad / Tournament gear. So people abused them and had S grades that way just couldnt enchant them. So i made to be wearable only if u are nobless. That way i cancel this "exploit".  The server gives opportunity to solo and clans , epic gear ( epic weapons) or armors can be bought with raid tokens and you can craft them or get them with various ways Regarding Buffs: 24 buff slots no changes asked. Cov/Pony/Cat , siren - renewal - champion out of buffer , if u make the char as main roll u can use them or use the offline buffer system to sell them and get adenas. their time is 20 mins so that way we see again the " 1kk for rene/siren" or rec = song  Regarding armors: they are dropped ( parts ) from 3 only raids , rest lvl 76+ raids drop recipes , so crafting takes place (so if u are solo u can craft them )  there are 3 armors each armor have its purpose: Revenge Armors - Example for light ( its a glass cannon , high damage , less atk speed and less pdef ) - they mostly modify your base stats, so useable on sieges or off tank chars Titanium Armors - A little bit of balanced of all  Epic Armor - Daggers/Enchanters/Healers mostly but u can always combine your build    Regarding weapons: can be dropped from Monastery of Silence monsters or get them from NPC with Raid Tokens its like a 5% better than S grades and the S/A Activates at +4  Regarding retail gear: you need to unseal only S grades for a great amount of armor tokens all weapons on any grade need Soul crystals that are sold for adenas  stage 13 crystals are expensive or dropped from raids Regarding fun: There is a squash event a Fortress vs Fortress pvp event an RB Event at weekends and from Monday - Wednesday Tournament ( Olympiad is closed monday/tuesday/wednesday)  at tournament you can practice 1vs1 like olympiad but pots/ss allowed , gear allowed is only olympiad or tournament , each win of match gives u 5 glits at 100 glits u can be hero till restart Olympiad works the same way regarding gear allowance but works only thursday to friday and you win monthly hero Auction with Raid Tokens is activated Event medals from events can be exchanged for various items i try to make the oldschool with a little bit of new school systems Not planing to open it anytime soon as i still develop and make corrections to extender , looking forward to meet people that actually played this and are hyped to help on testing / development   P.S is c5 into interlude ( theres no akamanah / nor PI aswell , no lifestones) forgot to mention
  • Topics

×
×
  • Create New...

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock