mirror of
https://gitlab.com/phoenix-dvpmt/mmocore.git
synced 2024-11-28 00:55:29 +01:00
Merge branch 'master' of https://git.lumine.io/mythiccraft/mmocore
This commit is contained in:
commit
e9eed241e0
@ -755,9 +755,9 @@ public class PlayerData extends OfflinePlayerData {
|
|||||||
return new SkillResult(this, skill, CancelReason.OTHER);
|
return new SkillResult(this, skill, CancelReason.OTHER);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* skill, mana and cooldown requirements are all calculated in the
|
* skill, mana stamina aand cooldown requirements are all calculated in the
|
||||||
* SkillResult instances. this cast(SkillResult) method only applies
|
* SkillResult instances. this cast(SkillResult) method only applies
|
||||||
* cooldown, reduces mana and send messages
|
* cooldown, reduces mana and/or stamina and send messages
|
||||||
*/
|
*/
|
||||||
SkillResult cast = skill.getSkill().whenCast(this, skill);
|
SkillResult cast = skill.getSkill().whenCast(this, skill);
|
||||||
if (!cast.isSuccessful()) {
|
if (!cast.isSuccessful()) {
|
||||||
@ -768,6 +768,9 @@ public class PlayerData extends OfflinePlayerData {
|
|||||||
if (cast.getCancelReason() == CancelReason.MANA)
|
if (cast.getCancelReason() == CancelReason.MANA)
|
||||||
MMOCore.plugin.configManager.getSimpleMessage("casting.no-mana").send(getPlayer());
|
MMOCore.plugin.configManager.getSimpleMessage("casting.no-mana").send(getPlayer());
|
||||||
|
|
||||||
|
if (cast.getCancelReason() == CancelReason.STAMINA)
|
||||||
|
MMOCore.plugin.configManager.getSimpleMessage("casting.no-stamina").send(getPlayer());
|
||||||
|
|
||||||
if (cast.getCancelReason() == CancelReason.COOLDOWN)
|
if (cast.getCancelReason() == CancelReason.COOLDOWN)
|
||||||
MMOCore.plugin.configManager.getSimpleMessage("casting.on-cooldown").send(getPlayer());
|
MMOCore.plugin.configManager.getSimpleMessage("casting.on-cooldown").send(getPlayer());
|
||||||
}
|
}
|
||||||
@ -783,6 +786,7 @@ public class PlayerData extends OfflinePlayerData {
|
|||||||
|
|
||||||
skillData.setLastCast(cast.getSkill(), System.currentTimeMillis() - (long) flatCooldownReduction);
|
skillData.setLastCast(cast.getSkill(), System.currentTimeMillis() - (long) flatCooldownReduction);
|
||||||
giveMana(-cast.getManaCost());
|
giveMana(-cast.getManaCost());
|
||||||
|
giveStamina(-cast.getStaminaCost());
|
||||||
}
|
}
|
||||||
|
|
||||||
PlayerPostCastSkillEvent postEvent = new PlayerPostCastSkillEvent(this, skill, cast, true);
|
PlayerPostCastSkillEvent postEvent = new PlayerPostCastSkillEvent(this, skill, cast, true);
|
||||||
|
@ -8,7 +8,7 @@ import net.Indyuce.mmocore.comp.flags.FlagPlugin.CustomFlag;
|
|||||||
public class SkillResult {
|
public class SkillResult {
|
||||||
private final SkillInfo skill;
|
private final SkillInfo skill;
|
||||||
private final int level;
|
private final int level;
|
||||||
private final double mana, cooldown;
|
private final double mana, cooldown, stamina;
|
||||||
|
|
||||||
private CancelReason cancelReason;
|
private CancelReason cancelReason;
|
||||||
|
|
||||||
@ -18,12 +18,14 @@ public class SkillResult {
|
|||||||
level = data.getSkillLevel(skill.getSkill());
|
level = data.getSkillLevel(skill.getSkill());
|
||||||
cooldown = (skill.getSkill().hasModifier("cooldown") ? data.getSkillData().getCooldown(skill) : 0);
|
cooldown = (skill.getSkill().hasModifier("cooldown") ? data.getSkillData().getCooldown(skill) : 0);
|
||||||
mana = (skill.getSkill().hasModifier("mana") ? skill.getModifier("mana", level) : 0);
|
mana = (skill.getSkill().hasModifier("mana") ? skill.getModifier("mana", level) : 0);
|
||||||
|
stamina = (skill.getSkill().hasModifier("stamina") ? skill.getModifier("stamina", level) : 0);
|
||||||
cancelReason = !data.hasSkillUnlocked(skill) ? CancelReason.LOCKED
|
cancelReason = !data.hasSkillUnlocked(skill) ? CancelReason.LOCKED
|
||||||
: cooldown > 0 ? CancelReason.COOLDOWN
|
: cooldown > 0 ? CancelReason.COOLDOWN
|
||||||
: mana > data.getMana() ? CancelReason.MANA
|
: mana > data.getMana() ? CancelReason.MANA
|
||||||
: !MMOCore.plugin.flagPlugin.isFlagAllowed(data.getPlayer(), CustomFlag.SKILLS)
|
: stamina > data.getStamina() ? CancelReason.STAMINA
|
||||||
? CancelReason.FLAG
|
: !MMOCore.plugin.flagPlugin.isFlagAllowed(data.getPlayer(), CustomFlag.SKILLS)
|
||||||
: null;
|
? CancelReason.FLAG
|
||||||
|
: null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SkillResult(PlayerData data, SkillInfo skill, CancelReason reason) {
|
public SkillResult(PlayerData data, SkillInfo skill, CancelReason reason) {
|
||||||
@ -33,6 +35,7 @@ public class SkillResult {
|
|||||||
level = data.getSkillLevel(skill.getSkill());
|
level = data.getSkillLevel(skill.getSkill());
|
||||||
cooldown = skill.getSkill().hasModifier("cooldown") ? data.getSkillData().getCooldown(skill) : 0;
|
cooldown = skill.getSkill().hasModifier("cooldown") ? data.getSkillData().getCooldown(skill) : 0;
|
||||||
mana = skill.getSkill().hasModifier("mana") ? skill.getModifier("mana", level) : 0;
|
mana = skill.getSkill().hasModifier("mana") ? skill.getModifier("mana", level) : 0;
|
||||||
|
stamina = (skill.getSkill().hasModifier("stamina") ? skill.getModifier("stamina", level) : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Skill getSkill() {
|
public Skill getSkill() {
|
||||||
@ -47,6 +50,10 @@ public class SkillResult {
|
|||||||
return level;
|
return level;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public double getStaminaCost() {
|
||||||
|
return stamina;
|
||||||
|
}
|
||||||
|
|
||||||
public double getManaCost() {
|
public double getManaCost() {
|
||||||
return mana;
|
return mana;
|
||||||
}
|
}
|
||||||
@ -83,6 +90,9 @@ public class SkillResult {
|
|||||||
// not enough mana
|
// not enough mana
|
||||||
MANA,
|
MANA,
|
||||||
|
|
||||||
|
// not enough stamina
|
||||||
|
STAMINA,
|
||||||
|
|
||||||
// skill still on cooldown
|
// skill still on cooldown
|
||||||
COOLDOWN,
|
COOLDOWN,
|
||||||
|
|
||||||
|
@ -57,6 +57,7 @@ casting:
|
|||||||
split: '&7 &7 - &7 '
|
split: '&7 &7 - &7 '
|
||||||
no-longer: '%&cYou cancelled skill casting.'
|
no-longer: '%&cYou cancelled skill casting.'
|
||||||
no-mana: '&cYou do not have enough mana!'
|
no-mana: '&cYou do not have enough mana!'
|
||||||
|
no-stamina: '&cYou do not have enough stamina!'
|
||||||
on-cooldown: '&cThis skill is on cooldown.'
|
on-cooldown: '&cThis skill is on cooldown.'
|
||||||
|
|
||||||
# Combat Log
|
# Combat Log
|
||||||
|
Loading…
Reference in New Issue
Block a user