feat(penetration): 将穿刺机制从固定次数改为概率触发模式

统一重命名所有穿刺相关属性为 `puncture_chance` 以规范代码命名,新增FightSet.PUNCTURE_DOWN配置项控制每次穿透后的概率衰减值。调整6408号穿刺强化技能,将提升穿刺次数效果改为提升20%穿透概率并修正AP消耗。在技能命中逻辑中添加穿透概率判定逻辑,实现概率穿透效果,同时更新所有引用原属性的代码位置确保功能正常。
This commit is contained in:
walkpan
2026-05-23 14:08:45 +08:00
parent cb53417ea8
commit 0b59f601d8
7 changed files with 41 additions and 9 deletions

View File

@@ -2,11 +2,13 @@ import { _decorator, Animation, CCInteger, Collider2D, Contact2DType, UITransfor
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp";
import { HeroViewComp } from "../hero/HeroViewComp";
import { EType, SkillConfig, SkillSet } from "../common/config/SkillSet";
import { DTType, EType, SkillConfig, SkillSet } from "../common/config/SkillSet";
import { SDataCom } from "./SDataCom";
import { HeroAttrsComp } from "../hero/HeroAttrsComp";
import { DamageQueueHelper } from "../hero/DamageQueueComp";
import { mLogger } from "../common/Logger";
import { FightSet } from "../common/config/GameSet";
import { Attrs } from "../common/config/HeroAttrs";
const { ccclass, property } = _decorator;
@@ -86,7 +88,30 @@ export class SkillView extends CCComp {
}
this.sData.hit_count++;
if (this.sData.hit_count >= this.sData.max_hit_count) {
this.handle_collision_limit();
// == 新增:穿透概率判定 ==
// 仅对单体伤害技能生效DTType.single且存在穿透概率
if (this.SConf.DTType === DTType.single) {
const punctureChance = this.sData.Attrs[Attrs.puncture_chance] || 0;
if (punctureChance > 0) {
const rand = Math.random() * 100;
if (rand < punctureChance) {
// 触发穿透:不销毁,增加 max_hit_count 允许继续穿透
this.sData.max_hit_count++;
// 概率衰减(减去固定的 PUNCTURE_DOWN 值,比如 50
this.sData.Attrs[Attrs.puncture_chance] = Math.max(0, punctureChance - FightSet.PUNCTURE_DOWN);
if (this.debugMode) {
mLogger.log(this.debugMode, 'SkillView', `[SkillView] 触发穿透!剩余概率: ${this.sData.Attrs[Attrs.puncture_chance]}%`);
}
} else {
// 未触发穿透,正常销毁
this.handle_collision_limit();
}
} else {
this.handle_collision_limit();
}
} else {
this.handle_collision_limit();
}
}
// 命中次数按碰撞事件统计:不依赖是否最终造成伤害