From: Kimmo R. <ki...@us...> - 2008-09-14 20:28:36
|
Update of /cvsroot/arianne/stendhal/src/games/stendhal/server/entity In directory sc8-pr-cvs11.sourceforge.net:/tmp/cvs-serv885/src/games/stendhal/server/entity Modified Files: RPEntity.java Log Message: cope with greater skill differences in canHit() Index: RPEntity.java =================================================================== RCS file: /cvsroot/arianne/stendhal/src/games/stendhal/server/entity/RPEntity.java,v retrieving revision 1.287 retrieving revision 1.288 diff -C2 -d -r1.287 -r1.288 *** RPEntity.java 7 Sep 2008 10:00:47 -0000 1.287 --- RPEntity.java 14 Sep 2008 20:28:43 -0000 1.288 *************** *** 1969,1980 **** */ public boolean canHit(final RPEntity defender) { ! boolean result = false; ! ! final int roll = Rand.roll1D20(); ! final int defenderDEF = defender.getDEF(); - final int attackerATK = this.getATK(); - int risk = calculateRiskForCanHit(roll, defenderDEF, attackerATK); /* --- 1969,1975 ---- */ public boolean canHit(final RPEntity defender) { ! int roll = Rand.roll1D20(); final int defenderDEF = defender.getDEF(); final int attackerATK = this.getATK(); /* *************** *** 1984,1999 **** */ if (!(getLevel() - LEVEL_DIFFERENCE_TO_NOT_NEED_KARMA > defender.getLevel())) { ! final double karma = this.useKarma(0.1); ! ! if (karma > 0.2) { ! risk += 4; ! } else if (karma > 0.1) { ! risk++; ! } else if (karma < -0.2) { ! risk -= 4; ! } else if (karma < -0.1) { ! risk--; ! } } if (logger.isDebugEnabled()) { --- 1979,1988 ---- */ if (!(getLevel() - LEVEL_DIFFERENCE_TO_NOT_NEED_KARMA > defender.getLevel())) { ! final double karma = this.useKarma(0.1); ! ! roll += roll * karma; } + int risk = calculateRiskForCanHit(roll, defenderDEF, attackerATK); + if (logger.isDebugEnabled()) { *************** *** 2008,2020 **** if (risk > 1) { risk = 1; - result = true; } this.put("risk", risk); ! return result; } int calculateRiskForCanHit(final int roll, final int defenderDEF, final int attackerATK) { ! return 2 * attackerATK - defenderDEF + roll - 10; } --- 1997,2009 ---- if (risk > 1) { risk = 1; } this.put("risk", risk); ! ! return (risk != 0); } int calculateRiskForCanHit(final int roll, final int defenderDEF, final int attackerATK) { ! return 20 * attackerATK - roll * defenderDEF; } |