Skip to content

Commit

Permalink
add enderdragon phase tag/mechanism
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Nov 25, 2016
1 parent d805164 commit eebe9b4
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions plugin/src/main/java/net/aufdemrand/denizen/objects/dEntity.java
Original file line number Diff line number Diff line change
Expand Up @@ -2429,6 +2429,21 @@ && getBukkitEntity() instanceof Item) {
.getAttribute(attribute.fulfill(1));
}

// <--[tag]
// @attribute <e@entity.dragon_phase>
// @returns Element(Number)
// @group properties
// @description
// Returns the phase an EnderDragon is currently in.
// Valid phases: CIRCLING, STRAFING, FLY_TO_PORTAL, LAND_ON_PORTAL, LEAVE_PORTAL,
// BREATH_ATTACK, SEARCH_FOR_BREATH_ATTACK_TARGET, ROAR_BEFORE_ATTACK,
// CHARGE_PLAYER, DYING, HOVER;
// -->
if (attribute.startsWith("experience") && getBukkitEntity() instanceof ExperienceOrb) {
return new Element(((EnderDragon) getLivingEntity()).getPhase().name())
.getAttribute(attribute.fulfill(1));
}

// <--[tag]
// @attribute <e@entity.describe>
// @returns Element(Boolean)
Expand Down Expand Up @@ -2759,6 +2774,20 @@ public void adjust(Mechanism mechanism) {
}
}

// <--[mechanism]
// @object dEntity
// @name dragon_phase
// @input Element
// @description
// Sets an EnderDragon's combat phase.
// @tags
// <e@entity.dragon_phase>
// -->
if (mechanism.matches("dragon_phase")) {
EnderDragon ed = (EnderDragon) getLivingEntity();
ed.setPhase(EnderDragon.Phase.valueOf(value.asString().toUpperCase()));
}

// <--[mechanism]
// @object dEntity
// @name experience
Expand Down

0 comments on commit eebe9b4

Please sign in to comment.