升星 所需材料逐级改变

This commit is contained in:
2024-12-11 09:54:57 +08:00
parent 5cc1bcfe46
commit 4ef7abf374
6 changed files with 5689 additions and 502 deletions

View File

@@ -83,8 +83,13 @@ export class HeroHomeComp extends CCComp {
lvup.getChildByName("info").getChildByName("def").getComponent(Label).string = "+"+this.hero.def_up
lvup.getChildByName("info").getChildByName("hp").getComponent(Label).string = "+"+this.hero.hp_up
slvup.getChildByName("gold").getChildByName("need").getComponent(Label).string = (UpGold.SlvUp*this.role.slv).toString()
slvup.getChildByName("item").getChildByName("need").getComponent(Label).string = ((SlvUp[this.role.slv]+this.hero.slvexp)*this.role.slv).toString()
slvup.getChildByName("gold").getChildByName("need").getComponent(Label).string = (UpGold.SlvUp*(this.role.slv+1)).toString()
slvup.getChildByName("lv1").getChildByName("need").getComponent(Label).string = ((SlvUp[1]+this.hero.slvexp)*1).toString()
slvup.getChildByName("lv2").getChildByName("need").getComponent(Label).string = ((SlvUp[2]+this.hero.slvexp)*2).toString()
slvup.getChildByName("lv3").getChildByName("need").getComponent(Label).string = ((SlvUp[3]+this.hero.slvexp)*3).toString()
slvup.getChildByName("lv4").getChildByName("need").getComponent(Label).string = ((SlvUp[4]+this.hero.slvexp)*4).toString()
slvup.getChildByName("lv5").getChildByName("need").getComponent(Label).string = ((SlvUp[5]+this.hero.slvexp)*5).toString()
slvup.getChildByName("lv6").getChildByName("need").getComponent(Label).string = ((SlvUp[6]+this.hero.slvexp)*6).toString()
slvup.getChildByName("info").getChildByName("ap").getComponent(Label).string = "+"+this.hero.sap_up+"%"
slvup.getChildByName("info").getChildByName("def").getComponent(Label).string = "+"+this.hero.sdef_up+"%"
slvup.getChildByName("info").getChildByName("hp").getComponent(Label).string = "+"+this.hero.shp_up+"%"
@@ -93,6 +98,16 @@ export class HeroHomeComp extends CCComp {
if( this.role.slv>=3) {slv_node.getChildByName("s3").active=true}else{slv_node.getChildByName("s3").active=false};
if( this.role.slv>=4) {slv_node.getChildByName("s4").active=true}else{slv_node.getChildByName("s4").active=false};
if( this.role.slv>=5) {slv_node.getChildByName("s5").active=true}else{slv_node.getChildByName("s5").active=false};
if( this.role.slv==0) {slvup.getChildByName("lv1").active=true}else{slvup.getChildByName("lv1").active=false};
if( this.role.slv==1) {slvup.getChildByName("lv2").active=true}else{slvup.getChildByName("lv2").active=false};
if( this.role.slv==2) {slvup.getChildByName("lv3").active=true}else{slvup.getChildByName("lv3").active=false};
if( this.role.slv==3) {slvup.getChildByName("lv4").active=true}else{slvup.getChildByName("lv4").active=false};
if( this.role.slv==4) {slvup.getChildByName("lv5").active=true}else{slvup.getChildByName("lv5").active=false};
if( this.role.slv==5) {
slvup.getChildByName("lv6").active=true;slvup.getChildByName("btned").active=true
}else{
slvup.getChildByName("lv6").active=false;slvup.getChildByName("btned").active=false
};
attr.getChildByName("ap").getChildByName("val").getComponent(Label).string = ((this.hero.ap+this.hero.ap_up* this.role.lv)*(1+this.hero.sap_up/100*this.role.slv)).toFixed(0).toString()
attr.getChildByName("hp").getChildByName("val").getComponent(Label).string = ((this.hero.hp+this.hero.hp_up* this.role.lv)*(1+this.hero.shp_up/100*this.role.slv)).toFixed(0).toString()
@@ -161,13 +176,30 @@ export class HeroHomeComp extends CCComp {
oops.gui.toast("已经满星,升星失败");
return
}
console.log("smc.vmdata.items[1004] ((SlvUp[this.role.slv]+this.hero.slvexp)*this.role.slv):",smc.vmdata.items[1004],((SlvUp[this.role.slv]+this.hero.slvexp)*this.role.slv))
if(smc.vmdata.items[1004] < ((SlvUp[this.role.slv]+this.hero.slvexp)*this.role.slv)||smc.vmdata.gold < (UpGold.SlvUp*this.role.slv)){
let need =smc.vmdata.items[1004]
switch(this.role.slv){
case 1:
need=smc.vmdata.items[1005]
break;
case 2:
need=smc.vmdata.items[1006]
break;
case 3:
need=smc.vmdata.items[1007]
break;
case 4:
need=smc.vmdata.items[1008]
break;
case 5:
need=smc.vmdata.items[1008]
break;
}
if(need < ((SlvUp[this.role.slv]+this.hero.slvexp)*this.role.slv)||smc.vmdata.gold < (UpGold.SlvUp*(this.role.slv+1))){
oops.gui.toast("资源不足,升星失败");
return
}
smc.vmdata.items[1004] -= ((SlvUp[this.role.slv]+this.hero.slvexp)*this.role.slv)
smc.vmdata.gold -= (UpGold.SlvUp*this.role.slv)
need -= ((SlvUp[this.role.slv]+this.hero.slvexp)*this.role.slv)
smc.vmdata.gold -= (UpGold.SlvUp*(this.role.slv+1))
this.role.slv++
this.update_data()