mirror of
https://github.com/Auxilor/EcoSkills.git
synced 2026-01-02 05:46:57 +00:00
Added ferocity stat
This commit is contained in:
@@ -5,6 +5,7 @@ import com.willfp.eco.core.config.updating.ConfigUpdater;
|
||||
import com.willfp.ecoskills.stats.stats.StatCritChance;
|
||||
import com.willfp.ecoskills.stats.stats.StatCritDamage;
|
||||
import com.willfp.ecoskills.stats.stats.StatDefense;
|
||||
import com.willfp.ecoskills.stats.stats.StatFerocity;
|
||||
import com.willfp.ecoskills.stats.stats.StatSpeed;
|
||||
import com.willfp.ecoskills.stats.stats.StatStrength;
|
||||
import com.willfp.ecoskills.stats.stats.StatWisdom;
|
||||
@@ -29,6 +30,7 @@ public class Stats {
|
||||
public static final Stat CRIT_DAMAGE = new StatCritDamage();
|
||||
public static final Stat SPEED = new StatSpeed();
|
||||
public static final Stat WISDOM = new StatWisdom();
|
||||
public static final Stat FEROCITY = new StatFerocity();
|
||||
|
||||
@ApiStatus.Internal
|
||||
public static void registerNewStat(@NotNull final Stat skill) {
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.willfp.ecoskills.stats.stats
|
||||
|
||||
import com.willfp.eco.util.NumberUtils
|
||||
import com.willfp.ecoskills.getStatLevel
|
||||
import com.willfp.ecoskills.isCrit
|
||||
import com.willfp.ecoskills.stats.Stat
|
||||
import com.willfp.ecoskills.stats.Stats
|
||||
import org.bukkit.entity.LivingEntity
|
||||
import org.bukkit.entity.Player
|
||||
import org.bukkit.entity.Projectile
|
||||
import org.bukkit.event.EventHandler
|
||||
import org.bukkit.event.EventPriority
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent
|
||||
|
||||
class StatFerocity : Stat(
|
||||
"ferocity"
|
||||
) {
|
||||
@EventHandler(priority = EventPriority.LOW)
|
||||
fun handle(event: EntityDamageByEntityEvent) {
|
||||
var player = event.damager
|
||||
val victim = event.entity
|
||||
val entity = event.damager
|
||||
|
||||
if (victim !is LivingEntity) {
|
||||
return
|
||||
}
|
||||
|
||||
if (player is Projectile) {
|
||||
if (player.shooter !is Player) {
|
||||
return
|
||||
} else {
|
||||
player = player.shooter as Player
|
||||
}
|
||||
}
|
||||
|
||||
if (player !is Player) {
|
||||
return
|
||||
}
|
||||
|
||||
val level = player.getStatLevel(this)
|
||||
|
||||
if (NumberUtils.randFloat(0.0, 100.0) >= this.config.getDouble("chance-per-level") * level) {
|
||||
return
|
||||
}
|
||||
|
||||
this.plugin.run {
|
||||
victim.noDamageTicks = 0
|
||||
victim.damage(event.finalDamage, entity)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -296,6 +296,9 @@ stats:
|
||||
wisdom:
|
||||
# The percent more xp to gain from orbs for each level of the stat.
|
||||
percent-more-xp-gain: 1
|
||||
ferocity:
|
||||
# The percent chance to deal damage twice
|
||||
chance-per-level: 0.5
|
||||
|
||||
effects:
|
||||
bountiful_harvest:
|
||||
|
||||
@@ -29,3 +29,5 @@ stats:
|
||||
name: "(ffe6✦ Speed"
|
||||
wisdom:
|
||||
name: "*f566✎ Wisdom"
|
||||
ferocity:
|
||||
name: "b0000⫽ Ferocity"
|
||||
|
||||
@@ -10,7 +10,7 @@ gui:
|
||||
lore:
|
||||
- "&fImproves Stats:"
|
||||
- "&8» &r%ecoskills_strength_name%"
|
||||
- "&8» &r%ecoskills_crit_damage_name%"
|
||||
- "&8» &r%ecoskills_ferocity_name%"
|
||||
- "&f"
|
||||
- "&fEffects:"
|
||||
- "&8» &r&6Serrated Strikes %ecoskills_serrated_strikes_numeral%"
|
||||
@@ -19,21 +19,28 @@ rewards:
|
||||
# The actual rewards to be given
|
||||
rewards:
|
||||
- "strength::2"
|
||||
- "crit_damage::1"
|
||||
- "ferocity::1:15:100"
|
||||
- "serrated_strikes::1"
|
||||
|
||||
# The chat messages to send on level up
|
||||
chat-messages:
|
||||
1:
|
||||
- " &8» &r&f+2 %ecoskills_strength_name%"
|
||||
- " &8» &r&f+1 %ecoskills_crit_damage_name%"
|
||||
- " &8» &r&6Serrated Strikes %ecoskills_serrated_strikes_numeral%"
|
||||
15:
|
||||
- " &8» &r&f+2 %ecoskills_strength_name%"
|
||||
- " &8» &r&f+1 %ecoskills_ferocity_name%"
|
||||
- " &8» &r&6Serrated Strikes %ecoskills_serrated_strikes_numeral%"
|
||||
|
||||
# The lore to show in the levels gui
|
||||
progression-lore:
|
||||
1:
|
||||
- " &8» &r&f+2 %ecoskills_strength_name%"
|
||||
- " &8» &r&f+1 %ecoskills_crit_damage_name%"
|
||||
- " &8» &r&f+1 %ecoskills_ferocity_name%"
|
||||
- " &8» &r&6Serrated Strikes %ecoskills_serrated_strikes_numeral%"
|
||||
15:
|
||||
- " &8» &r&f+2 %ecoskills_strength_name%"
|
||||
- " &8» &r&f+1 %ecoskills_ferocity_name%"
|
||||
- " &8» &r&6Serrated Strikes %ecoskills_serrated_strikes_numeral%"
|
||||
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ gui:
|
||||
lore:
|
||||
- "&fImproves Stats:"
|
||||
- "&8» &r%ecoskills_defense_name%"
|
||||
- "&8» &r%ecoskills_ferocity_name%"
|
||||
- "&f"
|
||||
- "&fEffects:"
|
||||
- "&8» &r&6Versatile Tools %ecoskills_versatile_tools_numeral%"
|
||||
@@ -18,18 +19,27 @@ rewards:
|
||||
# The actual rewards to be given
|
||||
rewards:
|
||||
- "defense::2"
|
||||
- "ferocity::1:15:100"
|
||||
- "versatile_tools::1"
|
||||
|
||||
# The chat messages to send on level up
|
||||
chat-messages:
|
||||
1:
|
||||
- " &8» &r&f+1 %ecoskills_defense_name%"
|
||||
- " &8» &r&f+2 %ecoskills_defense_name%"
|
||||
- " &8» &r&6Versatile Tools %ecoskills_versatile_tools_numeral%"
|
||||
15:
|
||||
- " &8» &r&f+2 %ecoskills_defense_name%"
|
||||
- " &8» &r&f+1 %ecoskills_ferocity_name%"
|
||||
- " &8» &r&6Versatile Tools %ecoskills_versatile_tools_numeral%"
|
||||
|
||||
# The lore to show in the levels gui
|
||||
progression-lore:
|
||||
1:
|
||||
- " &8» &r&f+1 %ecoskills_defense_name%"
|
||||
- " &8» &r&f+2 %ecoskills_defense_name%"
|
||||
- " &8» &r&6Versatile Tools %ecoskills_versatile_tools_numeral%"
|
||||
15:
|
||||
- " &8» &r&f+2 %ecoskills_defense_name%"
|
||||
- " &8» &r&f+1 %ecoskills_ferocity_name%"
|
||||
- " &8» &r&6Versatile Tools %ecoskills_versatile_tools_numeral%"
|
||||
|
||||
# The xp rewards for each block type
|
||||
|
||||
@@ -10,6 +10,7 @@ gui:
|
||||
lore:
|
||||
- "&fImproves Stats:"
|
||||
- "&8» &r%ecoskills_strength_name%"
|
||||
- "&8» &r%ecoskills_crit_damage_name%"
|
||||
- "&f"
|
||||
- "&fEffects:"
|
||||
- "&8» &r&6Craftsmanship %ecoskills_craftsmanship_numeral%"
|
||||
@@ -18,6 +19,7 @@ rewards:
|
||||
# The actual rewards to be given
|
||||
rewards:
|
||||
- "strength::2"
|
||||
- "crit_damage::1"
|
||||
- "craftsmanship::1"
|
||||
|
||||
# The chat messages to send on level up
|
||||
|
||||
Reference in New Issue
Block a user