Compare commits
3 Commits
03a8a41980
...
b965c88961
| Author | SHA1 | Date | |
|---|---|---|---|
| b965c88961 | |||
| b73d756106 | |||
| 3edc69deff |
@@ -32,8 +32,6 @@ export enum Attrs {
|
||||
HP_REGEN = 3, // 生命回复
|
||||
MP_REGEN = 4, // 魔法回复
|
||||
HEAL_EFFECT = 5, // 治疗效果
|
||||
POW_MAX = 6, // 最大怒气值
|
||||
POW_REGEN = 7, // 怒气值回复
|
||||
|
||||
// ========== 攻击属性 (10-19) ==========
|
||||
AP = 10, // 攻击力
|
||||
@@ -158,8 +156,6 @@ export const AttrsType: Record<Attrs, BType> = {
|
||||
[Attrs.SHIELD_MAX]: BType.VALUE, // 最大护盾值 - 数值型
|
||||
[Attrs.HP_REGEN]: BType.VALUE, // 生命回复 - 数值型
|
||||
[Attrs.MP_REGEN]: BType.VALUE, // 魔法回复 - 数值型
|
||||
[Attrs.POW_MAX]: BType.VALUE, // 最大怒气值 - 数值型
|
||||
[Attrs.POW_REGEN]: BType.VALUE, // 怒气值回复 - 数值型
|
||||
[Attrs.HEAL_EFFECT]: BType.RATIO, // 治疗效果 - 百分比型
|
||||
|
||||
// ========== 攻击属性(数值型) ==========
|
||||
|
||||
@@ -26,13 +26,12 @@ export enum TalEffet {
|
||||
BUFF = 5, // 暴击率,闪避率等,可叠加的触发后清零
|
||||
STATS=6, // 状态
|
||||
WFUNY=7, // 风怒
|
||||
SPLASH=8, // 溅射
|
||||
D_SKILL=9, //两次技能
|
||||
SHIELD=10, // 护盾
|
||||
LDMG=11, // 减伤
|
||||
D_SKILL=8, //两次技能
|
||||
SHIELD=9, // 护盾
|
||||
LDMG=10, // 减伤
|
||||
C_MSKILL=11, // 必杀技能必暴
|
||||
C_ATK=12, // 普工必爆
|
||||
C_SKILL=13, // 一般技能必暴
|
||||
C_MSKILL=14, // 必杀技能必暴
|
||||
}
|
||||
|
||||
export enum TalTarget {
|
||||
@@ -89,8 +88,7 @@ export const talConf: Record<number, ItalConf> = {
|
||||
/*** 普通攻击触发 ***/
|
||||
7001:{uuid:7001,name:"风怒",triType:TriType.ATK,Trigger:3,count:1,target:TalTarget.ENEMY,effet:TalEffet.WFUNY,vType:BType.RATIO, value:50,attrs:TalAttrs.NON,
|
||||
desc:"普通攻击3次后, 立即给与目标150%伤害的额外打击"},
|
||||
7002:{uuid:7002,name:"溅射",triType:TriType.ATK,Trigger:3,count:1,target:TalTarget.ENEMY,effet:TalEffet.SPLASH,vType:BType.RATIO, value:50,attrs:TalAttrs.NON,
|
||||
desc:"普通攻击3次后, 会对目标100码内的敌人造成30%伤害"},
|
||||
|
||||
7003:{uuid:7003,name:"回血",triType:TriType.ATK,Trigger:3,count:1,target:TalTarget.SELF,effet:TalEffet.HP,vType:BType.RATIO, value:1,attrs:TalAttrs.NON,
|
||||
desc:"普通攻击3次后, 会回复10%的生命值"},
|
||||
7004:{uuid:7004,name:"回蓝",triType:TriType.ATK,Trigger:3,count:1,target:TalTarget.SELF,effet:TalEffet.MP,vType:BType.RATIO, value:1,attrs:TalAttrs.NON,
|
||||
|
||||
@@ -3,6 +3,7 @@ import { Attrs, AttrsType, BType, NeAttrs } from "../common/config/HeroAttrs";
|
||||
import { BuffConf } from "../common/config/SkillSet";
|
||||
import { HeroInfo, AttrSet } from "../common/config/heroSet";
|
||||
import { HeroSkillsComp } from "./HeroSkills";
|
||||
import { HeroViewComp } from "./HeroViewComp";
|
||||
|
||||
|
||||
interface talTrigger{
|
||||
@@ -31,7 +32,6 @@ export class HeroAttrsComp extends ecs.Comp {
|
||||
// ==================== 动态属性值 ====================
|
||||
hp: number = 100; // 当前血量
|
||||
mp: number = 100; // 当前魔法值
|
||||
pow: number = 0; // 当前怒气值
|
||||
shield: number = 0; // 当前护盾
|
||||
Attrs: any = []; // 最终属性数组(经过Buff计算后)
|
||||
NeAttrs: any = []; // 负面状态数组
|
||||
@@ -118,7 +118,33 @@ export class HeroAttrsComp extends ecs.Comp {
|
||||
}
|
||||
}
|
||||
}
|
||||
/*******************基础属性管理********************/
|
||||
|
||||
add_hp(value:number,isValue:boolean){
|
||||
let addValue = value;
|
||||
if(!isValue){
|
||||
addValue = value * this.Attrs[Attrs.HP_MAX];
|
||||
}
|
||||
let heroView = this.ent.get(HeroViewComp);
|
||||
if(heroView){
|
||||
heroView.health(addValue);
|
||||
}
|
||||
this.hp += addValue;
|
||||
this.hp = Math.max(0, Math.min(this.hp, this.Attrs[Attrs.HP_MAX]));
|
||||
}
|
||||
add_mp(value:number,isValue:boolean){
|
||||
let addValue = value;
|
||||
if(!isValue){
|
||||
addValue = value * this.Attrs[Attrs.MP_MAX];
|
||||
}
|
||||
this.mp += addValue;
|
||||
this.mp = Math.max(0, Math.min(this.mp, this.Attrs[Attrs.MP_MAX]));
|
||||
}
|
||||
add_shield(value:number,isValue:boolean){
|
||||
let addValue = value;
|
||||
this.shield += addValue;
|
||||
this.shield = Math.max(0, Math.min(this.shield, this.Attrs[Attrs.HP_MAX]));
|
||||
}
|
||||
// ==================== BUFF 管理 ====================
|
||||
/**
|
||||
* 添加 buff 效果(支持多次叠加)
|
||||
@@ -150,6 +176,8 @@ export class HeroAttrsComp extends ecs.Comp {
|
||||
this.recalculateSingleAttr(attrIndex);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// ==================== 属性计算系统 ====================
|
||||
/**
|
||||
* 重新计算单个属性
|
||||
|
||||
@@ -31,8 +31,6 @@ export class HeroViewComp extends CCComp {
|
||||
status:String = "idle"
|
||||
scale: number = 1; // 显示方向
|
||||
box_group:number = BoxSet.HERO; // 碰撞组
|
||||
usePower:boolean = false;
|
||||
useMp:boolean = false;
|
||||
realDeadTime:number=10
|
||||
deadCD:number=0
|
||||
// 血条显示相关
|
||||
@@ -89,10 +87,7 @@ export class HeroViewComp extends CCComp {
|
||||
// }
|
||||
/* 显示角色血*/
|
||||
this.top_node.getChildByName("hp").active = true;
|
||||
this.usePower=HeroInfo[this.model.hero_uuid].type==HType.warrior||HeroInfo[this.model.hero_uuid].type==HType.assassin;
|
||||
this.useMp=HeroInfo[this.model.hero_uuid].type==HType.mage||HeroInfo[this.model.hero_uuid].type==HType.remote||HeroInfo[this.model.hero_uuid].type==HType.support;
|
||||
this.top_node.getChildByName("pow").active = this.usePower;
|
||||
this.top_node.getChildByName("mp").active = this.useMp;
|
||||
this.top_node.getChildByName("mp").active = true;
|
||||
// 初始隐藏血条(被攻击后才显示)
|
||||
this.top_node.active = false;
|
||||
}
|
||||
@@ -140,9 +135,9 @@ export class HeroViewComp extends CCComp {
|
||||
this.processDamageQueue(); // 伤害数字显示队列
|
||||
|
||||
// ✅ 更新 UI 显示(数据由 HeroAttrSystem 更新)
|
||||
// 移除了每帧调用的 hp_show,改为仅在需要时调用
|
||||
this.hp_show(this.model.hp, this.model.Attrs[Attrs.HP_MAX]);
|
||||
if(this.useMp) this.mp_show(this.model.mp, this.model.Attrs[Attrs.MP_MAX]);
|
||||
if(this.usePower) this.pow_show(this.model.pow, this.model.Attrs[Attrs.POW_MAX]);
|
||||
this.mp_show(this.model.mp, this.model.Attrs[Attrs.MP_MAX]);
|
||||
this.show_shield(this.model.shield, this.model.Attrs[Attrs.SHIELD_MAX]);
|
||||
}
|
||||
|
||||
@@ -294,12 +289,13 @@ export class HeroViewComp extends CCComp {
|
||||
if(this.model && this.model.shield>0) this.show_shield(this.model.shield, this.model.Attrs[Attrs.SHIELD_MAX]);
|
||||
}
|
||||
|
||||
health(hp: number = 0, is_num:boolean=true) {
|
||||
health(hp: number = 0) {
|
||||
// 生命值更新由 Model 层处理,这里只负责视图表现
|
||||
this.heathed();
|
||||
if(this.model) {
|
||||
this.hp_show(hp, this.model.Attrs[Attrs.HP_MAX]);
|
||||
}
|
||||
this.hp_tip(TooltipTypes.health, hp.toFixed(0));
|
||||
this.top_node.active=true
|
||||
this.hp_show(this.model.hp, this.model.Attrs[Attrs.HP_MAX]);
|
||||
|
||||
}
|
||||
|
||||
alive(){
|
||||
@@ -390,17 +386,6 @@ export class HeroViewComp extends CCComp {
|
||||
}
|
||||
// 伤害计算和战斗逻辑已迁移到 HeroBattleSystem
|
||||
|
||||
/** 死亡触发器(预留,用于天赋/特殊效果) */
|
||||
do_dead_trigger(){
|
||||
if(!this.model || this.model.is_dead || this.model.fac === FacSet.MON) return;
|
||||
// 预留:天赋触发、复活检查等
|
||||
}
|
||||
|
||||
/** 受击触发器(预留,用于天赋/特殊效果) */
|
||||
do_atked_trigger(){
|
||||
if(!this.model || this.model.is_dead || this.model.fac === FacSet.MON) return;
|
||||
// 预留:反击、护盾触发等
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -415,7 +400,7 @@ export class HeroViewComp extends CCComp {
|
||||
switch(skill.act){
|
||||
case "max":
|
||||
this.as.max()
|
||||
this.tooltip(TooltipTypes.skill, skill.name, skill_id)
|
||||
this.tooltip(TooltipTypes.skill, skill.name)
|
||||
break
|
||||
case "atk":
|
||||
this.as.atk()
|
||||
@@ -458,9 +443,9 @@ export class HeroViewComp extends CCComp {
|
||||
this.hp_show(this.model.hp, this.model.Attrs[Attrs.HP_MAX]);
|
||||
this.in_atked(anm, this.model.fac==FacSet.HERO?1:-1);
|
||||
if (isCrit) {
|
||||
this.hp_tip(TooltipTypes.crit, damage.toFixed(0), damage);
|
||||
this.hp_tip(TooltipTypes.crit, damage.toFixed(0));
|
||||
} else {
|
||||
this.hp_tip(TooltipTypes.life, damage.toFixed(0), damage);
|
||||
this.hp_tip(TooltipTypes.life, damage.toFixed(0));
|
||||
}
|
||||
}
|
||||
reset() {
|
||||
|
||||
@@ -161,19 +161,17 @@ export class SACastSystem extends ecs.ComblockSystem implements ecs.ISystemUpdat
|
||||
if (hset === HSSet.atk){
|
||||
let delay = 0.3
|
||||
let ext_dmg = heroAttrs.useCountValTal(TalEffet.ATK_DMG);
|
||||
let splash = heroAttrs.useCountValTal(TalEffet.SPLASH);
|
||||
heroView.scheduleOnce(() => {
|
||||
this.createSkill(s_uuid, heroView,targets,ext_dmg,splash);
|
||||
this.createSkill(s_uuid, heroView,targets,ext_dmg);
|
||||
}, delay);
|
||||
//风怒wfuny 只针对 普通攻击起效
|
||||
if (heroAttrs.useCountTal(TalEffet.WFUNY)){
|
||||
let ext2_dmg = heroAttrs.useCountValTal(TalEffet.ATK_DMG);
|
||||
let splash2 = heroAttrs.useCountValTal(TalEffet.SPLASH);
|
||||
let delay = 0.3
|
||||
heroView.playSkillEffect(s_uuid);
|
||||
//需要再添加 风怒动画
|
||||
heroView.scheduleOnce(() => {
|
||||
this.createSkill(s_uuid, heroView,targets,ext2_dmg,splash2);
|
||||
this.createSkill(s_uuid, heroView,targets,ext2_dmg);
|
||||
},delay);
|
||||
}
|
||||
}
|
||||
@@ -214,7 +212,7 @@ export class SACastSystem extends ecs.ComblockSystem implements ecs.ISystemUpdat
|
||||
/**
|
||||
* 创建技能实体
|
||||
*/
|
||||
private createSkill(s_uuid: number, caster: HeroViewComp,targets:Vec3[]=[],ext_dmg:number=0,splash:number=0) {
|
||||
private createSkill(s_uuid: number, caster: HeroViewComp,targets:Vec3[]=[],ext_dmg:number=0) {
|
||||
// 检查节点有效性
|
||||
if (!caster.node || !caster.node.isValid) {
|
||||
console.warn("[SACastSystem] 施法者节点无效");
|
||||
@@ -239,7 +237,7 @@ export class SACastSystem extends ecs.ComblockSystem implements ecs.ISystemUpdat
|
||||
const targetPos = targets[0]; // 使用第一个目标位置
|
||||
// console.log(`[SACastSystem]: ${s_uuid}, 起始位置: ${startPos}, 目标位置: ${targetPos}`);
|
||||
// 加载技能实体(包括预制体、组件初始化等)
|
||||
skill.load(startPos, parent, s_uuid, targetPos, caster,ext_dmg,splash);
|
||||
skill.load(startPos, parent, s_uuid, targetPos, caster,ext_dmg);
|
||||
|
||||
}
|
||||
/**
|
||||
|
||||
@@ -211,12 +211,12 @@ export class TalComp extends ecs.Comp {
|
||||
case TalEffet.LDMG:
|
||||
heroAttrs.addCountTal(TalEffet.LDMG, talent.value + talent.value_add);
|
||||
break;
|
||||
// case TalEffet.HP:
|
||||
// heroAttrs.addCountTal(TalEffet.HP, talent.value + talent.value_add);
|
||||
// break;
|
||||
// case TalEffet.MP:
|
||||
// heroAttrs.addCountTal(TalEffet.MP, talent.value + talent.value_add);
|
||||
// break;
|
||||
case TalEffet.HP:
|
||||
heroAttrs.add_hp(talent.value + talent.value_add,talent.vType == BType.VALUE);
|
||||
break;
|
||||
case TalEffet.MP:
|
||||
heroAttrs.add_mp(talent.value + talent.value_add,talent.vType == BType.VALUE);
|
||||
break;
|
||||
case TalEffet.WFUNY:
|
||||
heroAttrs.addCountTal(TalEffet.WFUNY, talent.value + talent.value_add);
|
||||
break;
|
||||
|
||||
@@ -13,7 +13,6 @@ export class SDataCom extends ecs.Comp {
|
||||
fac: number = 0; // 0:hero 1:monster
|
||||
s_uuid:number=0
|
||||
ext_dmg:number=0 //额外伤害
|
||||
splash:number=0 //溅射伤害
|
||||
dmg_ratio:number=1 //伤害比例
|
||||
hit_count:number=0 //击中数量
|
||||
reset() {
|
||||
@@ -24,7 +23,6 @@ export class SDataCom extends ecs.Comp {
|
||||
this.caster=null
|
||||
this.hit_count=0
|
||||
this.ext_dmg=0
|
||||
this.splash=0
|
||||
this.dmg_ratio=1
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ export class Skill extends ecs.Entity {
|
||||
this.addComponents<SMoveDataComp>(SMoveDataComp);
|
||||
}
|
||||
load(startPos: Vec3, parent: Node, s_uuid: number, targetPos: Vec3,
|
||||
caster:HeroViewComp,ext_dmg:number=0,splash:number=0) {
|
||||
caster:HeroViewComp,ext_dmg:number=0) {
|
||||
const config = SkillSet[s_uuid];
|
||||
|
||||
if (!config) {
|
||||
@@ -94,7 +94,6 @@ export class Skill extends ecs.Entity {
|
||||
sDataCom.s_uuid=s_uuid
|
||||
sDataCom.fac=cAttrsComp.fac
|
||||
sDataCom.ext_dmg=ext_dmg
|
||||
sDataCom.splash=splash
|
||||
}
|
||||
|
||||
/** 模块资源释放 */
|
||||
|
||||
Reference in New Issue
Block a user