重做 局内经验的利用,加攻 加血,特殊技能,todo:先完成物品设定

This commit is contained in:
walkpan
2024-11-25 00:02:07 +08:00
parent 5a268cc8f2
commit 2d4d564c1f
31 changed files with 5212 additions and 6212 deletions

View File

@@ -157,13 +157,13 @@ export class CardControllerComp extends CCComp {
// console.log("show_info",uuid)
let node =this.node.getChildByName("item_box")
if(type == 2){
smc.vm_data.item_box.info = smc.sitems[uuid].info
smc.vm_data.item_box.name = smc.sitems[uuid].name
smc.vm_data.item_box.skillcd = smc.sitems[uuid].cd
smc.vm_data.item_box.skillsd = smc.sitems[uuid].sd
smc.vm_data.item_box.atk = smc.sitems[uuid].atk
smc.vm_data.item_box.hp = smc.sitems[uuid].hp
smc.vm_data.item_box.shield = smc.sitems[uuid].shield
smc.vmdata.item_box.info = smc.sitems[uuid].info
smc.vmdata.item_box.name = smc.sitems[uuid].name
smc.vmdata.item_box.skillcd = smc.sitems[uuid].cd
smc.vmdata.item_box.skillsd = smc.sitems[uuid].sd
smc.vmdata.item_box.atk = smc.sitems[uuid].atk
smc.vmdata.item_box.hp = smc.sitems[uuid].hp
smc.vmdata.item_box.shield = smc.sitems[uuid].shield
node.active=true
if(smc.sitems[uuid].shield > 0){
node.getChildByName("data").getChildByName("shield").active=true
@@ -185,23 +185,23 @@ export class CardControllerComp extends CCComp {
node.getChildByName("data").getChildByName("hp").active=false
}
shuaxin(dt: number) {
smc.vm_data.shuaxin.min += smc.vm_data.shuaxin.speed*dt;
if (smc.vm_data.shuaxin.min >= smc.vm_data.shuaxin.max) {
smc.vm_data.shuaxin.min = 0;
smc.vmdata.shuaxin.min += smc.vmdata.shuaxin.speed*dt;
if (smc.vmdata.shuaxin.min >= smc.vmdata.shuaxin.max) {
smc.vmdata.shuaxin.min = 0;
this.load_cards()
}
}
// cards_update(){
// if(smc.vm_data.gold.min >= smc.vm_data.cards.up_cost){
// smc.vm_data.gold.min -= smc.vm_data.cards.up_cost;
// smc.vm_data.cards.level += 1;
// smc.vm_data.gold.max +=2;
// smc.vm_data.cards.up_cost += 2
// if(smc.vm_data.cards.level >= smc.vm_data.cards.level_max){
// smc.vm_data.cards.level = smc.vm_data.cards.level_max;
// smc.vm_data.cards.up_cost = 11
// if(smc.vmdata.gold.min >= smc.vmdata.cards.up_cost){
// smc.vmdata.gold.min -= smc.vmdata.cards.up_cost;
// smc.vmdata.cards.level += 1;
// smc.vmdata.gold.max +=2;
// smc.vmdata.cards.up_cost += 2
// if(smc.vmdata.cards.level >= smc.vmdata.cards.level_max){
// smc.vmdata.cards.level = smc.vmdata.cards.level_max;
// smc.vmdata.cards.up_cost = 11
// }
// console.log("card _level:"+this.card_level+"cost:"+smc.vm_data.cards.up_cost)
// console.log("card _level:"+this.card_level+"cost:"+smc.vmdata.cards.up_cost)
// }else{
// oops.gui.toast("金币不够");
// }
@@ -210,23 +210,23 @@ export class CardControllerComp extends CCComp {
if (this.in_load) {
return
}
if((smc.vm_data.shuaxin.max-smc.vm_data.shuaxin.min) < 0.5 ){
if((smc.vmdata.shuaxin.max-smc.vmdata.shuaxin.min) < 0.5 ){
oops.gui.toast("马上就要刷新了")
return
}
if(smc.vm_data.shuaxin.min < 0.5){
if(smc.vmdata.shuaxin.min < 0.5){
oops.gui.toast("不要刷新太快哦")
return
}
if (smc.vm_data.gold.min < smc.vm_data.cards.ref_cost) {
if (smc.vmdata.gold.min < smc.vmdata.cards.ref_cost) {
oops.gui.toast("金币不足")
return
}
smc.vm_data.gold.min -= smc.vm_data.cards.ref_cost;
smc.vmdata.gold.min -= smc.vmdata.cards.ref_cost;
this.load_cards()
smc.vm_data.shuaxin.min = -5
if(smc.vm_data.shuaxin.min <=0 ){
smc.vm_data.shuaxin.min = 0
smc.vmdata.shuaxin.min = -5
if(smc.vmdata.shuaxin.min <=0 ){
smc.vmdata.shuaxin.min = 0
}
}
@@ -323,7 +323,7 @@ export class CardControllerComp extends CCComp {
// console.log("card_index:",index,"card_alive:",this.cards[index].alive)
return;
};
if(smc.vm_data.gold.min >= this.cards[index].cost){
if(smc.vmdata.gold.min >= this.cards[index].cost){
this.cards[index].alive=false
this.do_use_card(index)
}else{
@@ -333,7 +333,7 @@ export class CardControllerComp extends CCComp {
}
do_use_card(index:number){
this.cards[index].alive=false
smc.vm_data.gold.min -= this.cards[index].cost;
smc.vmdata.gold.min -= this.cards[index].cost;
oops.message.dispatchEvent("do_add_hero", { uuid: this.cards[index].uuid });
// switch (this.cards[index].type) {
// case 1:
@@ -350,7 +350,7 @@ export class CardControllerComp extends CCComp {
}
do_reward(){
smc.vm_data.game_pause = true;
smc.vmdata.game_pause = true;
this.reward_lv+=1
this.rewards_set=RewardSet[this.reward_lv]
let i=RandomManager.instance.getRandomInt(0,this.rewards_set.length-1, 1)
@@ -395,17 +395,17 @@ export class CardControllerComp extends CCComp {
}
colse_reward(value:number){
this.node.getChildByName('rewards').active = false;
smc.vm_data.game_pause = false;
smc.vmdata.game_pause = false;
let reward=this.rewards[value]
if(reward.type==1){
if(reward.atk > 0){
smc.vm_data.mission.hero.atk += reward.atk / 100
smc.vmdata.mission.hero.atk += reward.atk / 100
}
if(reward.atk_cd > 0){
smc.vm_data.mission.hero.atk_cd -= reward.atk_cd/100
smc.vmdata.mission.hero.atk_cd -= reward.atk_cd/100
}
if(reward.hp > 0){
smc.vm_data.mission.hero.hp += reward.hp / 100;
smc.vmdata.mission.hero.hp += reward.hp / 100;
this.add_hero_hp_max(reward.hp / 100)
}
}
@@ -430,7 +430,7 @@ export class CardControllerComp extends CCComp {
}
}
protected update(dt: number): void {
if(smc.vm_data.game_over||smc.vm_data.game_pause){
if(smc.vmdata.game_over||smc.vmdata.game_pause){
return
}
this.shuaxin(dt)
@@ -442,10 +442,10 @@ export class CardControllerComp extends CCComp {
}
gold_add(dt: number) {
smc.vm_data.gold.time += dt;
if (smc.vm_data.gold.time >= smc.vm_data.gold.cd) {
smc.vm_data.gold.min += 1;
smc.vm_data.gold.time = 0;
smc.vmdata.gold.time += dt;
if (smc.vmdata.gold.time >= smc.vmdata.gold.cd) {
smc.vmdata.gold.min += 1;
smc.vmdata.gold.time = 0;
}
}
/** 视图对象通过 ecs.Entity.remove(ControllerComp) 删除组件是触发组件处理自定义释放逻辑 */