Search in sources :

Example 11 with Hero

use of com.herocraftonline.heroes.characters.Hero in project MagicPlugin by elBukkit.

the class HeroesManager method setMana.

@Override
public void setMana(Player player, float amount) {
    Hero hero = getHero(player);
    if (hero == null)
        return;
    hero.setMana((int) amount);
}
Also used : Hero(com.herocraftonline.heroes.characters.Hero)

Example 12 with Hero

use of com.herocraftonline.heroes.characters.Hero in project MagicPlugin by elBukkit.

the class HeroesManager method getClassName.

public String getClassName(Player player) {
    Hero hero = getHero(player);
    if (hero == null)
        return "";
    HeroClass heroClass = hero.getHeroClass();
    if (heroClass == null)
        return "";
    return heroClass.getName();
}
Also used : HeroClass(com.herocraftonline.heroes.characters.classes.HeroClass) Hero(com.herocraftonline.heroes.characters.Hero)

Example 13 with Hero

use of com.herocraftonline.heroes.characters.Hero in project MagicPlugin by elBukkit.

the class HeroesManager method setCooldown.

public void setCooldown(Player player, long ms) {
    Hero hero = getHero(player);
    if (hero == null)
        return;
    long cooldown = System.currentTimeMillis() + ms;
    Set<String> skills = getSkills(player, false, false);
    for (String skill : skills) {
        Long currentCooldown = hero.getCooldown(skill);
        if (currentCooldown == null || currentCooldown < cooldown) {
            hero.setCooldown(skill, cooldown);
        }
    }
}
Also used : Hero(com.herocraftonline.heroes.characters.Hero)

Example 14 with Hero

use of com.herocraftonline.heroes.characters.Hero in project MagicPlugin by elBukkit.

the class HeroesSkillSpell method addLore.

@Override
public void addLore(Messages messages, Mage mage, com.elmakers.mine.bukkit.api.wand.Wand wand, List<String> lore) {
    if (mage == null || !mage.isPlayer())
        return;
    Hero hero = heroes.getHero(mage.getPlayer());
    if (hero == null)
        return;
    if (skill instanceof PassiveSkill) {
        lore.add(messages.get("skills.passive_description", "Passive"));
    }
    int level = SkillConfigManager.getUseSetting(hero, skill, SkillSetting.LEVEL, 1, true);
    String levelDescription = controller.getMessages().get("spell.level_description").replace("$level", Integer.toString(level));
    if (levelDescription != null && levelDescription.length() > 0) {
        lore.add(ChatColor.GOLD + levelDescription);
    }
    String description = getDescription();
    if (description == null || description.isEmpty()) {
        description = skill.getDescription(hero);
    }
    if (description != null && description.length() > 0) {
        InventoryUtils.wrapText(description, lore);
    }
    int cooldown = SkillConfigManager.getUseSetting(hero, skill, SkillSetting.COOLDOWN, 0, true);
    if (cooldown > 0) {
        String cooldownDescription = getCooldownDescription(messages, cooldown, mage, wand);
        if (cooldownDescription != null && !cooldownDescription.isEmpty()) {
            lore.add(messages.get("cooldown.description").replace("$time", cooldownDescription));
        }
    }
    int mana = SkillConfigManager.getUseSetting(hero, skill, SkillSetting.MANA, 0, true);
    if (mana > 0) {
        String manaDescription = messages.get("costs.heroes_mana").replace("$amount", Integer.toString(mana));
        lore.add(ChatColor.YELLOW + messages.get("wand.costs_description").replace("$description", manaDescription));
    }
}
Also used : PassiveSkill(com.herocraftonline.heroes.characters.skill.PassiveSkill) Hero(com.herocraftonline.heroes.characters.Hero)

Aggregations

Hero (com.herocraftonline.heroes.characters.Hero)14 HeroClass (com.herocraftonline.heroes.characters.classes.HeroClass)4 HeroParty (com.herocraftonline.heroes.characters.party.HeroParty)2 ActiveSkill (com.herocraftonline.heroes.characters.skill.ActiveSkill)2 Skill (com.herocraftonline.heroes.characters.skill.Skill)2 HashSet (java.util.HashSet)2 Player (org.bukkit.entity.Player)2 PassiveSkill (com.herocraftonline.heroes.characters.skill.PassiveSkill)1 ArrayList (java.util.ArrayList)1 Nullable (javax.annotation.Nullable)1