Class TransfigurationBase
java.lang.Object
net.pottercraft.ollivanders2.spell.O2Spell
net.pottercraft.ollivanders2.spell.TransfigurationBase
- Direct Known Subclasses:
BlockTransfiguration,EntityTransfiguration
The base class for all transfiguration spells that change blocks and entities.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected intThe percent chance this spell will succeed each casting.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
ConstructorsConstructorDescriptionTransfigurationBase(@NotNull Ollivanders2 plugin, @NotNull org.bukkit.entity.Player player, @NotNull Double rightWand) Constructor.TransfigurationBase(Ollivanders2 plugin) Default constructor for use in generating spell text. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidIf the target is not transfigured, attempt to transfigure it.abstract booleanisBlockTransfigured(org.bukkit.block.Block block) Is this block transfigured by this spellbooleanDoes this spell consume the original block or not.abstract booleanisEntityTransfigured(org.bukkit.entity.Entity entity) Is this entity transfigured by this spellbooleanIs this spell permanent.booleanHas the transfiguration taken place or not.protected abstract voidrevert()Revert the transfiguration, if not permanentMethods 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, sendFailureMessage, sendSuccessMessage, setUsesModifier
-
Field Details
-
successRate
protected int successRateThe percent chance this spell will succeed each casting.
-
-
Constructor Details
-
TransfigurationBase
Default constructor for use in generating spell text. Do not use to cast the spell.- Parameters:
plugin- the Ollivanders2 plugin
-
TransfigurationBase
public TransfigurationBase(@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
-
isTransfigured
public boolean isTransfigured()Has the transfiguration taken place or not.- Returns:
- whether the target has transfigured or not
-
isPermanent
public boolean isPermanent()Is this spell permanent.- Returns:
- true if permanent, false otherwise
-
isConsumeOriginal
public boolean isConsumeOriginal()Does this spell consume the original block or not.- Returns:
- true if it consumes the block, false otherwise
-
doCheckEffect
protected void doCheckEffect()If the target is not transfigured, attempt to transfigure it. If it is transfigured and this is not a permanent spell, age the spell one tick.- Specified by:
doCheckEffectin classO2Spell
-
isEntityTransfigured
public abstract boolean isEntityTransfigured(org.bukkit.entity.Entity entity) Is this entity transfigured by this spell- Parameters:
entity- the entity to check- Returns:
- true if transfigured, false otherwise
-
isBlockTransfigured
public abstract boolean isBlockTransfigured(org.bukkit.block.Block block) Is this block transfigured by this spell- Parameters:
block- the block to check- Returns:
- true if transfigured, false otherwise
-
revert
protected abstract void revert()Revert the transfiguration, if not permanent
-