Search in sources :

Example 21 with BehaviorImpl

use of de.Keyle.MyPet.skill.skills.BehaviorImpl in project MyPet by xXKeyleXx.

the class BehaviorDuelTarget method shouldStart.

@Override
public boolean shouldStart() {
    Behavior behaviorSkill = myPet.getSkills().get(Behavior.class);
    if (!behaviorSkill.isActive() || behaviorSkill.getBehavior() != BehaviorMode.Duel) {
        return false;
    }
    if (myPet.getDamage() <= 0 && myPet.getRangedDamage() <= 0) {
        return false;
    }
    if (!petEntity.canMove()) {
        return false;
    }
    if (petEntity.hasTarget()) {
        return false;
    }
    if (duelOpponent != null) {
        this.target = duelOpponent;
        return true;
    }
    for (EntityMyPet entityMyPet : this.petEntity.world.a(EntityMyPet.class, this.petOwnerEntity.getBoundingBox().grow((double) range, (double) range, (double) range))) {
        MyPet targetMyPet = entityMyPet.getMyPet();
        if (entityMyPet != petEntity && entityMyPet.isAlive()) {
            if (!targetMyPet.getSkills().isActive(BehaviorImpl.class) || !targetMyPet.getEntity().get().canMove()) {
                continue;
            }
            BehaviorImpl targetbehavior = targetMyPet.getSkills().get(BehaviorImpl.class);
            if (targetbehavior.getBehavior() != BehaviorMode.Duel) {
                continue;
            }
            if (targetMyPet.getDamage() == 0) {
                continue;
            }
            this.target = entityMyPet;
            return true;
        }
    }
    return false;
}
Also used : EntityMyPet(de.Keyle.MyPet.compat.v1_9_R2.entity.EntityMyPet) BehaviorImpl(de.Keyle.MyPet.skill.skills.BehaviorImpl) MyPet(de.Keyle.MyPet.api.entity.MyPet) EntityMyPet(de.Keyle.MyPet.compat.v1_9_R2.entity.EntityMyPet) Behavior(de.Keyle.MyPet.api.skill.skills.Behavior)

Example 22 with BehaviorImpl

use of de.Keyle.MyPet.skill.skills.BehaviorImpl in project MyPet by xXKeyleXx.

the class BehaviorDuelTarget method shouldStart.

@Override
public boolean shouldStart() {
    Behavior behaviorSkill = myPet.getSkills().get(Behavior.class);
    if (!behaviorSkill.isActive() || behaviorSkill.getBehavior() != BehaviorMode.Duel) {
        return false;
    }
    if (myPet.getDamage() <= 0 && myPet.getRangedDamage() <= 0) {
        return false;
    }
    if (!petEntity.canMove()) {
        return false;
    }
    if (petEntity.hasTarget()) {
        return false;
    }
    if (duelOpponent != null) {
        this.target = duelOpponent;
        return true;
    }
    for (EntityMyPet entityMyPet : this.petEntity.world.a(EntityMyPet.class, this.petOwnerEntity.getBoundingBox().grow((double) range, (double) range, (double) range))) {
        MyPet targetMyPet = entityMyPet.getMyPet();
        if (entityMyPet != petEntity && entityMyPet.isAlive()) {
            if (!targetMyPet.getSkills().isActive(BehaviorImpl.class) || !targetMyPet.getEntity().get().canMove()) {
                continue;
            }
            BehaviorImpl targetbehavior = targetMyPet.getSkills().get(BehaviorImpl.class);
            if (targetbehavior.getBehavior() != BehaviorMode.Duel) {
                continue;
            }
            if (targetMyPet.getDamage() == 0) {
                continue;
            }
            this.target = entityMyPet;
            return true;
        }
    }
    return false;
}
Also used : EntityMyPet(de.Keyle.MyPet.compat.v1_8_R3.entity.EntityMyPet) BehaviorImpl(de.Keyle.MyPet.skill.skills.BehaviorImpl) MyPet(de.Keyle.MyPet.api.entity.MyPet) EntityMyPet(de.Keyle.MyPet.compat.v1_8_R3.entity.EntityMyPet) Behavior(de.Keyle.MyPet.api.skill.skills.Behavior)

Example 23 with BehaviorImpl

use of de.Keyle.MyPet.skill.skills.BehaviorImpl in project MyPet by xXKeyleXx.

the class EntityMyEnderman method doMyPetTick.

protected void doMyPetTick() {
    super.doMyPetTick();
    BehaviorImpl skill = getMyPet().getSkills().get(BehaviorImpl.class);
    Behavior.BehaviorMode behavior = skill.getBehavior();
    if (behavior == Behavior.BehaviorMode.Aggressive) {
        if (!getMyPet().isScreaming()) {
            getMyPet().setScreaming(true);
        }
    } else {
        if (getMyPet().isScreaming()) {
            getMyPet().setScreaming(false);
        }
    }
}
Also used : BehaviorImpl(de.Keyle.MyPet.skill.skills.BehaviorImpl) Behavior(de.Keyle.MyPet.api.skill.skills.Behavior)

Example 24 with BehaviorImpl

use of de.Keyle.MyPet.skill.skills.BehaviorImpl in project MyPet by xXKeyleXx.

the class EntityMyVex method doMyPetTick.

@Override
protected void doMyPetTick() {
    super.doMyPetTick();
    BehaviorImpl skill = getMyPet().getSkills().get(BehaviorImpl.class);
    Behavior.BehaviorMode behavior = skill.getBehavior();
    if (behavior == Behavior.BehaviorMode.Aggressive) {
        if (!isAggressive) {
            isAggressive = true;
            this.updateVisuals();
        }
    } else {
        if (isAggressive) {
            isAggressive = false;
            this.updateVisuals();
        }
    }
}
Also used : BehaviorImpl(de.Keyle.MyPet.skill.skills.BehaviorImpl) Behavior(de.Keyle.MyPet.api.skill.skills.Behavior)

Aggregations

BehaviorImpl (de.Keyle.MyPet.skill.skills.BehaviorImpl)24 Behavior (de.Keyle.MyPet.api.skill.skills.Behavior)23 MyPet (de.Keyle.MyPet.api.entity.MyPet)8 MyPetApi (de.Keyle.MyPet.MyPetApi)1 Configuration (de.Keyle.MyPet.api.Configuration)1 Util (de.Keyle.MyPet.api.Util)1 WorldGroup (de.Keyle.MyPet.api.WorldGroup)1 CommandTabCompleter (de.Keyle.MyPet.api.commands.CommandTabCompleter)1 PetState (de.Keyle.MyPet.api.entity.MyPet.PetState)1 StoredMyPet (de.Keyle.MyPet.api.entity.StoredMyPet)1 DonateCheck (de.Keyle.MyPet.api.player.DonateCheck)1 MyPetPlayer (de.Keyle.MyPet.api.player.MyPetPlayer)1 Permissions (de.Keyle.MyPet.api.player.Permissions)1 Colorizer (de.Keyle.MyPet.api.util.Colorizer)1 ConfigItem (de.Keyle.MyPet.api.util.ConfigItem)1 FancyMessage (de.Keyle.MyPet.api.util.chat.FancyMessage)1 ItemTooltip (de.Keyle.MyPet.api.util.chat.parts.ItemTooltip)1 Translation (de.Keyle.MyPet.api.util.locale.Translation)1 EntityMyPet (de.Keyle.MyPet.compat.v1_12_R1.entity.EntityMyPet)1 EntityMyPet (de.Keyle.MyPet.compat.v1_16_R1.entity.EntityMyPet)1