This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -103,6 +103,15 @@ public class LegacyAgent extends Agent {
|
||||
btList.put(botEntity, loc);
|
||||
}
|
||||
|
||||
private boolean entholdsmace(LivingEntity target) {
|
||||
if (target instanceof Player player) {
|
||||
if (player.getInventory().getItemInMainHand().getType() == Material.MACE) return true;
|
||||
return false;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private void tickBot(Terminator bot) {
|
||||
if (!bot.isBotAlive()) {
|
||||
return;
|
||||
@@ -120,6 +129,8 @@ public class LegacyAgent extends Agent {
|
||||
if (livingTarget == null) {
|
||||
stopMining(bot);
|
||||
return;
|
||||
} else if (bot.getVelocity().getY() < 0 || bot.isFalling()) {
|
||||
tryWindchargeMaceAttack(bot, livingTarget, false);
|
||||
}
|
||||
|
||||
blockCheck.clutch(bot, livingTarget);
|
||||
@@ -138,6 +149,9 @@ public class LegacyAgent extends Agent {
|
||||
network.feed(BotData.generate(bot, livingTarget));
|
||||
}
|
||||
|
||||
if (entholdsmace(livingTarget) && livingTarget.getLocation().getY() > bot.getLocation().getY()) {
|
||||
bot.block(10, 10);
|
||||
}
|
||||
if (bot.tickDelay(3) && !miningAnim.containsKey(botPlayer)) {
|
||||
Location botEyeLoc = botPlayer.getEyeLocation();
|
||||
Location playerEyeLoc = livingTarget.getEyeLocation();
|
||||
@@ -148,6 +162,8 @@ public class LegacyAgent extends Agent {
|
||||
bot.block(10, 10);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (LegacyUtils.checkFreeSpace(botEyeLoc, playerEyeLoc) || LegacyUtils.checkFreeSpace(botEyeLoc, playerLoc)) {
|
||||
attack(bot, livingTarget, loc);
|
||||
@@ -802,6 +818,17 @@ public class LegacyAgent extends Agent {
|
||||
Material m1 = playerNPC.getLocation().add(0, 1, 0).getBlock().getType();
|
||||
Material m2 = playerNPC.getLocation().add(0, 2, 0).getBlock().getType();
|
||||
|
||||
if (macemode(npc)) {
|
||||
//npc.jump();
|
||||
//useWindcharge(npc);
|
||||
//Bukkit.getScheduler().scheduleAsyncDelayedTask(plugin, () -> {
|
||||
// while (npc.getVelocity().getY() > 0) {}
|
||||
// Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, () -> {
|
||||
// blockCheck.placeBlock(npc, playerNPC, get);
|
||||
// }, 0);
|
||||
//}, 0);
|
||||
//return false;
|
||||
}
|
||||
if (LegacyMats.BREAK.contains(m0) && LegacyMats.BREAK.contains(m1) && LegacyMats.BREAK.contains(m2)) {
|
||||
|
||||
npc.setItem(new ItemStack(Material.COBBLESTONE));
|
||||
@@ -1403,7 +1430,52 @@ public class LegacyAgent extends Agent {
|
||||
return Math.abs(entity.getWorld().getHighestBlockYAt(entity.getLocation()) - entity.getLocation().getY());
|
||||
}*/
|
||||
|
||||
private boolean macemode(Terminator bot) {
|
||||
LivingEntity botEntity = bot.getBukkitEntity();
|
||||
if (botEntity == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
ItemStack mainHand;
|
||||
if (botEntity instanceof Player player) {
|
||||
mainHand = player.getInventory().getItemInMainHand();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (bot.getDefaultItem().getType() != Material.MACE && mainHand.getType() != Material.MACE) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean useWindcharge(Terminator bot) {
|
||||
if (!bot.isBotOnGround() && Math.random() >= 0.5) return false;
|
||||
|
||||
// Face the ground at own position to launch upward
|
||||
bot.look(org.bukkit.block.BlockFace.DOWN);
|
||||
|
||||
// Jump boost from windcharge with higher velocity
|
||||
bot.setItem(new ItemStack(Material.WIND_CHARGE, 1));
|
||||
Vector jumpVel = new Vector(0, 0.6, 0);
|
||||
Vector cvel = bot.getVelocity().add(jumpVel);
|
||||
cvel.setX(clamp(cvel.getX(), -0.05, 0.05));
|
||||
cvel.setZ(clamp(cvel.getZ(), -0.05, 0.05));
|
||||
bot.setVelocity(cvel);
|
||||
World world = bot.getLocation().getWorld();
|
||||
if (world != null) {
|
||||
world.playSound(bot.getLocation(), Sound.ENTITY_WIND_CHARGE_WIND_BURST, SoundCategory.PLAYERS, 1, 1);
|
||||
world.spawnParticle(Particle.GUST_EMITTER_SMALL, bot.getLocation(), 1, 0, 0, 0, 0.1);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean tryWindchargeMaceAttack(Terminator bot, LivingEntity target) {
|
||||
return tryWindchargeMaceAttack(bot, target, true);
|
||||
}
|
||||
|
||||
private boolean tryWindchargeMaceAttack(Terminator bot, LivingEntity target, boolean attemptwindcharge) {
|
||||
LivingEntity botEntity = bot.getBukkitEntity();
|
||||
if (botEntity == null) {
|
||||
return false;
|
||||
@@ -1422,35 +1494,20 @@ public class LegacyAgent extends Agent {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!bot.isBotOnGround() && Math.random() >= 0.5) return false;
|
||||
|
||||
// Face the ground at own position to launch upward
|
||||
bot.look(org.bukkit.block.BlockFace.DOWN);
|
||||
|
||||
// Jump boost from windcharge with higher velocity
|
||||
bot.setItem(new ItemStack(Material.WIND_CHARGE, 1));
|
||||
Vector jumpVel = new Vector(0, 0.6, 0);
|
||||
Vector cvel = bot.getVelocity().add(jumpVel);
|
||||
cvel.setX(clamp(cvel.getX(), -0.05, 0.05));
|
||||
cvel.setZ(clamp(cvel.getZ(), -0.05, 0.05));
|
||||
bot.setVelocity(cvel);
|
||||
World world = bot.getLocation().getWorld();
|
||||
if (world != null) {
|
||||
world.playSound(bot.getLocation(), Sound.ENTITY_WIND_CHARGE_WIND_BURST, SoundCategory.PLAYERS, 1, 1);
|
||||
world.spawnParticle(Particle.GUST_EMITTER_SMALL, target.getLocation(), 1, 0, 0, 0, 0.1);
|
||||
}
|
||||
if (attemptwindcharge)
|
||||
if (!useWindcharge(bot)) return false;
|
||||
|
||||
Bukkit.getScheduler().scheduleAsyncDelayedTask(plugin, () -> {
|
||||
while (!bot.isBotOnGround() && bot.getLocation().distanceSquared(target.getLocation()) > 3) {}
|
||||
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, () -> {
|
||||
double falldist = -(bot.getVelocity().getY()*10); // CERTAINLY not the best way but meh
|
||||
double falldist = -(bot.getVelocity().getY()*15); // CERTAINLY not the best way but meh
|
||||
//Bukkit.getLogger().info("fall dist: "+falldist+" cvy: "+bot.getVelocity().getY());
|
||||
|
||||
if (bot.isBotOnGround()) {
|
||||
/*if (bot.isBotOnGround()) {
|
||||
//Bukkit.getLogger().info("Bot -> ground, no mace");
|
||||
return;
|
||||
}
|
||||
}*/
|
||||
|
||||
double extradmg = 0;
|
||||
if (falldist >= 1.5) {
|
||||
@@ -1463,6 +1520,9 @@ public class LegacyAgent extends Agent {
|
||||
bot.setItem(bot.getDefaultItem());
|
||||
bot.faceLocation(target.getLocation());
|
||||
bot.punch();
|
||||
|
||||
World world = bot.getBukkitEntity().getWorld();
|
||||
|
||||
if (bot.getLocation().distanceSquared(target.getLocation()) <= 5) {
|
||||
double exdmg = extradmg;
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, () -> {
|
||||
@@ -1484,7 +1544,7 @@ public class LegacyAgent extends Agent {
|
||||
//Bukkit.getLogger().info("Bot out of range.");
|
||||
}
|
||||
}, 0);
|
||||
}, 8);
|
||||
}, attemptwindcharge ? 8 : 0);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user