mirror of
https://github.com/Auxilor/EcoSkills.git
synced 2026-01-02 13:56:38 +00:00
Added endangering effect
This commit is contained in:
@@ -4,6 +4,7 @@ import com.google.common.collect.ImmutableSet;
|
||||
import com.willfp.eco.core.config.updating.ConfigUpdater;
|
||||
import com.willfp.ecoskills.effects.effects.EffectAcceleratedEscape;
|
||||
import com.willfp.ecoskills.effects.effects.EffectBountifulHarvest;
|
||||
import com.willfp.ecoskills.effects.effects.EffectEndangering;
|
||||
import com.willfp.ecoskills.effects.effects.EffectInfernalResistance;
|
||||
import com.willfp.ecoskills.effects.effects.EffectCraftsmanship;
|
||||
import com.willfp.ecoskills.effects.effects.EffectDazzle;
|
||||
@@ -54,6 +55,7 @@ public class Effects {
|
||||
public static final Effect INFERNAL_RESISTANCE = new EffectInfernalResistance();
|
||||
public static final Effect DAZZLE = new EffectDazzle();
|
||||
public static final Effect STRONG_IMPACT = new EffectStrongImpact();
|
||||
public static final Effect ENDANGERING = new EffectEndangering();
|
||||
|
||||
@ApiStatus.Internal
|
||||
public static void registerNewEffect(@NotNull final Effect effect) {
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
package com.willfp.ecoskills.effects.effects
|
||||
|
||||
import com.willfp.eco.util.NumberUtils
|
||||
import com.willfp.ecoskills.effects.Effect
|
||||
import com.willfp.ecoskills.getEffectLevel
|
||||
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 EffectEndangering : Effect(
|
||||
"endangering"
|
||||
) {
|
||||
override fun formatDescription(string: String, level: Int): String {
|
||||
return string.replace("%chance%", NumberUtils.format(config.getDouble("chance-per-level") * level))
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
||||
fun handle(event: EntityDamageByEntityEvent) {
|
||||
var player = event.damager
|
||||
val victim = event.entity
|
||||
|
||||
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.getEffectLevel(this)
|
||||
|
||||
if (NumberUtils.randFloat(0.0, 100.0) >= config.getDouble("chance-per-level") * level) {
|
||||
return
|
||||
}
|
||||
|
||||
this.plugin.run {
|
||||
victim.noDamageTicks = 0
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -139,4 +139,9 @@ strong_impact:
|
||||
# The damage multiplier
|
||||
multiplier: 3
|
||||
# The chance to deal 3x damage, per level
|
||||
chance-per-level: 0.2
|
||||
chance-per-level: 0.2
|
||||
endangering:
|
||||
description: "&a%chance%%&8 chance to remove your opponents invulnerability frame"
|
||||
|
||||
# The chance as a percentage
|
||||
chance-per-level: 3
|
||||
@@ -19,6 +19,8 @@ gui:
|
||||
- " %ecoskills_dazzle_description%"
|
||||
- "&8» &r&6Strong Impact %ecoskills_strong_impact_numeral%"
|
||||
- " %ecoskills_strong_impact_description%"
|
||||
- "&8» &r&6Endangering %ecoskills_endangering_numeral%"
|
||||
- " %ecoskills_endangering_description%"
|
||||
|
||||
rewards:
|
||||
# The actual rewards to be given
|
||||
@@ -28,6 +30,7 @@ rewards:
|
||||
- "serrated_strikes::1"
|
||||
- "dazzle::1"
|
||||
- "strong_impact::1:10:100"
|
||||
- "endangering::1:20:100"
|
||||
|
||||
# The chat messages to send on level up
|
||||
chat-messages:
|
||||
@@ -54,6 +57,17 @@ rewards:
|
||||
- " %ecoskills_dazzle_description%"
|
||||
- " &8» &r&6Strong Impact %ecoskills_strong_impact_numeral%"
|
||||
- " %ecoskills_strong_impact_description%"
|
||||
20:
|
||||
- " &8» &r&f+2 %ecoskills_strength_name%"
|
||||
- " &8» &r&f+1 %ecoskills_ferocity_name%"
|
||||
- " &8» &r&6Serrated Strikes %ecoskills_serrated_strikes_numeral%"
|
||||
- " %ecoskills_serrated_strikes_description%"
|
||||
- " &8» &r&6Dazzle %ecoskills_dazzle_numeral%"
|
||||
- " %ecoskills_dazzle_description%"
|
||||
- " &8» &r&6Strong Impact %ecoskills_strong_impact_numeral%"
|
||||
- " %ecoskills_strong_impact_description%"
|
||||
- " &8» &r&6Endangering %ecoskills_endangering_numeral%"
|
||||
- " %ecoskills_endangering_description%"
|
||||
|
||||
# The lore to show in the levels gui
|
||||
progression-lore:
|
||||
@@ -81,6 +95,17 @@ rewards:
|
||||
- " %ecoskills_dazzle_description%"
|
||||
- " &8» &r&6Strong Impact %ecoskills_strong_impact_numeral%"
|
||||
- " %ecoskills_strong_impact_description%"
|
||||
20:
|
||||
- " &8» &r&f+2 %ecoskills_strength_name%"
|
||||
- " &8» &r&f+1 %ecoskills_ferocity_name%"
|
||||
- " &8» &r&6Serrated Strikes %ecoskills_serrated_strikes_numeral%"
|
||||
- " %ecoskills_serrated_strikes_description%"
|
||||
- " &8» &r&6Dazzle %ecoskills_dazzle_numeral%"
|
||||
- " %ecoskills_dazzle_description%"
|
||||
- " &8» &r&6Strong Impact %ecoskills_strong_impact_numeral%"
|
||||
- " %ecoskills_strong_impact_description%"
|
||||
- " &8» &r&6Endangering %ecoskills_endangering_numeral%"
|
||||
- " %ecoskills_endangering_description%"
|
||||
|
||||
|
||||
# The experience to give for each hp of a killed enemy
|
||||
|
||||
Reference in New Issue
Block a user