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.
Responsibilities
• Working with the Lineage 2 server datapack
• Editing and maintaining:
• NPCs, mobs, raids, minions
• Skills, items, multisell, buylists
• Quests (XML + HTML)
• Spawn lists, territories, siege data
• Balancing:
• EXP / SP / Drop / Spoil
• Economy, shops, crafting
• PvE progression without PvP bias
• Testing changes:
• clean characters + GM testing
• server restarts
• log analysis
Required Skills
• Excellent knowledge of the Lineage 2 datapack structure
• Confident work with XML / CSV / TXT
• Understanding of Interlude mechanics:
• aggro, AI, land-rate
• champion / raid mechanics
• Understanding of interdependencies:
• item ↔ skill ↔ NPC ↔ quest
• Careful handling of IDs (without breaking compatibility)
Would Be a Big Plus
• Experience with L2J forks
• Understanding of the Java side of the server (datapack ↔ code integration level)
• Experience with custom systems:
• dynamic rates
• stage-based progression
• seasonal / PvE events
• Ability to balance using tables and formulas rather than “by feel”
We Are Not Looking for Someone Who
• Copies datapacks from other servers
• Changes IDs without understanding the consequences
• Creates multisells with infinite profit
• Does not test changes after a restart
• Balances “by intuition”
We've added 5% discounts for bulk purchases of Google accounts for orders of 300 or more, and 10% for orders of 500 or more. The discount is applied automatically when you place your order! The discount is indicated in the product title and description for each category.
Question
Gries
Hello, i currently have this code:
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.
7 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 accountSign in
Already have an account? Sign in here.
Sign In Now