DemonSkills/src/main/java/com/yaohun/demonskills/skills/Skill_牵魂法阵.java
2025-07-14 13:03:15 +08:00

112 lines
6.1 KiB
Java

package com.yaohun.demonskills.skills;
import com.yaohun.demonskills.SkillsMain;
import com.yaohun.demonskills.component.CdTimeComponent;
import com.yaohun.demonskills.component.DelayComponent;
import com.yaohun.demonskills.component.PotionEffectComponent;
import com.yaohun.demonskills.component.projectile.ProjectileAdvanceComponent;
import com.yaohun.demonskills.component.projectile.ProjectilePullComponent;
import com.yaohun.demonskills.component.projectile.ProjectileVectorComponent;
import com.yaohun.demonskills.component.SoundComponent;
import com.yaohun.demonskills.component.damage.DamageComponent;
import com.yaohun.demonskills.component.dragoncore.ParticleSpawnCommponent;
import com.yaohun.demonskills.component.dragoncore.PlayerAnimationComponent;
import com.yaohun.demonskills.component.dragoncore.StandAnimationComponent;
import com.yaohun.demonskills.component.effects.StunPlayerComponent;
import com.yaohun.demonskills.component.particles.ParticlesComponent;
import com.yaohun.demonskills.core.Skill;
import com.yaohun.demonskills.data.PlayerData;
import com.yaohun.demonskills.manage.PlayerManager;
import com.yaohun.demonskills.target.ConeEnemiesSelector;
import com.yaohun.demonskills.target.NearestEnemiesSelector;
import com.yaohun.demonskills.target.SelfSelector;
import org.bukkit.Particle;
import org.bukkit.entity.Player;
import org.bukkit.potion.PotionEffectType;
import org.serverct.ersha.jd.AttributeAPI;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
public class Skill_牵魂法阵 {
private static final String skillName = "牵魂法阵";
private static final double cooldownTime = 38;
private static final double cdReducePerLevel = 1.2; // 每级减少1.2秒冷却
private static final double minCooldown = 30.0; // 最低冷却限制
private static final Map<Integer, Integer> skillMagicMap = new HashMap<>();
static {
skillMagicMap.put(1, 1);
skillMagicMap.put(2, 1);
skillMagicMap.put(3, 2);
skillMagicMap.put(4, 2);
skillMagicMap.put(5, 3);
skillMagicMap.put(6, 3);
skillMagicMap.put(7, 4);
skillMagicMap.put(8, 4);
}
public static Skill getSkillItemStack(int skillLevel){
double realCooldown = Math.max(cooldownTime - cdReducePerLevel * (skillLevel - 1), minCooldown);
int realNeedMagic = skillMagicMap.getOrDefault(skillLevel, 1);
return new Skill(skillName, realNeedMagic, realCooldown, 4.0,new ArrayList<>());
}
public static Skill getSkillData(Player player) {
String playerName = player.getName();
PlayerManager playerManager = SkillsMain.getPlayerManager();
PlayerData playerData = playerManager.getPlayerData(playerName);
int skillLevel = playerData.getSkillLevel(skillName);
double realCooldown = Math.max(cooldownTime - cdReducePerLevel * (skillLevel - 1), minCooldown);
int realNeedMagic = skillMagicMap.getOrDefault(skillLevel, 1);
double damageValue = AttributeAPI.getAttrData(player).getAttributeRandomValue("物理伤害");
double damage = ((0.2 * skillLevel) * damageValue + 50) + damageValue;
Skill skill = new Skill( // 技能 ID
skillName, // 技能名称
realNeedMagic, // 魔力需求
realCooldown, // 冷却时间
4.0,
Arrays.asList(
// 技能组件列表
new StunPlayerComponent(new SelfSelector(), 60L), // 定身3.0秒
new CdTimeComponent("skill_ImmunityDamage",3000),
new PotionEffectComponent(PotionEffectType.SPEED,20 * 3,2),
new PlayerAnimationComponent("灵吸",60),
new StandAnimationComponent("战士技能", "灵吸", 1, 70),
new ParticleSpawnCommponent("战士暴雪/怒吼效果", 200, 2),
new ParticleSpawnCommponent("战士暴雪/灵吸效果", 200, 1),
new SoundComponent("战士音效/灵吸音效.ogg", 0.5f, 1.8f),
new DelayComponent(50L,Arrays.asList(
new ProjectileAdvanceComponent(2,0.2,new NearestEnemiesSelector(5)),
new DamageComponent(damage,new NearestEnemiesSelector(5))
)
),
new DelayComponent(10L,Arrays.asList(
new ParticlesComponent(Particle.LAVA,8,2,5),
new ProjectilePullComponent(1,-0.1,new NearestEnemiesSelector(8,3)),
new DelayComponent(10L,Arrays.asList(
new ParticlesComponent(Particle.LAVA,8,2,5),
new ProjectilePullComponent(1,-0.1,new NearestEnemiesSelector(8,3)),
new DelayComponent(10L,Arrays.asList(
new ParticlesComponent(Particle.LAVA,8,2,5),
new ProjectilePullComponent(1,-0.1,new NearestEnemiesSelector(6,3)),
new DelayComponent(10L,Arrays.asList(
new ParticlesComponent(Particle.LAVA,8,2,5),
new ProjectilePullComponent(1,-0.1,new NearestEnemiesSelector(6,3)),
new DelayComponent(10L,Arrays.asList(
new ParticlesComponent(Particle.LAVA,8,2,5),
new ProjectilePullComponent(1,-0.1,new NearestEnemiesSelector(4,3))
))
)
))
))
))
)));
playerData.setCooldownData(skillName, realCooldown);
return skill;
}
}