rendered paste body private int getMdefBasedDisablerSuccess( L2Character player, L2Character target, L2Skill skill, double chanceMulti, double lvlModifier, double matkModifier, boolean witCheck, double witModifier, double baseVal) { double rate = 0; int returnRate = 0; double pLVL = player.getLevel(); double tLVL = target.getLevel(); /** double chanceMulti = xml.chanceMulti; double lvlModifier = config.lvlModifier = 1.05; // higher this number, the more level difference plays a part in success double matkModifier = config.matkModifier = 1.07; // higher this number, the more mdef/matk plays a part in success boolean witCheck = config.WITCheckForDebuff = true // compare wit? double witModifier = config.witModifier = 0.73; // higher this number, the more wit plays a part in success */ double minChance = 2; double maxChance = 99; // compare player/targ lvl /** double baseVal = config.baseVal = 70%; */ rate = baseVal; consolePrint(player,"Rate[0] = "+rate); rate *= (pLVL/tLVL) * lvlModifier; double tempLvlModi = (pLVL/tLVL) * lvlModifier; // temp var for debug consolePrint(player,"Rate[1] = "+rate); // baseVal = 70 * 1.236 = 86.54 // compare skill/targ lvl double skillCheck = 0; if ( player instanceof L2PcInstance ) { L2PcInstance activecharPC = (L2PcInstance)player; ClassId classID = activecharPC.getClassId(); // allows GM to be any class to use sleep or root... consolePrint(player,"----- PLAYER DISABLER ----- GM("+activecharPC.isGM()+") CLASS("+classID+")"); skillCheck = SkillTreeTable.getMinSkillLevel(skill.getId(), classID, skill.getLevel()); if ( activecharPC.isGM() && skillCheck <= 1 ) { skillCheck = activecharPC.getLevel(); } consolePrint(player,"skillCheck("+skillCheck+")"); } else { consolePrint(player,"----- MONSTER DISABLER -----"); skillCheck = player.getLevel(); } //skill lvl = 9 = 35 rate *= skillCheck/tLVL; consolePrint(player,"Rate[2] = "+rate); double tempSkillModi = skillCheck/tLVL; // temp var for debug // compare p matk and targ mdef double pMATK = 0; double pMDEF = 0; pMATK = Math.sqrt(player.getMAtk(target, skill)); pMDEF = Math.sqrt(target.getMDef(player, skill)); rate *= (pMATK / pMDEF) * matkModifier; consolePrint(player,"Rate[3] = "+rate); double tempMATKModi = (pMATK / pMDEF) * matkModifier; // temp var for debug double pWIT = 0; double tWIT = 0; if ( witCheck == true ) { pWIT = player.getTemplate().baseWIT; tWIT = target.getTemplate().baseWIT; double witComparison = pWIT/tWIT; double newRate = rate * witComparison; double rateDifference = newRate - rate; rateDifference *= witModifier; rate += rateDifference; } consolePrint(player,"Rate[4] = "+rate); // TODO: [ootz0rz] factor in mental aegis-type buffs for sleep/root... int aegis = L2Skill.STAT_SLEEPRES; target.getEffect(aegis); L2ItemInstance weaponInst = player.getActiveWeaponInstance(); boolean sps = false; boolean bsps = false; if (weaponInst != null) { if (weaponInst.getChargedSpiritshot() == L2ItemInstance.CHARGED_BLESSED_SPIRITSHOT) { bsps = true; sps = false; consolePrint(player,"BSPS CHARGED"); weaponInst.setChargedSpiritshot(L2ItemInstance.CHARGED_NONE); } else if (weaponInst.getChargedSpiritshot() == L2ItemInstance.CHARGED_SPIRITSHOT) { sps = true; bsps = false; consolePrint(player,"SPS CHARGED"); weaponInst.setChargedSpiritshot(L2ItemInstance.CHARGED_NONE); } } if ( sps == true ) rate *= 1.13; if ( bsps == true ) rate *= 1.3; consolePrint(player,"Rate[5] = "+rate); double tempChanceModi = rate; // temp var for debug rate *= chanceMulti; consolePrint(player,"Rate[6] = "+rate); consolePrint(player,"Used skill("+skill.getName()+" Lv."+skill.getLevel()+") on ("+target.getName()+"/"+target.getLevel()+")."); consolePrint(player,"base("+baseVal+") " + "lv("+pLVL+"/"+tLVL+"*"+lvlModifier+"="+tempLvlModi+") " + "skLv("+skillCheck+"/"+tLVL+"="+tempSkillModi+") " + "mAmD("+pMATK+"/"+pMDEF+"*"+matkModifier+"="+tempMATKModi+") " + "wit("+witCheck+")" + "final("+tempChanceModi+"*"+chanceMulti+"="+rate+")"); if ( rate < minChance ) rate = minChance; if ( rate > maxChance ) rate = maxChance; consolePrint(player,"FINAL RATE: "+rate); returnRate = (int)Math.round(rate); return returnRate; }