This commit is contained in:
2025-01-09 12:39:52 +08:00
7 changed files with 1508 additions and 1435 deletions

View File

@@ -142,8 +142,8 @@
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 120, "width": 130,
"height": 120 "height": 145
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
@@ -353,8 +353,8 @@
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 120, "width": 130,
"height": 120 "height": 145
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
@@ -564,8 +564,8 @@
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 120, "width": 130,
"height": 120 "height": 145
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
@@ -789,7 +789,7 @@
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 0, "x": 0,
"y": -75.015, "y": -89.732,
"z": 0 "z": 0
}, },
"_lrot": { "_lrot": {
@@ -801,8 +801,8 @@
}, },
"_lscale": { "_lscale": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 0.6, "x": 0.7,
"y": 0.6, "y": 0.7,
"z": 1 "z": 1
}, },
"_mobility": 0, "_mobility": 0,
@@ -915,8 +915,8 @@
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 95, "width": 115,
"height": 95 "height": 130
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
@@ -1033,8 +1033,8 @@
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 36.297, "x": 37.317,
"y": -33.879, "y": -46.597,
"z": 0 "z": 0
}, },
"_lrot": { "_lrot": {
@@ -1074,8 +1074,8 @@
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 17.90380859375, "width": 20.6845703125,
"height": 39.28 "height": 41.8
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
@@ -1113,10 +1113,10 @@
"_string": "1", "_string": "1",
"_horizontalAlign": 1, "_horizontalAlign": 1,
"_verticalAlign": 1, "_verticalAlign": 1,
"_actualFontSize": 25, "_actualFontSize": 30,
"_fontSize": 25, "_fontSize": 30,
"_fontFamily": "Arial", "_fontFamily": "Arial",
"_lineHeight": 28, "_lineHeight": 30,
"_overflow": 0, "_overflow": 0,
"_enableWrapText": true, "_enableWrapText": true,
"_font": null, "_font": null,
@@ -1183,8 +1183,8 @@
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 100, "width": 130,
"height": 100 "height": 150
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",

View File

@@ -34,26 +34,26 @@
"__id__": 78 "__id__": 78
}, },
{ {
"__id__": 87 "__id__": 90
}, },
{ {
"__id__": 112 "__id__": 115
}, },
{ {
"__id__": 118 "__id__": 121
} }
], ],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 124 "__id__": 127
}, },
{ {
"__id__": 126 "__id__": 129
} }
], ],
"_prefab": { "_prefab": {
"__id__": 128 "__id__": 131
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
@@ -1880,6 +1880,12 @@
}, },
{ {
"__id__": 86 "__id__": 86
},
{
"__id__": 87
},
{
"__id__": 88
} }
], ],
"removedComponents": [] "removedComponents": []
@@ -1911,7 +1917,7 @@
"value": { "value": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": -277.953, "x": -277.953,
"y": 139, "y": 134.528,
"z": 0 "z": 0
} }
}, },
@@ -1954,7 +1960,42 @@
"propertyPath": [ "propertyPath": [
"_active" "_active"
], ],
"value": false "value": true
},
{
"__type__": "CCPropertyOverrideInfo",
"targetInfo": {
"__id__": 82
},
"propertyPath": [
"_lscale"
],
"value": {
"__type__": "cc.Vec3",
"x": 0.7,
"y": 0.7,
"z": 1
}
},
{
"__type__": "CCPropertyOverrideInfo",
"targetInfo": {
"__id__": 89
},
"propertyPath": [
"_contentSize"
],
"value": {
"__type__": "cc.Size",
"width": 130,
"height": 155
}
},
{
"__type__": "cc.TargetInfo",
"localID": [
"bafb2QLFdOPYA6doPdH0gj"
]
}, },
{ {
"__type__": "cc.Node", "__type__": "cc.Node",
@@ -1966,23 +2007,23 @@
}, },
"_children": [ "_children": [
{ {
"__id__": 88 "__id__": 91
}, },
{ {
"__id__": 100 "__id__": 103
} }
], ],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 106 "__id__": 109
}, },
{ {
"__id__": 108 "__id__": 111
} }
], ],
"_prefab": { "_prefab": {
"__id__": 111 "__id__": 114
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
@@ -2017,17 +2058,17 @@
"__type__": "cc.Node", "__type__": "cc.Node",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 87 "__id__": 90
}, },
"_prefab": { "_prefab": {
"__id__": 89 "__id__": 92
}, },
"__editorExtras__": {} "__editorExtras__": {}
}, },
{ {
"__type__": "cc.PrefabInfo", "__type__": "cc.PrefabInfo",
"root": { "root": {
"__id__": 88 "__id__": 91
}, },
"asset": { "asset": {
"__uuid__": "915a4408-90ea-4c30-9974-05d96c0c27f1", "__uuid__": "915a4408-90ea-4c30-9974-05d96c0c27f1",
@@ -2035,7 +2076,7 @@
}, },
"fileId": "c46/YsCPVOJYA4mWEpNYRx", "fileId": "c46/YsCPVOJYA4mWEpNYRx",
"instance": { "instance": {
"__id__": 90 "__id__": 93
}, },
"targetOverrides": null "targetOverrides": null
}, },
@@ -2048,23 +2089,23 @@
"mountedChildren": [], "mountedChildren": [],
"mountedComponents": [], "mountedComponents": [],
"propertyOverrides": [ "propertyOverrides": [
{
"__id__": 91
},
{
"__id__": 93
},
{ {
"__id__": 94 "__id__": 94
}, },
{
"__id__": 95
},
{ {
"__id__": 96 "__id__": 96
}, },
{
"__id__": 97
},
{ {
"__id__": 98 "__id__": 98
},
{
"__id__": 99
},
{
"__id__": 101
} }
], ],
"removedComponents": [] "removedComponents": []
@@ -2072,7 +2113,7 @@
{ {
"__type__": "CCPropertyOverrideInfo", "__type__": "CCPropertyOverrideInfo",
"targetInfo": { "targetInfo": {
"__id__": 92 "__id__": 95
}, },
"propertyPath": [ "propertyPath": [
"_name" "_name"
@@ -2088,7 +2129,7 @@
{ {
"__type__": "CCPropertyOverrideInfo", "__type__": "CCPropertyOverrideInfo",
"targetInfo": { "targetInfo": {
"__id__": 92 "__id__": 95
}, },
"propertyPath": [ "propertyPath": [
"_lpos" "_lpos"
@@ -2103,7 +2144,7 @@
{ {
"__type__": "CCPropertyOverrideInfo", "__type__": "CCPropertyOverrideInfo",
"targetInfo": { "targetInfo": {
"__id__": 92 "__id__": 95
}, },
"propertyPath": [ "propertyPath": [
"_lrot" "_lrot"
@@ -2119,7 +2160,7 @@
{ {
"__type__": "CCPropertyOverrideInfo", "__type__": "CCPropertyOverrideInfo",
"targetInfo": { "targetInfo": {
"__id__": 92 "__id__": 95
}, },
"propertyPath": [ "propertyPath": [
"_euler" "_euler"
@@ -2134,7 +2175,7 @@
{ {
"__type__": "CCPropertyOverrideInfo", "__type__": "CCPropertyOverrideInfo",
"targetInfo": { "targetInfo": {
"__id__": 97 "__id__": 100
}, },
"propertyPath": [ "propertyPath": [
"_lscale" "_lscale"
@@ -2155,7 +2196,7 @@
{ {
"__type__": "CCPropertyOverrideInfo", "__type__": "CCPropertyOverrideInfo",
"targetInfo": { "targetInfo": {
"__id__": 99 "__id__": 102
}, },
"propertyPath": [ "propertyPath": [
"_contentSize" "_contentSize"
@@ -2178,20 +2219,20 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"_parent": { "_parent": {
"__id__": 87 "__id__": 90
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 101 "__id__": 104
}, },
{ {
"__id__": 103 "__id__": 106
} }
], ],
"_prefab": { "_prefab": {
"__id__": 105 "__id__": 108
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
@@ -2228,11 +2269,11 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"node": { "node": {
"__id__": 100 "__id__": 103
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 102 "__id__": 105
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
@@ -2256,11 +2297,11 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"node": { "node": {
"__id__": 100 "__id__": 103
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 104 "__id__": 107
}, },
"_customMaterial": null, "_customMaterial": null,
"_srcBlendFactor": 2, "_srcBlendFactor": 2,
@@ -2337,11 +2378,11 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"node": { "node": {
"__id__": 87 "__id__": 90
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 107 "__id__": 110
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
@@ -2365,15 +2406,15 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"node": { "node": {
"__id__": 87 "__id__": 90
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 109 "__id__": 112
}, },
"clickEvents": [ "clickEvents": [
{ {
"__id__": 110 "__id__": 113
} }
], ],
"_interactable": true, "_interactable": true,
@@ -2454,14 +2495,14 @@
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 113 "__id__": 116
}, },
{ {
"__id__": 115 "__id__": 118
} }
], ],
"_prefab": { "_prefab": {
"__id__": 117 "__id__": 120
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
@@ -2498,11 +2539,11 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"node": { "node": {
"__id__": 112 "__id__": 115
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 114 "__id__": 117
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
@@ -2526,11 +2567,11 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"node": { "node": {
"__id__": 112 "__id__": 115
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 116 "__id__": 119
}, },
"_customMaterial": null, "_customMaterial": null,
"_srcBlendFactor": 2, "_srcBlendFactor": 2,
@@ -2590,14 +2631,14 @@
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 119 "__id__": 122
}, },
{ {
"__id__": 121 "__id__": 124
} }
], ],
"_prefab": { "_prefab": {
"__id__": 123 "__id__": 126
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
@@ -2634,11 +2675,11 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"node": { "node": {
"__id__": 118 "__id__": 121
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 120 "__id__": 123
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
@@ -2662,11 +2703,11 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"node": { "node": {
"__id__": 118 "__id__": 121
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 122 "__id__": 125
}, },
"_customMaterial": null, "_customMaterial": null,
"_srcBlendFactor": 2, "_srcBlendFactor": 2,
@@ -2747,7 +2788,7 @@
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 125 "__id__": 128
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
@@ -2775,7 +2816,7 @@
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 127 "__id__": 130
}, },
"_id": "" "_id": ""
}, },
@@ -2796,7 +2837,7 @@
"targetOverrides": null, "targetOverrides": null,
"nestedPrefabInstanceRoots": [ "nestedPrefabInstanceRoots": [
{ {
"__id__": 88 "__id__": 91
}, },
{ {
"__id__": 78 "__id__": 78

File diff suppressed because it is too large Load Diff

View File

@@ -65,7 +65,11 @@ export class SingletonModuleComp extends ecs.Comp {
{uuid:9001,num:100000,type:0,cost:0,inventory:5}, {uuid:9001,num:100000,type:0,cost:0,inventory:5},
{uuid:9003,num:1000,type:1,cost:0,inventory:5}, {uuid:9003,num:1000,type:1,cost:0,inventory:5},
{uuid:1001,num:10,type:2,cost:10000,inventory:99}, {uuid:1001,num:10,type:2,cost:10000,inventory:99},
{uuid:5001,num:10,type:3,cost:10000,inventory:99}, {uuid:1001,num:10,type:2,cost:10000,inventory:99},
{uuid:1001,num:10,type:2,cost:10000,inventory:99},
{uuid:1001,num:10,type:2,cost:10000,inventory:99},
{uuid:1001,num:10,type:2,cost:10000,inventory:99},
{uuid:1001,num:10,type:2,cost:10000,inventory:99},
]; ];
items:any={ items:any={
1001:{uuid:1001,num:10,x1:1}, 1001:{uuid:1001,num:10,x1:1},

View File

@@ -260,6 +260,7 @@ export class BuffComp extends Component {
heathed(){ heathed(){
this.node.getChildByName("heathed").active=true this.node.getChildByName("heathed").active=true
} }
} }

View File

@@ -315,35 +315,6 @@ export class HeroViewComp extends CCComp {
} }
} }
skill_pos(){
return v3((this.node.position.x,this.node.position.y + 35))
}
get_enemy_pos(){
let t_pos:Vec3 = v3(720,0)
if(this.enemy){
t_pos = v3(this.enemy.x,this.enemy.y)
}
console.log(this.hero_name+":"+this.uuid+"enemy ="+this.enemy.x+" x"+this.node.position.x+" t_pos"+t_pos);
return t_pos
}
get_back_enemy_pos(hero:any){
let t_pos:Vec3 = v3(720,0)
if(this.enemy){
t_pos = v3(this.enemy.x,this.enemy.y)
}
console.log(this.hero_name+":"+this.uuid+"enemy ="+this.enemy.x+" x"+this.node.position.x+" t_pos"+t_pos);
return {t_pos}
}
get_hero_pos(hero:any){
let t_pos:Vec3 = v3(-720,0)
if(!hero.node.isValid){
return
}else{
t_pos = v3(hero.node.position.x,hero.node.position.y)
}
return t_pos
}
//受伤判断 //受伤判断
check_uatk(skill:any){ check_uatk(skill:any){
if(this.shield > 0){ if(this.shield > 0){
@@ -373,7 +344,6 @@ export class HeroViewComp extends CCComp {
} }
check_debuff(skill:any,l_hp:number=0){ check_debuff(skill:any,l_hp:number=0){
console.log(this.hero_name+":"+this.uuid+"check_debuff "+skill.debuff); console.log(this.hero_name+":"+this.uuid+"check_debuff "+skill.debuff);
if(skill.debuff == 0) return if(skill.debuff == 0) return
let num=RandomManager.instance.getRandomInt(0,100) let num=RandomManager.instance.getRandomInt(0,100)
switch (skill.debuff){ switch (skill.debuff){
@@ -410,25 +380,14 @@ export class HeroViewComp extends CCComp {
if(num > skill.depb) return if(num > skill.depb) return
tween(this.node).to( 0.1, tween(this.node).to( 0.1,
{ position: new Vec3(this.node.position.x-this.scale*50,this.node.position.y) }, { position: new Vec3(this.node.position.x-this.scale*50,this.node.position.y) },
{ { }
}
).start(); ).start();
break; break;
} }
} }
//能量判断
check_power(){
if(this.pw >= this.pwm){
this.pw = 0
this.BUFFCOMP.max_show()
this.do_skill(this.sk2)
return true
}else{
return false
}
}
//暴击判断 //暴击判断
/** /**
* 检查是否触发暴击,并执行相应的暴击效果。 * 检查是否触发暴击,并执行相应的暴击效果。
@@ -536,18 +495,30 @@ export class HeroViewComp extends CCComp {
},0.3) },0.3)
} }
} }
}
//能量判断
check_power(){
if(this.pw >= this.pwm){
this.pw = 0
this.BUFFCOMP.max_show()
this.do_skill(this.sk2)
return true
}else{
return false
}
} }
//使用max_skill //使用max_skill
do_skill(skill:number){ do_skill(skill:number){
this.as.max() this.as.max()
this.at = 0; this.at = 0; //共享普攻攻击cd
this.BUFFCOMP.tooltip(3,SkillSet[skill].name,skill); this.BUFFCOMP.tooltip(3,SkillSet[skill].name,skill);
switch (SkillSet[skill].tg) { switch (SkillSet[skill].tg) {
case SkTG.self: //自己 case SkTG.self: //自己
this.do_add_buff(this.node.getComponent(HeroViewComp),skill) this.do_add_buff(this.node.getComponent(HeroViewComp),skill)
break; break;
case SkTG.friend: //伙伴 case SkTG.friend: //伙伴
this.check_other_buff(skill) if(this.box_group == BoxSet.HERO) this.check_other_hero_buff(skill)
if(this.box_group == BoxSet.MONSTER) this.check_other_mon_buff(skill)
break; break;
case SkTG.team: //自己和伙伴 case SkTG.team: //自己和伙伴
this.do_all_buff(skill) this.do_all_buff(skill)
@@ -561,129 +532,21 @@ export class HeroViewComp extends CCComp {
break; break;
} }
} }
check_other_buff(skill:number){
let heros:any = ecs.query(ecs.allOf(HeroModelComp));
let least_hp:number=0
let hight_hp:number=9999999999
let right_x:number=360
let left_x:number=-360
if(this.box_group==BoxSet.MONSTER){
heros=ecs.query(ecs.allOf(MonModelComp))
}
let t_hero:any= null
if (heros.length > 0) {
if(SkillSet[skill].type==SkType.random){ //随机添加buff
let i = RandomManager.instance.getRandomInt(0,heros.length-1,3)
while(!heros[i].HeroView){
i = RandomManager.instance.getRandomInt(0,heros.length-1,3)
if(heros[i].HeroView){
break
}
}
this.do_add_buff(heros[i].HeroView,skill)
}else{
for (let i = 0; i < heros.length; i++) {
if(!heros[i].HeroView) continue
let hero = heros[i].HeroView;
switch(SkillSet[skill].type){
case SkType.leastHealth: //血量最少单体
if((hero.rhp_max-hero.hp) > least_hp){
least_hp = (hero.rhp_max-hero.hp)
t_hero = hero
}
break;
case SkType.highestHealth: //血量最多单体
if((hero.rhp_max-hero.hp) < hight_hp){
hight_hp = (hero.rhp_max-hero.hp)
t_hero = hero
}
break;
case SkType.frontRow: //最前排
if(hero.node.position.x > left_x){
left_x = hero.node.position.x
t_hero = hero
}
if(this.box_group==BoxSet.MONSTER){
if(hero.node.position.x < right_x){
right_x = hero.node.position.x
t_hero = hero
}
}
break;
case SkType.backRow: //最后排
if(hero.node.position.x < right_x){
right_x = hero.node.position.x
t_hero = hero
}
if(this.box_group==BoxSet.MONSTER){
if(hero.node.position.x > left_x){
left_x = hero.node.position.x
t_hero = hero
}
}
break;
}
// if(SkillSet[skill].type==SkType.leastHealth){ //血量最少单体
// if((hero.rhp_max-hero.hp) > least_hp){
// least_hp = (hero.rhp_max-hero.hp)
// t_hero = hero
// }
// }
// if(SkillSet[skill].type==SkType.highestHealth){ //血量最多单体
// if((hero.rhp_max-hero.hp) < hight_hp){
// hight_hp = (hero.rhp_max-hero.hp)
// t_hero = hero
// }
// }
// if(SkillSet[skill].type==SkType.frontRow){ //最前排
// if(hero.node.position.x > left_x){
// left_x = hero.node.position.x
// t_hero = hero
// }
// }
// if(SkillSet[skill].type==SkType.backRow){ //最后排
// if(hero.node.position.x < right_x){
// right_x = hero.node.position.x
// t_hero = hero
// }
// }
//todo 最前排 最后排 远程 近战 辅助
}
if(t_hero){ //存在目标
this.do_add_buff(t_hero,skill)
}
}
}
}
do_all_buff(sk:number){
let skill = ecs.getEntity<Skill>(Skill);
let t_pos=v3(-320,0)
if(this.box_group==BoxSet.MONSTER){
t_pos=v3(320,0)
}
let pos = t_pos
this.to_console("to_all_buff:"+sk)
let is_crit=this.check_crit()
skill.load(pos,this.box_group,this.node,sk,this.ap_max,t_pos,is_crit,this.crit_add);
this.to_console("使用buff:"+sk+" t_pos:"+t_pos+" box:"+this.box_group);
}
shoot_enemy(sk:number,y:number=0,x:number=0){ shoot_enemy(sk:number,y:number=0,x:number=0){
// console.log("mon shoot_enemy"); // console.log("mon shoot_enemy");
let skill = ecs.getEntity<Skill>(Skill); let skill = ecs.getEntity<Skill>(Skill);
let t_pos=v3(smc.mon_front_x,BoxSet.GAME_LINE) let t_pos=v3(smc.mon_front_x,BoxSet.GAME_LINE) //最前排目标
if(this.box_group==BoxSet.MONSTER){ if(this.box_group==BoxSet.MONSTER){
t_pos=v3(smc.hero_front_x,BoxSet.GAME_LINE) t_pos=v3(smc.hero_front_x,BoxSet.GAME_LINE)
} }
switch(SkillSet[sk].type){ switch(SkillSet[sk].type){
case SkType.leastHealth: //血量最少单体 case SkType.leastHealth: //血量最少单体
t_pos=this.check_heros().l_hero.node.position
if(this.box_group==BoxSet.MONSTER) t_pos=this.check_mons().l_hero.node.position
break; break;
case SkType.highestHealth: //血量最多单体 case SkType.highestHealth: //血量最多单体
t_pos=this.check_heros().m_hero.node.position
if(this.box_group==BoxSet.MONSTER) t_pos=this.check_mons().m_hero.node.position
break; break;
case SkType.backRow: //最后排 case SkType.backRow: //最后排
t_pos=v3(smc.mon_back_x,BoxSet.GAME_LINE) t_pos=v3(smc.mon_back_x,BoxSet.GAME_LINE)
@@ -692,17 +555,159 @@ export class HeroViewComp extends CCComp {
} }
break; break;
} }
let pos =this.skill_pos() let pos =this.node.position
pos.y=this.node.position.y + y let is_crit=this.check_crit()
pos.x=this.node.position.x + x this.to_console(this.scale+this.hero_name+"使用技能:"+sk+SkillSet[sk].name+" pos:"+pos+" t_pos:"+t_pos+" box:"+this.box_group,);
skill.load(pos,this.box_group,this.node,sk,this.ap_max,t_pos,is_crit,this.crit_add);
}
check_heros(){
let heros:any = ecs.query(ecs.allOf(HeroModelComp));
let l_hp:number=0
let h_hp:number=9999999999
let right_x:number=360
let left_x:number=-360
let f_hero:any= null
let b_hero:any= null
let l_hero:any= null
let m_hero:any= null
let r_hero:any= null
let i = RandomManager.instance.getRandomInt(0,heros.length-1,3)
while(!heros[i].HeroView){
i = RandomManager.instance.getRandomInt(0,heros.length-1,3)
if(!heros[i].HeroView.in_grave){
r_hero= heros[i].HeroView
break
}
}
for (let i = 0; i < heros.length; i++) {
let hero:any = heros[i].HeroView;
if (hero.in_grave) continue
if((hero.rhp_max-hero.hp) > l_hp){
l_hp = (hero.rhp_max-hero.hp)
l_hero = hero
}
if((hero.rhp_max-hero.hp) < h_hp){
h_hp = (hero.rhp_max-hero.hp)
m_hero = hero
}
if(hero.node.position.x > left_x){
left_x = hero.node.position.x
f_hero = hero
}
if(this.box_group==BoxSet.MONSTER){
if(hero.node.position.x < right_x){
right_x = hero.node.position.x
f_hero = hero
}
}
if(hero.node.position.x < right_x){
right_x = hero.node.position.x
b_hero = hero
}
if(this.box_group==BoxSet.MONSTER){
if(hero.node.position.x > left_x){
left_x = hero.node.position.x
b_hero = hero
}
}
}
return {l_hero,m_hero,f_hero,b_hero,r_hero}
}
check_mons(){
let heros:any=ecs.query(ecs.allOf(MonModelComp))
let l_hp:number=0
let h_hp:number=9999999999
let right_x:number=360
let left_x:number=-360
let f_hero:any= null
let b_hero:any= null
let l_hero:any= null
let m_hero:any= null
let r_hero:any= null
let i = RandomManager.instance.getRandomInt(0,heros.length-1,3)
while(!heros[i].HeroView){
i = RandomManager.instance.getRandomInt(0,heros.length-1,3)
if(!heros[i].HeroView.in_grave){
r_hero= heros[i].HeroView
break
}
}
for (let i = 0; i < heros.length; i++) {
let hero:any = heros[i].HeroView;
if (hero.in_grave) continue
if((hero.rhp_max-hero.hp) > l_hp){
l_hp = (hero.rhp_max-hero.hp)
l_hero = hero
}
if((hero.rhp_max-hero.hp) < h_hp){
h_hp = (hero.rhp_max-hero.hp)
m_hero = hero
}
if(hero.node.position.x < right_x){
right_x = hero.node.position.x
f_hero = hero
}
if(hero.node.position.x > left_x){
left_x = hero.node.position.x
b_hero = hero
}
}
return {l_hero,m_hero,f_hero,b_hero,r_hero}
}
check_other_hero_buff(skill:number){
switch(SkillSet[skill].type){
case SkType.random:
this.do_add_buff(this.check_heros().r_hero,skill)
break;
case SkType.leastHealth: //血量最少单体
this.do_add_buff(this.check_heros().l_hero,skill)
break;
case SkType.highestHealth: //血量最多单体
this.do_add_buff(this.check_heros().m_hero,skill)
break;
case SkType.frontRow: //最前排
this.do_add_buff(this.check_heros().f_hero,skill)
break;
case SkType.backRow: //最后排
this.do_add_buff(this.check_heros().b_hero,skill)
break;
}
}
check_other_mon_buff(skill:number){
switch(SkillSet[skill].type){
case SkType.random:
this.do_add_buff(this.check_mons().r_hero,skill)
break;
case SkType.leastHealth: //血量最少单体
this.do_add_buff(this.check_mons().l_hero,skill)
break;
case SkType.highestHealth: //血量最多单体
this.do_add_buff(this.check_mons().m_hero,skill)
break;
case SkType.frontRow: //最前排
this.do_add_buff(this.check_mons().f_hero,skill)
break;
case SkType.backRow: //最后排
this.do_add_buff(this.check_mons().b_hero,skill)
break;
}
}
do_all_buff(sk:number){
let skill = ecs.getEntity<Skill>(Skill);
let t_pos=v3(-320,0)
if(this.box_group==BoxSet.MONSTER) t_pos=v3(320,0)
let pos = t_pos
this.to_console("to_all_buff:"+sk)
let is_crit=this.check_crit() let is_crit=this.check_crit()
skill.load(pos,this.box_group,this.node,sk,this.ap_max,t_pos,is_crit,this.crit_add); skill.load(pos,this.box_group,this.node,sk,this.ap_max,t_pos,is_crit,this.crit_add);
this.to_console(this.scale+this.hero_name+"使用技能:"+sk+SkillSet[sk].name+" t_pos:"+t_pos+" box:"+this.box_group,); this.to_console("使用buff:"+sk+" t_pos:"+t_pos+" box:"+this.box_group);
} }
do_add_buff(hero:any,sk:number){ do_add_buff(hero:any,sk:number){
let skill = ecs.getEntity<Skill>(Skill); let skill = ecs.getEntity<Skill>(Skill);
let t_pos=this.get_hero_pos(hero) let t_pos=hero.node.position
let pos = this.skill_pos() let pos = this.node.position
this.to_console("do_add_buff:"+hero.hero_name+" "+sk); this.to_console("do_add_buff:"+hero.hero_name+" "+sk);
let is_crit=this.check_crit() let is_crit=this.check_crit()
skill.load(pos,this.box_group,this.node,sk,this.ap_max,t_pos,is_crit,this.crit_add); skill.load(pos,this.box_group,this.node,sk,this.ap_max,t_pos,is_crit,this.crit_add);
@@ -721,9 +726,8 @@ export class HeroViewComp extends CCComp {
this.pw+= p this.pw+= p
} }
/** /**
* 增加英雄的行动点数AP * 增加英雄的攻击AP
* @param ap 要增加的行动点数 * @param ap 要增加的攻击
* @param time 可选参数表示增加行动点数的时间默认为0。
*/ */
add_ap(ap: number){ add_ap(ap: number){
this.ap += Math.floor(ap); this.ap += Math.floor(ap);

View File

@@ -26,7 +26,7 @@ export class Skill extends ecs.Entity {
{ {
var path = "game/skills/"+SkillSet[uuid].sp_name; var path = "game/skills/"+SkillSet[uuid].sp_name;
var prefab: Prefab = oops.res.get(path, Prefab)!; var prefab: Prefab = oops.res.get(path, Prefab)!;
// console.log("load skill :",path,prefab) console.log("load skill pos:",pos)
var node = instantiate(prefab); var node = instantiate(prefab);
pos=v3(pos.x,pos.y) pos=v3(pos.x,pos.y)
node.parent = parent.parent; node.parent = parent.parent;