public static List<L2Effect> calcCancelStealEffects(L2Character activeChar, L2Character target, L2Skill skill, double power)
{
// Resists.
int cancelMagicLvl = skill.getMagicLevel();
int count = skill.getMaxNegatedEffects();
final double vuln = target.calcStat(Stats.CANCEL_VULN, 0, target, null);
final double prof = activeChar.calcStat(Stats.CANCEL_PROF, 0, target, null);
double resMod = 1 + (((vuln + prof) * -1) / 100);
double rate = power / resMod;
if (activeChar.isDebug() || Config.DEVELOPER)
{
final StringBuilder stat = new StringBuilder(100);
StringUtil.append(stat, skill.getName(), " Base Rate:", String.valueOf((int) power), " Magiclvl:", String.valueOf(cancelMagicLvl), " resMod:", String.format("%1.2f", resMod), "(", String.format("%1.2f", prof), "/", String.format("%1.2f", vuln), ") Rate:", String.valueOf(rate));
final String result = stat.toString();
if (activeChar.isDebug())
{
activeChar.sendDebugMessage(result);
}
if (Config.DEVELOPER)
{
_log.info(result);
}
}
// Cancel for Abnormals.
final L2Effect[] effects = target.getAllEffects();
List<L2Effect> canceled = new ArrayList<>(count);
if (skill.getNegateAbnormals() != null)
{
for (L2Effect eff : effects)
{
if (eff == null)
{
continue;
}
for (String negateAbnormalType : skill.getNegateAbnormals().keySet())
{
if (negateAbnormalType.equalsIgnoreCase(eff.getAbnormalType()) && (skill.getNegateAbnormals().get(negateAbnormalType) >= eff.getAbnormalLvl()))
{
if (calcCancelSuccess(eff, cancelMagicLvl, (int) rate, skill))
{
eff.exit();
}
}
}
}
}
// Common Cancel/Steal.
else
{
// First Pass.
int lastCanceledSkillId = 0;
L2Effect effect;
for (int i = effects.length; --i >= 0;) // reverse order
{
effect = effects[i];
if (effect == null)
{
continue;
}
// remove effect if can't be stolen
if (!effect.canBeStolen())
{
effects[i] = null;
continue;
}
// if effect time is smaller than 5 seconds, will not be stolen, just to save CPU,
// avoid synchronization(?) problems and NPEs
if ((effect.getAbnormalTime() - effect.getTime()) < 5)
{
effects[i] = null;
continue;
}
// Only Dances/Songs.
if (!effect.getSkill().isDance())
{
continue;
}
if (!calcCancelSuccess(effect, cancelMagicLvl, (int) rate, skill))
{
continue;
}
if (effect.getSkill().getId() != lastCanceledSkillId)
{
lastCanceledSkillId = effect.getSkill().getId();
count--;
}
canceled.add(effect);
if (count == 0)
{
break;
}
}
// Second Pass.
if (count > 0)
{
lastCanceledSkillId = 0;
for (int i = effects.length; --i >= 0;)
{
effect = effects[i];
if (effect == null)
{
continue;
}
// All Except Dances/Songs.
if (effect.getSkill().isDance())
{
continue;
}
if (!calcCancelSuccess(effect, cancelMagicLvl, (int) rate, skill))
{
continue;
}
if (effect.getSkill().getId() != lastCanceledSkillId)
{
lastCanceledSkillId = effect.getSkill().getId();
count--;
}
canceled.add(effect);
if (count == 0)
{
break;
}
}
}
}
return canceled;
}
public static boolean calcCancelSuccess(L2Effect eff, int cancelMagicLvl, int rate, L2Skill skill)
{
// Lvl Bonus Modifier.
rate *= (eff.getSkill().getMagicLevel() > 0) ? (cancelMagicLvl / eff.getSkill().getMagicLevel()) : 1;
// Check the Rate Limits.
rate = Math.min(Math.max(rate, skill.getMinChance()), skill.getMaxChance());
return Rnd.get(100) < rate;
}
}
to calculate the amount of stolen debuffs based on the character resists, however it appears that songs and dances are not being removed as first when a steal skill type is used.
You can post now and register later.
If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.
Hello. You may encounter the Push item fail error when trying to pick up an item dropped on the ground by a mob.
or
You can throw something out of your inventory and pick it up again, several times.
Probably this is a quantum dependency) I don't understand at what point this happens, sometimes two items one after another experience push item errors, and sometimes I don't have enough thousands of attempts to repeat this trick)
In any case, this is just a visual error and after the relog, the item appears in the inventory. I think first i need to disconnect the extender and check it on a bare server. I still need time to check this, maybe it's not even about the autoloot function.
https://youtu.be/6mcfmdImofE
-----------
In general, I would like to thank our wonderful Emca Eressea for her deep knowledge in programming and reverse engineering. And for the fact that her work is open to everyone, this is very amazing, and incredibly valuable.
ADENA
500 K = 40e
1kk = 70e
3kk = 190e
ITEMS
staff of life = 150e
karmian set = 90e
elven jewls top D = 30e
Orcish Poleaxe+1 best C pole = 680e
any D grade armor on demand
discord
wiz0642_81242
Question
Gries
Hello, i currently have this code:
to calculate the amount of stolen debuffs based on the character resists, however it appears that songs and dances are not being removed as first when a steal skill type is used.
7 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.