All pastes #19270 Raw Edit

Miscellany

public java v1 · immutable
#19270 ·published 2005-08-04 06:12 UTC
rendered paste body
// this is also just sorta pseudo-code....it will be different in the actual code its just to give an idea of how it works    	 // this can easily be modified for use with stun instead..../*    	XML File contains    	<disabler type=sleep/root chanceMulti=1.3/1.12 baseRate=70/60> // greater than 1 = more chance of success. less than 1 = lower chance    	server config keeps base chance for each skill    	contiains max chance, and min chance (overall)    	also contains lvlModifier and matkModifier    	 ////////////////////////////////////////////    	 // the server.prop  file will also contain defaults of each    	 // of the vars so if sometin is not defined in the xml file, it'll default    	 // to whatever is set here     	 sleep/rootBaseLandRate = 70/60 // %    	     	 minChance = 2 // %    	 maxChance = 99 // %    	 lvlModifier = 1.05    	 matkModifier = 1.15    	 WITCheckForDebuff = true    	 witModifier = 0.73    	 sleep/rootChanceMulti = 1.3/1.12    	 ////////////////////////////////////////////*/    	int pLVL = player.getLevel(); = 73    	int tLVL = target.getLevel(); = 62    	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    	    	// compare player/targ lvl    	double baseVal = config.baseVal = 70%;    	baseVal *= pLVL/tLVL * lvlModifier = 1.2362903225806451612903225806452    	    	// 70 * 1.236 = 86.54    	    	    	// compare skill/targ lvl    	L2PcInstance activecharPC = L2World.getInstance().getPlayer(L2Character.getName());    	ClassId classID = activecharPC.getClassId();    	int skillCheck = SkillTreeTable.getMinSkillLevel(skill.getId(), classID, skill.getLevel());    	    	//skill lvl = 9 = 35    	    	baseVal *= skillCheck / tLVL = 35 / 62 = 0.564 * 86.54 = 48.4624    	    	// compare p matk and targ mdef    	int pMATK = player.getTemplate().baseMAtk; = 900    	int pMDEF = target.getTemplate().baseMDef; = 700    	    	baseVal *= pMATK / pMDEF * matkModifier; = 900/700*1.07=1.4785 * baseVal = 66.670416;    	    	if ( witCheck == true ) {    		int pWIT = player.getTemplate().baseWIT; = 40    		int tWIT = target.getTemplate().baseWIT; = 28    		    		baseVal *= pWIT / tWIT * witModifier; = 40/28*.7 = 1.0428 * 66.67 = 69.527719542857142857142857142857    	}    	    	// TODO: factor in mental aegis-type buffs for sleep/root...    	    	baseVal *= chanceMulti; = 69.5277 * 1.3 = 90.38603;    	    	if ( baseVal < config.minChance ) baseVal = config.minChance;    	if ( baseVal > config.maxChance ) baseVal = config.maxChance;    	    	rate = baseVal;