Search in sources :

Example 11 with CasterProperties

use of com.elmakers.mine.bukkit.api.magic.CasterProperties in project MagicPlugin by elBukkit.

the class BaseSpell method checkActiveCosts.

public void checkActiveCosts() {
    if (activeCosts == null)
        return;
    long now = System.currentTimeMillis();
    activeCostScale = (float) ((double) (now - lastActiveCost) / 1000);
    lastActiveCost = now;
    CasterProperties caster = null;
    if (currentCast != null) {
        caster = currentCast.getWand();
        if (caster == null) {
            caster = currentCast.getMageClass();
        }
    }
    for (CastingCost cost : activeCosts) {
        if (!cost.has(mage, caster, this)) {
            deactivate();
            break;
        }
        cost.deduct(mage, caster, this);
    }
    activeCostScale = 1;
}
Also used : CasterProperties(com.elmakers.mine.bukkit.api.magic.CasterProperties) CastingCost(com.elmakers.mine.bukkit.api.spell.CastingCost)

Aggregations

CasterProperties (com.elmakers.mine.bukkit.api.magic.CasterProperties)11 Mage (com.elmakers.mine.bukkit.api.magic.Mage)10 ProgressionPath (com.elmakers.mine.bukkit.api.magic.ProgressionPath)6 Wand (com.elmakers.mine.bukkit.api.wand.Wand)6 ItemStack (org.bukkit.inventory.ItemStack)5 MageClass (com.elmakers.mine.bukkit.api.magic.MageClass)4 Player (org.bukkit.entity.Player)4 ItemMeta (org.bukkit.inventory.meta.ItemMeta)4 MageController (com.elmakers.mine.bukkit.api.magic.MageController)3 MageSpell (com.elmakers.mine.bukkit.api.spell.MageSpell)3 Spell (com.elmakers.mine.bukkit.api.spell.Spell)3 SpellTemplate (com.elmakers.mine.bukkit.api.spell.SpellTemplate)3 ArrayList (java.util.ArrayList)3 Nullable (javax.annotation.Nullable)3 WandUpgradePath (com.elmakers.mine.bukkit.api.wand.WandUpgradePath)2 BaseSpell (com.elmakers.mine.bukkit.spell.BaseSpell)2 EquationTransform (de.slikey.effectlib.math.EquationTransform)2 Inventory (org.bukkit.inventory.Inventory)2 Messages (com.elmakers.mine.bukkit.api.magic.Messages)1 Requirement (com.elmakers.mine.bukkit.api.requirements.Requirement)1