This commit is contained in:
2024-11-13 17:20:45 +08:00
parent 4e08ad13d1
commit 9d0ee7e7b5
7 changed files with 98 additions and 296 deletions

View File

@@ -869,7 +869,7 @@
"value": { "value": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": -8.972, "x": -8.972,
"y": 80.491, "y": 145.491,
"z": 0 "z": 0
} }
}, },

View File

@@ -22,23 +22,23 @@
"__id__": 2 "__id__": 2
}, },
{ {
"__id__": 18 "__id__": 12
}, },
{ {
"__id__": 34 "__id__": 28
} }
], ],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 44 "__id__": 38
}, },
{ {
"__id__": 46 "__id__": 40
} }
], ],
"_prefab": { "_prefab": {
"__id__": 48 "__id__": 42
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
@@ -80,24 +80,21 @@
"_children": [ "_children": [
{ {
"__id__": 3 "__id__": 3
},
{
"__id__": 9
} }
], ],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 15 "__id__": 9
} }
], ],
"_prefab": { "_prefab": {
"__id__": 17 "__id__": 11
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 0, "x": 0,
"y": 20, "y": 49.342,
"z": 0 "z": 0
}, },
"_lrot": { "_lrot": {
@@ -187,7 +184,7 @@
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 31.8076171875, "width": 48.4921875,
"height": 54.4 "height": 54.4
}, },
"_anchorPoint": { "_anchorPoint": {
@@ -226,8 +223,8 @@
"_string": "10", "_string": "10",
"_horizontalAlign": 1, "_horizontalAlign": 1,
"_verticalAlign": 1, "_verticalAlign": 1,
"_actualFontSize": 25, "_actualFontSize": 40,
"_fontSize": 25, "_fontSize": 40,
"_fontFamily": "Arial", "_fontFamily": "Arial",
"_lineHeight": 40, "_lineHeight": 40,
"_overflow": 0, "_overflow": 0,
@@ -236,7 +233,7 @@
"_isSystemFontUsed": true, "_isSystemFontUsed": true,
"_spacingX": 0, "_spacingX": 0,
"_isItalic": false, "_isItalic": false,
"_isBold": false, "_isBold": true,
"_isUnderline": false, "_isUnderline": false,
"_underlineHeight": 2, "_underlineHeight": 2,
"_cacheMode": 0, "_cacheMode": 0,
@@ -282,165 +279,6 @@
"targetOverrides": null, "targetOverrides": null,
"nestedPrefabInstanceRoots": null "nestedPrefabInstanceRoots": null
}, },
{
"__type__": "cc.Node",
"_name": "-",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
"__id__": 2
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 10
},
{
"__id__": 12
}
],
"_prefab": {
"__id__": 14
},
"_lpos": {
"__type__": "cc.Vec3",
"x": -18.702999999999975,
"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__": 9
},
"_enabled": true,
"__prefab": {
"__id__": 11
},
"_contentSize": {
"__type__": "cc.Size",
"width": 10.66015625,
"height": 54.4
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "9ahdBJciJJE5b82+DFngqr"
},
{
"__type__": "cc.Label",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 9
},
"_enabled": true,
"__prefab": {
"__id__": 13
},
"_customMaterial": null,
"_srcBlendFactor": 2,
"_dstBlendFactor": 4,
"_color": {
"__type__": "cc.Color",
"r": 243,
"g": 13,
"b": 13,
"a": 255
},
"_string": "-",
"_horizontalAlign": 1,
"_verticalAlign": 1,
"_actualFontSize": 20,
"_fontSize": 20,
"_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": 255,
"b": 255,
"a": 255
},
"_outlineWidth": 2,
"_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": "5apOCQBs9MA5D5RWeseFRK"
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "0bDawUUztMGamX5EtY9FQz",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{ {
"__type__": "cc.UITransform", "__type__": "cc.UITransform",
"_name": "", "_name": "",
@@ -451,7 +289,7 @@
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 16 "__id__": 10
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
@@ -492,20 +330,20 @@
}, },
"_children": [ "_children": [
{ {
"__id__": 19 "__id__": 13
}, },
{ {
"__id__": 25 "__id__": 19
} }
], ],
"_active": false, "_active": false,
"_components": [ "_components": [
{ {
"__id__": 31 "__id__": 25
} }
], ],
"_prefab": { "_prefab": {
"__id__": 33 "__id__": 27
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
@@ -542,20 +380,20 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"_parent": { "_parent": {
"__id__": 18 "__id__": 12
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 20 "__id__": 14
}, },
{ {
"__id__": 22 "__id__": 16
} }
], ],
"_prefab": { "_prefab": {
"__id__": 24 "__id__": 18
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
@@ -592,11 +430,11 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"node": { "node": {
"__id__": 19 "__id__": 13
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 21 "__id__": 15
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
@@ -620,11 +458,11 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"node": { "node": {
"__id__": 19 "__id__": 13
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 23 "__id__": 17
}, },
"_customMaterial": null, "_customMaterial": null,
"_srcBlendFactor": 2, "_srcBlendFactor": 2,
@@ -640,7 +478,7 @@
"_horizontalAlign": 1, "_horizontalAlign": 1,
"_verticalAlign": 1, "_verticalAlign": 1,
"_actualFontSize": 20, "_actualFontSize": 20,
"_fontSize": 25, "_fontSize": 40,
"_fontFamily": "Arial", "_fontFamily": "Arial",
"_lineHeight": 40, "_lineHeight": 40,
"_overflow": 0, "_overflow": 0,
@@ -649,7 +487,7 @@
"_isSystemFontUsed": true, "_isSystemFontUsed": true,
"_spacingX": 0, "_spacingX": 0,
"_isItalic": false, "_isItalic": false,
"_isBold": false, "_isBold": true,
"_isUnderline": false, "_isUnderline": false,
"_underlineHeight": 2, "_underlineHeight": 2,
"_cacheMode": 0, "_cacheMode": 0,
@@ -701,20 +539,20 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"_parent": { "_parent": {
"__id__": 18 "__id__": 12
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 26 "__id__": 20
}, },
{ {
"__id__": 28 "__id__": 22
} }
], ],
"_prefab": { "_prefab": {
"__id__": 30 "__id__": 24
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
@@ -751,11 +589,11 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"node": { "node": {
"__id__": 25 "__id__": 19
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 27 "__id__": 21
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
@@ -779,11 +617,11 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"node": { "node": {
"__id__": 25 "__id__": 19
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 29 "__id__": 23
}, },
"_customMaterial": null, "_customMaterial": null,
"_srcBlendFactor": 2, "_srcBlendFactor": 2,
@@ -799,7 +637,7 @@
"_horizontalAlign": 1, "_horizontalAlign": 1,
"_verticalAlign": 1, "_verticalAlign": 1,
"_actualFontSize": 20, "_actualFontSize": 20,
"_fontSize": 20, "_fontSize": 40,
"_fontFamily": "Arial", "_fontFamily": "Arial",
"_lineHeight": 40, "_lineHeight": 40,
"_overflow": 0, "_overflow": 0,
@@ -860,11 +698,11 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"node": { "node": {
"__id__": 18 "__id__": 12
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 32 "__id__": 26
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
@@ -905,17 +743,17 @@
}, },
"_children": [ "_children": [
{ {
"__id__": 35 "__id__": 29
} }
], ],
"_active": false, "_active": false,
"_components": [ "_components": [
{ {
"__id__": 41 "__id__": 35
} }
], ],
"_prefab": { "_prefab": {
"__id__": 43 "__id__": 37
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
@@ -952,20 +790,20 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"_parent": { "_parent": {
"__id__": 34 "__id__": 28
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 36 "__id__": 30
}, },
{ {
"__id__": 38 "__id__": 32
} }
], ],
"_prefab": { "_prefab": {
"__id__": 40 "__id__": 34
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
@@ -1002,11 +840,11 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"node": { "node": {
"__id__": 35 "__id__": 29
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 37 "__id__": 31
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
@@ -1030,11 +868,11 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"node": { "node": {
"__id__": 35 "__id__": 29
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 39 "__id__": 33
}, },
"_customMaterial": null, "_customMaterial": null,
"_srcBlendFactor": 2, "_srcBlendFactor": 2,
@@ -1111,11 +949,11 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"node": { "node": {
"__id__": 34 "__id__": 28
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 42 "__id__": 36
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
@@ -1156,7 +994,7 @@
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 45 "__id__": 39
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
@@ -1184,7 +1022,7 @@
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 47 "__id__": 41
}, },
"_id": "" "_id": ""
}, },

View File

@@ -40,7 +40,7 @@ export const SkillSet={
2001:{uuid: 2001,path: "2001",type: 91,tg:1,angle:false,level: 1,name: "治愈术",sp_name:"heath",info:"释放一个寒冰箭攻击敌人", 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,atk: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:"释放一个寒冰箭攻击敌人", 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:5,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,atk: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:"释放一个寒冰箭攻击敌人", 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,atk:1,hp:0,shield:0,sd:0,cd:0,bsd:8,bcd:0,sk_uuid:1001,sk_count:0,speed:450, },

View File

@@ -1,8 +1,8 @@
export const HeroSet = { export const HeroSet = {
9001: { 9001: {
uuid: 9001, path: "k1", type: 1, level: 1,cost:2, name: "白骑士", uuid: 9001, path: "k1", type: 1, lv: 1,name: "白骑士", wp:1001,arm:2001,ring:3001,shoes:4001,
atk: 10, hp: 100, atk_dis: 100, atk_cd: 1, power: 0, power_max: 15, speed: 40, atk: 20, atk_rate:0.1, hp: 100, hp_rate:0.1, def:10,def_rate:0.1, dis: 100, atk_cd: 1, power: 0, power_max: 15, speed: 40,
sk1: 9001, sk2: 2002, sk3: 9001, sk4: 2002, sk5: 9001, sk6: 2002, atktype: 1, sk1: 9001, sk2: 2002, sk3: 9001, sk4: 2002, sk5: 9001, sk6: 2002, atktype: 1,
}, },

View File

@@ -77,7 +77,7 @@ export class Hero extends ecs.Entity {
hv.hero_name= hero_set.name; hv.hero_name= hero_set.name;
hv.speed =hv.ospeed = hero_set.speed; hv.speed =hv.ospeed = hero_set.speed;
hv.atk_dis = hero_set.atk_dis; hv.dis = hero_set.dis;
hv.power = hero_set.power; hv.power = hero_set.power;
hv.level = hero_set.level; hv.level = hero_set.level;
hv.type = hero_set.type; hv.type = hero_set.type;
@@ -86,13 +86,10 @@ export class Hero extends ecs.Entity {
hv.sk3 = hero_set.sk3; hv.sk3 = hero_set.sk3;
hv.sk4 = hero_set.sk4; hv.sk4 = hero_set.sk4;
hv.sk5 = hero_set.sk5; hv.sk5 = hero_set.sk5;
hv.role_heros_index = index;
hv.type = hero_set.type; hv.type = hero_set.type;
hv.hp= hv.hp_max =hero_set.hp; hv.hp= hv.hp_max =hero_set.hp;
hv.atk = hero_set.atk; hv.atk = hero_set.atk;
hv.atk_cd = hero_set.atk_cd hv.atk_cd = hero_set.atk_cd
hv.st_boncus=1
hv.s_boncus=1
hv.power_max= hero_set.power_max hv.power_max= hero_set.power_max
this.add(hv); this.add(hv);
} }

View File

@@ -79,34 +79,30 @@ export class HeroViewComp extends CCComp {
atk_buffs:any = []; atk_buffs:any = [];
// atk_speed: number = 1; // atk_speed: number = 1;
atk_cd: number = 1.3; /**攻击速度 攻击间隔 */ atk_cd: number = 1.3; /**攻击速度 攻击间隔 */
atk_dis: number = 80; dis: number = 80;
atk_time: number = 0; /** 冷却时间 */ atk_time: number = 0; /** 冷却时间 */
st_boncus: number = 1; //技能持续时间加成 def: number = 0; //防御
s_boncus: number = 1; //技能效果加成 vun: number = 0; //易伤
crit: number = 1.5; //暴击伤害比率
crit_rate: number = 0;//暴击伤害加成
dodge: number = 10; //闪避率
shield:number = 0; //护盾,免伤1次减1
speed: number = 100; /** 角色移动速度 */ speed: number = 100; /** 角色移动速度 */
ospeed: number = 100; /** 角色初始速度 */ ospeed: number = 100; /** 角色初始速度 */
Tpos: Vec3 = v3(0,-60,0); Tpos: Vec3 = v3(0,-60,0);
stop_cd: number = 0.5; /*停止倒计时*/ stop_cd: number = 0.5; /*停止倒计时*/
//暴击
crit: number = 1.5;
crit_rate: number = 0;
//免伤
dodge_rate: number = 0;
shield:number = 0; //护盾量
shield_max:number = 200;
shield_time:number = 0; //护盾持续时间
buff_shields:any=[];
dir_y:number = 0; dir_y:number = 0;
speek_time:number = 0; speek_time:number = 0;
role_heros_index:number = -1;
onLoad() { onLoad() {
this.as = this.getComponent(HeroSpine); this.as = this.getComponent(HeroSpine);
@@ -162,8 +158,21 @@ export class HeroViewComp extends CCComp {
if(this.hp <= 0 ){ if(this.hp <= 0 ){
return return
} }
let loss_hp=skill.atk*(100-this.dodge_rate)/100 if(this.shield > 0){
this.hp_change(loss_hp); this.shield -= 1
return
}
let dodge = RandomManager.instance.getRandomInt(0,100,3)
if(dodge < this.dodge){
//todo 闪避跳字
console.log("闪避了",dodge,this.dodge);
return
}
let l_hp=(skill.atk-this.def)*-1
if(l_hp >= 0){
l_hp=-1 //最低1点伤害
}
this.hp_change(l_hp);
} }
} }
@@ -206,7 +215,7 @@ export class HeroViewComp extends CCComp {
} }
update(dt: number){ update(dt: number){
if(!smc.vm_data.mission.play||smc.vm_data.pause){ if(!smc.vm_data.mission.play||smc.vm_data.pause||this.is_dead){
return return
} }
if (this.timer.update(dt)) { if (this.timer.update(dt)) {
@@ -215,9 +224,7 @@ export class HeroViewComp extends CCComp {
// if(this.anm_timer.update(dt)) { // if(this.anm_timer.update(dt)) {
// this.change_anm() // this.change_anm()
// } // }
this.in_destroy();
this.check_atk_buffs(dt) this.check_atk_buffs(dt)
this.in_shield(dt);
this.in_stop(dt); this.in_stop(dt);
this.atk_time += dt; this.atk_time += dt;
this.check_enemy_alive() this.check_enemy_alive()
@@ -274,9 +281,9 @@ export class HeroViewComp extends CCComp {
} }
} }
} }
if(dir < this.atk_dis){ if(dir < this.dis){
this.is_atking=true this.is_atking=true
this.stop_cd = 0.1 this.stop_cd = 0.1
}else{ }else{
@@ -378,16 +385,15 @@ export class HeroViewComp extends CCComp {
let {pos,t_pos}=this.get_hero_pos(hero) let {pos,t_pos}=this.get_hero_pos(hero)
skill.load(pos,this.box_group,this.node,this.sk2,atk,t_pos); skill.load(pos,this.box_group,this.node,this.sk2,atk,t_pos);
if(smc.skills[s_uuid].hp > 0){ //buff加血 if(smc.skills[s_uuid].hp > 0){ //buff加血
let increase_hp=Math.floor(smc.skills[s_uuid].hp*this.atk*this.s_boncus*smc.vm_data.mission.hero.atk) let increase_hp=Math.floor(smc.skills[s_uuid].hp*this.atk)
hero.add_hp(increase_hp) hero.add_hp(increase_hp)
} }
if(smc.skills[s_uuid].atk > 0){ //buff加攻击 if(smc.skills[s_uuid].atk > 0){ //buff加攻击
let increase_atk=Math.floor(smc.skills[s_uuid].atk*this.atk*this.s_boncus*smc.vm_data.mission.hero.atk) let increase_atk=Math.floor(smc.skills[s_uuid].atk*this.atk)
hero.add_atk(increase_atk,smc.skills[s_uuid].bsd*this.st_boncus) hero.add_atk(increase_atk,smc.skills[s_uuid].bsd)
} }
if(smc.skills[s_uuid].shield > 0){ //buff护盾 if(smc.skills[s_uuid].shield > 0){ //buff护盾
let increase_shield=Math.floor(smc.skills[s_uuid].shield*this.atk*this.s_boncus*smc.vm_data.mission.hero.atk) hero.add_shield(smc.skills[s_uuid].shield)
hero.add_shield(increase_shield,smc.skills[s_uuid].bsd*this.st_boncus)
} }
} }
@@ -516,12 +522,9 @@ export class HeroViewComp extends CCComp {
if(this.is_dead){ if(this.is_dead){
return; return;
} }
let lhp=this.shield_change(hp);
if(lhp == 0){ this.hp += hp;
return; this.tooltip(1,hp.toString(),250);
}
this.hp += lhp;
// this.tooltip(1,hp.toString());
if(this.hp > this.hp_max){ if(this.hp > this.hp_max){
this.hp = this.hp_max; this.hp = this.hp_max;
} }
@@ -575,43 +578,10 @@ export class HeroViewComp extends CCComp {
add_shield(shield: number,time:number=0){ add_shield(shield:number){
this.shield =this.shield_max=shield this.shield =shield
this.shield_time = time;
}
shield_change(hp: number){
let ls=this.shield - hp;
if(ls <= 0){
this.shield = 0;
return ls;
}else{
this.shield = ls;
return 0;
}
}
in_shield(dt: number){
if(this.shield <= 0){
this.shield_time=0
this.node.getChildByName("shielded").active=false
}else{
this.node.getChildByName("shielded").active=true
}
if(this.shield_time <= 0){
this.shield = this.shield_max=0;
this.node.getChildByName("shielded").active=false
return
}
if(this.shield_time > 0){
this.shield_time -= dt;
if(this.shield_time <= 0){
this.shield_time = 0;
this.shield = this.shield_max=0;
// this.node.getChildByName("top").getChildByName("shield").active=false
}
// let shield_progress= this.shield/this.shield_max;
// this.node.getChildByName("top").getChildByName("shield").getComponent(ProgressBar)!.progress = shield_progress;
}
} }
tooltip(type:number=1,value:string="",s_uuid:number=1001,y:number=60){ tooltip(type:number=1,value:string="",s_uuid:number=1001,y:number=60){
// console.log("tooltip",type); // console.log("tooltip",type);
let tip =ecs.getEntity<Tooltip>(Tooltip); let tip =ecs.getEntity<Tooltip>(Tooltip);
@@ -631,10 +601,7 @@ export class HeroViewComp extends CCComp {
} }
} }
} }
in_destroy(){
}
in_atked() { in_atked() {
// var path = "game/skills/atked"; // var path = "game/skills/atked";
// var prefab: Prefab = oops.res.get(path, Prefab)!; // var prefab: Prefab = oops.res.get(path, Prefab)!;

View File

@@ -45,7 +45,7 @@ export class TooltipCom extends CCComp {
this.node.getChildByName("add_life").active=true; this.node.getChildByName("add_life").active=true;
tween(this.node).to( tween(this.node).to(
this.alive_time, this.alive_time,
{position:v3(this.node.position.x-30,this.node.position.y+20), }, {position:v3(this.node.position.x,this.node.position.y+20), },
{ {
onComplete:()=>{ this.ent.destroy()}, onComplete:()=>{ this.ent.destroy()},
easing:"linear" easing:"linear"