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