mirror of
https://github.com/Auxilor/EcoSkills.git
synced 2026-01-03 06:12:21 +00:00
Added dazzle and strong impact effects
This commit is contained in:
@@ -6,6 +6,7 @@ import com.willfp.ecoskills.effects.effects.EffectAcceleratedEscape;
|
||||
import com.willfp.ecoskills.effects.effects.EffectBountifulHarvest;
|
||||
import com.willfp.ecoskills.effects.effects.EffectBravery;
|
||||
import com.willfp.ecoskills.effects.effects.EffectCraftsmanship;
|
||||
import com.willfp.ecoskills.effects.effects.EffectDazzle;
|
||||
import com.willfp.ecoskills.effects.effects.EffectDodging;
|
||||
import com.willfp.ecoskills.effects.effects.EffectEfficientBrewing;
|
||||
import com.willfp.ecoskills.effects.effects.EffectEyeOfTheDepths;
|
||||
@@ -51,6 +52,7 @@ public class Effects {
|
||||
public static final Effect ACCELERATED_ESCAPE = new EffectAcceleratedEscape();
|
||||
public static final Effect BRAVERY = new EffectBravery();
|
||||
public static final Effect INFERNAL_RESISTANCE = new EffectInfernalResistance();
|
||||
public static final Effect DAZZLE = new EffectDazzle();
|
||||
|
||||
@ApiStatus.Internal
|
||||
public static void registerNewEffect(@NotNull final Effect effect) {
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.willfp.ecoskills.effects.effects
|
||||
|
||||
import com.willfp.eco.core.scheduling.RunnableTask
|
||||
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
|
||||
import org.bukkit.potion.PotionEffect
|
||||
import org.bukkit.potion.PotionEffectType
|
||||
import org.bukkit.util.Vector
|
||||
import java.util.concurrent.atomic.AtomicInteger
|
||||
|
||||
|
||||
class EffectDazzle : Effect(
|
||||
"dazzle"
|
||||
) {
|
||||
override fun formatDescription(string: String, level: Int): String {
|
||||
return string.replace("%chance%", NumberUtils.format(config.getDouble("chance-per-level") * level))
|
||||
.replace("%seconds%", NumberUtils.format(((config.getInt("ticks-per-level") * level) + config.getInt("base-ticks")) / 20.0))
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
||||
fun handle(event: EntityDamageByEntityEvent) {
|
||||
var player = event.damager
|
||||
|
||||
if (player is Projectile) {
|
||||
if (player.shooter !is Player) {
|
||||
return
|
||||
} else {
|
||||
player = player.shooter as Player
|
||||
}
|
||||
}
|
||||
|
||||
if (player !is Player) {
|
||||
return
|
||||
}
|
||||
|
||||
val victim = event.entity
|
||||
|
||||
if (victim !is LivingEntity) {
|
||||
return
|
||||
}
|
||||
|
||||
val level = player.getEffectLevel(this)
|
||||
|
||||
if (NumberUtils.randFloat(0.0, 100.0) >= config.getDouble("chance-per-level") * level) {
|
||||
return
|
||||
}
|
||||
|
||||
val duration = (config.getInt("ticks-per-level") * level) + config.getInt("base-ticks")
|
||||
|
||||
victim.setVelocity(Vector(0, 0, 0))
|
||||
victim.addPotionEffect(PotionEffect(PotionEffectType.CONFUSION, duration, level))
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ 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
|
||||
@@ -21,12 +22,20 @@ class EffectSerratedStrikes : Effect(
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
||||
fun handle(event: EntityDamageByEntityEvent) {
|
||||
val player = event.damager
|
||||
val victim = event.entity
|
||||
var player = event.damager
|
||||
|
||||
if (player is Projectile) {
|
||||
if (player.shooter !is Player) {
|
||||
return
|
||||
} else {
|
||||
player = player.shooter as Player
|
||||
}
|
||||
}
|
||||
|
||||
if (player !is Player) {
|
||||
return
|
||||
}
|
||||
val victim = event.entity
|
||||
|
||||
if (victim !is LivingEntity) {
|
||||
return
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.willfp.ecoskills.effects.effects
|
||||
|
||||
import com.willfp.eco.core.scheduling.RunnableTask
|
||||
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
|
||||
import java.util.concurrent.atomic.AtomicInteger
|
||||
|
||||
|
||||
class EffectStrongImpact : Effect(
|
||||
"strong_impact"
|
||||
) {
|
||||
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
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
event.damage = event.damage * config.getDouble("multiplier")
|
||||
}
|
||||
}
|
||||
@@ -122,4 +122,21 @@ infernal_resistance:
|
||||
bravery:
|
||||
description: "&8Take &a%chance%%&8 less damage from bosses"
|
||||
|
||||
percent-less-per-level: 1.5
|
||||
# The percent less damage to take
|
||||
percent-less-per-level: 1.5
|
||||
dazzle:
|
||||
description: "&a%chance%%&8 chance to give your opponent nausea for &a%seconds%&8 seconds"
|
||||
|
||||
# The base ticks to give nausea for
|
||||
base-ticks: 18
|
||||
# The extra ticks to give nausea for per level
|
||||
ticks-per-level: 2
|
||||
# The chance to give nausea per level, as a percentage
|
||||
chance-per-level: 1.5
|
||||
strong_impact:
|
||||
description: "&a%chance%%&8 chance to deal &a3x&8 damage"
|
||||
|
||||
# The damage multiplier
|
||||
multiplier: 3
|
||||
# The chance to deal 3x damage, per level
|
||||
chance-per-level: 0.2
|
||||
@@ -15,6 +15,10 @@ gui:
|
||||
- "&fEffects:"
|
||||
- "&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%"
|
||||
|
||||
rewards:
|
||||
# The actual rewards to be given
|
||||
@@ -22,6 +26,8 @@ rewards:
|
||||
- "strength::2"
|
||||
- "ferocity::1:15:100"
|
||||
- "serrated_strikes::1"
|
||||
- "dazzle::1"
|
||||
- "strong_impact::1:10:100"
|
||||
|
||||
# The chat messages to send on level up
|
||||
chat-messages:
|
||||
@@ -29,11 +35,25 @@ rewards:
|
||||
- " &8» &r&f+2 %ecoskills_strength_name%"
|
||||
- " &8» &r&6Serrated Strikes %ecoskills_serrated_strikes_numeral%"
|
||||
- " %ecoskills_serrated_strikes_description%"
|
||||
- " &8» &r&6Dazzle %ecoskills_dazzle_numeral%"
|
||||
- " %ecoskills_dazzle_description%"
|
||||
10:
|
||||
- " &8» &r&f+2 %ecoskills_strength_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%"
|
||||
15:
|
||||
- " &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%"
|
||||
|
||||
# The lore to show in the levels gui
|
||||
progression-lore:
|
||||
@@ -42,11 +62,25 @@ rewards:
|
||||
- " &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%"
|
||||
10:
|
||||
- " &8» &r&f+2 %ecoskills_strength_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%"
|
||||
15:
|
||||
- " &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%"
|
||||
|
||||
|
||||
# The experience to give for each hp of a killed enemy
|
||||
|
||||
Reference in New Issue
Block a user