mirror of
https://github.com/Auxilor/EcoSkills.git
synced 2026-01-02 05:46:57 +00:00
Optimised skill descriptions
This commit is contained in:
@@ -43,19 +43,19 @@ class EffectBountifulHarvest: Effect(
|
||||
|
||||
val level = player.getEffectLevel(this)
|
||||
|
||||
val chance = config.getDouble("chance-per-level") * level
|
||||
val chance = getChance(level)
|
||||
|
||||
val base = (chance / 100).toInt()
|
||||
val multiplier = getMultiplier(level)
|
||||
|
||||
if (base >= 1) {
|
||||
for (i in 1..base) {
|
||||
if (multiplier >= 2) {
|
||||
for (i in 2..multiplier) {
|
||||
DropQueue(player)
|
||||
.addItems(*event.items.map { item -> item.itemStack })
|
||||
.push()
|
||||
}
|
||||
}
|
||||
|
||||
if (NumberUtils.randFloat(0.0, 100.0) < chance - (base * 100)) {
|
||||
if (NumberUtils.randFloat(0.0, 100.0) < chance) {
|
||||
DropQueue(player)
|
||||
.addItems(*event.items.map { item -> item.itemStack })
|
||||
.push()
|
||||
@@ -65,12 +65,23 @@ class EffectBountifulHarvest: Effect(
|
||||
private fun getMultiplier(level: Int): Int {
|
||||
val chance = config.getDouble("chance-per-level") * level
|
||||
|
||||
return (chance / 100).toInt() + 1
|
||||
var add = 2
|
||||
|
||||
if (chance % 100 == 0.0) {
|
||||
add = 1
|
||||
}
|
||||
|
||||
return (chance / 100).toInt() + add
|
||||
}
|
||||
|
||||
private fun getChance(level: Int): Double {
|
||||
val chance = config.getDouble("chance-per-level") * level
|
||||
var chance = config.getDouble("chance-per-level") * level
|
||||
|
||||
return chance - ((getMultiplier(level) - 1) * 100)
|
||||
chance -= ((getMultiplier(level) - 2) * 100)
|
||||
if (chance == 0.0) {
|
||||
chance = 100.0
|
||||
}
|
||||
|
||||
return chance
|
||||
}
|
||||
}
|
||||
@@ -8,10 +8,10 @@ import com.willfp.eco.util.StringUtils
|
||||
import com.willfp.ecoskills.EcoSkillsPlugin
|
||||
import com.willfp.ecoskills.SkillObject
|
||||
import com.willfp.ecoskills.config.SkillConfig
|
||||
import com.willfp.ecoskills.effects.Effect
|
||||
import com.willfp.ecoskills.effects.Effects
|
||||
import com.willfp.ecoskills.getSkillLevel
|
||||
import com.willfp.ecoskills.stats.Stats
|
||||
import org.bukkit.Effect
|
||||
import org.bukkit.NamespacedKey
|
||||
import org.bukkit.entity.Player
|
||||
import org.bukkit.event.Listener
|
||||
@@ -118,7 +118,7 @@ abstract class Skill(
|
||||
var msg = string
|
||||
|
||||
for (effect in Effects.values()) {
|
||||
msg = msg.replace("%ecoskills_${effect.id}_description", effect.getDescription(level))
|
||||
msg = msg.replace("%ecoskills_${effect.id}_description%", effect.getDescription(level))
|
||||
}
|
||||
messages.add(
|
||||
StringUtils.format(
|
||||
@@ -146,14 +146,16 @@ abstract class Skill(
|
||||
for (string in this.config.getStrings("rewards.progression-lore.$highestLevel", false)) {
|
||||
var s = string;
|
||||
|
||||
for (skillObject in Effects.values() union Stats.values()) {
|
||||
for (levelUpReward in this.getLevelUpRewards()) {
|
||||
val skillObject = levelUpReward.obj
|
||||
val objLevel = this.getCumulativeLevelUpReward(skillObject, level)
|
||||
|
||||
s = s.replace("%ecoskills_${skillObject.id}%", objLevel.toString())
|
||||
s = s.replace("%ecoskills_${skillObject.id}_numeral%", NumberUtils.toNumeral(objLevel))
|
||||
}
|
||||
for (effect in Effects.values()) {
|
||||
s = s.replace("%ecoskills_${effect.id}_description%", effect.getDescription(level))
|
||||
|
||||
if (skillObject is Effect) {
|
||||
s = s.replace("%ecoskills_${skillObject.id}_description%", skillObject.getDescription(level))
|
||||
}
|
||||
}
|
||||
|
||||
lore.add(StringUtils.format(s, player))
|
||||
|
||||
@@ -368,7 +368,7 @@ effects:
|
||||
# Since this chance will be called many times, it would be best to have this be low.
|
||||
chance-per-level: 0.1
|
||||
efficient_brewing:
|
||||
description: "&8Potions take &a%seconds_less%&8 seconds to brew"
|
||||
description: "&8Potions take &a%seconds_less%&8 less seconds to brew"
|
||||
|
||||
# The ticks faster brewing time for each level (default is 400)
|
||||
ticks-less-per-level: 6
|
||||
|
||||
Reference in New Issue
Block a user