当前位置: 首页>>代码示例>>Java>>正文


Java Mage.getExperience方法代码示例

本文整理汇总了Java中com.elmakers.mine.bukkit.api.magic.Mage.getExperience方法的典型用法代码示例。如果您正苦于以下问题:Java Mage.getExperience方法的具体用法?Java Mage.getExperience怎么用?Java Mage.getExperience使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.elmakers.mine.bukkit.api.magic.Mage的用法示例。


在下文中一共展示了Mage.getExperience方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: has

import com.elmakers.mine.bukkit.api.magic.Mage; //导入方法依赖的package包/类
public boolean has(Spell spell)
{
    if (!(spell instanceof MageSpell)) return false;
    Mage mage = ((MageSpell)spell).getMage();
    int amount = getAmount(spell);
    boolean hasItem = true;
    if (item != null && amount > 0 && !isConsumeFree(spell))
    {
        hasItem = mage.hasItem(item.getItemStack(amount), item.getData() == null);
    }
    boolean hasXp = xp <= 0 || mage.getExperience() >= getXP(spell);
    boolean hasMana = mana <= 0 || mage.getMana() >= getMana(spell);
    boolean hasCurrency = currency <= 0;
    if (!hasCurrency) {
        VaultController vault = VaultController.getInstance();
        hasCurrency = vault.has(mage.getPlayer(), getCurrency(spell));
    }

    return hasItem && hasXp && hasMana && hasCurrency;
}
 
开发者ID:elBukkit,项目名称:MagicLib,代码行数:21,代码来源:CastingCost.java

示例2: hasItemCosts

import com.elmakers.mine.bukkit.api.magic.Mage; //导入方法依赖的package包/类
protected boolean hasItemCosts(CastContext context, ShopItem shopItem) {
    Mage mage = context.getMage();
    MageController controller = context.getController();
    double worth = shopItem.getWorth();
    boolean hasCosts = true;
    if (worth > 0) {
        if (isXP) {
            worth = Math.ceil(costScale * worth * controller.getWorthBase() / controller.getWorthXP());
            hasCosts = mage.getExperience() >= (int)(double)worth;
        } else if (isItems) {
            worth = Math.ceil(costScale * worth * controller.getWorthBase() / controller.getWorthItemAmount());
            int hasAmount = getItemAmount(controller, mage);
            hasCosts = hasAmount >= worth;
        } else if (isSkillPoints) {
            worth = Math.ceil(costScale * worth * controller.getWorthBase() / controller.getWorthSkillPoints());
            hasCosts = mage.getSkillPoints() >= Math.ceil(worth);
        } else {
            worth = Math.ceil(costScale * worth * controller.getWorthBase());
            hasCosts = VaultController.getInstance().has(mage.getPlayer(), worth);
        }
    }

    return hasCosts;
}
 
开发者ID:elBukkit,项目名称:MagicLib,代码行数:25,代码来源:BaseShopAction.java


注:本文中的com.elmakers.mine.bukkit.api.magic.Mage.getExperience方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。