Jump to content
  • 0

Cleanse Don't Remove Malaria & Flu (Acis)


Question

Posted

I do some modifications on EffectCancelDebuff but can't make Cleanse don't remove malaria and flu.

 

I try to change skills from DeBuff to Buff, but still removing it.

/*
 * 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 net.sf.l2j.gameserver.skills.effects;

import net.sf.l2j.gameserver.model.L2Effect;
import net.sf.l2j.gameserver.model.L2Skill;
import net.sf.l2j.gameserver.model.actor.L2Character;
import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
import net.sf.l2j.gameserver.skills.Env;
import net.sf.l2j.gameserver.skills.Formulas;
import net.sf.l2j.gameserver.templates.skills.L2EffectType;
import net.sf.l2j.gameserver.templates.skills.L2SkillType;
import net.sf.l2j.util.Rnd;

/**
 * @author UnAfraid
 */
public class EffectCancelDebuff extends L2Effect
{
	public EffectCancelDebuff(Env env, EffectTemplate template)
	{
		super(env, template);
	}
	
	@Override
	public L2EffectType getEffectType()
	{
		return L2EffectType.CANCEL_DEBUFF;
	}
	
	@Override
	public boolean onStart()
	{
		return cancel(getEffector(), getEffected(), getSkill(), getEffectTemplate().effectType);
	}
	
	@Override
	public boolean onActionTime()
	{
		return false;
	}
	
	private static boolean cancel(L2Character caster, L2Character target, L2Skill skill, L2SkillType effectType)
	{
		if (!(target instanceof L2PcInstance) || target.isDead())
			return false;
		
		final int cancelLvl = skill.getMagicLevel();
		int count = skill.getMaxNegatedEffects();
		double baseRate = Formulas.calcSkillVulnerability(caster, target, skill, effectType);
		
		L2Effect effect;
		int lastCanceledSkillId = 0;
		final L2Effect[] effects = target.getAllEffects();
		for (int i = effects.length; --i >= 0;)
		{
			effect = effects[i];
			if (effect == null)
				continue;
			
			if (!effect.getSkill().isDebuff() || !effect.getSkill().canBeDispeled() || effect.getSkill().getId() != 4554 || effect.getSkill().getId() != 4553)
			{
				effects[i] = null;
				continue;
			}
			
			if (effect.getSkill().getId() == lastCanceledSkillId)
			{
				effect.exit(); // this skill already canceled
				continue;
			}
			
			if (!calcCancelSuccess(effect, cancelLvl, (int) baseRate))
				continue;
			
			lastCanceledSkillId = effect.getSkill().getId();
			effect.exit();
			count--;
			
			if (count == 0)
				break;
		}
		
		if (count != 0)
		{
			lastCanceledSkillId = 0;
			for (int i = effects.length; --i >= 0;)
			{
				effect = effects[i];
				if (effect == null)
					continue;
				
				if (!effect.getSkill().isDebuff() || !effect.getSkill().canBeDispeled() || effect.getSkill().getId() != 4554 || effect.getSkill().getId() != 4553)
				{
					effects[i] = null;
					continue;
				}
				
				if (effect.getSkill().getId() == lastCanceledSkillId)
				{
					effect.exit(); // this skill already canceled
					continue;
				}
				
				if (!calcCancelSuccess(effect, cancelLvl, (int) baseRate))
					continue;
				
				lastCanceledSkillId = effect.getSkill().getId();
				effect.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.getPeriod() - effect.getTime()) / 1200;
		rate *= baseRate;
		
		if (rate < 25)
			rate = 25;
		else if (rate > 75)
			rate = 75;
		
		return Rnd.get(100) < rate;
	}
}

5 answers to this question

Recommended Posts

  • 0
Posted

U say my this right?

<set name="skillType" val="DEBUFF" />

 

And here need to change something or is just for buff bar slot?

<effect name="Debuff" time="3600" val="0" stackOrder="#stackOrder" stackType="spa_disease_c" abnormal="poison">

Guest
This topic is now closed to further replies.


  • Posts

    • Dear players, Account registration for Airin x2 will be open 13.03 at 19:00 (GMT+1)! You can create an account by selecting Airin in the upper right corner of your profile or via the link. Accounts will not be deleted after the Open Beta Test, so don't miss the registration!   The Open Beta Test (OBT) will start on March 14 at 18:00 (GMT+1) and will last until March 17 at 20:00 (GMT+1) (approximately). Players who find bugs during OBT will receive CoL as a reward: - 1 CoL for each visual staticmeshes bug - For example, passing through textures, stairs, etc. - 2 CoL or more for server-side bugs (depending on severity) You can report bugs via ⁠support in Discord or forum.   🔽 Download links: Google Drive: Download  China Client: Download  Updater: Download  Nickname reservation will be available from March 20 at 17:00 (GMT+1). Service cost: 5 CoL.
    • 💰 Calling All Clans! Join Project Nemesis and Earn Real Money! 💰 Project Nemesis is offering exclusive rewards for clans that join our server! If you're a clan leader or a member looking for a fresh, competitive, and rewarding experience, this is your chance! 🎁 Clan Leader Rewards: ✅ Earn real money just for playing and leading your clan! ✅ Special in-game perks and bonuses. 🎮 Clan Member Rewards: ✅ Starter Pack – Boost your progress from day one! ✅ Free Premium Account – Enjoy extra features at no cost! 💀 Why Choose Project Nemesis? 🔥 Thrilling PvP and PvE content. 🔥 Active community and dedicated staff. 🔥 Balanced economy and fair play. 🔥 Regular events and tournaments. 🔗 Join Us Now! 🌍 Website: playnemesis.org 💬 Discord: Join Here Don't miss this opportunity! Bring your clan, enjoy epic battles, and get rewarded for your dedication! 💎🔥
    • thats funny, you are beign funny, hopzone.net is the most legit website is. (was) the reason? Selling votes to server owners (fake servers can be first due to money) Advertising new scryde owner's server and cycling the players to cryde server while other admins paying Kadar made a mistake selling to a server owner she destroyed the reputation of the website alongside with its legitimacy so as all people saying RIP
    • Hi guys! I want to ask if someone tried playing lineage 2 server with game guard on winlator and is it possible to do it
  • Topics

×
×
  • Create New...