dd
This commit is contained in:
@@ -8,12 +8,13 @@ import { GameEvent } from '../common/config/GameEvent';
|
||||
import { BoxSet } from '../common/config/BoxSet';
|
||||
import { smc } from '../common/SingletonModuleComp';
|
||||
import { CCComp } from 'db://oops-framework/module/common/CCComp';
|
||||
import { FightConComp } from '../map/FightConComp';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass('SkillCon')
|
||||
@ecs.register('SkillCon')
|
||||
export class SkillConComp extends CCComp {
|
||||
|
||||
FIGHTCON:FightConComp=null!
|
||||
HeroView:any=null;
|
||||
HeroEntity:any=null;
|
||||
private _timers: { [key: string]: number } = {};
|
||||
@@ -23,6 +24,7 @@ export class SkillConComp extends CCComp {
|
||||
}
|
||||
onLoad(){
|
||||
this.HeroView=this.node.getComponent(HeroViewComp)
|
||||
this.FIGHTCON=this.node.parent.getComponent(FightConComp)
|
||||
// console.log(this.HeroView.uuid+"=>"+this.HeroView.hero_name+"=> SkillConComp onLoad")
|
||||
this.on(GameEvent.CastHeroSkill,this.cast_master_skill,this)
|
||||
}
|
||||
@@ -36,7 +38,13 @@ export class SkillConComp extends CCComp {
|
||||
if (this.HeroView.is_atking &&this.HeroView.at > this.HeroView.cd) {
|
||||
const config = SkillSet[this.HeroView.atk_skill];
|
||||
if (!config) return;
|
||||
this.castSkill(config);
|
||||
let count=1
|
||||
if(this.HeroView.is_master){
|
||||
count+=this.FIGHTCON.hero.ATK_COUNT+this.FIGHTCON.ally.ATK_COUNT
|
||||
}else{
|
||||
count+=this.FIGHTCON.friend.ATK_COUNT+this.FIGHTCON.ally.ATK_COUNT
|
||||
}
|
||||
this.castSkill(config,count);
|
||||
this.HeroView.at = 0;
|
||||
}
|
||||
}
|
||||
@@ -46,29 +54,29 @@ export class SkillConComp extends CCComp {
|
||||
if(!this.HeroView.is_master) return
|
||||
console.log("hart cast_skill",uuid ,e)
|
||||
const config = SkillSet[uuid];
|
||||
this.castSkill(config)
|
||||
this.castSkill(config,(1+this.FIGHTCON.hero.ATK_COUNT+this.FIGHTCON.ally.ATK_COUNT))
|
||||
}
|
||||
|
||||
/** 施放技能 */
|
||||
castSkill(config: typeof SkillSet[keyof typeof SkillSet]) {
|
||||
castSkill(config: typeof SkillSet[keyof typeof SkillSet],count:number=1) {
|
||||
// console.log(view.uuid+"=>"+view.hero_name+"施放技能:"+config.uuid);
|
||||
if (config.TargetGroup === TargetGroup.Enemy) {
|
||||
this.HeroView.playSkillEffect(config.uuid);
|
||||
this.doSkill(config);
|
||||
this.doSkill(config,count);
|
||||
}
|
||||
|
||||
if (config.TargetGroup === TargetGroup.Ally) {
|
||||
const targets = this.selectAllyTargets( config);
|
||||
if (targets.length === 0) return;
|
||||
|
||||
this.doSkill(config,count);
|
||||
}
|
||||
if (config.TargetGroup === TargetGroup.Self) {
|
||||
|
||||
this.doSkill(config,count);
|
||||
}
|
||||
|
||||
}
|
||||
private doSkill(config: typeof SkillSet[keyof typeof SkillSet]) {
|
||||
|
||||
private doSkill(config: typeof SkillSet[keyof typeof SkillSet],count:number=1) {
|
||||
|
||||
const skillEntity = ecs.getEntity<Skill>(Skill);
|
||||
const targets = this.selectEnemyTargets(config);
|
||||
if (targets.length === 0) return;
|
||||
|
||||
Reference in New Issue
Block a user