开箱 随机buff 初步完成
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user