Search in sources :

Example 16 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_16_R1.entity.EntityMyPet) BehaviorImpl(de.Keyle.MyPet.skill.skills.BehaviorImpl) MyPet(de.Keyle.MyPet.api.entity.MyPet) EntityMyPet(de.Keyle.MyPet.compat.v1_16_R1.entity.EntityMyPet) Behavior(de.Keyle.MyPet.api.skill.skills.Behavior)

Example 17 with BehaviorImpl

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

the class EntityMyBee 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 (!isAngry) {
            isAngry = true;
            this.updateVisuals();
        }
    } else {
        if (isAngry) {
            isAngry = false;
            this.updateVisuals();
        }
    }
}
Also used : BehaviorImpl(de.Keyle.MyPet.skill.skills.BehaviorImpl) Behavior(de.Keyle.MyPet.api.skill.skills.Behavior)

Example 18 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)

Example 19 with BehaviorImpl

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

the class EntityMyBee 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 (!isAngry) {
            isAngry = true;
            this.updateVisuals();
        }
    } else {
        if (isAngry) {
            isAngry = false;
            this.updateVisuals();
        }
    }
}
Also used : BehaviorImpl(de.Keyle.MyPet.skill.skills.BehaviorImpl) Behavior(de.Keyle.MyPet.api.skill.skills.Behavior)

Example 20 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.level.getEntitiesOfClass(EntityMyPet.class, this.petOwnerEntity.getBoundingBox().inflate(range, range, 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_17_R1.entity.EntityMyPet) BehaviorImpl(de.Keyle.MyPet.skill.skills.BehaviorImpl) MyPet(de.Keyle.MyPet.api.entity.MyPet) EntityMyPet(de.Keyle.MyPet.compat.v1_17_R1.entity.EntityMyPet) 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