改了 好多
This commit is contained in:
@@ -11,6 +11,7 @@ import { CCComp } from 'db://oops-framework/module/common/CCComp';
|
||||
import { FightConComp } from '../map/FightConComp';
|
||||
import { MonModelComp } from './MonModelComp';
|
||||
import { HeroModelComp } from './HeroModelComp';
|
||||
import { FightSet } from '../common/config/Mission';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass('SkillCon')
|
||||
@@ -37,7 +38,7 @@ export class SkillConComp extends CCComp {
|
||||
|
||||
update(dt: number) {
|
||||
if(!smc.mission.play||smc.mission.pause) return
|
||||
this.HeroView.at += dt;
|
||||
if(this.HeroView.DEBUFF_STUN <= 0) this.HeroView.at += dt;
|
||||
|
||||
let cd = this.get_cd(this.HeroView.cd,this.HeroView)
|
||||
let count=this.get_count(1,this.HeroView)
|
||||
@@ -55,29 +56,6 @@ export class SkillConComp extends CCComp {
|
||||
}
|
||||
}
|
||||
|
||||
get_cd(cd:number,view:HeroViewComp){
|
||||
if(view.fac==FacSet.HERO){
|
||||
if(view.is_master){
|
||||
return cd*(100-this.FIGHTCON.hero_buff.ATK_CD+this.FIGHTCON.hero_debuff.DECD)/100
|
||||
}else{
|
||||
return cd*(100-this.FIGHTCON.friend_buff.ATK_CD+this.FIGHTCON.friend_debuff.DECD)/100
|
||||
}
|
||||
}else{
|
||||
return cd*(100-this.FIGHTCON.enemy_buff.ATK_CD+this.FIGHTCON.enemy_debuff.DECD)/100
|
||||
}
|
||||
}
|
||||
get_count(count:number,view:HeroViewComp){
|
||||
if(view.fac==FacSet.HERO){
|
||||
if(view.is_master){
|
||||
return count+(this.FIGHTCON.hero_buff.ATK_COUNT-this.FIGHTCON.hero_debuff.DECOUNT)
|
||||
}else{
|
||||
return count+(this.FIGHTCON.friend_buff.ATK_COUNT-this.FIGHTCON.friend_debuff.DECOUNT)
|
||||
}
|
||||
}else{
|
||||
return count+(this.FIGHTCON.enemy_buff.ATK_COUNT-this.FIGHTCON.enemy_debuff.DECOUNT)
|
||||
}
|
||||
|
||||
}
|
||||
cast_master_skill(e:string,uuid:any){
|
||||
if(!this.HeroView) return
|
||||
if(!this.HeroView.is_master) return
|
||||
@@ -85,15 +63,15 @@ export class SkillConComp extends CCComp {
|
||||
const config = SkillSet[uuid];
|
||||
this.castSkill(config,1,this.FIGHTCON.hero_buff.SKILL_DMG)
|
||||
}
|
||||
|
||||
/** 施放技能 */
|
||||
castSkill(config: typeof SkillSet[keyof typeof SkillSet],count:number=1,dmg:number=0) {
|
||||
castSkill(config: typeof SkillSet[keyof typeof SkillSet],count:number=1,dmg:number=0) {
|
||||
// console.log(view.uuid+"=>"+view.hero_name+"施放技能:"+config.uuid);
|
||||
|
||||
this.doSkill(config,count,dmg);
|
||||
|
||||
|
||||
}
|
||||
|
||||
private doSkill(config: typeof SkillSet[keyof typeof SkillSet],count:number=1,angle:number=0,dmg:number=0) {
|
||||
// 添加节点有效性检查
|
||||
if (!this.node || !this.node.isValid || !this.HeroView || !this.HeroView.node || !this.HeroView.node.isValid) {
|
||||
@@ -144,17 +122,22 @@ export class SkillConComp extends CCComp {
|
||||
dmg
|
||||
);
|
||||
}, 300);
|
||||
count-=1
|
||||
if(count>0){
|
||||
let angle=10*count
|
||||
if(count > 1 && this.check_double_atk(count)){
|
||||
this.scheduleOnce(()=>{
|
||||
this.doSkill(config,count,angle)
|
||||
},0.1)
|
||||
this.HeroView.ex_show("blue")
|
||||
this.doSkill(config,1)
|
||||
},0.05)
|
||||
}
|
||||
// 保存定时器ID
|
||||
this._timers[`skill_${config.uuid}`] = timerId;
|
||||
}
|
||||
|
||||
check_double_atk(count:number){
|
||||
let random = Math.random()*100
|
||||
if(random < FightSet.DOUBLE_ATK_RATE*count){
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
/** 筛选最前排单位 */
|
||||
@@ -202,7 +185,29 @@ export class SkillConComp extends CCComp {
|
||||
// console.log("clear_timer");
|
||||
Object.values(this._timers).forEach(clearTimeout);
|
||||
}
|
||||
|
||||
get_cd(cd:number,view:HeroViewComp){
|
||||
if(view.fac==FacSet.HERO){
|
||||
if(view.is_master){
|
||||
return cd*(100-this.FIGHTCON.hero_buff.ATK_CD+this.FIGHTCON.hero_debuff.DECD)/100
|
||||
}else{
|
||||
return cd*(100-this.FIGHTCON.friend_buff.ATK_CD+this.FIGHTCON.friend_debuff.DECD)/100
|
||||
}
|
||||
}else{
|
||||
return cd*(100-this.FIGHTCON.enemy_buff.ATK_CD+this.FIGHTCON.enemy_debuff.DECD)/100
|
||||
}
|
||||
}
|
||||
get_count(count:number,view:HeroViewComp){
|
||||
if(view.fac==FacSet.HERO){
|
||||
if(view.is_master){
|
||||
return count+(this.FIGHTCON.hero_buff.ATK_COUNT-this.FIGHTCON.hero_debuff.DECOUNT)
|
||||
}else{
|
||||
return count+(this.FIGHTCON.friend_buff.ATK_COUNT-this.FIGHTCON.friend_debuff.DECOUNT)
|
||||
}
|
||||
}else{
|
||||
return count+(this.FIGHTCON.enemy_buff.ATK_COUNT-this.FIGHTCON.enemy_debuff.DECOUNT)
|
||||
}
|
||||
|
||||
}
|
||||
reset() {
|
||||
this.clear_timer();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user