mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-24 22:26:46 +01:00
More optimzation
This commit is contained in:
parent
aff6b0925f
commit
ed8e2ab8b9
@ -22,7 +22,6 @@ import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
|||||||
import org.bukkit.event.entity.EntityDamageEvent;
|
import org.bukkit.event.entity.EntityDamageEvent;
|
||||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.plugin.Plugin;
|
|
||||||
|
|
||||||
import com.gmail.nossr50.config.LoadProperties;
|
import com.gmail.nossr50.config.LoadProperties;
|
||||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||||
@ -62,17 +61,17 @@ public class Combat
|
|||||||
ItemStack itemInHand = attacker.getItemInHand();
|
ItemStack itemInHand = attacker.getItemInHand();
|
||||||
PlayerProfile PPa = Users.getProfile(attacker);
|
PlayerProfile PPa = Users.getProfile(attacker);
|
||||||
|
|
||||||
//If there are any abilities to activate
|
|
||||||
combatAbilityChecks(attacker, PPa, pluginx);
|
|
||||||
|
|
||||||
//Damage modifiers and proc checks
|
//Damage modifiers and proc checks
|
||||||
if(m.isSwords(itemInHand) && mcPermissions.getInstance().swords(attacker))
|
if(m.isSwords(itemInHand) && mcPermissions.getInstance().swords(attacker))
|
||||||
{
|
{
|
||||||
|
if(PPa.getSwordsPreparationMode())
|
||||||
|
Swords.serratedStrikesActivationCheck(attacker, PPa);
|
||||||
|
|
||||||
if(!pluginx.misc.bleedTracker.contains(target)) //Bleed
|
if(!pluginx.misc.bleedTracker.contains(target)) //Bleed
|
||||||
Swords.bleedCheck(attacker, target, pluginx);
|
Swords.bleedCheck(attacker, PPa.getSkillLevel(SkillType.SWORDS), target, pluginx);
|
||||||
|
|
||||||
if (!(event instanceof FakeEntityDamageByEntityEvent) && PPa.getSerratedStrikesMode())
|
if (!(event instanceof FakeEntityDamageByEntityEvent) && PPa.getSerratedStrikesMode())
|
||||||
Swords.applySerratedStrikes(attacker, eEvent, pluginx);
|
Swords.applySerratedStrikes(attacker, target, damage, pluginx);
|
||||||
|
|
||||||
if(target instanceof Player)
|
if(target instanceof Player)
|
||||||
PvPExperienceGain(attacker, PPa, (Player) target, damage, SkillType.SWORDS);
|
PvPExperienceGain(attacker, PPa, (Player) target, damage, SkillType.SWORDS);
|
||||||
@ -81,31 +80,39 @@ public class Combat
|
|||||||
}
|
}
|
||||||
else if(m.isAxes(itemInHand) && mcPermissions.getInstance().axes(attacker))
|
else if(m.isAxes(itemInHand) && mcPermissions.getInstance().axes(attacker))
|
||||||
{
|
{
|
||||||
if(Users.getProfile(attacker).getSkillLevel(SkillType.AXES) >= 500)
|
if(PPa.getAxePreparationMode())
|
||||||
event.setDamage(damage + 4);
|
Axes.skullSplitterActivationCheck(attacker, PPa);
|
||||||
|
|
||||||
Axes.axeCriticalCheck(attacker, eEvent, pluginx); //Critical hit
|
if(PPa.getSkillLevel(SkillType.AXES) >= 500)
|
||||||
|
damage += 4;
|
||||||
|
|
||||||
|
damage = Axes.axeCriticalCheck(attacker, PPa.getSkillLevel(SkillType.AXES), target, damage, pluginx); //Critical hit
|
||||||
|
|
||||||
if (!(event instanceof FakeEntityDamageByEntityEvent) && PPa.getSkullSplitterMode())
|
if (!(event instanceof FakeEntityDamageByEntityEvent) && PPa.getSkullSplitterMode())
|
||||||
Axes.applyAoeDamage(attacker, eEvent, pluginx);
|
Axes.applyAoeDamage(attacker, target, damage, pluginx);
|
||||||
|
|
||||||
if(target instanceof Player)
|
if(target instanceof Player)
|
||||||
PvPExperienceGain(attacker, PPa, (Player) target, eEvent.getDamage(), SkillType.AXES);
|
PvPExperienceGain(attacker, PPa, (Player) target, damage, SkillType.AXES);
|
||||||
else if(!pluginx.misc.mobSpawnerList.contains(target.getEntityId()))
|
else if(!pluginx.misc.mobSpawnerList.contains(target.getEntityId()))
|
||||||
PvEExperienceGain(attacker, PPa, target, eEvent.getDamage(), SkillType.AXES);
|
PvEExperienceGain(attacker, PPa, target, damage, SkillType.AXES);
|
||||||
}
|
}
|
||||||
else if(itemInHand.getTypeId() == 0 && mcPermissions.getInstance().unarmed(attacker)) //Unarmed
|
else if(itemInHand.getTypeId() == 0 && mcPermissions.getInstance().unarmed(attacker)) //Unarmed
|
||||||
{
|
{
|
||||||
Unarmed.unarmedBonus(attacker, eEvent);
|
if(PPa.getFistsPreparationMode())
|
||||||
|
Unarmed.berserkActivationCheck(attacker, PPa);
|
||||||
|
|
||||||
|
damage += Unarmed.unarmedBonus(PPa);
|
||||||
|
|
||||||
if(PPa.getBerserkMode())
|
if(PPa.getBerserkMode())
|
||||||
event.setDamage(eEvent.getDamage() + (eEvent.getDamage() / 2));
|
damage *= 1.5;
|
||||||
if(target instanceof Player)
|
|
||||||
Unarmed.disarmProcCheck(attacker, (Player) target); //Disarm
|
|
||||||
|
|
||||||
if(target instanceof Player)
|
if(target instanceof Player)
|
||||||
PvPExperienceGain(attacker, PPa, (Player) target, eEvent.getDamage(), SkillType.UNARMED);
|
Unarmed.disarmProcCheck(attacker, PPa.getSkillLevel(SkillType.UNARMED), (Player) target); //Disarm
|
||||||
|
|
||||||
|
if(target instanceof Player)
|
||||||
|
PvPExperienceGain(attacker, PPa, (Player) target, damage, SkillType.UNARMED);
|
||||||
else if(!pluginx.misc.mobSpawnerList.contains(target.getEntityId()))
|
else if(!pluginx.misc.mobSpawnerList.contains(target.getEntityId()))
|
||||||
PvEExperienceGain(attacker, PPa, target, eEvent.getDamage(), SkillType.UNARMED);
|
PvEExperienceGain(attacker, PPa, target, damage, SkillType.UNARMED);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Player use bone on wolf.
|
//Player use bone on wolf.
|
||||||
@ -125,6 +132,8 @@ public class Combat
|
|||||||
mcLocale.getString("Combat.BeastLoreHealthWolf", new Object[] {wolf.getHealth()}));
|
mcLocale.getString("Combat.BeastLoreHealthWolf", new Object[] {wolf.getHealth()}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
eEvent.setDamage(damage);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -183,17 +192,6 @@ public class Combat
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void combatAbilityChecks(Player attacker, PlayerProfile PPa, Plugin pluginx)
|
|
||||||
{
|
|
||||||
//Check to see if any abilities need to be activated
|
|
||||||
if(PPa.getAxePreparationMode())
|
|
||||||
Axes.skullSplitterCheck(attacker);
|
|
||||||
if(PPa.getSwordsPreparationMode())
|
|
||||||
Swords.serratedStrikesActivationCheck(attacker);
|
|
||||||
if(PPa.getFistsPreparationMode())
|
|
||||||
Unarmed.berserkActivationCheck(attacker);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void archeryCheck(EntityDamageByEntityEvent event, mcMMO pluginx)
|
public static void archeryCheck(EntityDamageByEntityEvent event, mcMMO pluginx)
|
||||||
{
|
{
|
||||||
Arrow arrow = (Arrow)event.getDamager();
|
Arrow arrow = (Arrow)event.getDamager();
|
||||||
|
@ -233,7 +233,7 @@ public class mcBlockListener implements Listener
|
|||||||
Excavation.gigaDrillBreakerActivationCheck(player);
|
Excavation.gigaDrillBreakerActivationCheck(player);
|
||||||
}
|
}
|
||||||
if(PP.getFistsPreparationMode() && (Excavation.canBeGigaDrillBroken(block) || id == 78))
|
if(PP.getFistsPreparationMode() && (Excavation.canBeGigaDrillBroken(block) || id == 78))
|
||||||
Unarmed.berserkActivationCheck(player);
|
Unarmed.berserkActivationCheck(player, PP);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* TREE FELLER STUFF
|
* TREE FELLER STUFF
|
||||||
|
@ -1,18 +1,18 @@
|
|||||||
/*
|
/*
|
||||||
This file is part of mcMMO.
|
This file is part of mcMMO.
|
||||||
|
|
||||||
mcMMO is free software: you can redistribute it and/or modify
|
mcMMO is free software: you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
(at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
mcMMO is distributed in the hope that it will be useful,
|
mcMMO is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with mcMMO. If not, see <http://www.gnu.org/licenses/>.
|
along with mcMMO. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package com.gmail.nossr50.skills;
|
package com.gmail.nossr50.skills;
|
||||||
|
|
||||||
@ -21,163 +21,144 @@ import org.bukkit.entity.Entity;
|
|||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.entity.Wolf;
|
import org.bukkit.entity.Wolf;
|
||||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
|
||||||
import org.bukkit.plugin.Plugin;
|
|
||||||
|
|
||||||
import com.gmail.nossr50.locale.mcLocale;
|
import com.gmail.nossr50.locale.mcLocale;
|
||||||
import com.gmail.nossr50.Combat;
|
import com.gmail.nossr50.Combat;
|
||||||
import com.gmail.nossr50.Users;
|
import com.gmail.nossr50.Users;
|
||||||
import com.gmail.nossr50.m;
|
import com.gmail.nossr50.m;
|
||||||
import com.gmail.nossr50.mcPermissions;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.config.LoadProperties;
|
import com.gmail.nossr50.config.LoadProperties;
|
||||||
import com.gmail.nossr50.datatypes.AbilityType;
|
import com.gmail.nossr50.datatypes.AbilityType;
|
||||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||||
import com.gmail.nossr50.datatypes.SkillType;
|
import com.gmail.nossr50.datatypes.SkillType;
|
||||||
import com.gmail.nossr50.party.Party;
|
import com.gmail.nossr50.party.Party;
|
||||||
|
|
||||||
public class Axes {
|
public class Axes
|
||||||
public static void skullSplitterCheck(Player player){
|
{
|
||||||
PlayerProfile PP = Users.getProfile(player);
|
public static void skullSplitterActivationCheck(Player player, PlayerProfile PPa)
|
||||||
if(m.isAxes(player.getItemInHand()) && mcPermissions.getInstance().axesAbility(player)){
|
|
||||||
/*
|
|
||||||
* CHECK FOR AXE PREP MODE
|
|
||||||
*/
|
|
||||||
if(PP.getAxePreparationMode())
|
|
||||||
{
|
|
||||||
PP.setAxePreparationMode(false);
|
|
||||||
}
|
|
||||||
int ticks = 2;
|
|
||||||
int x = PP.getSkillLevel(SkillType.AXES);
|
|
||||||
while(x >= 50){
|
|
||||||
x-=50;
|
|
||||||
ticks++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!PP.getSkullSplitterMode() && Skills.cooldownOver(player, (PP.getSkillDATS(AbilityType.SKULL_SPLIITER)*1000), LoadProperties.skullSplitterCooldown))
|
|
||||||
{
|
|
||||||
player.sendMessage(mcLocale.getString("Skills.SkullSplitterOn"));
|
|
||||||
for(Player y : player.getWorld().getPlayers()){
|
|
||||||
if(y != null && y != player && m.getDistance(player.getLocation(), y.getLocation()) < 10)
|
|
||||||
y.sendMessage(mcLocale.getString("Skills.SkullSplitterPlayer", new Object[] {player.getName()}));
|
|
||||||
}
|
|
||||||
PP.setSkillDATS(AbilityType.SKULL_SPLIITER, System.currentTimeMillis()+(ticks*1000));
|
|
||||||
PP.setSkullSplitterMode(true);
|
|
||||||
}
|
|
||||||
if(!PP.getSkullSplitterMode() && !Skills.cooldownOver(player, (PP.getSkillDATS(AbilityType.SKULL_SPLIITER)*1000), LoadProperties.skullSplitterCooldown)){
|
|
||||||
player.sendMessage(mcLocale.getString("Skills.TooTired")
|
|
||||||
+ChatColor.YELLOW+" ("+Skills.calculateTimeLeft(player, (PP.getSkillDATS(AbilityType.SKULL_SPLIITER)*1000), LoadProperties.skullSplitterCooldown)+"s)");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void axeCriticalCheck(Player attacker, EntityDamageByEntityEvent event, Plugin pluginx)
|
|
||||||
{
|
{
|
||||||
Entity x = event.getEntity();
|
PPa.setAxePreparationMode(false);
|
||||||
|
|
||||||
if(x instanceof Wolf){
|
int ticks = 2;
|
||||||
Wolf wolf = (Wolf)x;
|
int x = PPa.getSkillLevel(SkillType.AXES);
|
||||||
if(Taming.getOwner(wolf, pluginx) != null)
|
while(x >= 50){
|
||||||
{
|
x-=50;
|
||||||
if(Taming.getOwner(wolf, pluginx) == attacker)
|
ticks++;
|
||||||
return;
|
}
|
||||||
if(Party.getInstance().inSameParty(attacker, Taming.getOwner(wolf, pluginx)))
|
|
||||||
return;
|
if (!PPa.getSkullSplitterMode())
|
||||||
}
|
{
|
||||||
}
|
if (Skills.cooldownOver(player, (PPa.getSkillDATS(AbilityType.SKULL_SPLIITER)*1000), LoadProperties.skullSplitterCooldown))
|
||||||
PlayerProfile PPa = Users.getProfile(attacker);
|
{
|
||||||
if(m.isAxes(attacker.getItemInHand()) && mcPermissions.getInstance().axes(attacker)){
|
player.sendMessage(mcLocale.getString("Skills.SkullSplitterOn"));
|
||||||
if(PPa.getSkillLevel(SkillType.AXES) >= 750){
|
for(Player y : player.getWorld().getPlayers()){
|
||||||
if(Math.random() * 1000 <= 750 && !x.isDead()){
|
if(y != null && y != player && m.getDistance(player.getLocation(), y.getLocation()) < 10)
|
||||||
if(x instanceof Player){
|
y.sendMessage(mcLocale.getString("Skills.SkullSplitterPlayer", new Object[] {player.getName()}));
|
||||||
int damage = (event.getDamage() * 2) - (event.getDamage() / 2);
|
}
|
||||||
event.setDamage(damage);
|
PPa.setSkillDATS(AbilityType.SKULL_SPLIITER, System.currentTimeMillis()+(ticks*1000));
|
||||||
Player player = (Player)x;
|
PPa.setSkullSplitterMode(true);
|
||||||
player.sendMessage(ChatColor.DARK_RED + "You were CRITICALLY hit!");
|
}
|
||||||
}
|
|
||||||
else {
|
else
|
||||||
int damage = event.getDamage() * 2;
|
player.sendMessage(mcLocale.getString("Skills.TooTired")
|
||||||
event.setDamage(damage);
|
+ChatColor.YELLOW+" ("+Skills.calculateTimeLeft(player, (PPa.getSkillDATS(AbilityType.SKULL_SPLIITER)*1000), LoadProperties.skullSplitterCooldown)+"s)");
|
||||||
}
|
}
|
||||||
attacker.sendMessage(ChatColor.RED+"CRITICAL HIT!");
|
}
|
||||||
}
|
|
||||||
} else if(Math.random() * 1000 <= PPa.getSkillLevel(SkillType.AXES) && !x.isDead()){
|
public static int axeCriticalCheck(Player attacker, int skillLevel, LivingEntity target, int damage, mcMMO pluginx)
|
||||||
if(x instanceof Player){
|
{
|
||||||
int damage = (event.getDamage() * 2) - (event.getDamage() / 2);
|
if(target instanceof Wolf)
|
||||||
event.setDamage(damage);
|
{
|
||||||
Player player = (Player)x;
|
if (Taming.isFriendlyWolf(attacker, (Wolf) target, pluginx))
|
||||||
player.sendMessage(ChatColor.DARK_RED + "You were CRITICALLY hit!");
|
return damage;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
int damage = event.getDamage() * 2;
|
double random = Math.random() * 1000;
|
||||||
event.setDamage(damage);
|
int newDamage = damage;
|
||||||
}
|
|
||||||
|
if(skillLevel >= 750)
|
||||||
|
{
|
||||||
|
if(random <= 750)
|
||||||
|
{
|
||||||
|
if(target instanceof Player)
|
||||||
|
{
|
||||||
|
newDamage *= 1.5;
|
||||||
|
((Player) target).sendMessage(ChatColor.DARK_RED + "You were CRITICALLY hit!");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
newDamage *= 2;
|
||||||
attacker.sendMessage(ChatColor.RED+"CRITICAL HIT!");
|
attacker.sendMessage(ChatColor.RED+"CRITICAL HIT!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
else if(random <= skillLevel)
|
||||||
|
{
|
||||||
|
if(target instanceof Player)
|
||||||
|
{
|
||||||
|
newDamage *= 1.5;
|
||||||
|
((Player) target).sendMessage(ChatColor.DARK_RED + "You were CRITICALLY hit!");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
newDamage *= 2;
|
||||||
|
attacker.sendMessage(ChatColor.RED+"CRITICAL HIT!");
|
||||||
|
}
|
||||||
|
|
||||||
public static void applyAoeDamage(Player attacker, EntityDamageByEntityEvent event, Plugin pluginx)
|
return newDamage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void applyAoeDamage(Player attacker, LivingEntity target, int damage, mcMMO pluginx)
|
||||||
{
|
{
|
||||||
int targets = 0;
|
int targets = 0;
|
||||||
|
|
||||||
int dmgAmount = (event.getDamage()/2);
|
int dmgAmount = damage / 2;
|
||||||
|
|
||||||
//Setup minimum damage
|
//Setup minimum damage
|
||||||
if(dmgAmount < 1)
|
if(dmgAmount < 1)
|
||||||
dmgAmount = 1;
|
dmgAmount = 1;
|
||||||
|
|
||||||
if(event.getEntity() instanceof LivingEntity)
|
targets = m.getTier(attacker);
|
||||||
{
|
|
||||||
LivingEntity x = (LivingEntity) event.getEntity();
|
|
||||||
targets = m.getTier(attacker);
|
|
||||||
|
|
||||||
for(Entity derp : x.getNearbyEntities(2.5, 2.5, 2.5))
|
for(Entity derp : target.getNearbyEntities(2.5, 2.5, 2.5))
|
||||||
{
|
{
|
||||||
//Make sure the Wolf is not friendly
|
//Make sure the Wolf is not friendly
|
||||||
if(derp instanceof Wolf)
|
if(derp instanceof Wolf)
|
||||||
{
|
{
|
||||||
Wolf hurrDurr = (Wolf)derp;
|
if (Taming.isFriendlyWolf(attacker, (Wolf) derp, pluginx))
|
||||||
if(Taming.getOwner(hurrDurr, pluginx) == attacker)
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Damage nearby LivingEntities
|
||||||
|
if(derp instanceof LivingEntity && targets >= 1)
|
||||||
|
{
|
||||||
|
if(derp instanceof Player)
|
||||||
|
{
|
||||||
|
Player nearbyPlayer = (Player) derp;
|
||||||
|
|
||||||
|
if(Users.getProfile(nearbyPlayer).getGodMode())
|
||||||
continue;
|
continue;
|
||||||
if(Party.getInstance().inSameParty(attacker, Taming.getOwner(hurrDurr, pluginx)))
|
|
||||||
|
if(nearbyPlayer.getName().equals(attacker.getName()))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if(Party.getInstance().inSameParty(attacker, nearbyPlayer))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if(target.isDead())
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if(targets >= 1 && nearbyPlayer.getWorld().getPVP())
|
||||||
|
{
|
||||||
|
Combat.dealDamage(nearbyPlayer, dmgAmount, attacker);
|
||||||
|
nearbyPlayer.sendMessage(ChatColor.DARK_RED+"Struck by CLEAVE!");
|
||||||
|
targets--;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
//Damage nearby LivingEntities
|
{
|
||||||
if(derp instanceof LivingEntity && targets >= 1)
|
LivingEntity nearbyLivingEntity = (LivingEntity) derp;
|
||||||
{
|
Combat.dealDamage(nearbyLivingEntity, dmgAmount, attacker);
|
||||||
if(derp instanceof Player)
|
targets--;
|
||||||
{
|
}
|
||||||
Player target = (Player)derp;
|
}
|
||||||
|
}
|
||||||
if(Users.getProfile(target).getGodMode())
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if(target.getName().equals(attacker.getName()))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if(Party.getInstance().inSameParty(attacker, target))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if(target.isDead())
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if(targets >= 1 && derp.getWorld().getPVP())
|
|
||||||
{
|
|
||||||
Combat.dealDamage(target, dmgAmount, attacker);
|
|
||||||
target.sendMessage(ChatColor.DARK_RED+"Struck by CLEAVE!");
|
|
||||||
targets--;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
LivingEntity target = (LivingEntity)derp;
|
|
||||||
Combat.dealDamage(target, dmgAmount, attacker);
|
|
||||||
targets--;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,18 +1,18 @@
|
|||||||
/*
|
/*
|
||||||
This file is part of mcMMO.
|
This file is part of mcMMO.
|
||||||
|
|
||||||
mcMMO is free software: you can redistribute it and/or modify
|
mcMMO is free software: you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
(at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
mcMMO is distributed in the hope that it will be useful,
|
mcMMO is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with mcMMO. If not, see <http://www.gnu.org/licenses/>.
|
along with mcMMO. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package com.gmail.nossr50.skills;
|
package com.gmail.nossr50.skills;
|
||||||
|
|
||||||
@ -35,219 +35,196 @@ import com.gmail.nossr50.party.Party;
|
|||||||
|
|
||||||
public class Swords
|
public class Swords
|
||||||
{
|
{
|
||||||
public static void serratedStrikesActivationCheck(Player player){
|
public static void serratedStrikesActivationCheck(Player player, PlayerProfile PPa)
|
||||||
PlayerProfile PP = Users.getProfile(player);
|
{
|
||||||
if(m.isSwords(player.getItemInHand()))
|
PPa.setSwordsPreparationMode(false);
|
||||||
|
|
||||||
|
int ticks = 2;
|
||||||
|
int x = PPa.getSkillLevel(SkillType.SWORDS);
|
||||||
|
while(x >= 50)
|
||||||
{
|
{
|
||||||
if(PP.getSwordsPreparationMode())
|
x-=50;
|
||||||
|
ticks++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!PPa.getSerratedStrikesMode() && PPa.getSkillDATS(AbilityType.SERRATED_STRIKES) < System.currentTimeMillis())
|
||||||
|
{
|
||||||
|
player.sendMessage(mcLocale.getString("Skills.SerratedStrikesOn"));
|
||||||
|
for(Player y : player.getWorld().getPlayers())
|
||||||
{
|
{
|
||||||
PP.setSwordsPreparationMode(false);
|
if(y != null && y != player && m.getDistance(player.getLocation(), y.getLocation()) < 10)
|
||||||
}
|
y.sendMessage(mcLocale.getString("Skills.SerratedStrikesPlayer", new Object[] {player.getName()}));
|
||||||
int ticks = 2;
|
}
|
||||||
int x = PP.getSkillLevel(SkillType.SWORDS);
|
PPa.setSkillDATS(AbilityType.SERRATED_STRIKES, System.currentTimeMillis()+(ticks*1000));
|
||||||
while(x >= 50)
|
PPa.setSerratedStrikesMode(true);
|
||||||
{
|
}
|
||||||
x-=50;
|
|
||||||
ticks++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!PP.getSerratedStrikesMode() && PP.getSkillDATS(AbilityType.SERRATED_STRIKES) < System.currentTimeMillis())
|
|
||||||
{
|
|
||||||
player.sendMessage(mcLocale.getString("Skills.SerratedStrikesOn"));
|
|
||||||
for(Player y : player.getWorld().getPlayers())
|
|
||||||
{
|
|
||||||
if(y != null && y != player && m.getDistance(player.getLocation(), y.getLocation()) < 10)
|
|
||||||
y.sendMessage(mcLocale.getString("Skills.SerratedStrikesPlayer", new Object[] {player.getName()}));
|
|
||||||
}
|
|
||||||
PP.setSkillDATS(AbilityType.SERRATED_STRIKES, System.currentTimeMillis()+(ticks*1000));
|
|
||||||
PP.setSerratedStrikesMode(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void bleedCheck(Player attacker, LivingEntity x, mcMMO pluginx)
|
public static void bleedCheck(Player attacker, int skillLevel, LivingEntity target, mcMMO pluginx)
|
||||||
{
|
{
|
||||||
PlayerProfile PPa = Users.getProfile(attacker);
|
if(target instanceof Wolf)
|
||||||
|
{
|
||||||
|
if(Taming.isFriendlyWolf(attacker, (Wolf) target, pluginx))
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if(x instanceof Wolf)
|
double random = Math.random() * 1000;
|
||||||
{
|
|
||||||
Wolf wolf = (Wolf)x;
|
if(skillLevel >= 750)
|
||||||
if(Taming.getOwner(wolf, pluginx) != null)
|
{
|
||||||
{
|
if(random <= 750)
|
||||||
if(Taming.getOwner(wolf, pluginx) == attacker)
|
|
||||||
return;
|
|
||||||
if(Party.getInstance().inSameParty(attacker, Taming.getOwner(wolf, pluginx)))
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(mcPermissions.getInstance().swords(attacker) && m.isSwords(attacker.getItemInHand())){
|
|
||||||
if(PPa.getSkillLevel(SkillType.SWORDS) >= 750)
|
|
||||||
{
|
{
|
||||||
if(Math.random() * 1000 <= 750)
|
if(!(target instanceof Player))
|
||||||
{
|
pluginx.misc.addToBleedQue(target);
|
||||||
if(!(x instanceof Player))
|
else if(target instanceof Player)
|
||||||
pluginx.misc.addToBleedQue(x);
|
Users.getProfile((Player) target).addBleedTicks(3);
|
||||||
if(x instanceof Player)
|
|
||||||
{
|
|
||||||
Player target = (Player)x;
|
|
||||||
Users.getProfile(target).addBleedTicks(3);
|
|
||||||
}
|
|
||||||
attacker.sendMessage(ChatColor.GREEN+"**ENEMY BLEEDING**");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (Math.random() * 1000 <= PPa.getSkillLevel(SkillType.SWORDS))
|
|
||||||
{
|
|
||||||
if(!(x instanceof Player))
|
|
||||||
pluginx.misc.addToBleedQue(x);
|
|
||||||
if(x instanceof Player)
|
|
||||||
{
|
|
||||||
Player target = (Player)x;
|
|
||||||
Users.getProfile(target).addBleedTicks(2);
|
|
||||||
}
|
|
||||||
attacker.sendMessage(ChatColor.GREEN+"**ENEMY BLEEDING**");
|
attacker.sendMessage(ChatColor.GREEN+"**ENEMY BLEEDING**");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
else if(random <= skillLevel)
|
||||||
public static void applySerratedStrikes(Player attacker, EntityDamageByEntityEvent event, mcMMO pluginx)
|
{
|
||||||
{
|
if(!(target instanceof Player))
|
||||||
int targets = 0;
|
pluginx.misc.addToBleedQue(target);
|
||||||
|
if(target instanceof Player)
|
||||||
int dmgAmount = (event.getDamage()/4);
|
Users.getProfile((Player) target).addBleedTicks(2);
|
||||||
|
attacker.sendMessage(ChatColor.GREEN+"**ENEMY BLEEDING**");
|
||||||
//Setup minimum damage
|
}
|
||||||
if(dmgAmount < 1)
|
|
||||||
dmgAmount = 1;
|
|
||||||
|
|
||||||
if(event.getEntity() instanceof LivingEntity)
|
|
||||||
{
|
|
||||||
LivingEntity x = (LivingEntity) event.getEntity();
|
|
||||||
targets = m.getTier(attacker);
|
|
||||||
|
|
||||||
for(Entity derp : x.getNearbyEntities(2.5, 2.5, 2.5))
|
|
||||||
{
|
|
||||||
//Make sure the Wolf is not friendly
|
|
||||||
if(derp instanceof Wolf)
|
|
||||||
{
|
|
||||||
Wolf hurrDurr = (Wolf)derp;
|
|
||||||
if(Taming.getOwner(hurrDurr, pluginx) == attacker)
|
|
||||||
continue;
|
|
||||||
if(Party.getInstance().inSameParty(attacker, Taming.getOwner(hurrDurr, pluginx)))
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
//Damage nearby LivingEntities
|
|
||||||
if(derp instanceof LivingEntity && targets >= 1)
|
|
||||||
{
|
|
||||||
if(derp instanceof Player)
|
|
||||||
{
|
|
||||||
Player target = (Player)derp;
|
|
||||||
|
|
||||||
if(target.getName().equals(attacker.getName()))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if(Users.getProfile(target).getGodMode())
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if(Party.getInstance().inSameParty(attacker, target))
|
|
||||||
continue;
|
|
||||||
if(targets >= 1 && derp.getWorld().getPVP())
|
|
||||||
{
|
|
||||||
Combat.dealDamage(target, dmgAmount, attacker);
|
|
||||||
target.sendMessage(ChatColor.DARK_RED+"Struck by Serrated Strikes!");
|
|
||||||
Users.getProfile(target).addBleedTicks(5);
|
|
||||||
targets--;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if(!pluginx.misc.bleedTracker.contains(derp))
|
|
||||||
pluginx.misc.addToBleedQue((LivingEntity)derp);
|
|
||||||
|
|
||||||
LivingEntity target = (LivingEntity)derp;
|
|
||||||
Combat.dealDamage(target, dmgAmount, attacker);
|
|
||||||
targets--;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void counterAttackChecks(EntityDamageByEntityEvent event)
|
public static void applySerratedStrikes(Player attacker, LivingEntity target, int damage, mcMMO pluginx)
|
||||||
{
|
{
|
||||||
//Don't want to counter attack stuff not alive
|
int targets = 0;
|
||||||
|
|
||||||
if(!(event.getDamager() instanceof LivingEntity))
|
int dmgAmount = damage / 4;
|
||||||
return;
|
|
||||||
|
|
||||||
if(event instanceof EntityDamageByEntityEvent)
|
//Setup minimum damage
|
||||||
{
|
if(dmgAmount < 1)
|
||||||
Entity f = ((EntityDamageByEntityEvent) event).getDamager();
|
dmgAmount = 1;
|
||||||
|
|
||||||
|
targets = m.getTier(attacker);
|
||||||
|
|
||||||
|
for(Entity derp : target.getNearbyEntities(2.5, 2.5, 2.5))
|
||||||
|
{
|
||||||
|
//Make sure the Wolf is not friendly
|
||||||
|
if(derp instanceof Wolf)
|
||||||
|
{
|
||||||
|
if (Taming.isFriendlyWolf(attacker, (Wolf) target, pluginx))
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Damage nearby LivingEntities
|
||||||
|
if(derp instanceof LivingEntity && targets >= 1)
|
||||||
|
{
|
||||||
|
if(derp instanceof Player)
|
||||||
|
{
|
||||||
|
Player nearbyPlayer = (Player) derp;
|
||||||
|
|
||||||
|
if(nearbyPlayer.getName().equals(attacker.getName()))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if(Users.getProfile(nearbyPlayer).getGodMode())
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if(Party.getInstance().inSameParty(attacker, nearbyPlayer))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if(targets >= 1 && nearbyPlayer.getWorld().getPVP())
|
||||||
|
{
|
||||||
|
Combat.dealDamage(nearbyPlayer, dmgAmount, attacker);
|
||||||
|
nearbyPlayer.sendMessage(ChatColor.DARK_RED+"Struck by Serrated Strikes!");
|
||||||
|
Users.getProfile(nearbyPlayer).addBleedTicks(5);
|
||||||
|
targets--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LivingEntity neabyLivingEntity = (LivingEntity) derp;
|
||||||
|
|
||||||
|
if(!pluginx.misc.bleedTracker.contains(neabyLivingEntity))
|
||||||
|
pluginx.misc.addToBleedQue(neabyLivingEntity);
|
||||||
|
|
||||||
|
Combat.dealDamage(neabyLivingEntity, dmgAmount, attacker);
|
||||||
|
targets--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void counterAttackChecks(EntityDamageByEntityEvent event)
|
||||||
|
{
|
||||||
|
//Don't want to counter attack stuff not alive
|
||||||
|
|
||||||
|
if(!(event.getDamager() instanceof LivingEntity))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if(event instanceof EntityDamageByEntityEvent)
|
||||||
|
{
|
||||||
|
Entity f = ((EntityDamageByEntityEvent) event).getDamager();
|
||||||
if(event.getEntity() instanceof Player)
|
if(event.getEntity() instanceof Player)
|
||||||
{
|
{
|
||||||
Player defender = (Player)event.getEntity();
|
Player defender = (Player)event.getEntity();
|
||||||
PlayerProfile PPd = Users.getProfile(defender);
|
PlayerProfile PPd = Users.getProfile(defender);
|
||||||
if(m.isSwords(defender.getItemInHand()) && mcPermissions.getInstance().swords(defender))
|
if(m.isSwords(defender.getItemInHand()) && mcPermissions.getInstance().swords(defender))
|
||||||
{
|
{
|
||||||
if(PPd.getSkillLevel(SkillType.SWORDS) >= 600)
|
if(PPd.getSkillLevel(SkillType.SWORDS) >= 600)
|
||||||
{
|
{
|
||||||
if(Math.random() * 2000 <= 600)
|
if(Math.random() * 2000 <= 600)
|
||||||
{
|
{
|
||||||
Combat.dealDamage((LivingEntity) f, event.getDamage() / 2);
|
Combat.dealDamage((LivingEntity) f, event.getDamage() / 2);
|
||||||
defender.sendMessage(ChatColor.GREEN+"**COUNTER-ATTACKED**");
|
defender.sendMessage(ChatColor.GREEN+"**COUNTER-ATTACKED**");
|
||||||
if(f instanceof Player)
|
if(f instanceof Player)
|
||||||
((Player) f).sendMessage(ChatColor.DARK_RED+"Hit with counterattack!");
|
((Player) f).sendMessage(ChatColor.DARK_RED+"Hit with counterattack!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (Math.random() * 2000 <= PPd.getSkillLevel(SkillType.SWORDS))
|
else if (Math.random() * 2000 <= PPd.getSkillLevel(SkillType.SWORDS))
|
||||||
{
|
{
|
||||||
Combat.dealDamage((LivingEntity) f, event.getDamage() / 2);
|
Combat.dealDamage((LivingEntity) f, event.getDamage() / 2);
|
||||||
defender.sendMessage(ChatColor.GREEN+"**COUNTER-ATTACKED**");
|
defender.sendMessage(ChatColor.GREEN+"**COUNTER-ATTACKED**");
|
||||||
if(f instanceof Player)
|
if(f instanceof Player)
|
||||||
((Player) f).sendMessage(ChatColor.DARK_RED+"Hit with counterattack!");
|
((Player) f).sendMessage(ChatColor.DARK_RED+"Hit with counterattack!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void bleedSimulate(mcMMO plugin)
|
public static void bleedSimulate(mcMMO plugin)
|
||||||
{
|
{
|
||||||
//Add items from Que list to BleedTrack list
|
//Add items from Que list to BleedTrack list
|
||||||
|
|
||||||
for(LivingEntity x : plugin.misc.bleedQue)
|
for(LivingEntity x : plugin.misc.bleedQue)
|
||||||
{
|
{
|
||||||
plugin.misc.bleedTracker.add(x);
|
plugin.misc.bleedTracker.add(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Clear list
|
//Clear list
|
||||||
plugin.misc.bleedQue = new LivingEntity[plugin.misc.bleedQue.length];
|
plugin.misc.bleedQue = new LivingEntity[plugin.misc.bleedQue.length];
|
||||||
plugin.misc.bleedQuePos = 0;
|
plugin.misc.bleedQuePos = 0;
|
||||||
|
|
||||||
//Cleanup any dead entities from the list
|
//Cleanup any dead entities from the list
|
||||||
for(LivingEntity x : plugin.misc.bleedRemovalQue)
|
for(LivingEntity x : plugin.misc.bleedRemovalQue)
|
||||||
{
|
{
|
||||||
plugin.misc.bleedTracker.remove(x);
|
plugin.misc.bleedTracker.remove(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Clear bleed removal list
|
//Clear bleed removal list
|
||||||
plugin.misc.bleedRemovalQue = new LivingEntity[plugin.misc.bleedRemovalQue.length];
|
plugin.misc.bleedRemovalQue = new LivingEntity[plugin.misc.bleedRemovalQue.length];
|
||||||
plugin.misc.bleedRemovalQuePos = 0;
|
plugin.misc.bleedRemovalQuePos = 0;
|
||||||
|
|
||||||
//Bleed monsters/animals
|
//Bleed monsters/animals
|
||||||
for(LivingEntity x : plugin.misc.bleedTracker)
|
for(LivingEntity x : plugin.misc.bleedTracker)
|
||||||
{
|
{
|
||||||
if(x == null){continue;}
|
if(x == null){continue;}
|
||||||
|
|
||||||
if(x.getHealth() <= 0)
|
if(x.getHealth() <= 0)
|
||||||
{
|
{
|
||||||
plugin.misc.addToBleedRemovalQue(x);
|
plugin.misc.addToBleedRemovalQue(x);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Combat.dealDamage(x, 2);
|
Combat.dealDamage(x, 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,7 @@ import com.gmail.nossr50.mcMMO;
|
|||||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||||
import com.gmail.nossr50.datatypes.SkillType;
|
import com.gmail.nossr50.datatypes.SkillType;
|
||||||
import com.gmail.nossr50.locale.mcLocale;
|
import com.gmail.nossr50.locale.mcLocale;
|
||||||
|
import com.gmail.nossr50.party.Party;
|
||||||
|
|
||||||
public class Taming
|
public class Taming
|
||||||
{
|
{
|
||||||
@ -169,4 +170,11 @@ public class Taming
|
|||||||
if(cause == DamageCause.FIRE_TICK)
|
if(cause == DamageCause.FIRE_TICK)
|
||||||
event.getEntity().setFireTicks(0);
|
event.getEntity().setFireTicks(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean isFriendlyWolf(Player player, Wolf wolf, mcMMO pluginx)
|
||||||
|
{
|
||||||
|
if(getOwner(wolf, pluginx) == player || Party.getInstance().inSameParty(player, getOwner(wolf, pluginx)))
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,26 +1,24 @@
|
|||||||
/*
|
/*
|
||||||
This file is part of mcMMO.
|
This file is part of mcMMO.
|
||||||
|
|
||||||
mcMMO is free software: you can redistribute it and/or modify
|
mcMMO is free software: you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
(at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
mcMMO is distributed in the hope that it will be useful,
|
mcMMO is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with mcMMO. If not, see <http://www.gnu.org/licenses/>.
|
along with mcMMO. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package com.gmail.nossr50.skills;
|
package com.gmail.nossr50.skills;
|
||||||
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import com.gmail.nossr50.Users;
|
|
||||||
import com.gmail.nossr50.m;
|
import com.gmail.nossr50.m;
|
||||||
import com.gmail.nossr50.config.LoadProperties;
|
import com.gmail.nossr50.config.LoadProperties;
|
||||||
import com.gmail.nossr50.datatypes.AbilityType;
|
import com.gmail.nossr50.datatypes.AbilityType;
|
||||||
@ -28,93 +26,80 @@ import com.gmail.nossr50.datatypes.PlayerProfile;
|
|||||||
import com.gmail.nossr50.datatypes.SkillType;
|
import com.gmail.nossr50.datatypes.SkillType;
|
||||||
import com.gmail.nossr50.locale.mcLocale;
|
import com.gmail.nossr50.locale.mcLocale;
|
||||||
|
|
||||||
public class Unarmed {
|
public class Unarmed
|
||||||
public static void berserkActivationCheck(Player player)
|
{
|
||||||
|
public static void berserkActivationCheck(Player player, PlayerProfile PPa)
|
||||||
{
|
{
|
||||||
PlayerProfile PP = Users.getProfile(player);
|
PPa.setFistsPreparationMode(false);
|
||||||
if(player.getItemInHand().getTypeId() == 0)
|
|
||||||
|
int ticks = 2;
|
||||||
|
int x = PPa.getSkillLevel(SkillType.UNARMED);
|
||||||
|
while(x >= 50)
|
||||||
{
|
{
|
||||||
if(PP.getFistsPreparationMode())
|
x-=50;
|
||||||
|
ticks++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!PPa.getBerserkMode() && Skills.cooldownOver(player, PPa.getSkillDATS(AbilityType.BERSERK), LoadProperties.berserkCooldown))
|
||||||
|
{
|
||||||
|
player.sendMessage(mcLocale.getString("Skills.BerserkOn"));
|
||||||
|
for(Player y : player.getWorld().getPlayers())
|
||||||
{
|
{
|
||||||
PP.setFistsPreparationMode(false);
|
if(y != null && y != player && m.getDistance(player.getLocation(), y.getLocation()) < 10)
|
||||||
}
|
y.sendMessage(mcLocale.getString("Skills.BerserkPlayer", new Object[] {player.getName()}));
|
||||||
|
}
|
||||||
int ticks = 2;
|
PPa.setSkillDATS(AbilityType.BERSERK, System.currentTimeMillis()+(ticks*1000));
|
||||||
int x = PP.getSkillLevel(SkillType.UNARMED);
|
//System.out.println("getSkillDATS(): "+PPa.getSkillDATS(AbilityType.BERSERK));
|
||||||
|
PPa.setBerserkMode(true);
|
||||||
while(x >= 50)
|
}
|
||||||
{
|
|
||||||
x-=50;
|
|
||||||
ticks++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!PP.getBerserkMode() && Skills.cooldownOver(player, PP.getSkillDATS(AbilityType.BERSERK), LoadProperties.berserkCooldown))
|
|
||||||
{
|
|
||||||
player.sendMessage(mcLocale.getString("Skills.BerserkOn"));
|
|
||||||
for(Player y : player.getWorld().getPlayers())
|
|
||||||
{
|
|
||||||
if(y != null && y != player && m.getDistance(player.getLocation(), y.getLocation()) < 10)
|
|
||||||
y.sendMessage(mcLocale.getString("Skills.BerserkPlayer", new Object[] {player.getName()}));
|
|
||||||
}
|
|
||||||
PP.setSkillDATS(AbilityType.BERSERK, System.currentTimeMillis()+(ticks*1000));
|
|
||||||
System.out.println("getSkillDATS(): "+PP.getSkillDATS(AbilityType.BERSERK));
|
|
||||||
PP.setBerserkMode(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void unarmedBonus(Player attacker, EntityDamageByEntityEvent event)
|
public static int unarmedBonus(PlayerProfile PPa)
|
||||||
{
|
{
|
||||||
PlayerProfile PPa = Users.getProfile(attacker);
|
|
||||||
int bonus = 3;
|
int bonus = 3;
|
||||||
|
|
||||||
//Add 1 DMG for every 50 skill levels
|
//Add 1 DMG for every 50 skill levels
|
||||||
bonus += PPa.getSkillLevel(SkillType.UNARMED)/50;
|
bonus += PPa.getSkillLevel(SkillType.UNARMED)/50;
|
||||||
|
|
||||||
if(bonus > 8)
|
if(bonus > 8)
|
||||||
bonus = 8;
|
bonus = 8;
|
||||||
|
|
||||||
event.setDamage(event.getDamage()+bonus);
|
return bonus;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void disarmProcCheck(Player attacker, Player defender)
|
public static void disarmProcCheck(Player attacker, int skillLevel, Player defender)
|
||||||
{
|
{
|
||||||
PlayerProfile PP = Users.getProfile(attacker);
|
double random = Math.random() * 4000;
|
||||||
if(attacker.getItemInHand().getTypeId() == 0)
|
|
||||||
|
if(skillLevel >= 1000)
|
||||||
{
|
{
|
||||||
if(PP.getSkillLevel(SkillType.UNARMED) >= 1000)
|
if(random <= 1000)
|
||||||
{
|
{
|
||||||
if(Math.random() * 4000 <= 1000)
|
Location loc = defender.getLocation();
|
||||||
{
|
ItemStack itemInHand = defender.getItemInHand();
|
||||||
Location loc = defender.getLocation();
|
|
||||||
if(defender.getItemInHand() != null && defender.getItemInHand().getTypeId() != 0)
|
if(itemInHand != null && itemInHand.getTypeId() != 0)
|
||||||
{
|
{
|
||||||
defender.sendMessage(mcLocale.getString("Skills.Disarmed"));
|
defender.sendMessage(mcLocale.getString("Skills.Disarmed"));
|
||||||
ItemStack item = defender.getItemInHand();
|
m.mcDropItem(loc, itemInHand);
|
||||||
if(item != null)
|
defender.setItemInHand(null);
|
||||||
{
|
}
|
||||||
m.mcDropItem(loc, item);
|
}
|
||||||
ItemStack itemx = null;
|
}
|
||||||
defender.setItemInHand(itemx);
|
else
|
||||||
}
|
{
|
||||||
}
|
if(random <= skillLevel)
|
||||||
}
|
{
|
||||||
} else {
|
Location loc = defender.getLocation();
|
||||||
if(Math.random() * 4000 <= PP.getSkillLevel(SkillType.UNARMED)){
|
ItemStack itemInHand = defender.getItemInHand();
|
||||||
Location loc = defender.getLocation();
|
|
||||||
if(defender.getItemInHand() != null && defender.getItemInHand().getTypeId() != 0)
|
if(itemInHand != null && itemInHand.getTypeId() != 0)
|
||||||
{
|
{
|
||||||
defender.sendMessage(mcLocale.getString("Skills.Disarmed"));
|
defender.sendMessage(mcLocale.getString("Skills.Disarmed"));
|
||||||
ItemStack item = defender.getItemInHand();
|
m.mcDropItem(loc, itemInHand);
|
||||||
if(item != null)
|
defender.setItemInHand(null);
|
||||||
{
|
}
|
||||||
m.mcDropItem(loc, item);
|
}
|
||||||
ItemStack itemx = null;
|
|
||||||
defender.setItemInHand(itemx);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user