From: Katie R. <ky...@us...> - 2011-03-19 14:33:51
|
Update of /cvsroot/arianne/stendhal/src/games/stendhal/server/entity/player In directory vz-cvs-4.sog:/tmp/cvs-serv8004/src/games/stendhal/server/entity/player Modified Files: PlayerDieer.java Log Message: round the % possible to lose to 0.1% accuracy - which should have a positive effect at the top end of the scale (if you were quite lucky and got a 99.95 % loss that was still pretty unlucky for higher level players!) The benefit is mainly that we can now accurately print to the player how much they lost and not be rounding to 100% when actually it was 99.95% etc. Fixes #3225867 Index: PlayerDieer.java =================================================================== RCS file: /cvsroot/arianne/stendhal/src/games/stendhal/server/entity/player/PlayerDieer.java,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** PlayerDieer.java 13 Feb 2011 22:01:48 -0000 1.29 --- PlayerDieer.java 19 Mar 2011 14:33:48 -0000 1.30 *************** *** 115,118 **** --- 115,122 ---- penaltyFactor = 0.99 + (karma / 100.0); } + + // round to 3 decimal places (i.e as a percentage it will be one decimal place) + penaltyFactor = (double) Math.round(penaltyFactor * 1000) / 1000; + // note on karma: players can only hit the maximums of these ranges if they themselves had over 100 Karma, less than -100 karma, respectively. // and even then, some chance will mean they are not guaranteed to hit the maximum *************** *** 132,138 **** } ! // this is for telling the player what % of their old value, the skills are now. so, some loss of precision is ok. ! final int skillPercentage = (int) Math.round(penaltyFactor * 100.0); ! player.setHP(player.getBaseHP()); --- 136,147 ---- } ! // this is for telling the player what % of their old value, the skills are now. so, some loss of precision is ok ! // but we don't want to say it is 100% when it is not. ! final String skillPercentage; ! if (penaltyFactor > 0.99 && penaltyFactor < 1) { ! skillPercentage = String.format("%.1f",penaltyFactor * 100.0); ! } else { ! skillPercentage = String.format("%.0f",penaltyFactor * 100.0); ! } player.setHP(player.getBaseHP()); |