forked from Upstream/mmocore
Casting Delay
This commit is contained in:
parent
9abe1fd929
commit
c4198f264c
@ -52,6 +52,7 @@ public class ClassSkill implements CooldownObject {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public RegisteredSkill getSkill() {
|
||||
return skill;
|
||||
}
|
||||
@ -81,6 +82,15 @@ public class ClassSkill implements CooldownObject {
|
||||
return Objects.requireNonNull(modifiers.get(modifier), "Could not find modifier '" + modifier + "'").calculate(level);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gives the delay to launch the skill
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public int getDelay(PlayerData data) {
|
||||
return modifiers.containsKey("delay") ? (int) modifiers.get("delay").calculate(data.getSkillLevel(getSkill())) : 0;
|
||||
}
|
||||
|
||||
public List<String> calculateLore(PlayerData data) {
|
||||
return calculateLore(data, data.getSkillLevel(skill));
|
||||
}
|
||||
@ -125,9 +135,11 @@ public class ClassSkill implements CooldownObject {
|
||||
return new CastableSkill(this, caster.getSkillLevel(getSkill()));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Be careful, this method creates a new UUID each time it is called. Need to be remembered when trying to unregister passive skill
|
||||
* from PassiveSkillMap.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public PassiveSkill toPassive(PlayerData caster) {
|
||||
|
@ -9,6 +9,7 @@ import net.Indyuce.mmocore.api.player.PlayerData;
|
||||
import net.Indyuce.mmocore.api.event.PlayerKeyPressEvent;
|
||||
import net.Indyuce.mmocore.api.SoundEvent;
|
||||
import net.Indyuce.mmocore.skill.ClassSkill;
|
||||
import net.Indyuce.mmocore.skill.RegisteredSkill;
|
||||
import net.Indyuce.mmocore.skill.cast.PlayerKey;
|
||||
import net.Indyuce.mmocore.skill.cast.SkillCastingHandler;
|
||||
import org.bukkit.GameMode;
|
||||
@ -81,7 +82,8 @@ public class SkillBar implements Listener {
|
||||
*/
|
||||
if (slot >= 0 && getCaster().hasSkillBound(slot)) {
|
||||
PlayerMetadata caster = getCaster().getMMOPlayerData().getStatMap().cache(EquipmentSlot.MAIN_HAND);
|
||||
getCaster().getBoundSkill(slot).toCastable(getCaster()).cast(new TriggerMetadata(caster, null, null));
|
||||
int delay= getCaster().getBoundSkill(slot).getDelay(getCaster());
|
||||
getCaster().getBoundSkill(slot).toCastable(getCaster()).cast(new TriggerMetadata(caster, null, null),delay);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -82,7 +82,8 @@ public class SkillScroller implements Listener {
|
||||
|
||||
CustomSkillCastingHandler casting = (CustomSkillCastingHandler) playerData.getSkillCasting();
|
||||
PlayerMetadata caster = playerData.getMMOPlayerData().getStatMap().cache(EquipmentSlot.MAIN_HAND);
|
||||
playerData.getBoundSkill(casting.index).toCastable(playerData).cast(new TriggerMetadata(caster, null, null));
|
||||
playerData.getBoundSkill(casting.index).toCastable(playerData).cast(new TriggerMetadata(caster, null, null)
|
||||
, playerData.getBoundSkill(casting.index).getDelay(playerData));
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user