Class REPARIFARGE
Reparifarge reverses active transfigurations cast by other spells, returning transfigured blocks and entities back to their original state. This spell is primarily useful for countering incomplete or unwanted transfigurations. It does not work on permanent transfigurations or Animagus transformations.
Success Mechanics: The spell has a variable success rate based on the caster's
skill level with Reparifarge (number of uses). The success rate ranges from minSuccessRate%
to maxSuccessRate%. Block transfigurations can always be reverted with a successful cast,
but entity transfigurations can only be reverted if the source transfiguration spell has an equal or
lower level than Reparifarge.
Target Detection: The spell projectile searches for both blocks and entities at the impact location. Ender Dragon parts are automatically converted to their parent dragon entity for targeting consistency.
- See Also:
-
Field Summary
Fields inherited from class net.pottercraft.ollivanders2.spell.O2Spell
branch, cooldownMessage, defaultRadius, flavorText, isAllowedFailureMessage, location, maxProjectileDistance, maxSpellLifetime, noProjectile, player, rightWand, spellMasteryLevel, spellType, text, usesModifier, vector -
Constructor Summary
ConstructorsConstructorDescriptionREPARIFARGE(@NotNull Ollivanders2 plugin, @NotNull org.bukkit.entity.Player player, @NotNull Double rightWand) Constructor.REPARIFARGE(Ollivanders2 plugin) Default constructor for use in generating spell text. -
Method Summary
Modifier and TypeMethodDescriptionvoidExecutes the Reparifarge spell effect.booleanreparifargeBlock(@NotNull org.bukkit.block.Block target) Attempts to revert any active block transfiguration affecting the target block.booleanreparifargeEntity(@NotNull org.bukkit.entity.Entity target) Attempts to revert any active entity transfiguration affecting the target entity.Methods inherited from class net.pottercraft.ollivanders2.spell.O2Spell
checkEffect, getCloseEntities, getCoolDown, getFailureMessage, getFlavorText, getLevel, getLifeTicks, getMagicBranch, getName, getNearbyDamageableEntities, getNearbyItems, getNearbyLivingEntities, getNearbyPlayers, getSuccessMessage, getTargetBlock, getText, getWorldGuardFlags, hasHitTarget, isAtMaxDistance, isKilled, isSpellAllowed, kill, move, revert, sendFailureMessage, sendSuccessMessage, setUsesModifier
-
Constructor Details
-
REPARIFARGE
Default constructor for use in generating spell text. Do not use to cast the spell.- Parameters:
plugin- the Ollivanders2 plugin
-
REPARIFARGE
public REPARIFARGE(@NotNull @NotNull Ollivanders2 plugin, @NotNull @NotNull org.bukkit.entity.Player player, @NotNull @NotNull Double rightWand) Constructor.- Parameters:
plugin- a callback to the MC pluginplayer- the player who cast this spellrightWand- which wand the player was using
-
-
Method Details
-
doCheckEffect
public void doCheckEffect()Executes the Reparifarge spell effect.When the projectile hits a target block, attempts to revert any active transfiguration on that block. When the projectile is in flight near entities, searches nearby entities and attempts to revert transfigurations on the first valid target found. Ender Dragon parts are automatically converted to their parent dragon entity before checking for transfigurations.
Sends success or failure message to the caster and terminates the spell after attempting reversion.
- Specified by:
doCheckEffectin classO2Spell
-
reparifargeEntity
public boolean reparifargeEntity(@NotNull @NotNull org.bukkit.entity.Entity target) Attempts to revert any active entity transfiguration affecting the target entity.Searches for active transfiguration spells that have transfigured the target entity. If a matching transfiguration is found, checks if Reparifarge's level is equal to or greater than the source transfiguration spell's level. If so, performs a success check and kills the source spell if successful, reverting the transfiguration.
Returns true if a transfiguration was found (regardless of whether it was reverted), false otherwise. This distinguishes between "no transfiguration found" and "transfiguration found but revert failed".
- Parameters:
target- the target entity to check for transfiguration- Returns:
- true if any transfiguration was found affecting this entity, false otherwise
-
reparifargeBlock
public boolean reparifargeBlock(@NotNull @NotNull org.bukkit.block.Block target) Attempts to revert any active block transfiguration affecting the target block.Searches for active transfiguration spells that have transfigured the target block. If a matching transfiguration is found, performs a success check and kills the source spell if successful, reverting the transfiguration. Unlike entity transfigurations, block transfigurations have no level requirement - they can always be reverted if the success check passes.
Returns true if a transfiguration was found (regardless of whether it was reverted), false otherwise. This distinguishes between "no transfiguration found" and "transfiguration found but revert failed".
- Parameters:
target- the target block to check for transfiguration- Returns:
- true if any transfiguration was found affecting this block, false otherwise
-