crt 改为crit

This commit is contained in:
2025-06-24 21:08:46 +08:00
parent 4ef2855e49
commit 766c1f8176
12 changed files with 11211 additions and 7154 deletions

View File

@@ -56,7 +56,7 @@ export class Hero extends ecs.Entity {
}
/** 加载角色 */
load(pos: Vec3 = Vec3.ZERO,scale:number = 1,uuid:number=1001,info:any={ap:0,hp:0,lv:1,crt:0,crt_d:0,dod:0,dod_no:false,crt_no:false},fight_pos:number=1) {
load(pos: Vec3 = Vec3.ZERO,scale:number = 1,uuid:number=1001,info:any={ap:0,hp:0,lv:1,crit:0,crit_d:0,dod:0,dod_no:false,crit_no:false},fight_pos:number=1) {
// console.log("英雄加载:",uuid,pos,scale,info)
scale = 1
let box_group=BoxSet.HERO
@@ -78,7 +78,7 @@ export class Hero extends ecs.Entity {
console.log("[Hero]:friend",hv)
}
hero_init(uuid:number=1001,node:Node,info:any={ap:0,hp:0,lv:1,crt:0,crt_d:0,dod:0,dod_no:false,crt_no:false}) {
hero_init(uuid:number=1001,node:Node,info:any={ap:0,hp:0,lv:1,crit:0,crit_d:0,dod:0,dod_no:false,crit_no:false}) {
var hv = node.getComponent(HeroViewComp)!;
let hero= HeroInfo[uuid] // 共用英雄数据
hv.scale = 1;
@@ -93,11 +93,11 @@ export class Hero extends ecs.Entity {
hv.cd = hero.a_cd
hv.hp= hv.hp_max =hero.hp+info.hp
hv.ap = hero.ap+info.ap;
hv.crt=hero.crt+info.crt
hv.crt_d=hero.crt_d+info.crt_d
hv.crit=hero.crit+info.crit
hv.crit_d=hero.crit_d+info.crit_d
hv.dod=hero.dod+info.dod
hv.dod_no=info.dod_no
hv.crt_no=info.crt_no
hv.crit_no=info.crit_no
hv.atk_skill=hero.skills[0]
return hv
}

View File

@@ -64,9 +64,9 @@ export class HeroViewComp extends CCComp {
dod: number = 10; //闪避率
dod_no:boolean=false;
crt:number=0; //暴击率
crt_no:boolean=false; //暴击免疫
crt_d:number=0; //暴击伤害
crit:number=0; //暴击率
crit_no:boolean=false; //暴击免疫
crit_d:number=0; //暴击伤害
shield:number = 0; //护盾,免伤1次减1
speed: number = 100; /** 角色移动速度 */
@@ -373,17 +373,17 @@ export class HeroViewComp extends CCComp {
}
}
do_atked(remainingDamage:number,crt:number=0,crt_d:number=0){
do_atked(remainingDamage:number,crit:number=0,crit_d:number=0){
this.do_atked_trigger()
if(this.check_shield()) return
if(this.check_dodge()) return
let is_crit = this.check_crit(crt)
let is_crit = this.check_crit(crit)
if(this == null) return;
let damage = this.count_damage(remainingDamage)
if(is_crit) {
damage = Math.floor(damage * (1 + (FightSet.CRIT_DAMAGE+crt_d)/100))
damage = Math.floor(damage * (1 + (FightSet.CRIT_DAMAGE+crit_d)/100))
}
this.hp -= damage;
if(this.hp <= 0) {
@@ -454,16 +454,16 @@ export class HeroViewComp extends CCComp {
return false
}
check_crit(crt:number=0){
if(this.crt_no) return false
if(crt > 0){
check_crit(crit:number=0){
if(this.crit_no) return false
if(crit > 0){
let random = Math.random()*100
if(random < crt) {
console.log("[HeroViewComp]:crit",crt,random)
if(random < crit) {
console.log("[HeroViewComp]:crit",crit,random)
return true
}
}
console.log("[HeroViewComp]:crit",crt)
console.log("[HeroViewComp]:crit",crit)
return false
}
// dead(){

View File

@@ -67,11 +67,11 @@ export class Monster extends ecs.Entity {
hv.hp= hv.hp_max =hero.hp;
hv.ap = hero.ap;
hv.cd = hero.a_cd
hv.crt=hero.crt
hv.crt_d=hero.crt_d
hv.crit=hero.crit
hv.crit_d=hero.crit_d
hv.dod=hero.dod
hv.dod_no=hero.dod_no
hv.crt_no=hero.crt_no
hv.crit_no=hero.crit_no
hv.atk_skill=hero.skills[0]
this.add(hv);
}