Exemplo n.º 1
0
 public static double getSpecialMeleeHit(Player p, Entity target, int weapon)
 {
     double p2Defence = getMeleeDefence(p, target);
     double attack = getMeleeAttack(p) * getSpecialAttackBonus(weapon);
     double hit = misc.randomDouble() * getPlayerMaxHit(p, 0);
     if ((misc.randomDouble() * attack) < (misc.randomDouble() * p2Defence))
     {
         p.setLastHit(0);
         return 0;
     }
     if (hit < (getPlayerMaxHit(p, 0) * 0.50))
     {
         if (p.getLastHit() == 0) {
             if (misc.random(6) == 0)
             {
                 hit = (getPlayerMaxHit(p, 0) * 0.50) + (misc.randomDouble() * (getPlayerMaxHit(p, 0) * 0.50));
             }
         }
         else if (p.getLastHit() > misc.random(6))
         {
             if (misc.random(6) == 0)
             {
                 hit = (getPlayerMaxHit(p, 0) * 0.50) + (misc.randomDouble() * (getPlayerMaxHit(p, 0) * 0.50));
             }
         }
     }
     return hit;
 }