基础主将添加+ 修复第一次伤害计算为穿刺伤害bug

This commit is contained in:
2025-07-06 23:58:10 +08:00
parent 9ebf620ed8
commit f7c231de00
60 changed files with 9355 additions and 414 deletions

View File

@@ -25,6 +25,7 @@ export class CardComp extends CCComp {
cost_gold:number=0;
skill_slot:string="skill1"
equip_slot:string="weapon"
is_master:boolean=false;
onLoad(){
// this.on(GameEvent.HeroSelect,this.hero_select,this)
}
@@ -37,11 +38,13 @@ export class CardComp extends CCComp {
this.node.getChildByName("Button").active=false
this.node.getChildByName("show").active=false
}
hero_select(args: any){
hero_select(args: any,is_master:boolean=false){
console.log("[cardcomp]:card hero_select",args,is_master)
this.c_type=cardType.HERO
this.c_uuid=args.uuid
console.log("[cardcomp]:card hero_select c_uuid:"+this.c_uuid)
this.show_hero(this.c_uuid)
this.is_master=is_master
this.show_hero(this.c_uuid,is_master)
this.node.getChildByName("show").active=false
this.node.getChildByName("anim").getChildByName("up").getComponent(Animation).play('carsup')
this.scheduleOnce(() => {
@@ -113,7 +116,7 @@ export class CardComp extends CCComp {
show.getChildByName("info").getComponent(Label).string=SkillSet[uuid].info
}
show_hero(uuid:number){
show_hero(uuid:number,is_master:boolean=false){
let show=this.node.getChildByName("show")
show.getChildByName("name").getChildByName("name").getComponent(Label).string=HeroInfo[uuid].name
this.do_card_bg_show(HeroInfo[uuid].quality)
@@ -274,7 +277,7 @@ export class CardComp extends CCComp {
use_card(){
switch(this.c_type){
case cardType.HERO:
oops.message.dispatchEvent(GameEvent.UseHeroCard,{uuid:this.c_uuid})
oops.message.dispatchEvent(GameEvent.UseHeroCard,{uuid:this.c_uuid,is_master:this.is_master})
oops.message.dispatchEvent(GameEvent.CardsClose)
break
case cardType.SKILL:

View File

@@ -55,12 +55,51 @@ export class CardsCompComp extends CCComp {
}
hero_select(){
let list=getRandomCardsByType(cardType.HERO,3)
show_cards(e:GameEvent,data:any,is_refresh:boolean=false){
this.node.getChildByName("btns").getChildByName("cancel").active=false
switch(e){
case GameEvent.HeroSelect:
console.log("[CardsComp]:显示英雄选择卡牌",data)
let title="选择伙伴"
if(data.is_master) title="选择英雄"
this.node.getChildByName("top").getChildByName("title").getChildByName("Label").getComponent(Label).string=title
this.hero_select(data)
break
case GameEvent.HeroSkillSelect:
console.log("[CardsComp]:显示技能选择卡牌")
this.node.getChildByName("top").getChildByName("title").getChildByName("Label").getComponent(Label).string="选择技能"
this.hero_skill_select(data)
break
case GameEvent.FuncSelect:
console.log("[CardsComp]:显示功能卡牌")
this.node.getChildByName("btns").getChildByName("cancel").active=true
this.node.getChildByName("top").getChildByName("title").getChildByName("Label").getComponent(Label).string="选择卡牌"
this.func_select()
break
case GameEvent.EquipSelect:
console.log("[CardsComp]:显示装备选择卡牌")
this.node.getChildByName("btns").getChildByName("cancel").active=true
this.node.getChildByName("top").getChildByName("title").getChildByName("Label").getComponent(Label).string="选择装备"
this.equip_select(data)
break
}
if(!is_refresh) this.show()
}
hero_select(data:any){
let list=[]
if(data.is_master){ //1是主将,0 是伙伴
list=getRandomCardsByType(cardType.HERO,3,1)
}else{
list=getRandomCardsByType(cardType.HERO,3,0)
}
console.log("[CardsComp]:英雄选择卡牌列表",list)
this.card1c.hero_select(list[0])
this.card2c.hero_select(list[1])
this.card3c.hero_select(list[2])
this.card1c.hero_select(list[0],data.is_master)
this.card2c.hero_select(list[1],data.is_master)
this.card3c.hero_select(list[2],data.is_master)
// this.card4c.hero_select(list[3])
}
@@ -125,32 +164,7 @@ export class CardsCompComp extends CCComp {
this.show_cards(nextCard.type, nextCard.data);
}
show_cards(e:GameEvent,data:any,is_refresh:boolean=false){
this.node.getChildByName("btns").getChildByName("cancel").active=false
switch(e){
case GameEvent.HeroSelect:
console.log("[CardsComp]:显示英雄选择卡牌")
this.hero_select()
break
case GameEvent.HeroSkillSelect:
console.log("[CardsComp]:显示技能选择卡牌")
this.hero_skill_select(data)
break
case GameEvent.FuncSelect:
console.log("[CardsComp]:显示功能卡牌")
this.node.getChildByName("btns").getChildByName("cancel").active=true
this.func_select()
break
case GameEvent.EquipSelect:
console.log("[CardsComp]:显示装备选择卡牌")
this.node.getChildByName("btns").getChildByName("cancel").active=true
this.equip_select(data)
break
}
if(!is_refresh) this.show()
}
close_cards(e:GameEvent,data:any){
switch(e){
case GameEvent.HeroSelect:

View File

@@ -63,22 +63,21 @@ export class MissionComp extends CCComp {
oops.message.dispatchEvent(GameEvent.FightReady)
this.node.active=true
this.data_init()
this.hart_hero_load()
// this.hart_hero_load()
let loading=this.node.parent.getChildByName("loading")
loading.active=true
this.scheduleOnce(()=>{
this.to_ready()
this.to_fight()
loading.active=false
},0.5)
this.to_ready()
this.to_fight()
}
to_ready(){
console.log("英雄技能选择")
// oops.message.dispatchEvent(GameEvent.HeroSkillSelect)
oops.message.dispatchEvent(GameEvent.HeroSelect,{is_master:true})
}
to_call_friend(){
oops.message.dispatchEvent(GameEvent.HeroSelect)
oops.message.dispatchEvent(GameEvent.HeroSelect,{is_master:false})
}
to_fight(){
@@ -145,7 +144,7 @@ export class MissionComp extends CCComp {
}
call_friend_card(){
oops.message.dispatchEvent(GameEvent.HeroSelect)
oops.message.dispatchEvent(GameEvent.HeroSelect,{is_master:false})
}

View File

@@ -52,22 +52,30 @@ export class MissionHeroCompComp extends CCComp {
}
private call_friend(event: string, args: any,freind_pos:number=1){
console.log("[MissionHeroComp]:call_hero addHero",args.uuid)
private call_friend(event: string, args: any,is_master:boolean=false){
console.log("[MissionHeroComp]:call_hero addHero",args.uuid,is_master)
let hero_pos=1
if(is_master){
hero_pos=0
}
let info:any={ap:0,hp:0,lv:0}
let hero = ecs.getEntity<Hero>(Hero);
let scale = 1
let heros=ecs.query(ecs.allOf(HeroViewComp))
for(let hero of heros){
let hv = hero.get(HeroViewComp)
if(hv.fight_pos==freind_pos){
freind_pos=2
if(hv.fight_pos==hero_pos){
hero_pos=2
break
}
}
console.log("[MissionHeroComp]:call_friend",heros)
let pos:Vec3 = HeroPos[freind_pos].pos;
hero.load(pos,scale,args.uuid,info,freind_pos);
let pos:Vec3 = HeroPos[hero_pos].pos;
if(is_master){
hero.hart_load(args.uuid)
}else{
hero.load(pos,scale,args.uuid,info,hero_pos);
}
}
@@ -123,17 +131,25 @@ export class MissionHeroCompComp extends CCComp {
// let x=RandomManager.instance.getRandomInt(0,hero_list.length,1)
// // let uuid=args.uuid
// // console.log("call_hero",uuid)
this.addHero(args.uuid)
this.addHero(args.uuid,args.is_master)
}
/** 添加英雄 */
private addHero(uuid:number=1001,freind_pos:number=1) {
let info:any=this.get_info_and_remove(freind_pos,uuid)
private addHero(uuid:number=1001,is_master:boolean=false) {
let hero_pos=1
if(is_master){
hero_pos=0
}
let info:any=this.get_info_and_remove(hero_pos,uuid)
// let info:any={ap:0,hp:0,lv:0}
let hero = ecs.getEntity<Hero>(Hero);
let scale = 1
let pos:Vec3 = HeroPos[freind_pos].pos;
hero.load(pos,scale,uuid,info,freind_pos);
let pos:Vec3 = HeroPos[hero_pos].pos;
if(is_master){
hero.hart_load(uuid)
}else{
hero.load(pos,scale,uuid,info,hero_pos);
}
}
get_info_and_remove(fight_pos:number,uuid:number){