Add Blitzcrank, Ninja and Trident kits
Add three new kits (Blitzcrank, Ninja, Trident) and register them in SpeedHG. Each kit includes full ability implementations (hook/stun/ult for Blitzcrank, teleport/smoke for Ninja, dive/parry for Trident) with their internal cooldowns, tasks and item handling. Update AbilityUtils.createBeam signature/logic (now accepts Player and improved beam stepping/hit detection) and adjust VenomKit to pass the player to createBeam. Extend en_US.yml with translations for the new kits and fix a few markup strings.
This commit is contained in:
@@ -15,6 +15,7 @@ object AbilityUtils {
|
||||
private val plugin = SpeedHG.instance
|
||||
|
||||
fun createBeam(
|
||||
player: Player,
|
||||
startLocation: Location,
|
||||
direction: Vector,
|
||||
particle: Particle,
|
||||
@@ -22,37 +23,36 @@ object AbilityUtils {
|
||||
step: Double,
|
||||
onHit: (Player) -> Unit
|
||||
) {
|
||||
val normalizedDirection = direction.normalize()
|
||||
val stepVector = direction.clone().normalize().multiply( step )
|
||||
val currentLocation = startLocation.clone().add(stepVector.clone().normalize().multiply( 1.0 ))
|
||||
|
||||
object : BukkitRunnable()
|
||||
{
|
||||
object : BukkitRunnable() {
|
||||
var traveledDistance = 0.0
|
||||
var currentLocation = startLocation.clone()
|
||||
|
||||
override fun run()
|
||||
{
|
||||
if ( traveledDistance >= range)
|
||||
if ( traveledDistance >= range )
|
||||
{
|
||||
this.cancel()
|
||||
return
|
||||
}
|
||||
|
||||
currentLocation.world.spawnParticle( particle, currentLocation, 5, 0.0, 0.0, 0.0, 0.0 )
|
||||
currentLocation.world.spawnParticle( particle, currentLocation, 3, 0.0, 0.0, 0.0, 0.0 )
|
||||
|
||||
val nearestPlayer = currentLocation.world.getNearbyEntities( currentLocation, 0.5, 0.5, 0.5 )
|
||||
.filterIsInstance<Player>().minByOrNull { it.location.distance( currentLocation ) }
|
||||
val hitEntities = currentLocation.world.getNearbyEntities( currentLocation, 0.5, 0.5, 0.5 ) {
|
||||
it is Player && it.uniqueId != player.uniqueId && it.gameMode != GameMode.SPECTATOR
|
||||
}
|
||||
|
||||
if ( nearestPlayer != null )
|
||||
if ( hitEntities.isNotEmpty() )
|
||||
{
|
||||
onHit( nearestPlayer )
|
||||
onHit( hitEntities.first() as Player )
|
||||
this.cancel()
|
||||
return
|
||||
}
|
||||
|
||||
currentLocation.add(normalizedDirection.multiply( step ))
|
||||
currentLocation.add( stepVector )
|
||||
traveledDistance += step
|
||||
}
|
||||
|
||||
}.runTaskTimer( plugin, 0L, 1L )
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user