Search in sources :

Example 6 with Hero

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

the class HeroesManager method getSecondaryClassName.

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

Example 7 with Hero

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

the class HeroesManager method getSkills.

public Set<String> getSkills(Player player, boolean showUnuseable, boolean showPassive) {
    if (skills == null)
        return emptySkills;
    Hero hero = getHero(player);
    if (hero == null)
        return emptySkills;
    Set<String> skillSet = new HashSet<>();
    HeroClass heroClass = hero.getHeroClass();
    HeroClass secondClass = hero.getSecondClass();
    addSkills(hero, heroClass, skillSet, showUnuseable, showPassive);
    addSkills(hero, secondClass, skillSet, showUnuseable, showPassive);
    return skillSet;
}
Also used : HeroClass(com.herocraftonline.heroes.characters.classes.HeroClass) Hero(com.herocraftonline.heroes.characters.Hero) HashSet(java.util.HashSet)

Example 8 with Hero

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

the class HeroesManager method removeMana.

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

Example 9 with Hero

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

the class HeroesSkillSpell method getRemainingCooldown.

@Override
public long getRemainingCooldown() {
    if (isCasting || skill == null || mage == null)
        return 0;
    Player player = mage.getPlayer();
    if (player == null)
        return 0;
    Hero hero = heroes.getHero(mage.getPlayer());
    if (hero == null)
        return 0;
    Long cooldown = hero.getCooldown(skillKey);
    if (cooldown == null)
        return 0;
    long now = System.currentTimeMillis();
    return Math.max(0, cooldown - now);
}
Also used : Player(org.bukkit.entity.Player) Hero(com.herocraftonline.heroes.characters.Hero)

Example 10 with Hero

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

the class HeroesSkillSpell method getRequiredCost.

@Nullable
@Override
public CastingCost getRequiredCost() {
    if (isCasting || skill == null || mage == null)
        return null;
    Player player = mage.getPlayer();
    if (player == null)
        return null;
    Hero hero = heroes.getHero(mage.getPlayer());
    if (hero == null)
        return null;
    int mana = SkillConfigManager.getUseSetting(hero, skill, SkillSetting.MANA, 0, true);
    if (mana == 0 || hero.getMana() > mana)
        return null;
    manaCost.setAmount(mana);
    return manaCost;
}
Also used : Player(org.bukkit.entity.Player) Hero(com.herocraftonline.heroes.characters.Hero) Nullable(javax.annotation.Nullable)

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