Fix AOE bug, again.

This commit is contained in:
sigonasr2 2016-07-19 23:22:13 -05:00
parent 7ba0208943
commit 1d78308d28
2 changed files with 40 additions and 38 deletions

Binary file not shown.

View File

@ -3948,47 +3948,49 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
GenericFunctions.ApplyDeathMark(m); GenericFunctions.ApplyDeathMark(m);
} }
//Deal AoE damage. //Deal AoE damage.
double checkrange = ArtifactAbility.calculateValue(ArtifactAbility.AOE, p.getEquipment().getItemInMainHand().getEnchantmentLevel(Enchantment.LUCK), ArtifactAbility.getEnchantmentLevel(ArtifactAbility.AOE, p.getEquipment().getItemInMainHand())); if (ArtifactAbility.containsEnchantment(ArtifactAbility.AOE, p.getEquipment().getItemInMainHand())) {
List<Entity> entities = m.getNearbyEntities(checkrange, checkrange, checkrange); double checkrange = ArtifactAbility.calculateValue(ArtifactAbility.AOE, p.getEquipment().getItemInMainHand().getEnchantmentLevel(Enchantment.LUCK), ArtifactAbility.getEnchantmentLevel(ArtifactAbility.AOE, p.getEquipment().getItemInMainHand()));
int totalexp = 0; List<Entity> entities = m.getNearbyEntities(checkrange, checkrange, checkrange);
for (int i=0;i<entities.size();i++) { int totalexp = 0;
if ((entities.get(i) instanceof Monster || entities.get(i) instanceof Animals) && for (int i=0;i<entities.size();i++) {
entities.get(i)!=m) { if ((entities.get(i) instanceof Monster || entities.get(i) instanceof Animals) &&
LivingEntity ent = (LivingEntity)entities.get(i); entities.get(i)!=m) {
GenericFunctions.DealDamageToMob(CalculateWeaponDamage(p,ent),ent,p,false); LivingEntity ent = (LivingEntity)entities.get(i);
if (ent instanceof Monster) { GenericFunctions.DealDamageToMob(CalculateWeaponDamage(p,ent),ent,p,false);
if (!ent.hasPotionEffect(PotionEffectType.GLOWING)) { if (ent instanceof Monster) {
((Monster)ent).setTarget(p); if (!ent.hasPotionEffect(PotionEffectType.GLOWING)) {
if (monsterdata.containsKey(((Monster)ent).getUniqueId())) { ((Monster)ent).setTarget(p);
MonsterStructure ms = (MonsterStructure)monsterdata.get(((Monster)ent).getUniqueId()); if (monsterdata.containsKey(((Monster)ent).getUniqueId())) {
ms.SetTarget(p); MonsterStructure ms = (MonsterStructure)monsterdata.get(((Monster)ent).getUniqueId());
} else { ms.SetTarget(p);
monsterdata.put(((Monster)ent).getUniqueId(),new MonsterStructure(p)); } else {
} monsterdata.put(((Monster)ent).getUniqueId(),new MonsterStructure(p));
} }
if (applyDeathmark) { }
hitlist.add(ent); if (applyDeathmark) {
GenericFunctions.ApplyDeathMark(ent); hitlist.add(ent);
GenericFunctions.ApplyDeathMark(ent);
}
} }
totalexp+=(int)(ratio*20)+5;
GenericFunctions.DealDamageToMob(rawdmg, ent, p, false);
} }
totalexp+=(int)(ratio*20)+5;
GenericFunctions.DealDamageToMob(rawdmg, ent, p, false);
} }
} AwakenedArtifact.addPotentialEXP(p.getEquipment().getItemInMainHand(), totalexp, p);
AwakenedArtifact.addPotentialEXP(p.getEquipment().getItemInMainHand(), totalexp, p); final List<LivingEntity> finallist = hitlist;
final List<LivingEntity> finallist = hitlist; Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() { public void run() {
public void run() { for (int i=0;i<finallist.size();i++) {
for (int i=0;i<finallist.size();i++) { LivingEntity le = finallist.get(i);
LivingEntity le = finallist.get(i); if (le!=null && !le.isDead() && !le.hasPotionEffect(PotionEffectType.UNLUCK)) {
if (le!=null && !le.isDead() && !le.hasPotionEffect(PotionEffectType.UNLUCK)) { GenericFunctions.ResetMobName(le);
GenericFunctions.ResetMobName(le); //They don't have death marks anymore, so we just remove their name color.
//They don't have death marks anymore, so we just remove their name color. }
} }
} }}
}} ,100);
,100);
}
if (ArtifactAbility.containsEnchantment(ArtifactAbility.COMBO, p.getEquipment().getItemInMainHand())) { if (ArtifactAbility.containsEnchantment(ArtifactAbility.COMBO, p.getEquipment().getItemInMainHand())) {
PlayerStructure pd = (PlayerStructure)playerdata.get(p.getUniqueId()); PlayerStructure pd = (PlayerStructure)playerdata.get(p.getUniqueId());
if (pd.last_swordhit+40>=getServerTickTime()) { if (pd.last_swordhit+40>=getServerTickTime()) {