diff --git a/assets/resources/game/skills/tooltip.prefab b/assets/resources/game/skills/tooltip.prefab index 0b04fd41..03fbab7b 100644 --- a/assets/resources/game/skills/tooltip.prefab +++ b/assets/resources/game/skills/tooltip.prefab @@ -26,19 +26,22 @@ }, { "__id__": 28 + }, + { + "__id__": 38 } ], "_active": true, "_components": [ { - "__id__": 38 + "__id__": 54 }, { - "__id__": 40 + "__id__": 56 } ], "_prefab": { - "__id__": 42 + "__id__": 58 }, "_lpos": { "__type__": "cc.Vec3", @@ -82,7 +85,7 @@ "__id__": 3 } ], - "_active": true, + "_active": false, "_components": [ { "__id__": 9 @@ -848,8 +851,8 @@ }, "_contentSize": { "__type__": "cc.Size", - "width": 70.68701171875, - "height": 24.16 + "width": 104.71875, + "height": 33.2 }, "_anchorPoint": { "__type__": "cc.Vec2", @@ -887,10 +890,10 @@ "_string": "skill name", "_horizontalAlign": 1, "_verticalAlign": 1, - "_actualFontSize": 15, - "_fontSize": 16, + "_actualFontSize": 20, + "_fontSize": 20, "_fontFamily": "Arial", - "_lineHeight": 16, + "_lineHeight": 20, "_overflow": 0, "_enableWrapText": true, "_font": null, @@ -909,7 +912,7 @@ "b": 0, "a": 255 }, - "_outlineWidth": 1, + "_outlineWidth": 4, "_enableShadow": false, "_shadowColor": { "__type__": "cc.Color", @@ -984,6 +987,419 @@ "targetOverrides": null, "nestedPrefabInstanceRoots": null }, + { + "__type__": "cc.Node", + "_name": "bloss", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 1 + }, + "_children": [ + { + "__id__": 39 + }, + { + "__id__": 45 + } + ], + "_active": false, + "_components": [ + { + "__id__": 51 + } + ], + "_prefab": { + "__id__": 53 + }, + "_lpos": { + "__type__": "cc.Vec3", + "x": 0, + "y": 49.342, + "z": 0 + }, + "_lrot": { + "__type__": "cc.Quat", + "x": 0, + "y": 0, + "z": 0, + "w": 1 + }, + "_lscale": { + "__type__": "cc.Vec3", + "x": 1, + "y": 1, + "z": 1 + }, + "_mobility": 0, + "_layer": 1073741824, + "_euler": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_id": "" + }, + { + "__type__": "cc.Node", + "_name": "hp", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 38 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 40 + }, + { + "__id__": 42 + } + ], + "_prefab": { + "__id__": 44 + }, + "_lpos": { + "__type__": "cc.Vec3", + "x": 73.978, + "y": 0, + "z": 0 + }, + "_lrot": { + "__type__": "cc.Quat", + "x": 0, + "y": 0, + "z": 0, + "w": 1 + }, + "_lscale": { + "__type__": "cc.Vec3", + "x": 1, + "y": 1, + "z": 1 + }, + "_mobility": 0, + "_layer": 1073741824, + "_euler": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_id": "" + }, + { + "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 39 + }, + "_enabled": true, + "__prefab": { + "__id__": 41 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 200, + "height": 64.7 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "55I8JpnXhPoLsF7UAMsW2P" + }, + { + "__type__": "cc.Label", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 39 + }, + "_enabled": true, + "__prefab": { + "__id__": 43 + }, + "_customMaterial": null, + "_srcBlendFactor": 2, + "_dstBlendFactor": 4, + "_color": { + "__type__": "cc.Color", + "r": 231, + "g": 22, + "b": 22, + "a": 255 + }, + "_string": "10", + "_horizontalAlign": 0, + "_verticalAlign": 1, + "_actualFontSize": 56, + "_fontSize": 55, + "_fontFamily": "Arial", + "_lineHeight": 55, + "_overflow": 2, + "_enableWrapText": true, + "_font": null, + "_isSystemFontUsed": true, + "_spacingX": 0, + "_isItalic": false, + "_isBold": true, + "_isUnderline": false, + "_underlineHeight": 2, + "_cacheMode": 0, + "_enableOutline": true, + "_outlineColor": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_outlineWidth": 7, + "_enableShadow": false, + "_shadowColor": { + "__type__": "cc.Color", + "r": 0, + "g": 0, + "b": 0, + "a": 255 + }, + "_shadowOffset": { + "__type__": "cc.Vec2", + "x": 2, + "y": 2 + }, + "_shadowBlur": 2, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "8fe9dF+oZOtrBXkWK7Zov5" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__id__": 0 + }, + "fileId": "7fnHKSWA5JtKAidc9unW1m", + "instance": null, + "targetOverrides": null, + "nestedPrefabInstanceRoots": null + }, + { + "__type__": "cc.Node", + "_name": "b", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 38 + }, + "_children": [], + "_active": false, + "_components": [ + { + "__id__": 46 + }, + { + "__id__": 48 + } + ], + "_prefab": { + "__id__": 50 + }, + "_lpos": { + "__type__": "cc.Vec3", + "x": -59.652, + "y": -2.544, + "z": 0 + }, + "_lrot": { + "__type__": "cc.Quat", + "x": 0, + "y": 0, + "z": 0, + "w": 1 + }, + "_lscale": { + "__type__": "cc.Vec3", + "x": 1, + "y": 1, + "z": 1 + }, + "_mobility": 0, + "_layer": 1073741824, + "_euler": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_id": "" + }, + { + "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 45 + }, + "_enabled": true, + "__prefab": { + "__id__": 47 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 62, + "height": 52.4 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "322JjRaLVCH6xInPHAtHJU" + }, + { + "__type__": "cc.Label", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 45 + }, + "_enabled": true, + "__prefab": { + "__id__": 49 + }, + "_customMaterial": null, + "_srcBlendFactor": 2, + "_dstBlendFactor": 4, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_string": "暴击", + "_horizontalAlign": 1, + "_verticalAlign": 1, + "_actualFontSize": 30, + "_fontSize": 30, + "_fontFamily": "Arial", + "_lineHeight": 40, + "_overflow": 0, + "_enableWrapText": true, + "_font": null, + "_isSystemFontUsed": true, + "_spacingX": 0, + "_isItalic": false, + "_isBold": false, + "_isUnderline": false, + "_underlineHeight": 2, + "_cacheMode": 0, + "_enableOutline": true, + "_outlineColor": { + "__type__": "cc.Color", + "r": 255, + "g": 0, + "b": 0, + "a": 255 + }, + "_outlineWidth": 1, + "_enableShadow": false, + "_shadowColor": { + "__type__": "cc.Color", + "r": 0, + "g": 0, + "b": 0, + "a": 255 + }, + "_shadowOffset": { + "__type__": "cc.Vec2", + "x": 2, + "y": 2 + }, + "_shadowBlur": 2, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "9duqGwDtVOQIskLBlI+GeW" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__id__": 0 + }, + "fileId": "ddEVlyv8BP9Jn5ubLJ8w8h", + "instance": null, + "targetOverrides": null, + "nestedPrefabInstanceRoots": null + }, + { + "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 38 + }, + "_enabled": true, + "__prefab": { + "__id__": 52 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 100, + "height": 100 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "03+pQINmpEeLZGnj5sA4RM" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__id__": 0 + }, + "fileId": "20vKhpGcBEoKbUIhLvPmd1", + "instance": null, + "targetOverrides": null, + "nestedPrefabInstanceRoots": null + }, { "__type__": "cc.UITransform", "_name": "", @@ -994,7 +1410,7 @@ }, "_enabled": true, "__prefab": { - "__id__": 39 + "__id__": 55 }, "_contentSize": { "__type__": "cc.Size", @@ -1022,7 +1438,7 @@ }, "_enabled": true, "__prefab": { - "__id__": 41 + "__id__": 57 }, "_id": "" }, diff --git a/assets/script/game/common/SingletonModuleComp.ts b/assets/script/game/common/SingletonModuleComp.ts index 7cdc4d8e..2bcf5dd8 100644 --- a/assets/script/game/common/SingletonModuleComp.ts +++ b/assets/script/game/common/SingletonModuleComp.ts @@ -118,7 +118,7 @@ export class SingletonModuleComp extends ecs.Comp { reward_gold:0, reward_exp:0, hero:{ - atk:1, + ap:1, atk_cd:1, hp:1, }, diff --git a/assets/script/game/common/config/SkillSet.ts b/assets/script/game/common/config/SkillSet.ts index 9632e5f5..9062c3d3 100644 --- a/assets/script/game/common/config/SkillSet.ts +++ b/assets/script/game/common/config/SkillSet.ts @@ -29,40 +29,40 @@ run:number = 0; // 0有目标 带方向,1贝塞尔曲线 2 不动 ,3 直线 */ export const SkillSet={ 1001:{uuid: 1001,path: "1001",type: 1,tg:3,angle:true,level: 1,name: "火球术",sp_name:"fire",info:"释放一个火球术攻击敌人", - dis:1,count:1,in:0,run:0,atk:10,hp:0,shield:0,sd:10,cd:3,bsd:0,bcd:0,sk_uuid:1001,sk_count:0,speed:600, }, + dis:1,count:1,in:0,run:0,ap:10,hp:0,shield:0,sd:10,cd:3,bsd:0,bcd:0,sk_uuid:1001,sk_count:0,speed:600, }, 1002:{uuid: 1002,path: "1002",type: 1,tg:3,angle:true,level: 3,name: "寒冰箭",sp_name:"ice",info:"释放一个寒冰箭攻击敌人", - dis:1,count:1,in:0,run:0,atk:10,hp:0,shield:0,sd:10,cd:1,bsd:0,bcd:0,sk_uuid:1001,sk_count:0,speed:600, }, + dis:1,count:1,in:0,run:0,ap:10,hp:0,shield:0,sd:10,cd:1,bsd:0,bcd:0,sk_uuid:1001,sk_count:0,speed:600, }, 1003:{uuid: 1003,path: "1003",type: 1,tg:3,angle:true,level: 3,name: "强效射击",sp_name:"b_arrow",info:"释放一个火球术攻击敌人", - dis:1,count:1,in:0,run:1,atk:10,hp:0,shield:0,sd:10,cd:1,bsd:0,bcd:0,sk_uuid:1001,sk_count:0,speed:600, }, + dis:1,count:1,in:0,run:1,ap:10,hp:0,shield:0,sd:10,cd:1,bsd:0,bcd:0,sk_uuid:1001,sk_count:0,speed:600, }, 1004:{uuid: 1004,path: "1004",type: 1,tg:3,angle:true,level: 3,name: "奥术冲击",sp_name:"bm_ball",info:"释放一个寒冰箭攻击敌人", - dis:1,count:1,in:0,run:0,atk:10,hp:0,shield:0,sd:10,cd:1,bsd:0,bcd:0,sk_uuid:1001,sk_count:0,speed:600, }, + dis:1,count:1,in:0,run:0,ap:10,hp:0,shield:0,sd:10,cd:1,bsd:0,bcd:0,sk_uuid:1001,sk_count:0,speed:600, }, 2001:{uuid: 2001,path: "2001",type: 91,tg:1,angle:false,level: 1,name: "治愈术",sp_name:"heath",info:"释放一个寒冰箭攻击敌人", - dis:1,count:1,in:0,run:1,atk:0,hp:3,shield:0,sd:10,cd:1,bsd:0,bcd:0,sk_uuid:1001,sk_count:0,speed:450, }, + dis:1,count:1,in:0,run:1,ap:0,hp:3,shield:0,sd:10,cd:1,bsd:0,bcd:0,sk_uuid:1001,sk_count:0,speed:450, }, 2002:{uuid: 2002,path: "2002",type: 91,tg:0,angle:false,level: 1,name: "魔法盾",sp_name:"shield",info:"释放一个寒冰箭攻击敌人", - dis:1,count:1,in:0.2,run:2,atk:0,hp:0,shield:1,sd:0,cd:0,bsd:8,bcd:0,sk_uuid:1001,sk_count:0,speed:450, }, + dis:1,count:1,in:0.2,run:2,ap:0,hp:0,shield:1,sd:0,cd:0,bsd:8,bcd:0,sk_uuid:1001,sk_count:0,speed:450, }, 2003:{uuid: 2003,path: "2003",type: 91,tg:0,angle:false,level: 1,name: "狂暴",sp_name:"atkup",info:"释放一个寒冰箭攻击敌人", - dis:1,count:1,in:0.2,run:2,atk:1,hp:0,shield:0,sd:0,cd:0,bsd:8,bcd:0,sk_uuid:1001,sk_count:0,speed:450, }, + dis:1,count:1,in:0.2,run:2,ap:1,hp:0,shield:0,sd:0,cd:0,bsd:8,bcd:0,sk_uuid:1001,sk_count:0,speed:450, }, 3001:{uuid: 3001,path: "3001",type: 1,tg:3,angle:true,level: 1,name: "三连击",sp_name:"patk",info:"释放一个魔法球攻击敌人", - dis:1,count:3,in:0.3,run:2,atk:0,hp:0,shield:0,sd:0,cd:0,bsd:0,bcd:0,sk_uuid:1001,sk_count:0,speed:600,}, + dis:1,count:3,in:0.3,run:2,ap:0,hp:0,shield:0,sd:0,cd:0,bsd:0,bcd:0,sk_uuid:1001,sk_count:0,speed:600,}, 4011:{uuid: 4011,path: "1011",type: 11,tg:3,angle:true,level: 3,name: "火焰风暴",sp_name:"fire",info:"释放多个个火球术攻击敌人", - dis:1,count:5,in:0,run:0,atk:10,hp:0,shield:0,sd:10,cd:2,bsd:0,bcd:0,sk_uuid:1001,sk_count:0,speed:600, }, + dis:1,count:5,in:0,run:0,ap:10,hp:0,shield:0,sd:10,cd:2,bsd:0,bcd:0,sk_uuid:1001,sk_count:0,speed:600, }, 4012:{uuid: 4012,path: "1012",type: 11,tg:3,angle:true,level: 3,name: "冰晶风暴",sp_name:"ice",info:"释放多个个寒冰箭攻击敌人", - dis:1,count:5,in:0,run:0,atk:10,hp:0,shield:0,sd:10,cd:2,bsd:0,bcd:0,sk_uuid:1001,sk_count:0,speed:600, }, + dis:1,count:5,in:0,run:0,ap:10,hp:0,shield:0,sd:10,cd:2,bsd:0,bcd:0,sk_uuid:1001,sk_count:0,speed:600, }, 9001:{uuid: 9001,path: "1001",type: 1,tg:3,angle:true,level: 1,name: "普攻",sp_name:"patk",info:"释放一个魔法球攻击敌人", - dis:1,count:1,in:0,run:0,atk:0,hp:0,shield:0,sd:0,cd:0,bsd:0,bcd:0,sk_uuid:1001,sk_count:0,speed:1000,}, + dis:1,count:1,in:0,run:0,ap:0,hp:0,shield:0,sd:0,cd:0,bsd:0,bcd:0,sk_uuid:1001,sk_count:0,speed:1000,}, 9002:{uuid: 9002,path: "1001",type: 1,tg:3,angle:true,level: 1,name: "魔法小球",sp_name:"mball",info:"释放一个魔法球攻击敌人", - dis:1,count:1,in:0,run:0,atk:0,hp:0,shield:0,sd:0,cd:0,bsd:0,bcd:0,sk_uuid:1001,sk_count:0,speed:600,}, + dis:1,count:1,in:0,run:0,ap:0,hp:0,shield:0,sd:0,cd:0,bsd:0,bcd:0,sk_uuid:1001,sk_count:0,speed:600,}, 9003:{uuid: 9003,path: "1001",type: 1,tg:3,angle:true,level: 1,name: "射击",sp_name:"arrow",info:"释放一个魔法球攻击敌人", - dis:1,count:1,in:0,run:1,atk:0,hp:0,shield:0,sd:0,cd:0,bsd:0,bcd:0,sk_uuid:1001,sk_count:0,speed:600,}, + dis:1,count:1,in:0,run:1,ap:0,hp:0,shield:0,sd:0,cd:0,bsd:0,bcd:0,sk_uuid:1001,sk_count:0,speed:600,}, 8001:{uuid: 8001,path: "8001",type: 1,tg:3,angle:true,level: 1,name: "飞刀",sp_name:"sword1",info:"释放一个魔法球攻击敌人", - dis:1,count:1,in:0,run:0,atk:0,hp:0,shield:0,sd:0,cd:0,bsd:0,bcd:0,sk_uuid:8001,sk_count:0,speed:600,}, + dis:1,count:1,in:0,run:0,ap:0,hp:0,shield:0,sd:0,cd:0,bsd:0,bcd:0,sk_uuid:8001,sk_count:0,speed:600,}, } diff --git a/assets/script/game/common/config/heroSet.ts b/assets/script/game/common/config/heroSet.ts index 92a56b6d..8635e8af 100644 --- a/assets/script/game/common/config/heroSet.ts +++ b/assets/script/game/common/config/heroSet.ts @@ -3,7 +3,7 @@ export const HeroInfo = { 9001: { 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, + 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: 100,vun:0,crit:20,crit_add:0,dodge:0, 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 9bacc214..84a5ffc5 100644 --- a/assets/script/game/hero/Hero.ts +++ b/assets/script/game/hero/Hero.ts @@ -95,6 +95,10 @@ export class Hero extends ecs.Entity { hv.ap = HInf.ap; hv.def= HInf.def; hv.cd = HInf.a_cd + hv.vun = HInf.vun; //易伤 + hv.crit = HInf.crit; //暴击率 + hv.crit_add = HInf.crit_add;//暴击伤害加成 + hv.dodge = HInf.dodge; //闪避率 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 55c2aa06..d4ebe58b 100644 --- a/assets/script/game/hero/HeroViewComp.ts +++ b/assets/script/game/hero/HeroViewComp.ts @@ -79,8 +79,8 @@ export class HeroViewComp extends CCComp { def: number = 0; //防御 vun: number = 0; //易伤 - crit: number = 1.5; //暴击伤害比率 - crit_rate: number = 0;//暴击伤害加成 + crit: number = 0; //暴击率 + crit_add: number = 0;//暴击伤害加成 dodge: number = 10; //闪避率 shield:number = 0; //护盾,免伤1次减1 @@ -153,17 +153,15 @@ export class HeroViewComp extends CCComp { } return } - let dodge = RandomManager.instance.getRandomInt(0,100,3) - if(dodge < this.dodge){ - //todo 闪避跳字 - console.log("闪避了",dodge,this.dodge); - return + if(this.check_dodge()) return + let l_hp=(skill.ap-this.def)*-1 + if(skill.is_crit){ + l_hp = l_hp * (150+skill.crit_add)/100 } - let l_hp=(skill.atk-this.def)*-1 if(l_hp >= 0){ l_hp=-1 //最低1点伤害 } - this.hp_change(l_hp); + this.hp_change(l_hp,skill.is_crit); } } @@ -332,20 +330,41 @@ export class HeroViewComp extends CCComp { return {pos,t_pos} } + //暴击判断 + check_crit(){ + let i = RandomManager.instance.getRandomInt(0,100,3) + if(i < this.crit){ + console.log("攻击会暴击",i,this.crit); + return true + }else{ + return false + } + } + //闪避判断 + check_dodge(){ + let i = RandomManager.instance.getRandomInt(0,100,3) + if(i < this.dodge){ + this.tooltip(5,"闪避"); + console.log("闪避了",i,this.dodge); + return true + }else{ + return false + } + } 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) - // } + 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 @@ -400,31 +419,30 @@ export class HeroViewComp extends CCComp { shoot_enemy(sk1:number,y:number=0,x:number=0){ // console.log("mon shoot_enemy"); let skill = ecs.getEntity(Skill); - let increase_atk=Math.floor(this.ap*smc.vm_data.mission.hero.atk) - let atk = smc.skills[sk1].atk+this.ap_buff+increase_atk; + let increase_ap=Math.floor(this.ap*smc.vm_data.mission.hero.ap) + let ap = smc.skills[sk1].ap+this.ap_buff+increase_ap; let {pos,t_pos}=this.get_enemy_pos() - pos.y=pos.y + y pos.x=pos.x + x - skill.load(pos,this.box_group,this.node,sk1,atk,t_pos); + let is_crit=this.check_crit() + skill.load(pos,this.box_group,this.node,sk1,ap,t_pos,is_crit,this.crit_add); console.log(this.scale+this.hero_name+"使用技能:"+sk1); // 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 ap = smc.skills[s_uuid].ap+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); - + let is_crit=this.check_crit() + skill.load(pos,this.box_group,this.node,this.sk2,ap,t_pos,is_crit,this.crit_add); 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) } - if(smc.skills[s_uuid].atk > 0){ //buff加攻击 - 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].ap > 0){ //buff加攻击 + let increase_atk=Math.floor(smc.skills[s_uuid].ap*this.ap) + hero.add_ap(increase_atk,smc.skills[s_uuid].bsd) } if(smc.skills[s_uuid].shield > 0){ //buff护盾 @@ -513,13 +531,19 @@ export class HeroViewComp extends CCComp { let hp_progress= this.hp/this.hp_max; this.node.getChildByName("top").getChildByName("hp").getComponent(ProgressBar)!.progress = hp_progress; } - hp_change(hp: number){ + hp_change(hp: number,is_crit:boolean=false){ if(this.is_dead){ return; } this.hp += hp; - this.tooltip(1,hp.toString(),250); + + if(is_crit){ + this.tooltip(4,hp.toString(),250); + }else{ + this.tooltip(1,hp.toString(),250); + } + if(this.hp > this.hp_max){ this.hp = this.hp_max; } @@ -533,25 +557,15 @@ export class HeroViewComp extends CCComp { // }, 15); } } - add_atk(atk: number,time:number=0){ - if(time > 0){ - this.ap_buff=0 - let buff={atk:atk,time:time} - this.ap_buffs.push(buff); - this.ap_buffs.forEach((element: { atk: number; }) => { - this.ap_buff += element.atk - }); - }else{ - this.ap += atk; - } - // console.log(this.ap_buffs) + add_ap(ap: number,time:number=0){ + this.ap += ap; } check_atk_buffs(dt: number){ for(let i=0;i(Tooltip); - let pos = this.node.getPosition(); - let node =this.node.parent + let pos = v3(0,0); pos.y=pos.y+y; - tip.load(pos,type,value,s_uuid,node); + tip.load(pos,type,value,s_uuid,this.node); } /** 静止时间 */ diff --git a/assets/script/game/skills/Skill.ts b/assets/script/game/skills/Skill.ts index eb86f03d..337374c7 100644 --- a/assets/script/game/skills/Skill.ts +++ b/assets/script/game/skills/Skill.ts @@ -29,9 +29,8 @@ export class Skill extends ecs.Entity { this.remove(SkillCom); super.destroy(); } - load(pos: Vec3 = Vec3.ZERO,group:number,parent:Node, - uuid:number=1001,atk:number =10,t_pos:Vec3 = null,dis:number=0,) - + load(pos: Vec3 = Vec3.ZERO,group:number,parent:Node,uuid:number=1001, + ap:number =10,t_pos:Vec3 = null,is_crit:boolean=false,crit_add:number=0) { var path = "game/skills/"+smc.skills[uuid].sp_name; var prefab: Prefab = oops.res.get(path, Prefab)!; @@ -56,11 +55,13 @@ export class Skill extends ecs.Entity { sv.angle = angle; // console.log(smc.skills[uuid].name+"angle:"+angle) sv.s_uuid = uuid; - sv.atk = atk; + sv.ap = ap; + sv.is_crit=is_crit + sv.crit_add=crit_add // node.setScale(v3(node.scale.x*scale,node.scale.y)) sv.speed=smc.skills[uuid].speed; - sv.dis=smc.skills[uuid].dis+dis; + sv.dis=smc.skills[uuid].dis; sv.run_type=smc.skills[uuid].run; if(sv.dis == 0){ sv.run_type=2 diff --git a/assets/script/game/skills/SkillCom.ts b/assets/script/game/skills/SkillCom.ts index 10a1c001..c8cd23f2 100644 --- a/assets/script/game/skills/SkillCom.ts +++ b/assets/script/game/skills/SkillCom.ts @@ -26,8 +26,10 @@ export class SkillCom extends CCComp { x_speed:number = 0; dis:number = 80; scale:number = 1; - atk:number = 10; + ap:number = 10; atk_count:number = 0; + is_crit:boolean = false; + crit_add: number = 0;//暴击伤害加成 angle:number = 0; t_pos:Vec3 = v3(0,0,0); // 目标增量 is_destroy:boolean = false; diff --git a/assets/script/game/skills/Tooltip.ts b/assets/script/game/skills/Tooltip.ts index 8b28e787..fd8c3071 100644 --- a/assets/script/game/skills/Tooltip.ts +++ b/assets/script/game/skills/Tooltip.ts @@ -35,13 +35,16 @@ export class Tooltip extends ecs.Entity { var prefab: Prefab = oops.res.get(path, Prefab)!; var node = instantiate(prefab); node.parent = parent; + if(parent.scale.x < 0){ + node.setScale(-node.scale.x, node.scale.y, 0); + } node.setPosition(pos) var sv = node.getComponent(TooltipCom)!; // console.log("load tooltip type",type,vaule,s_uuid); sv.stype = type; sv.value = vaule; sv.s_uuid = s_uuid; - sv.alive_time = 0.3; + sv.alive_time = 0.5; this.add(sv) } } diff --git a/assets/script/game/skills/TooltipCom.ts b/assets/script/game/skills/TooltipCom.ts index e04fbfdb..de0cfd02 100644 --- a/assets/script/game/skills/TooltipCom.ts +++ b/assets/script/game/skills/TooltipCom.ts @@ -22,10 +22,8 @@ export class TooltipCom extends CCComp { s_uuid:number = 1001; alive_time:number = 0.2; skill_name_time=0.5; + scale:number = 1; start() { - this.node.getChildByName("loss_life").active=false; - this.node.getChildByName("add_life").active=false - this.node.getChildByName("skill").active=false; // console.log("TooltipView start",this.node); switch(this.stype){ case 1: @@ -33,7 +31,7 @@ export class TooltipCom extends CCComp { this.node.getChildByName("loss_life").active=true; tween(this.node).to( this.alive_time, - {position:v3(this.node.position.x+30,this.node.position.y+20), }, + {position:v3(this.node.position.x-10,this.node.position.y+20), }, { onComplete:()=>{ this.ent.destroy()}, easing:"linear" @@ -53,20 +51,45 @@ export class TooltipCom extends CCComp { ).start() break case 3: - this.node.getChildByName("skill").getChildByName("name").getComponent(Label).string = smc.skills[this.s_uuid].name; this.node.getChildByName("skill").active=true; this.node.setPosition(v3(this.node.position.x,this.node.position.y+60)) // this.alive_time = 2 tween(this.node).to( this.alive_time, - {position:v3(this.node.position.x,this.node.position.y), }, + {position:v3(this.node.position.x,this.node.position.y+30), }, { onComplete:()=>{ this.ent.destroy()}, easing:"linear" } ).start() break + case 4: + this.node.getChildByName("bloss").getChildByName("hp").getComponent(Label).string = this.value; + this.node.getChildByName("bloss").active=true; + tween(this.node).to( + this.alive_time, + {position:v3(this.node.position.x-10,this.node.position.y+20), }, + { + onComplete:()=>{ this.ent.destroy()}, + easing:"linear" + } + ).start() + break + case 5: + this.node.getChildByName("skill").getChildByName("name").getComponent(Label).string = this.value; + this.node.getChildByName("skill").active=true; + this.node.setPosition(v3(this.node.position.x,this.node.position.y+60)) + // this.alive_time = 2 + tween(this.node).to( + this.alive_time, + {position:v3(this.node.position.x-20,this.node.position.y+30), }, + { + onComplete:()=>{ this.ent.destroy()}, + easing:"linear" + } + ).start() + break } } @@ -77,9 +100,6 @@ export class TooltipCom extends CCComp { /** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */ reset() { - this.node.getChildByName("loss_life").active=false; - this.node.getChildByName("add_life").active=false; - this.node.getChildByName("skill").active=false; this.node.destroy(); } } \ No newline at end of file