Search in sources :

Example 1 with LothricKnight

use of complexMobs.mob.LothricKnight in project ComplexMobs by AmirBohd.

the class Grab method move.

protected void move() {
    double distance = ((LothricKnight) getMob()).getBrain().getLocation().distance(((LothricKnight) getMob()).getTarget().getLocation());
    Location difference = ((LothricKnight) getMob()).getBrain().getLocation().subtract(((LothricKnight) getMob()).getTarget().getLocation());
    Vector direction = difference.toVector().divide(new Vector(distance, distance, distance));
    float yaw = (float) (Math.atan2(direction.getX(), direction.getZ()) * 57.29);
    if (yaw > 0)
        yaw -= 360;
    yaw *= -1;
    yaw += 180;
    ((CraftEntity) (((LothricKnight) getMob()).getBrain())).getHandle().setHeadRotation(yaw);
    if (getTick() <= 17)
        getMob().move(.25, 20, 0);
}
Also used : Vector(org.bukkit.util.Vector) LothricKnight(complexMobs.mob.LothricKnight) Location(org.bukkit.Location)

Example 2 with LothricKnight

use of complexMobs.mob.LothricKnight in project ComplexMobs by AmirBohd.

the class Grab method attackFrame.

protected void attackFrame() {
    LothricKnight mob = (LothricKnight) getMob();
    if (getTick() == 14) {
        List<Entity> grabbableEntities = mob.getParts().get("left_hand").getArmorStand().getNearbyEntities(.4, .5, .4);
        grabbableEntities.addAll(mob.getParts().get("left_arm").getArmorStand().getNearbyEntities(.4, .5, .4));
        for (Entity entity : grabbableEntities) {
            if (entity instanceof Player) {
                Player p = (Player) entity;
                // !(lothricKnight.getNation() == Nations.getNation(player).getId())
                if (true) {
                    p.damage(.01);
                    p.playSound(p.getLocation(), "lothricknight.playerhurt", 1, 1);
                    p.getWorld().spawnParticle(Particle.END_ROD, mob.getParts().get("left_hand").getArmorStand().getLocation().add(0, 1.6, 0), 1, 0, 0, 0, 0);
                    mob.setVictim(p);
                    mob.setAction("riposte");
                    break;
                }
            }
        }
    }
}
Also used : CraftEntity(org.bukkit.craftbukkit.v1_13_R2.entity.CraftEntity) Entity(org.bukkit.entity.Entity) Player(org.bukkit.entity.Player) LothricKnight(complexMobs.mob.LothricKnight)

Example 3 with LothricKnight

use of complexMobs.mob.LothricKnight in project ComplexMobs by AmirBohd.

the class LeftSlash method actions.

protected int actions() {
    playSound();
    move();
    attackFrame();
    pelvis();
    chest();
    cape();
    head();
    leftElbow();
    leftArm();
    leftHand();
    shield();
    rightElbow();
    rightArm();
    rightHand();
    sword();
    leftThigh();
    leftCalf();
    leftFoot();
    rightThigh();
    rightCalf();
    rightFoot();
    if (getTick() >= getReturnTick() - 7) {
        LothricKnight mob = (LothricKnight) getMob();
        if (mob.getTarget().getLocation().distance(mob.getMain().getLocation()) < 4 && mob.getStamina() > 25) {
            mob.setStamina(mob.getStamina() - 25);
            mob.setStaminaUseTick(mob.getStaminaUseTickMax());
            mob.setAction("right_slash");
            return 0;
        }
    }
    if (getTick() >= getReturnTick()) {
        return -1;
    }
    return getTick() + 1;
}
Also used : LothricKnight(complexMobs.mob.LothricKnight)

Example 4 with LothricKnight

use of complexMobs.mob.LothricKnight in project ComplexMobs by AmirBohd.

the class RightSlash method actions.

protected int actions() {
    playSound();
    move();
    attackFrame();
    pelvis();
    chest();
    cape();
    head();
    leftElbow();
    leftArm();
    leftHand();
    shield();
    rightElbow();
    rightArm();
    rightHand();
    sword();
    leftThigh();
    leftCalf();
    leftFoot();
    rightThigh();
    rightCalf();
    rightFoot();
    if (getTick() >= getReturnTick() - 7) {
        LothricKnight mob = (LothricKnight) getMob();
        if (mob.getTarget().getLocation().distance(mob.getMain().getLocation()) < 4 && mob.getStamina() > 25) {
            mob.setStamina(mob.getStamina() - 25);
            mob.setStaminaUseTick(mob.getStaminaUseTickMax());
            mob.setAction("left_slash");
            return 0;
        }
    }
    if (getTick() >= getReturnTick()) {
        return -1;
    }
    return getTick() + 1;
}
Also used : LothricKnight(complexMobs.mob.LothricKnight)

Example 5 with LothricKnight

use of complexMobs.mob.LothricKnight in project ComplexMobs by AmirBohd.

the class Riposte method attackFrame.

protected void attackFrame() {
    LothricKnight mob = (LothricKnight) getMob();
    Player victim = mob.getVictim();
    if (victim == null && getTick() < 90) {
        mob.setAction("idle");
        return;
    } else if (victim.isDead() && getTick() < 90) {
        mob.setAction("idle");
        return;
    }
    Part part;
    Vector weaponMid = new Vector(0, 0, 0);
    if (getTick() < 64)
        part = mob.getParts().get("left_hand");
    else {
        part = mob.getParts().get("sword");
        weaponMid = new Vector(0, 0, .9);
    }
    EulerAngle weaponAngle = part.getHeadPose();
    weaponMid.rotateAroundX(weaponAngle.getX());
    weaponMid.rotateAroundY(-weaponAngle.getY());
    weaponMid.rotateAroundZ(-weaponAngle.getZ());
    weaponMid.rotateAroundAxis(new Vector(0, 1, 0), part.getArmorStand().getLocation().getYaw() / -57.29);
    Vector victimPosition = part.getArmorStand().getLocation().add(weaponMid).add(0, .4, 0).toVector();
    double x = victimPosition.getX();
    double y = victimPosition.getY();
    double z = victimPosition.getZ();
    victim.setFallDistance(0);
    if (getTick() < 90)
        ((CraftEntity) victim).getHandle().setPosition(x, y, z);
    if (getTick() < 90)
        victim.setVelocity(new Vector(.15 - Math.random() * .3, .15 - Math.random() * .3, .15 - Math.random() * .3));
    else if (getTick() == 90) {
        victim.setVelocity(mob.getMain().getLocation().getDirection().multiply(4).rotateAroundY(-80 / 57.29).setY(-1));
    } else if (getTick() < 110) {
        victim.getWorld().spawnParticle(Particle.BLOCK_CRACK, getMob().getVictim().getLocation().add(0, 1, 0), 4, 0, 0, 0, .5, Material.REDSTONE_WIRE.createBlockData(), true);
    }
    if (getTick() == 100) {
        victim.damage(20, getMob().getMain());
    }
    if (getTick() == 64) {
        victim.setHealth(victim.getHealth() * .25);
        victim.damage(1);
    }
}
Also used : Player(org.bukkit.entity.Player) Part(complexMobs.object.Part) CraftEntity(org.bukkit.craftbukkit.v1_13_R2.entity.CraftEntity) EulerAngle(org.bukkit.util.EulerAngle) Vector(org.bukkit.util.Vector) LothricKnight(complexMobs.mob.LothricKnight)

Aggregations

LothricKnight (complexMobs.mob.LothricKnight)9 Vector (org.bukkit.util.Vector)5 Location (org.bukkit.Location)3 CraftEntity (org.bukkit.craftbukkit.v1_13_R2.entity.CraftEntity)2 Player (org.bukkit.entity.Player)2 ComplexMob (complexMobs.complexMob.ComplexMob)1 Part (complexMobs.object.Part)1 LivingComplexMob (complexMobs.template.LivingComplexMob)1 World (org.bukkit.World)1 Entity (org.bukkit.entity.Entity)1 EventHandler (org.bukkit.event.EventHandler)1 EulerAngle (org.bukkit.util.EulerAngle)1