改了 好多

This commit is contained in:
2025-06-22 23:50:28 +08:00
parent 80359de181
commit 6584fa0e72
57 changed files with 19275 additions and 4959 deletions

View File

@@ -5,8 +5,8 @@ import { HeroSpine } from "./HeroSpine";
import { BoxSet, FacSet } from "../common/config/BoxSet";
import { smc } from "../common/SingletonModuleComp";
import { Timer } from "../../../../extensions/oops-plugin-framework/assets/core/common/timer/Timer";
import { SkillSet, TGroup, TType } from "../common/config/SkillSet";
import { BuffComp } from "./BuffComp";
import { BuffAttr, DebuffAttr, SkillSet, TGroup, TType } from "../common/config/SkillSet";
import { BuffComp } from "./BuffComp";
import { oops } from "db://oops-framework/core/Oops";
import { GameEvent } from "../common/config/GameEvent";
import { FightConComp } from "../map/FightConComp";
@@ -62,8 +62,11 @@ export class HeroViewComp extends CCComp {
def: number = 0; //防御
vun: number = 0; //易伤
dodge: number = 10; //闪避率
dod: number = 10; //闪避率
dod_no:boolean=false;
crt:number=0; //暴击率
crt_no:boolean=false; //暴击免疫
crt_d:number=0; //暴击伤害
shield:number = 0; //护盾,免伤1次减1
speed: number = 100; /** 角色移动速度 */
@@ -73,14 +76,17 @@ export class HeroViewComp extends CCComp {
atked_count: number = 0;
atk_add_count:number=0;
stop_cd: number = 0; /*停止倒计时*/
yun_cd: number = 0; //眩晕倒计时
ice_cd: number = 0; //冰冻倒计时
dir_y:number = 0;
speek_time:number = 0;
is_stop_temp:boolean = false;i
Friend_alive_cd:Timer=new Timer(10)
double_dead:boolean=false
double_atked:boolean=false
DEBUFF_BURN: Array<{burn: number, count: number}> = []
DEBUFF_SLOW: number = 0;
DEBUFF_FROST: number = 0;
DEBUFF_STUN: number = 0;
BUFF_DEF: Array<{def: number, count: number}> = []
private damageQueue: Array<{
damage: number,
isCrit: boolean,
@@ -130,12 +136,12 @@ export class HeroViewComp extends CCComp {
if(this.timer.update(dt)){
// this.add_ap(10)
};
if(this.ice_cd > 0){
this.ice_cd -=dt;
if(this.DEBUFF_FROST > 0){
this.DEBUFF_FROST -=dt;
return
}
if(this.yun_cd > 0){
this.yun_cd -=dt;
if(this.DEBUFF_STUN > 0){
this.DEBUFF_STUN -=dt;
return
}
this.in_stop(dt);
@@ -150,7 +156,7 @@ export class HeroViewComp extends CCComp {
}else if(data.fire){
this.atk_skill=6012
}else if(data.wind){
this.atk_skill=6016
this.atk_skill=6013
}else{
this.atk_skill=6001
}
@@ -320,35 +326,147 @@ export class HeroViewComp extends CCComp {
}
}
do_atked(remainingDamage:number){
this.do_atked_trigger()
if (this.shield > 0) {
add_debuff(type:number,debuff:number,count:number,){
switch(type){
case DebuffAttr.BURN:
this.DEBUFF_BURN.push({burn:debuff,count:count})
break
case DebuffAttr.SLOW:
this.DEBUFF_SLOW+=debuff
break
case DebuffAttr.FROST:
this.BUFFCOMP.in_iced(debuff)
this.DEBUFF_FROST+=debuff
break
case DebuffAttr.STUN:
this.BUFFCOMP.in_yun(debuff)
this.DEBUFF_STUN+=debuff
this.is_stop=true
break
case DebuffAttr.DECD:
this.cd-=debuff
break
case DebuffAttr.DEHP:
this.hp_max-=debuff
if(this.hp-this.hp_max>0) this.hp=this.hp_max
break
case DebuffAttr.DEATK:
this.ap-=debuff
break
case DebuffAttr.DECOUNT:
this.atk_count-=debuff
if(this.atk_count<0) this.atk_count=1
break
case DebuffAttr.BACK:
if(this.fac==FacSet.MON) {
let tx=this.node.position.x+50
if(tx > 320) tx=320
tween(this.node).to(0.3, { position:v3(tx,this.node.position.y,0)}).start()
}
break
}
}
add_buff(buff:number,count:number,type:number){
switch(type){
case BuffAttr.DEF:
this.BUFF_DEF.push({def:buff,count:count})
break
}
}
do_atked(remainingDamage:number,crt:number=0,crt_d:number=0){
this.do_atked_trigger()
if(this.check_shield()) return
if(this.check_dodge()) return
let is_crit = this.check_crit(crt)
if(this == null) return;
let damage = this.count_damage(remainingDamage)
if(is_crit) {
damage = Math.floor(damage * (1 + (FightSet.CRIT_DAMAGE+crt_d)/100))
}
this.hp -= damage;
if(this.hp <= 0) {
if(this == null) return;
this.is_dead=true
this.BUFFCOMP.dead()
this.do_dead()
console.log("[HeroViewComp]:dead,fac => "+(this.fac==FacSet.HERO?"hero":"monster"))
if(this.ent == null) return;
if(this.fac ==FacSet.HERO){
this.to_grave()
}else{
this.ent.destroy();
}
}
this.BUFFCOMP.update_info_hp()
this.showDamage(damage, is_crit);
}
//伤害计算 debuff 易伤
count_damage(remainingDamage:number){
let damage = 0;
let Burn = 0;
let def = 0;
for(let i=0;i<this.DEBUFF_BURN.length;i++){
Burn+=this.DEBUFF_BURN[i].burn
this.DEBUFF_BURN[i].count-=1
if(this.DEBUFF_BURN[i].count<=0){
this.DEBUFF_BURN.splice(i,1)
}
}
for(let i=0;i<this.BUFF_DEF.length;i++){
def+=this.BUFF_DEF[i].def
this.BUFF_DEF[i].count-=1
if(this.BUFF_DEF[i].count<=0){
this.BUFF_DEF.splice(i,1)
}
}
if(this.fac == FacSet.HERO ){
damage=remainingDamage*(100-(this.FIGHTCON.hero_buff.DEF+def)+(this.FIGHTCON.hero_debuff.BURN+Burn))/100
}
if(this.fac == FacSet.MON){
damage=remainingDamage*(100-(this.FIGHTCON.enemy_buff.DEF+def)+(this.FIGHTCON.enemy_debuff.BURN+Burn))/100
}
return Math.floor(damage)
}
check_shield(){
if(this.shield>0){
this.shield -= 1
this.BUFFCOMP.tooltip(5,"*吸收*");
remainingDamage = 0
if (this.shield <= 0) {
if(this == null) return;
this.BUFFCOMP.show_shield(false);
}
}else{
if(this == null) return;
this.hp -= remainingDamage;
if(this.hp <= 0) {
if(this == null) return;
this.is_dead=true
this.BUFFCOMP.dead()
this.do_dead()
console.log("[HeroViewComp]:dead,fac => "+(this.fac==FacSet.HERO?"hero":"monster"))
if(this.ent == null) return;
if(this.fac ==FacSet.HERO){
this.to_grave()
}else{
this.ent.destroy();
}
}
this.BUFFCOMP.update_info_hp()
this.showDamage(remainingDamage, true);
return true
}
return false
}
check_dodge(){
if(this.dod > 0){
let random = Math.random()*100
if(random < this.dod) {
this.BUFFCOMP.tooltip(6,"*闪避*");
return true
}
}
return false
}
check_crit(crt:number=0){
if(this.crt_no) return false
if(crt > 0){
let random = Math.random()*100
if(random < crt) {
console.log("[HeroViewComp]:crit",crt,random)
return true
}
}
console.log("[HeroViewComp]:crit",crt)
return false
}
// dead(){
// this.BUFFCOMP.dead()
@@ -440,7 +558,16 @@ export class HeroViewComp extends CCComp {
delay: this.damageInterval
});
}
ex_show(text:string){
switch(text){
case "blue":
this.BUFFCOMP.max_show("max_blue")
break
case "red":
this.BUFFCOMP.max_show("max_red")
break
}
}
/** 处理伤害队列 */
private processDamageQueue() {
if (this.isProcessingDamage || this.damageQueue.length === 0) return;