开箱 随机buff 初步完成

This commit is contained in:
2025-08-02 09:59:25 +08:00
parent fef5480322
commit 4daac778a0
8 changed files with 316 additions and 443 deletions

View File

@@ -3,7 +3,7 @@
*/
import { getHeroList, HeroList } from "./heroSet"
import { getSkills, HeroSkillList, SkillSet } from "./SkillSet"
import { BuffAttr, getSkills, HeroSkillList, SkillSet } from "./SkillSet"
import { equip_list, weapons, armors, accessorys, getEquipUUIDsByType } from "./Equips"
import { getEnhancement } from "./LevelUp"
import { TalentList } from "./TalentSet"
@@ -162,13 +162,16 @@ export const Quality={
ORANGE:5,
}
export const SuperCardsList=[3101,3102,3103];
export const SuperCardsList=[3101,3102,3103,3104,3105,3106];
export const SuperCards={
3101:{uuid:3101,name:"陨石爆",quality:Quality.GREEN,path:"3101",CTarget:CTarget.ENEMY,type:SuperCardsType.AOE,value1:SkillSet[6032].uuid,value2:10,value3:0,
3101:{uuid:3101,name:"陨石爆",quality:Quality.GREEN,path:"3101",CTarget:CTarget.ENEMY,type:SuperCardsType.AOE,value1:SkillSet[6032].uuid,value2:1,value3:0,
info:"召唤大量火球攻击敌人,每个火球对敌人造成英雄攻击力的300%伤害"},
3102:{uuid:3102,name:"龙卷群",quality:Quality.BLUE,path:"3104",CTarget:CTarget.ENEMY,type:SuperCardsType.AOE,value1:SkillSet[6033].uuid,value2:10,value3:0,
3102:{uuid:3102,name:"龙卷群",quality:Quality.BLUE,path:"3104",CTarget:CTarget.ENEMY,type:SuperCardsType.AOE,value1:SkillSet[6033].uuid,value2:1,value3:0,
info:"召唤大量火球攻击敌人,每个火球对敌人造成英雄攻击力的300%伤害"},
3103:{uuid:3103,name:"大海啸",quality:Quality.PURPLE,path:"3105",CTarget:CTarget.ENEMY,type:SuperCardsType.AOE,value1:SkillSet[6034].uuid,value2:10,value3:0,
3103:{uuid:3103,name:"大海啸",quality:Quality.PURPLE,path:"3105",CTarget:CTarget.ENEMY,type:SuperCardsType.AOE,value1:SkillSet[6034].uuid,value2:1,value3:0,
info:"召唤大量火球攻击敌人,每个火球对敌人造成英雄攻击力的300%伤害"},
3104:{uuid:3104,name:"攻击力",quality:Quality.ORANGE,path:"3106",CTarget:CTarget.MASTER,type:SuperCardsType.BUFF,value1:BuffAttr.AP,value2:5,value3:0},
3105:{uuid:3105,name:"生命值",quality:Quality.ORANGE,path:"3107",CTarget:CTarget.MASTER,type:SuperCardsType.BUFF,value1:BuffAttr.HP_MAX,value2:5,value3:0},
3106:{uuid:3106,name:"防御值",quality:Quality.ORANGE,path:"3108",CTarget:CTarget.MASTER,type:SuperCardsType.BUFF,value1:BuffAttr.DEF,value2:5,value3:0},
}

View File

@@ -33,6 +33,7 @@ export enum GameEvent {
EnhancementSelect = "EnhancementSelect",
CanUpdateLv = "CanUpdateLv",
UseEnhancement = "UseEnhancement",
LuckCardUsed = "LuckCardUsed",
MasterCalled = "MasterCalled",
FightStart = "FightStart",
FightPause = "FightPause",

View File

@@ -9,6 +9,7 @@ import { BuffAttr } from "../common/config/SkillSet";
import { EnhancementType } from "../common/config/LevelUp";
import { TalentList } from "../common/config/TalentSet";
import { smc } from "../common/SingletonModuleComp";
import { SuperCards, SuperCardsType } from "../common/config/CardSet";
const { ccclass, property } = _decorator;
@@ -26,6 +27,7 @@ export class HeroConComp extends CCComp {
this.on(GameEvent.UseEnhancement,this.use_enhancement,this)
this.on(GameEvent.UseTalentCard,this.use_talent_card,this)
this.on(GameEvent.RemoveTalent,this.remove_talent_card,this)
this.on(GameEvent.LuckCardUsed,this.luck_card_used,this)
this.heroView=this.node.getComponent(HeroViewComp)
console.log("[HeroConCompComp]:onLoad",this.heroView)
@@ -104,108 +106,78 @@ export class HeroConComp extends CCComp {
use_talent_card(e:GameEvent,data:any){
console.log("[HeroConCompComp]:use_talent_card",data)
let tal=TalentList[data.uuid]
switch(tal.buffType){
case BuffAttr.ATK:
this.heroView.TALENT[BuffAttr.ATK]+=tal.value
this.heroView.count_atrr(BuffAttr.ATK)
this.do_buff_func(tal.buffType,tal.value)
}
remove_talent_card(e:GameEvent,data:any){
let tal=TalentList[data.uuid]
console.log("[HeroConCompComp]:remove_talent_card",data,tal)
this.do_buff_func(tal.buffType,-tal.value)
}
luck_card_used(e:GameEvent,card:any){
switch(card.type){
case SuperCardsType.BUFF:
this.do_buff_func(card.value1,card.value2)
break
case BuffAttr.ATK_CD:
this.heroView.TALENT[BuffAttr.ATK_CD]+=tal.value
this.heroView.count_atrr(BuffAttr.ATK_CD)
break
case BuffAttr.SKILL_CD:
smc.vmdata.hero.skill_cd_buff+=tal.value //直接加到vmdata中
break
case BuffAttr.HP:
this.heroView.TALENT[BuffAttr.HP]+=tal.value
this.heroView.count_atrr(BuffAttr.HP)
break
case BuffAttr.DEF:
this.heroView.change_def(tal.value)
break
case BuffAttr.CRITICAL:
this.heroView.change_crit(tal.value)
break
case BuffAttr.CRITICAL_DMG:
this.heroView.change_crit_d(tal.value)
break
case BuffAttr.DODGE:
this.heroView.change_dodge(tal.value)
break
case BuffAttr.PUNCTURE:
this.heroView.change_puncture(tal.value)
break
case BuffAttr.PUNCTURE_DMG:
this.heroView.change_puncture_damage(tal.value)
break
case BuffAttr.FROST_RATIO:
this.heroView.change_frost_ratto(tal.value)
break
case BuffAttr.KNOCKBACK:
this.heroView.change_knockback(tal.value)
break
case BuffAttr.STUN_RATTO:
this.heroView.change_stun_ratto(tal.value)
break
case BuffAttr.LIFESTEAL:
this.heroView.change_lifesteal(tal.value)
break
case BuffAttr.WFUNY:
this.heroView.change_wfuny(tal.value)
case SuperCardsType.AOE:
//do skill
break
}
}
remove_talent_card(e:GameEvent,data:any){
let tal=TalentList[data.uuid]
console.log("[HeroConCompComp]:remove_talent_card",data,tal)
switch(tal.buffType){
case BuffAttr.ATK:
console.log("[HeroConCompComp]:atk",this.heroView.TALENT[BuffAttr.ATK],tal.value)
this.heroView.TALENT[BuffAttr.ATK]-=tal.value
do_buff_func(buffType:number,value:number){
switch(buffType){
case BuffAttr.AP:
this.heroView.ap_base+=value
this.heroView.count_atrr(BuffAttr.ATK)
break
case BuffAttr.HP_MAX:
this.heroView.hp_base+=value
this.heroView.count_atrr(BuffAttr.HP)
break
case BuffAttr.ATK:
this.heroView.TALENT[BuffAttr.ATK]+=value
this.heroView.count_atrr(BuffAttr.ATK)
console.log("[HeroConCompComp]ed:atk",this.heroView.TALENT[BuffAttr.ATK],tal.value)
break
case BuffAttr.ATK_CD:
this.heroView.TALENT[BuffAttr.ATK_CD]-=tal.value
this.heroView.TALENT[BuffAttr.ATK_CD]+=value
this.heroView.count_atrr(BuffAttr.ATK_CD)
break
case BuffAttr.HP:
this.heroView.TALENT[BuffAttr.HP]-=tal.value
this.heroView.TALENT[BuffAttr.HP]+=value
break
case BuffAttr.DEF:
this.heroView.change_def(-tal.value)
this.heroView.change_def(value)
break
case BuffAttr.CRITICAL:
this.heroView.change_crit(-tal.value)
this.heroView.change_crit(value)
break
case BuffAttr.CRITICAL_DMG:
this.heroView.change_crit_d(-tal.value)
this.heroView.change_crit_d(value)
break
case BuffAttr.DODGE:
this.heroView.change_dodge(-tal.value)
this.heroView.change_dodge(value)
break
case BuffAttr.PUNCTURE:
this.heroView.change_puncture(-tal.value)
this.heroView.change_puncture(value)
break
case BuffAttr.PUNCTURE_DMG:
this.heroView.change_puncture_damage(-tal.value)
this.heroView.change_puncture_damage(value)
break
case BuffAttr.FROST_RATIO:
this.heroView.change_frost_ratto(-tal.value)
this.heroView.change_frost_ratto(value)
break
case BuffAttr.KNOCKBACK:
this.heroView.change_knockback(-tal.value)
this.heroView.change_knockback(value)
break
case BuffAttr.STUN_RATTO:
this.heroView.change_stun_ratto(-tal.value)
this.heroView.change_stun_ratto(value)
break
case BuffAttr.REFLECT:
this.heroView.change_reflect(-tal.value)
this.heroView.change_reflect(value)
break
case BuffAttr.LIFESTEAL:
this.heroView.change_lifesteal(-tal.value)
this.heroView.change_lifesteal(value)
break
}
}

View File

@@ -1,4 +1,6 @@
import { _decorator, Animation, Component, Node, tween, v3 } from 'cc';
import { _decorator, Animation, Component, Label, Node, resources, Sprite, SpriteAtlas, tween, v3 } from 'cc';
import { SuperCards, SuperCardsType } from '../common/config/CardSet';
import { SkillSet } from '../common/config/SkillSet';
const { ccclass, property } = _decorator;
@ccclass('LuckCardComp')
@@ -18,6 +20,22 @@ export class LuckCardComp extends Component {
this.timer=2
}
}
show_card(card:any){
var icon_path = "game/heros/cards"
resources.load(icon_path, SpriteAtlas, (err: any, atlas) => {
const sprite = this.node.getChildByName("icon").getComponent(Sprite);
sprite.spriteFrame = atlas.getSpriteFrame(SuperCards[card.uuid].path);
});
this.node.getChildByName("name").getComponent(Label).string=SuperCards[card.uuid].name
switch(SuperCards[card.uuid].type){
case SuperCardsType.BUFF:
this.node.getChildByName("val").getComponent(Label).string="+"+SuperCards[card.uuid].value2
break
case SuperCardsType.AOE:
this.node.getChildByName("val").getComponent(Label).string=SkillSet[SuperCards[card.uuid].value1].name+"X"+SuperCards[card.uuid].value2
break
}
}
do_destroy(){
tween(this.node)
.to(0.2, {

View File

@@ -12,6 +12,8 @@ import { defaultEnhancements, EnhancementOptions } from "../common/config/LevelU
import { MonModelComp } from "../hero/MonModelComp";
import { TalentSlot } from "../common/config/TalentSet";
import { RogueTalWave } from "./RogueConfig";
import { cardType, getRandomCardsByType, SuperCards, SuperCardsList, SuperCardsType } from "../common/config/CardSet";
import { LuckCardComp } from "./LuckCardComp";
const { ccclass, property } = _decorator;
@@ -293,17 +295,30 @@ export class MissionComp extends CCComp {
}
call_func_card(){
this.show_lucky_gold()
if(smc.vmdata.mission_data.gold < smc.vmdata.mission_data.lucky_gold){
oops.gui.toast("金币不足", false);
return
}
this.do_lucky_card()
}
show_lucky_gold(){
do_lucky_card(){
smc.vmdata.mission_data.gold-=smc.vmdata.mission_data.lucky_gold
let list=getRandomCardsByType(cardType.SPECIAL,1)
let card=SuperCards[list[0].uuid]
console.log("[MissionComp] do_lucky_card",card)
this.show_lucky_gold(card)
oops.message.dispatchEvent(GameEvent.LuckCardUsed,card)
}
show_lucky_gold(card:any){
var path = "game/gui/lcard";
var prefab: Prefab = oops.res.get(path, Prefab)!;
var node = instantiate(prefab);
node.setScale(0,0,0)
node.getComponent(LuckCardComp).show_card(card)
node.parent = this.node
node.setPosition(v3(this.node.getChildByName("luckybox").position.x,this.node.getChildByName("luckybox").position.y));
let height=this.node.getComponent(UITransform).height
let height=this.node.getComponent(UITransform).height
tween(node) .to(0.5, {
scale: v3(1,1,1),
position: v3(0, height-300),