diff --git a/assets/resources/game/skills/shield.prefab b/assets/resources/game/skills/shield.prefab index 0c64e0ef..86445e75 100644 --- a/assets/resources/game/skills/shield.prefab +++ b/assets/resources/game/skills/shield.prefab @@ -290,13 +290,13 @@ "_restitution": 0, "_offset": { "__type__": "cc.Vec2", - "x": 0, - "y": 0 + "x": 0.4, + "y": -0.7 }, "_size": { "__type__": "cc.Size", - "width": 30, - "height": 30 + "width": 11.6, + "height": 12.3 }, "_id": "" }, diff --git a/assets/script/game/common/config/heroSet.ts b/assets/script/game/common/config/heroSet.ts index a24828ab..92a56b6d 100644 --- a/assets/script/game/common/config/heroSet.ts +++ b/assets/script/game/common/config/heroSet.ts @@ -4,7 +4,7 @@ export const HeroInfo = { uuid: 9001, path: "k1", type: 1, lv: 1,name: "白骑士", wp:1001,arm:2001,ring:3001,shoes:4001, exp_type:0,lv2:5,lv3:10,lv4:20,lv5:30,a_exp:1,ua_exp:1,d_exp:10,ed_exp:1,a_buff:8101,ua_buff:8201,d_buff:8301,ed_buff:8401, ap: 20, ap_rate:0.1, hp: 100, hp_rate:0.1, def:10,def_rate:0.1, dis: 100, a_cd: 1, power: 0, power_max: 15, speed: 40, - sk1: 9001, sk2: 2002, sk3: 9003, sk4: 9004, sk5: 9005, sk6: 9006, atktype: 1,skr:[0,10,20,30,40,50] + sk1: 9001, sk2: 2002, sk3: 9003, sk4: 9004, sk5: 9005, sk6: 9006, atktype: 1,skr:[0,10,20,30,40,50],uar:[0,10,20,30,40,50], }, diff --git a/assets/script/game/hero/Hero.ts b/assets/script/game/hero/Hero.ts index 7f3fafe7..9bacc214 100644 --- a/assets/script/game/hero/Hero.ts +++ b/assets/script/game/hero/Hero.ts @@ -89,9 +89,11 @@ export class Hero extends ecs.Entity { hv.sk4 = HInf.sk4; hv.sk5 = HInf.sk5; hv.skr = HInf.skr; + hv.uar = HInf.uar; hv.type = HInf.type; hv.hp= hv.hp_max =HInf.hp; hv.ap = HInf.ap; + hv.def= HInf.def; hv.cd = HInf.a_cd hv.power_max= HInf.power_max this.add(hv); diff --git a/assets/script/game/hero/HeroViewComp.ts b/assets/script/game/hero/HeroViewComp.ts index 4badbbe7..55c2aa06 100644 --- a/assets/script/game/hero/HeroViewComp.ts +++ b/assets/script/game/hero/HeroViewComp.ts @@ -5,7 +5,7 @@ * @LastEditTime: 2022-08-17 12:36:18 */ -import { Vec3, _decorator , v3,Collider2D,Contact2DType,Label,RigidBody2D ,Node,Prefab,instantiate,ProgressBar, Component, Material, Sprite, math} from "cc"; +import { Vec3, _decorator , v3,Collider2D,Contact2DType,Label,RigidBody2D ,Node,Prefab,instantiate,ProgressBar, Component, Material, Sprite, math, clamp} from "cc"; import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS"; import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp"; import { HeroSpine } from "./HeroSpine"; @@ -33,7 +33,7 @@ export class HeroViewComp extends CCComp { enemy:any=null!; as: HeroSpine = null!; - anm_timer:Timer = new Timer(2); + anm_timer:Timer = new Timer(0.3); anm_name="idle" status:String = "idle" @@ -67,6 +67,7 @@ export class HeroViewComp extends CCComp { sk4:number = 1001; sk5:number = 1001; skr:any=[0,0,0,0,0,0]; + uar:any=[0,0,0,0,0,0]; ap: number = 10; /**攻击力 */ ap_buff: number = 0; ap_buffs:any = []; @@ -86,7 +87,8 @@ export class HeroViewComp extends CCComp { speed: number = 100; /** 角色移动速度 */ ospeed: number = 100; /** 角色初始速度 */ - Tpos: Vec3 = v3(0,-60,0); + atk_count: number = 0; + atked_count: number = 0; stop_cd: number = 0.5; /*停止倒计时*/ dir_y:number = 0; @@ -204,20 +206,21 @@ export class HeroViewComp extends CCComp { this.node.setPosition(pos) return } + // if (this.timer.update(dt)) { // this.power_change(this.power_speed) // } // if(this.anm_timer.update(dt)) { - // this.change_anm() + // this.handle_skill(this.sk2) // } this.check_atk_buffs(dt) + this.check_atk_counts() this.in_stop(dt); this.at += dt; this.check_enemy_alive() this.in_atk(dt); // this.hp_show() this.move(dt); - } @@ -329,34 +332,51 @@ export class HeroViewComp extends CCComp { return {pos,t_pos} } - - in_atk(dt: number) { - if(this.at >= this.cd){ - if(this.is_atking){ - this.at = 0; - // console.log("cd:"+this.cd); - this.as.atk(); - let i = RandomManager.instance.getRandomInt(0,100,3) - console.log("大招触发判断: i="+i+":skr="+this.skr[this.lv]); + check_atk_counts(){ + if(this.atk_count >= 1){ + this.atk_count = 0 + console.log("atk_count 清零:"+this.atk_count); + // let i = RandomManager.instance.getRandomInt(0,100,3) + // console.log("大招判断: i="+i+":skr="+this.skr[this.lv]); + // if(i < this.skr[this.lv]){ + // console.log("大招触发: i="+i+":skr="+this.skr[this.lv]); + // this.node.getChildByName("max").active=true + // this.scheduleOnce(()=>{ + // this.node.getChildByName("max").active=false + // },0.8) + // this.handle_skill(this.sk2) + // } + } + if(this.atked_count >= 1){ + this.atked_count = 0 + let i = RandomManager.instance.getRandomInt(0,100,3) + console.log("受伤判断:i="+i+":skr="+this.skr[this.lv]); if(i < this.skr[this.lv]){ + console.log("受伤触发: i="+i+":skr="+this.skr[this.lv]); this.node.getChildByName("max").active=true this.scheduleOnce(()=>{ this.node.getChildByName("max").active=false },0.8) - this.handle_skill(this.sk2) - - return + this.handle_skill(this.sk2) } + } + } + in_atk(dt: number) { + if(this.at >= this.cd){ + if(this.is_atking){ + this.at = 0; + this.atk_count++ + // console.log("cd:"+this.cd); + this.as.atk(); this.scheduleOnce(()=>{ this.shoot_enemy(this.sk1) },0.3) - } } } //使用max_skill handle_skill(skill:number){ - + this.as.atk() switch (smc.skills[skill].tg) { case 0: //自己 this.to_add_buff(this.node.getComponent(HeroViewComp),skill) @@ -391,10 +411,13 @@ export class HeroViewComp extends CCComp { // this.tooltip(3,smc.skills[sk1].name,this.sk1); } to_add_buff(hero:any,s_uuid:number){ + let skill = ecs.getEntity(Skill); let atk = smc.skills[s_uuid].atk+this.ap; let {pos,t_pos}=this.get_hero_pos(hero) + console.log("to_add_buff:"+hero.hero_name+" "+s_uuid); skill.load(pos,this.box_group,this.node,this.sk2,atk,t_pos); + if(smc.skills[s_uuid].hp > 0){ //buff加血 let increase_hp=Math.floor(smc.skills[s_uuid].hp*this.ap) hero.add_hp(increase_hp) @@ -403,9 +426,11 @@ export class HeroViewComp extends CCComp { let increase_atk=Math.floor(smc.skills[s_uuid].atk*this.ap) hero.add_atk(increase_atk,smc.skills[s_uuid].bsd) } + if(smc.skills[s_uuid].shield > 0){ //buff护盾 hero.add_shield(smc.skills[s_uuid].shield) } + } push_least_buff(skill:number){ @@ -543,6 +568,7 @@ export class HeroViewComp extends CCComp { } add_shield(shield:number){ this.shield =shield + console.log("shield:",shield); if(this.shield > 0){ this.node.getChildByName("shielded").active=true } @@ -573,7 +599,8 @@ export class HeroViewComp extends CCComp { var node = instantiate(prefab); let pos =v3(0,30); node.setPosition(pos) - node.parent = this.node; + node.parent = this.node; + this.atked_count++; } dead(){ var path = "game/skills/dead"; diff --git a/assets/script/game/skills/SkillCom.ts b/assets/script/game/skills/SkillCom.ts index 733cc47f..10a1c001 100644 --- a/assets/script/game/skills/SkillCom.ts +++ b/assets/script/game/skills/SkillCom.ts @@ -38,7 +38,7 @@ export class SkillCom extends CCComp { run_type:number = 0; // 0有目标 带方向,1贝塞尔曲线 2 不动 ,3 直线 in_time:number = 0.3; // 不动技能持续时间 start() { - console.log("skill start run_type",this.run_type) + // console.log("skill start run_type",this.run_type) if(this.node.parent.scale.x < 0){ this.t_pos.x=this.t_pos.x*-1 } @@ -72,7 +72,7 @@ export class SkillCom extends CCComp { let distance = Math.sqrt(squaredDistance); time = distance / this.speed; let e_pos=v3(this.node.position.x+this.t_pos.x,this.node.position.y+this.t_pos.y) - console.log("skill tx:"+e_pos.x+" node :"+this.node.position.x) + // console.log("skill tx:"+e_pos.x+" node :"+this.node.position.x) this.node.getChildByName("skill").setRotationFromEuler(0,0,this.angle) // console.log("skill ",this.node.getRotation()) tween(this.node).to( time,{ position: e_pos}, @@ -149,7 +149,7 @@ export class SkillCom extends CCComp { toDestroy() { if(this.is_destroy){ - if(this.node.parent) this.ent.destroy() + this.ent.destroy() } } diff --git a/assets/script/game/skills/oncend.ts b/assets/script/game/skills/oncend.ts index 0cb7602b..2230150a 100644 --- a/assets/script/game/skills/oncend.ts +++ b/assets/script/game/skills/oncend.ts @@ -8,7 +8,6 @@ export class dead extends Component { anim.on(Animation.EventType.FINISHED, this.onAnimationFinished, this); } onAnimationFinished(){ - console.log("动画结束"); this.node.destroy(); } update(deltaTime: number) {