コード例 #1
0
ファイル: Swords.java プロジェクト: nidefawl/mcMMO
 public static void parryCheck(EntityDamageByEntityEvent event, Player defender) {
   Entity y = event.getDamager();
   PlayerProfile PPd = Users.getProfile(defender);
   if (defender != null
       && Utils.isSword(defender.getItemInHand())
       && mcPermissions.skillPermission(SkillType.SWORDS, defender)) {
     if (PPd.getSkillLevel(SkillType.SWORDS) >= 900) {
       if (Math.random() * 3000 <= 900) {
         event.setCancelled(true);
         defender.sendMessage(ChatColor.GREEN + "**PARRIED**");
         defender
             .getItemInHand()
             .setDurability((short) (defender.getItemInHand().getDurability() + 1));
         if (y instanceof Player) {
           Player attacker = (Player) y;
           attacker.sendMessage(ChatColor.GREEN + "**PARRIED**");
         }
       }
     } else {
       if (Math.random() * 3000 <= PPd.getSkillLevel(SkillType.SWORDS)) {
         event.setCancelled(true);
         defender.sendMessage(ChatColor.YELLOW + "*CLANG* SUCCESSFUL PARRY *CLANG*");
         defender
             .getItemInHand()
             .setDurability((short) (defender.getItemInHand().getDurability() + 1));
         if (y instanceof Player) {
           Player attacker = (Player) y;
           attacker.sendMessage(ChatColor.DARK_RED + "**TARGET HAS PARRIED THAT ATTACK**");
         }
       }
     }
   }
 }
コード例 #2
0
ファイル: Swords.java プロジェクト: nidefawl/mcMMO
 public static void serratedStrikesActivationCheck(Player player) {
   PlayerProfile PP = Users.getProfile(player);
   if (PP == null) return;
   Ability ability = PP.getAbility(AbilityType.SerratedStrikes);
   if (ability == null) return;
   if (ability.activatesWith(player.getItemInHand())) {
     if (ability.isPrepared()) {
       int ticks = Math.max(2, MathHelper.floor(PP.getSkillLevel(SkillType.SWORDS) / 50));
       ability.activate(PP, ticks);
     }
   }
   //		if(Utils.isSword(player.getItemInHand()))
   //		{
   //			if(PP.getSwordsPreparationMode())
   //			{
   //    			PP.setSwordsPreparationMode(false);
   //    		}
   //	    	int ticks = 2;
   //	    	int x = PP.getSkillLevel(SkillType.SWORDS);
   //    		while(x >= 50)
   //    		{
   //    			x-=50;
   //    			ticks++;
   //    		}
   //
   //	    	if(!PP.getSerratedStrikesMode() && PP.getSerratedStrikesDeactivatedTimeStamp() <
   // System.currentTimeMillis())
   //	    	{
   //	    		player.sendMessage(Translate.getString("Skills.SerratedStrikesOn"));
   //	    		for(Player y : player.getWorld().getPlayers())
   //	    		{
   //	    			if(y != null && y != player && Utils.getDistance(player.getLocation(),
   // y.getLocation()) < 10)
   //	    				y.sendMessage(Translate.getString("Skills.SerratedStrikesPlayer", new Object[]
   // {player.getName()}));
   //	    		}
   //	    		PP.setSerratedStrikesActivatedTimeStamp(System.currentTimeMillis());
   //	    		PP.setSerratedStrikesDeactivatedTimeStamp(System.currentTimeMillis() + (ticks * 1000));
   //	    		PP.setSerratedStrikesMode(true);
   //	    	}
   //
   //	    }
 }
コード例 #3
0
ファイル: Swords.java プロジェクト: nidefawl/mcMMO
 public static void bleedCheck(Player attacker, LivingEntity damaged, mcMMO pluginx) {
   PlayerProfile PPa = Users.getProfile(attacker);
   if (damaged.getBleedTicks() > 0) return;
   if (damaged instanceof Wolf) {
     Wolf wolf = (Wolf) damaged;
     if (Taming.getOwner(wolf, pluginx) != null) {
       if (Taming.getOwner(wolf, pluginx) == attacker) return;
       //	    		if(Party.getInstance().inSameParty(attacker, Taming.getOwner(wolf, pluginx)))
       //	    			return;
     }
   }
   if (mcPermissions.skillPermission(SkillType.SWORDS, attacker)
       && Utils.isSword(attacker.getItemInHand())) {
     if (Math.random() * 1000 <= Math.min(PPa.getSkillLevel(SkillType.SWORDS), 750)) {
       if (!(damaged instanceof Player) || Combat.dealDamage(attacker, damaged, 0))
         damaged.increaseBleedTicks(5);
       attacker.sendMessage(ChatColor.GREEN + "**ENEMY BLEEDING**");
       damaged.setLastCustomDamageCause(
           new EntityDamageByEntityEvent(attacker, damaged, DamageCause.ENTITY_ATTACK, 0));
     }
   }
 }
コード例 #4
0
ファイル: Swords.java プロジェクト: nidefawl/mcMMO
  public static void counterAttackChecks(EntityDamageByEntityEvent event) {
    // Don't want to counter attack arrows
    if (event.getDamager() instanceof Projectile) return;

    if (event instanceof EntityDamageByEntityEvent) {
      Entity damager = ((EntityDamageByEntityEvent) event).getDamager();
      if (event.getEntity() instanceof Player) {
        Player damaged = (Player) event.getEntity();
        PlayerProfile PPd = Users.getProfile(damaged);
        if (Utils.isSword(damaged.getItemInHand())
            && mcPermissions.skillPermission(SkillType.SWORDS, damaged)) {
          if (Math.random() * 2000 <= Math.min(PPd.getSkillLevel(SkillType.SWORDS), 600)) {
            Combat.dealDamage(damaged, damager, event.getDamage() / 2);
            damaged.sendMessage(ChatColor.GREEN + "**COUNTER-ATTACKED**");
            if (damager instanceof Player) {
              ((Player) damager).sendMessage(ChatColor.DARK_RED + "Hit with counterattack!");
            }
          }
        }
      }
    }
  }