Exemplo n.º 1
0
 public void appendAffect(int spellbook, int spell) {
   try {
     if (!p.successfulCast) {
       return;
     }
     Player opp = Server.engine.players[p.magicOppIndex];
     if ((!opp.wildernessZone(opp.absX, opp.absY)) || (!p.wildernessZone(p.absX, p.absY))) {
       p.getActionSender().sendMessage(p, "You cannot attack players outside of the wilderness.");
       return;
     }
     if (p.InBounty == 0) {
       if (!p.properWildernessLevel(p.combatLevel, opp.combatLevel)
           || !opp.properWildernessLevel(opp.combatLevel, p.combatLevel)) {
         p.getActionSender().sendMessage(p, "Your combat difference is too great!");
         return;
       }
     }
     if (p.InBounty == 1) {
       if (opp.playerId != p.bhTarget && (p.playerId != opp.bhTarget)) {
         if (!opp.multiwayCombatZone(opp.absX, opp.absY)) {
           if (opp.attackedBy != null && (opp.attacking != null) && opp.attackedBy != p.username) {
             p.getActionSender().sendMessage(p, "This player is already in combat.");
             Engine.playerMovement.resetWalkingQueue(p);
             p.resetAttack();
             return;
           }
           if (opp.username != p.attackedBy && p.attackedBy != null) {
             p.getActionSender().sendMessage(p, "You are already in combat.");
             Engine.playerMovement.resetWalkingQueue(p);
             p.resetAttack();
             return;
           }
         }
       }
     }
     if (p.InBounty == 0) {
       if (!opp.multiwayCombatZone(opp.absX, opp.absY)) {
         if (opp.attackedBy != null
             && (opp.attacking != null || opp.attackedByCount >= 1)
             && opp.attackedBy != p.username) {
           p.getActionSender().sendMessage(p, "This player is already in combat.");
           Engine.playerMovement.resetWalkingQueue(p);
           p.resetAttack();
           return;
         }
         if (opp.username != p.attackedBy && p.attackedBy != null) {
           p.getActionSender().sendMessage(p, "You are already in combat.");
           Engine.playerMovement.resetWalkingQueue(p);
           p.resetAttack();
           return;
         }
       }
     }
     // }t
     opp.hitIndex = p.playerId;
     normalSpellAffect(opp);
   } catch (Exception e) {
     return;
   }
 }
Exemplo n.º 2
0
 public void appendDamage(int spellbook, int spell) {
   try {
     if (!p.successfulCast) {
       return;
     }
     Player opp = Server.engine.players[p.magicOppIndex];
     updateAttributes(spellbook, spell);
     if ((!opp.wildernessZone(opp.absX, opp.absY)) || (!p.wildernessZone(p.absX, p.absY))) {
       p.getActionSender().sendMessage(p, "You cannot attack players outside of the wilderness.");
       return;
     }
     if (p.InBounty == 0) {
       if (!p.properWildernessLevel(p.combatLevel, opp.combatLevel)
           || !opp.properWildernessLevel(opp.combatLevel, p.combatLevel)) {
         p.getActionSender().sendMessage(p, "Your combat difference is too great!");
         return;
       }
     }
     if (p.InBounty == 1) {
       if (opp.playerId != p.bhTarget && (p.playerId != opp.bhTarget)) {
         if (!opp.multiwayCombatZone(opp.absX, opp.absY)) {
           if (opp.attackedBy != null && (opp.attacking != null) && opp.attackedBy != p.username) {
             p.getActionSender().sendMessage(p, "This player is already in combat.");
             Engine.playerMovement.resetWalkingQueue(p);
             p.resetAttack();
             return;
           }
           if (opp.username != p.attackedBy && p.attackedBy != null) {
             p.getActionSender().sendMessage(p, "You are already in combat.");
             Engine.playerMovement.resetWalkingQueue(p);
             p.resetAttack();
             return;
           }
         }
       }
     }
     if (p.InBounty == 0) {
       if (!opp.multiwayCombatZone(opp.absX, opp.absY)) {
         if (opp.playerId != p.bhTarget
             && (p.playerId != opp.bhTarget && (p.username != opp.OriginalAttacker))) {
           if (opp.attackedBy != null
               && (opp.attacking != null || opp.attackedByCount >= 1)
               && opp.attackedBy != p.username) {
             p.getActionSender().sendMessage(p, "This player is already in combat.");
             Engine.playerMovement.resetWalkingQueue(p);
             p.resetAttack();
             return;
           }
           if (opp.username != p.attackedBy && p.attackedBy != null) {
             p.getActionSender().sendMessage(p, "You are already in combat.");
             Engine.playerMovement.resetWalkingQueue(p);
             p.resetAttack();
             return;
           }
         }
       }
     }
     if (!multipleDamage || !opp.multiwayCombatZone(opp.absX, opp.absY)) {
       opp.hitIndex = p.playerId;
       int damage = getHit(getAccuracy(), maxHit);
       p.appendExperience((damage * 1000), 6);
       p.appendExperience((damage * 1000), 3);
       opp.appendHit(damage, 0);
     } else {
       for (Player player : Server.engine.players) {
         if (player == null || player == p) {
           continue;
         }
         if (Misc.getDistance(opp.absX, opp.absY, player.absX, player.absY) <= 1) {
           if (player.wildernessZone(player.absX, player.absY)
               && p.properWildernessLevel(p.combatLevel, player.combatLevel)
               && player.properWildernessLevel(player.combatLevel, p.combatLevel)) {
             player.hitIndex = p.playerId;
             int damage = getHit(getAccuracy(), maxHit);
             p.appendExperience((damage * 1000), 6);
             p.appendExperience((damage * 1000), 3);
             player.appendHit(damage, 0);
           }
         }
       }
     }
   } catch (Exception e) {
     return;
   }
 }