信息展示 继续
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -42,14 +42,15 @@ export class SingletonModuleComp extends ecs.Comp {
|
||||
hero:{
|
||||
hp:0,
|
||||
hp_max:0,
|
||||
hp_buff:0,
|
||||
cd:3,
|
||||
damage:9999,
|
||||
ap:9999,
|
||||
equip_ap:9999,
|
||||
buff_ap:9999,
|
||||
debuff_ap:9999,
|
||||
def:9999,
|
||||
crit:9999,
|
||||
damage:0,
|
||||
ap:0,
|
||||
equip_ap:0,
|
||||
buff_ap:0,
|
||||
debuff_ap:0,
|
||||
def:0,
|
||||
crit:0,
|
||||
crit_d:99,
|
||||
dod:99,
|
||||
dod_no:false,
|
||||
@@ -58,34 +59,36 @@ export class SingletonModuleComp extends ecs.Comp {
|
||||
friend:{
|
||||
hp:0,
|
||||
hp_max:0,
|
||||
hp_buff:0,
|
||||
cd:3,
|
||||
t_ap:0,
|
||||
damage:0,
|
||||
ap:0,
|
||||
def:0,
|
||||
crit:0,
|
||||
crit_d:0,
|
||||
dod:0,
|
||||
dod_no:false,
|
||||
crit_no:false,
|
||||
equip_ap:0,
|
||||
buff_ap:0,
|
||||
debuff_ap:0,
|
||||
def:0,
|
||||
crit:0,
|
||||
crit_d:99,
|
||||
dod:99,
|
||||
dod_no:false,
|
||||
crit_no:false,
|
||||
},
|
||||
boss:{
|
||||
hp:0,
|
||||
hp_max:0,
|
||||
hp_buff:0,
|
||||
cd:3,
|
||||
t_ap:0,
|
||||
damage:0,
|
||||
ap:0,
|
||||
def:0,
|
||||
crit:0,
|
||||
crit_d:0,
|
||||
dod:0,
|
||||
dod_no:false,
|
||||
crit_no:false,
|
||||
equip_ap:0,
|
||||
buff_ap:0,
|
||||
debuff_ap:0,
|
||||
def:0,
|
||||
crit:0,
|
||||
crit_d:99,
|
||||
dod:99,
|
||||
dod_no:false,
|
||||
crit_no:false,
|
||||
},
|
||||
};
|
||||
vmAdd() {
|
||||
|
||||
@@ -75,7 +75,6 @@ export interface EquipData {
|
||||
info: string; // 装备描述
|
||||
special_attr: EquipSpecialAttrData[]; // 特殊属性数组
|
||||
buff: EquipAttribute[]; // 属性加成列表
|
||||
debuff: EquipDebuffAttribute[]; // 属性减益列表
|
||||
}
|
||||
export const EquipInfo: { [key: number]: EquipData } = {
|
||||
2001: {uuid: 2001, name: "新手剑", type: EquipType.WEAPON,quality: Quality.WHITE,info:"攻击力增加80%",
|
||||
@@ -93,9 +92,7 @@ export const EquipInfo: { [key: number]: EquipData } = {
|
||||
{ type: BuffAttr.ATK, value: 80, target: EquipAttrTarget.HERO },
|
||||
{ type: BuffAttr.ATK_COUNT, value: 30, target: EquipAttrTarget.HERO },
|
||||
],
|
||||
debuff: [
|
||||
{ type: DebuffAttr.DECD, value: 50, target: EquipAttrTarget.ENEMY },
|
||||
]
|
||||
|
||||
},
|
||||
2002: {uuid: 2002,name: "新手剑2",type: EquipType.WEAPON,quality: Quality.WHITE,info:"攻击速度增加30%",
|
||||
special_attr:[
|
||||
@@ -112,9 +109,6 @@ export const EquipInfo: { [key: number]: EquipData } = {
|
||||
{ type: BuffAttr.ATK_CD, value: 30, target: EquipAttrTarget.HERO },
|
||||
{ type: BuffAttr.ATK_COUNT, value: 30, target: EquipAttrTarget.HERO },
|
||||
],
|
||||
debuff: [
|
||||
{ type: DebuffAttr.DECD, value: 50, target: EquipAttrTarget.ENEMY },
|
||||
]
|
||||
},
|
||||
2003: {uuid: 2003,name: "新手剑3",type: EquipType.WEAPON,quality: Quality.WHITE,info:"攻击次数增加1次",
|
||||
special_attr:[
|
||||
@@ -129,10 +123,8 @@ export const EquipInfo: { [key: number]: EquipData } = {
|
||||
],
|
||||
buff: [
|
||||
{ type: BuffAttr.ATK_COUNT, value: 1, target: EquipAttrTarget.HERO },
|
||||
{ type: BuffAttr.HP, value: 30, target: EquipAttrTarget.HERO },
|
||||
],
|
||||
debuff: [
|
||||
{ type: DebuffAttr.DECD, value: 50, target: EquipAttrTarget.ENEMY },
|
||||
]
|
||||
},
|
||||
|
||||
}
|
||||
|
||||
@@ -45,4 +45,6 @@ export enum GameEvent {
|
||||
ChangeATK = "ChangeATK",
|
||||
ChangeATK_FRIEND_LIVE_CD = "ChangeATK_FRIEND_LIVE_CD",
|
||||
ChangeATK_EQUIP_SPECIAL_ATTR = "ChangeATK_EQUIP_SPECIAL_ATTR",
|
||||
UpdateVMData = "UpdateVMData",
|
||||
UpdateHP = "UpdateHP",
|
||||
}
|
||||
@@ -90,6 +90,8 @@ export enum BuffAttr {
|
||||
CRITICAL_NO = 11, //暴击免疫
|
||||
DODGE = 12, //闪避
|
||||
DODGE_NO = 13, //闪避免疫
|
||||
DEBUFF_COUNT = 14, //debuff次数
|
||||
DEBUFF_VALUE = 15, //debuff效果
|
||||
}
|
||||
|
||||
export const geDebuffNum=()=>{
|
||||
@@ -124,6 +126,8 @@ export const getBuffNum=()=>{
|
||||
CRITICAL_NO:0, //暴击免疫
|
||||
DODGE:0, //闪避
|
||||
DODGE_NO:0, //闪避免疫
|
||||
DEBUFF_COUNT:0, //debuff次数
|
||||
DEBUFF_VALUE:0, //debuff效果
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ import { BuffGet } from '../skills/BuffGet';
|
||||
import { HeroViewComp } from './HeroViewComp';
|
||||
import { FightConComp } from '../map/FightConComp';
|
||||
import { BuffAttr, DebuffAttr } from '../common/config/SkillSet';
|
||||
import { GameEvent } from '../common/config/GameEvent';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass('BuffComp')
|
||||
@@ -35,6 +36,9 @@ export class BuffComp extends Component {
|
||||
speek_time:number=0;
|
||||
HeroView:HeroViewComp=null!
|
||||
FIGHTCON:FightConComp=null!
|
||||
protected onLoad(): void {
|
||||
oops.message.on(GameEvent.UpdateVMData,this.to_update_vmdata,this)
|
||||
}
|
||||
start() {
|
||||
this.info_init()
|
||||
}
|
||||
@@ -53,9 +57,11 @@ export class BuffComp extends Component {
|
||||
this.top_node.getChildByName("ihp").active=false
|
||||
this.top_node.getChildByName("iap").active=false
|
||||
|
||||
this.vmdata_update(this.HeroView.VM_TYPE.ALL)
|
||||
this.vmdata_update()
|
||||
}
|
||||
to_update_vmdata(){
|
||||
this.vmdata_update(false)
|
||||
}
|
||||
|
||||
update(deltaTime: number) {
|
||||
if(smc.mission.pause) return
|
||||
this.hp_show()
|
||||
@@ -69,6 +75,7 @@ export class BuffComp extends Component {
|
||||
this.node.getChildByName("buff").active = false;
|
||||
}
|
||||
this.in_speek(deltaTime)
|
||||
// this.vmdata_update()
|
||||
}
|
||||
hp_show(){
|
||||
// if(this.node.getComponent(HeroViewComp).fac == 0) return
|
||||
@@ -83,47 +90,44 @@ export class BuffComp extends Component {
|
||||
this.node.getChildByName("shielded").active=val
|
||||
}
|
||||
|
||||
vmdata_update(data_type:string){
|
||||
let target_key=null
|
||||
let buff_key=null
|
||||
if(this.HeroView.is_master) {target_key="hero";buff_key="hero"}
|
||||
if(this.HeroView.is_friend) {target_key="friend";buff_key="friend"}
|
||||
if(this.HeroView.is_boss) {target_key="boss";buff_key="enemy"}
|
||||
if(target_key==null) return
|
||||
|
||||
switch(data_type){
|
||||
case this.HeroView.VM_TYPE.ALL:
|
||||
smc.vmdata[target_key].hp=this.HeroView.hp
|
||||
smc.vmdata[target_key].hp_max=this.HeroView.hp_max
|
||||
smc.vmdata[target_key].ap=this.HeroView.ap
|
||||
break
|
||||
case this.HeroView.VM_TYPE.HP:
|
||||
smc.vmdata[target_key].hp=this.HeroView.hp
|
||||
smc.vmdata[target_key].hp_max=this.HeroView.hp_max
|
||||
break
|
||||
case this.HeroView.VM_TYPE.OTHER:
|
||||
let view_atk = 0 //临时buff
|
||||
for(let i=0;i<this.HeroView.BUFF_ATKS.length;i++){
|
||||
view_atk += this.HeroView.BUFF_ATKS[i].value
|
||||
}
|
||||
let view_deatk = 0 //临时debuff
|
||||
for(let i=0;i<this.HeroView.DEBUFF_DEATKS.length;i++){
|
||||
view_deatk += this.HeroView.DEBUFF_DEATKS[i].value
|
||||
}
|
||||
|
||||
let buff=this.FIGHTCON[buff_key+"_buff"]
|
||||
vmdata_update(is_hp:boolean=false){
|
||||
console.log("[BuffComp]:vmdata_update",is_hp)
|
||||
let buff=null
|
||||
let info= null
|
||||
if(!this.HeroView) return
|
||||
if(this.HeroView.is_master) {info=smc.vmdata.hero;buff=this.FIGHTCON.hero_buff}
|
||||
if(this.HeroView.is_friend) {info=smc.vmdata.friend;buff=this.FIGHTCON.friend_buff}
|
||||
if(this.HeroView.is_boss) {info=smc.vmdata.boss;buff=this.FIGHTCON.enemy_buff}
|
||||
//if(this.HeroView.is_kalami) {target_key="enemy";buff_key="enemy"} 不显示小怪
|
||||
if(info==null) return
|
||||
let view_atk = 0 //临时buff
|
||||
let view_deatk = 0 //临时debuff
|
||||
if(is_hp){
|
||||
info.hp=this.HeroView.hp
|
||||
info.hp_max=this.HeroView.hp_max*(100+buff.HP)/100
|
||||
info.hp_buff=buff.HP
|
||||
}else{
|
||||
info.hp=this.HeroView.hp
|
||||
info.hp_max=this.HeroView.hp_max*(100+buff.HP)/100
|
||||
info.hp_buff=buff.HP
|
||||
for(let i=0;i<this.HeroView.BUFF_ATKS.length;i++){
|
||||
view_atk += this.HeroView.BUFF_ATKS[i].value
|
||||
}
|
||||
|
||||
|
||||
smc.vmdata[target_key].ap=this.HeroView.ap
|
||||
smc.vmdata[target_key].equip_ap=buff.ATK
|
||||
smc.vmdata[target_key].buff_ap=view_atk
|
||||
smc.vmdata[target_key].debuff_ap=view_deatk
|
||||
smc.vmdata[target_key].damage=this.HeroView.ap*(100+buff.ATK)/100*(100+view_atk-view_deatk)/100
|
||||
|
||||
|
||||
|
||||
break
|
||||
for(let i=0;i<this.HeroView.DEBUFF_DEATKS.length;i++){
|
||||
view_deatk += this.HeroView.DEBUFF_DEATKS[i].value
|
||||
}
|
||||
info.ap=this.HeroView.ap
|
||||
info.equip_ap=buff.ATK
|
||||
info.buff_ap=view_atk
|
||||
info.debuff_ap=view_deatk
|
||||
info.damage=this.HeroView.ap*(100+buff.ATK)/100*(100+view_atk-view_deatk)/100
|
||||
info.crit=this.HeroView.crit+buff.CRITICAL
|
||||
info.crit_d=this.HeroView.crit_d+buff.CRITICAL_DMG
|
||||
info.dod=this.HeroView.dod+buff.DODGE
|
||||
info.def=this.HeroView.def+buff.DEF
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
update_info_hp(){
|
||||
|
||||
@@ -52,6 +52,7 @@ export class HeroViewComp extends CCComp {
|
||||
hp_up:number=0;
|
||||
hp: number = 100; /** 血量 */
|
||||
hp_max: number = 100; /** 最大血量 */
|
||||
hp_buff:number=0;
|
||||
hp_speed: number = 0; //每秒回复量
|
||||
|
||||
pwt:Timer = new Timer(1); //计时器
|
||||
@@ -90,16 +91,10 @@ export class HeroViewComp extends CCComp {
|
||||
DEBUFF_BURNS: Array<{value: number, count: number}> = []
|
||||
DEBUFF_DEATKS: Array<{value: number, count: number}> = []
|
||||
DEBUFF_DECDS: Array<{value: number, count: number}> = []
|
||||
|
||||
DEBUFF_SLOW: number = 0;
|
||||
DEBUFF_FROST: number = 0;
|
||||
DEBUFF_STUN: number = 0;
|
||||
|
||||
VM_TYPE:any={
|
||||
ALL:0,
|
||||
HP:1,
|
||||
OTHER:2,
|
||||
}
|
||||
private damageQueue: Array<{
|
||||
damage: number,
|
||||
isCrit: boolean,
|
||||
@@ -115,7 +110,7 @@ export class HeroViewComp extends CCComp {
|
||||
this.FIGHTCON=this.node.parent.getComponent(FightConComp);
|
||||
console.log("[HeroViewComp]:hero view comp ",this.FIGHTCON)
|
||||
this.on(GameEvent.ChangeATK_EQUIP_SPECIAL_ATTR,this.change_atk,this)
|
||||
|
||||
this.on(GameEvent.UpdateHP,this.update_hp,this)
|
||||
// let anm = this.node.getChildByName("anm")
|
||||
// anm.setScale(anm.scale.x*0.8,anm.scale.y*0.8);
|
||||
}
|
||||
@@ -226,7 +221,7 @@ export class HeroViewComp extends CCComp {
|
||||
this.ap += Math.floor(ap/100*this.ap);
|
||||
}
|
||||
this.BUFFCOMP.update_info_ap()
|
||||
this.BUFFCOMP.vmdata_update(this.VM_TYPE.OTHER)
|
||||
this.BUFFCOMP.vmdata_update()
|
||||
}
|
||||
|
||||
de_ap(ap: number,is_num:boolean=true){
|
||||
@@ -237,9 +232,20 @@ export class HeroViewComp extends CCComp {
|
||||
this.ap -= Math.floor(ap/100*this.ap);
|
||||
}
|
||||
this.BUFFCOMP.update_info_ap()
|
||||
this.BUFFCOMP.vmdata_update(this.VM_TYPE.OTHER)
|
||||
this.BUFFCOMP.vmdata_update()
|
||||
}
|
||||
update_hp(e:GameEvent,data:any){
|
||||
console.log("[HeroViewComp]:update_hp",data)
|
||||
if(this.is_master===data.is_master&&this.fac===FacSet.HERO){
|
||||
this.hp_buff += data.hp
|
||||
if(data.hp > 0){
|
||||
this.hp += this.hp_max*data.hp/100
|
||||
if(this.hp > this.hp_max*(100+this.hp_buff/100)){
|
||||
this.hp=this.hp_max*(100+this.hp_buff/100)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
add_hp_max(hp: number=0,is_num:boolean=true){
|
||||
console.log("[HeroViewComp]:add_hp_max add:",hp,this.hp_max)
|
||||
if(is_num){
|
||||
@@ -260,7 +266,7 @@ export class HeroViewComp extends CCComp {
|
||||
this.hp_max -= Math.floor(hp/100*this.hp_max);
|
||||
}
|
||||
this.BUFFCOMP.update_info_hp()
|
||||
this.BUFFCOMP.vmdata_update(this.VM_TYPE.HP)
|
||||
this.BUFFCOMP.vmdata_update(true)
|
||||
}
|
||||
|
||||
add_hp(hp: number = 0,is_num:boolean=true) {
|
||||
@@ -274,7 +280,7 @@ export class HeroViewComp extends CCComp {
|
||||
this.hp = this.hp_max;
|
||||
}
|
||||
this.BUFFCOMP.tooltip(2,hp.toFixed(0));
|
||||
this.BUFFCOMP.vmdata_update(this.VM_TYPE.HP)
|
||||
this.BUFFCOMP.vmdata_update(true)
|
||||
}
|
||||
|
||||
|
||||
@@ -345,6 +351,9 @@ export class HeroViewComp extends CCComp {
|
||||
case DebuffAttr.BURN:
|
||||
this.DEBUFF_BURNS.push({value:deV,count:deC})
|
||||
break
|
||||
case DebuffAttr.DECD:
|
||||
this.DEBUFF_DECDS.push({value:deV,count:deC})
|
||||
break
|
||||
case DebuffAttr.SLOW:
|
||||
this.DEBUFF_SLOW+=deV
|
||||
break
|
||||
@@ -357,15 +366,16 @@ export class HeroViewComp extends CCComp {
|
||||
this.DEBUFF_STUN+=deV
|
||||
this.is_stop=true
|
||||
break
|
||||
case DebuffAttr.DECD:
|
||||
this.DEBUFF_DECDS.push({value:deV,count:deC})
|
||||
break
|
||||
case DebuffAttr.DEHP:
|
||||
this.hp_max-=deV
|
||||
this.hp_max-=deV/100*this.hp_max
|
||||
if(this.hp-this.hp_max>0) this.hp=this.hp_max
|
||||
break
|
||||
case DebuffAttr.DEATK:
|
||||
this.ap-=deV
|
||||
case DebuffAttr.DEATK: //99为具体数字 并且局内永久生效,其他为百分比
|
||||
if(deC == 99){
|
||||
this.ap-=deV
|
||||
}else{
|
||||
this.DEBUFF_DEATKS.push({value:deV,count:deC})
|
||||
}
|
||||
break
|
||||
case DebuffAttr.DECOUNT:
|
||||
this.atk_count-=deV
|
||||
@@ -416,7 +426,7 @@ export class HeroViewComp extends CCComp {
|
||||
}
|
||||
}
|
||||
this.BUFFCOMP.update_info_hp()
|
||||
this.BUFFCOMP.vmdata_update(this.VM_TYPE.HP)
|
||||
this.BUFFCOMP.vmdata_update(true)
|
||||
this.showDamage(damage, is_crit);
|
||||
|
||||
}
|
||||
@@ -439,14 +449,12 @@ export class HeroViewComp extends CCComp {
|
||||
this.BUFF_DEFS.splice(i,1)
|
||||
}
|
||||
}
|
||||
let buff_key=null
|
||||
if(this.is_master) {buff_key="hero"}
|
||||
if(this.is_friend) {buff_key="friend"}
|
||||
if(this.is_boss) {buff_key="enemy"}
|
||||
if(this.is_kalami) {buff_key="enemy"}
|
||||
if(buff_key==null) return
|
||||
|
||||
let buff=this.FIGHTCON[buff_key+"_buff"]
|
||||
let buff=null
|
||||
if(this.is_master) buff=this.FIGHTCON.hero_buff
|
||||
if(this.is_friend) buff=this.FIGHTCON.friend_buff
|
||||
if(this.is_boss) buff=this.FIGHTCON.enemy_buff
|
||||
if(this.is_kalami) buff=this.FIGHTCON.enemy_buff
|
||||
if(buff==null) return
|
||||
damage=remainingDamage*(100-(buff.DEF+def)+Burn)/100
|
||||
|
||||
return Math.floor(damage)
|
||||
|
||||
@@ -42,7 +42,6 @@ export class SkillConComp extends CCComp {
|
||||
|
||||
let cd = this.get_cd(this.HeroView.cd,this.HeroView)
|
||||
let count=this.get_count(1,this.HeroView)
|
||||
if(count<1) count=1
|
||||
// console.log(this.HeroView.hero_name+(this.HeroView.is_master?"[主]":"[从] 准备释放")+SkillSet[this.HeroView.atk_skill].name+"=>"+"=>cd:"+cd+"=> count:"+count)
|
||||
if (this.HeroView.is_atking &&(this.HeroView.at > cd)) {
|
||||
if(this.HeroView.is_dead) return
|
||||
@@ -133,7 +132,7 @@ export class SkillConComp extends CCComp {
|
||||
}
|
||||
check_double_atk(count:number){
|
||||
let random = Math.random()*100
|
||||
if(random < FightSet.DOUBLE_ATK_RATE*count){
|
||||
if(random < FightSet.DOUBLE_ATK_RATE*count){ //多次攻击概率
|
||||
return true
|
||||
}
|
||||
return false
|
||||
@@ -186,15 +185,11 @@ export class SkillConComp extends CCComp {
|
||||
Object.values(this._timers).forEach(clearTimeout);
|
||||
}
|
||||
get_cd(cd:number,view:HeroViewComp){
|
||||
let buff_key=null
|
||||
if(view.is_master) {buff_key="hero"}
|
||||
if(view.is_friend) {buff_key="friend"}
|
||||
if(view.is_boss) {buff_key="enemy"}
|
||||
if(view.is_kalami) {buff_key="enemy"}
|
||||
if(buff_key==null) return
|
||||
let debuff=this.FIGHTCON[buff_key+"_debuff"]
|
||||
let buff=this.FIGHTCON[buff_key+"_buff"]
|
||||
|
||||
|
||||
let buff=this.get_buff(view)
|
||||
let buff_cd=0
|
||||
if(buff!=null) buff_cd=buff.ATK_CD
|
||||
|
||||
// 汇总DEBUFF_DECD并处理count值
|
||||
let decd = 0;
|
||||
for (let i = view.DEBUFF_DECDS.length - 1; i >= 0; i--) {
|
||||
@@ -213,21 +208,21 @@ export class SkillConComp extends CCComp {
|
||||
view.BUFF_CDS.splice(i, 1);
|
||||
}
|
||||
}
|
||||
|
||||
return cd*(100-bcd-buff.ATK_CD)/100
|
||||
|
||||
return cd*(100-bcd-buff_cd+decd)/100
|
||||
}
|
||||
get_count(count:number,view:HeroViewComp){
|
||||
if(view.fac==FacSet.HERO){
|
||||
if(view.is_master){
|
||||
return count+(this.FIGHTCON.hero_buff.ATK_COUNT)
|
||||
}else{
|
||||
return count+(this.FIGHTCON.friend_buff.ATK_COUNT)
|
||||
}
|
||||
}else{
|
||||
return count+(this.FIGHTCON.enemy_buff.ATK_COUNT)
|
||||
}
|
||||
|
||||
let buff=this.get_buff(view)
|
||||
if(buff==null) return count
|
||||
let re=count+(buff.ATK_COUNT)
|
||||
if(re<1) re=1
|
||||
return re
|
||||
}
|
||||
|
||||
get_buff(view:HeroViewComp){
|
||||
if(view.is_master) return this.FIGHTCON.hero_buff
|
||||
if(view.is_friend) return this.FIGHTCON.friend_buff
|
||||
if(view.is_boss||view.is_kalami) return this.FIGHTCON.enemy_buff
|
||||
return null
|
||||
}
|
||||
reset() {
|
||||
this.clear_timer();
|
||||
|
||||
@@ -19,7 +19,7 @@ export class EquipsComp extends Component {
|
||||
attrs:any={
|
||||
hero_buff:getBuffNum(),
|
||||
friend_buff:getBuffNum(),
|
||||
enemy_debuff:getBuffNum(),
|
||||
enemy_buff:getBuffNum(),
|
||||
}
|
||||
/** 视图层逻辑代码分离演示 */
|
||||
onLoad() {
|
||||
@@ -112,14 +112,11 @@ export class EquipsComp extends Component {
|
||||
// 重置所有属性
|
||||
this.reset_attrs();
|
||||
console.log("[EquipsComp]:重置后的属性", this.attrs);
|
||||
|
||||
|
||||
// 获取所有装备的属性
|
||||
let weapon_buffs = this.weapon.uuid ? EquipInfo[this.weapon.uuid]?.buff || [] : [];
|
||||
let armor_buffs = this.armor.uuid ? EquipInfo[this.armor.uuid]?.buff || [] : [];
|
||||
let accessory_buffs = this.accessory.uuid ? EquipInfo[this.accessory.uuid]?.buff || [] : [];
|
||||
let weapon_debuffs = this.weapon.uuid ? EquipInfo[this.weapon.uuid]?.debuff || [] : [];
|
||||
let armor_debuffs = this.armor.uuid ? EquipInfo[this.armor.uuid]?.debuff || [] : [];
|
||||
let accessory_debuffs = this.accessory.uuid ? EquipInfo[this.accessory.uuid]?.debuff || [] : [];
|
||||
let weapon_special_attr = this.weapon.uuid ? EquipInfo[this.weapon.uuid]?.special_attr : [];
|
||||
let armor_special_attr = this.armor.uuid ? EquipInfo[this.armor.uuid]?.special_attr : [];
|
||||
let accessory_special_attr = this.accessory.uuid ? EquipInfo[this.accessory.uuid]?.special_attr : [];
|
||||
@@ -129,10 +126,7 @@ export class EquipsComp extends Component {
|
||||
console.log("[EquipsComp]:accessory_special_attr", accessory_special_attr);
|
||||
console.log("[EquipsComp]:weapon_buffs", weapon_buffs);
|
||||
console.log("[EquipsComp]:防具属性", armor_buffs);
|
||||
console.log("[EquipsComp]:饰品属性", accessory_buffs);
|
||||
console.log("[EquipsComp]:武器减益", weapon_debuffs);
|
||||
console.log("[EquipsComp]:防具减益", armor_debuffs);
|
||||
console.log("[EquipsComp]:饰品减益", accessory_debuffs);
|
||||
console.log("[EquipsComp]:饰品属性", accessory_buffs);
|
||||
const all_special_attr=[...weapon_special_attr,...armor_special_attr,...accessory_special_attr]
|
||||
|
||||
let equip_special_attr=this.count_equip_special_attr(all_special_attr)
|
||||
@@ -140,9 +134,7 @@ export class EquipsComp extends Component {
|
||||
|
||||
// 合并所有装备属性
|
||||
const allBuff = [...weapon_buffs, ...armor_buffs, ...accessory_buffs];
|
||||
const allDebuff = [...weapon_debuffs, ...armor_debuffs, ...accessory_debuffs];
|
||||
console.log("[EquipsComp]:合并后的所有属性", allBuff);
|
||||
console.log("[EquipsComp]:合并后的所有减益", allDebuff);
|
||||
// 计算每个目标的属性加成
|
||||
allBuff.forEach(attr => {
|
||||
const target = attr.target || EquipAttrTarget.HERO;
|
||||
@@ -158,23 +150,7 @@ export class EquipsComp extends Component {
|
||||
}
|
||||
this.add_attr(targetKey,attr)
|
||||
});
|
||||
allDebuff.forEach(attr => {
|
||||
const target = attr.target || EquipAttrTarget.HERO;
|
||||
let targetKey = null;
|
||||
// 根据目标类型获取对应的key
|
||||
switch (target) {
|
||||
case EquipAttrTarget.HERO:
|
||||
targetKey = 'hero_buff';
|
||||
break;
|
||||
case EquipAttrTarget.FRIEND:
|
||||
targetKey = 'friend_buff';
|
||||
break;
|
||||
case EquipAttrTarget.ENEMY:
|
||||
targetKey = 'enemy_debuff'; //都是敌人的减益
|
||||
break;
|
||||
}
|
||||
this.add_debuff(targetKey,attr)
|
||||
});
|
||||
|
||||
|
||||
console.log("[EquipsComp]:debuff buff attrs ", this.attrs);
|
||||
oops.message.dispatchEvent(GameEvent.EquipChange, this.attrs);
|
||||
@@ -238,31 +214,6 @@ export class EquipsComp extends Component {
|
||||
}
|
||||
}
|
||||
|
||||
add_debuff(targetKey:string,attr:any){
|
||||
switch(attr.type){
|
||||
case DebuffAttr.BURN:
|
||||
this.attrs[targetKey][BuffAttr.DEF] -= attr.value; //免伤, 负的免伤 就是加伤害
|
||||
break
|
||||
case DebuffAttr.DECD:
|
||||
this.attrs[targetKey][BuffAttr.ATK_CD] -= attr.value; //加cd值 技能释放中 按-cd 计算 所以 cd 值负数实际是加cd
|
||||
break
|
||||
case DebuffAttr.DEHP:
|
||||
this.attrs[targetKey][BuffAttr.HP] -= attr.value;
|
||||
break
|
||||
case DebuffAttr.DEATK:
|
||||
this.attrs[targetKey][BuffAttr.ATK] -= attr.value;
|
||||
break
|
||||
case DebuffAttr.DECOUNT:
|
||||
this.attrs[targetKey][BuffAttr.ATK_COUNT] -= attr.value;
|
||||
break
|
||||
case DebuffAttr.CRITICAL:
|
||||
this.attrs[targetKey][BuffAttr.CRITICAL] -= attr.value;
|
||||
break
|
||||
case DebuffAttr.DODGE:
|
||||
this.attrs[targetKey][BuffAttr.DODGE] -= attr.value;
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
// 重置所有属性为0
|
||||
private reset_attrs() {
|
||||
@@ -270,7 +221,7 @@ export class EquipsComp extends Component {
|
||||
const newAttrs = {
|
||||
hero_buff: getBuffNum(),
|
||||
friend_buff: getBuffNum(),
|
||||
enemy_debuff: getBuffNum(),
|
||||
enemy_buff: getBuffNum(),
|
||||
};
|
||||
|
||||
// 替换整个 attrs 对象
|
||||
@@ -279,7 +230,7 @@ export class EquipsComp extends Component {
|
||||
console.log("重置属性", {
|
||||
hero_buff: this.attrs.hero_buff,
|
||||
friend_buff: this.attrs.friend_buff,
|
||||
enemy_debuff: this.attrs.enemy_debuff,
|
||||
enemy_buff: this.attrs.enemy_buff,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -19,9 +19,6 @@ export class FightConComp extends Component {
|
||||
friend_buff=getBuffNum()
|
||||
enemy_buff=getBuffNum()
|
||||
|
||||
hero_debuff=geDebuffNum()
|
||||
friend_debuff=geDebuffNum()
|
||||
enemy_debuff=geDebuffNum()
|
||||
|
||||
//注意临时buff和debuff 每种buff的值 必须都一样 多种值 战斗处理复杂 暂时放弃
|
||||
atk_type:number=0;
|
||||
@@ -67,17 +64,38 @@ export class FightConComp extends Component {
|
||||
this.atk_add_master_atk=data.atk_add_master_atk+(this.card_atk_add > 0 ? this.card_atk_add:0) //装备特殊属性 英雄/伙伴 攻击力增加
|
||||
this.atk_add_master_hp=data.atk_add_master_hp+(this.card_hp_add > 0 ? this.card_hp_add:0) //装备特殊属性 英雄/伙伴 生命值增加
|
||||
this.friend_alive_cd=FightSet.FRIEND_LIVE_CD-data.friend_live_cd_less
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
private equip_change(e:GameEvent,equip:any){
|
||||
let old_hero_hp=JSON.parse(JSON.stringify(this.hero_buff.HP))
|
||||
let old_friend_hp=JSON.parse(JSON.stringify(this.friend_buff.HP))
|
||||
|
||||
let new_hero_hp=JSON.parse(JSON.stringify(equip.hero_buff.HP))
|
||||
let new_friend_hp=JSON.parse(JSON.stringify(equip.friend_buff.HP))
|
||||
|
||||
this.hero_buff=equip.hero_buff
|
||||
this.friend_buff=equip.friend_buff
|
||||
this.enemy_buff=equip.enemy_buff
|
||||
|
||||
|
||||
let hero_hp_add=new_hero_hp-old_hero_hp
|
||||
let friend_hp_add=new_friend_hp-old_friend_hp
|
||||
console.log("[FightConComp]:old_hero_hp:"+old_hero_hp+" new_hero_hp:"+new_hero_hp+" hero_hp_add:"+hero_hp_add)
|
||||
if(hero_hp_add!==0){
|
||||
|
||||
oops.message.dispatchEvent(GameEvent.UpdateHP,{hp:hero_hp_add,is_master:true})
|
||||
}
|
||||
|
||||
if(friend_hp_add!==0){
|
||||
oops.message.dispatchEvent(GameEvent.UpdateHP,{hp:friend_hp_add,is_master:false})
|
||||
}
|
||||
|
||||
this.hero_debuff=equip.hero_debuff
|
||||
this.friend_debuff=equip.friend_debuff
|
||||
this.enemy_debuff=equip.enemy_debuff
|
||||
this.scheduleOnce(()=>{
|
||||
oops.message.dispatchEvent(GameEvent.UpdateVMData)
|
||||
},0.1)
|
||||
}
|
||||
|
||||
private fight_ready(e:GameEvent){
|
||||
@@ -163,9 +181,6 @@ export class FightConComp extends Component {
|
||||
this.friend_buff=getBuffNum()
|
||||
this.enemy_buff=getBuffNum()
|
||||
|
||||
this.hero_debuff=geDebuffNum()
|
||||
this.friend_debuff=geDebuffNum()
|
||||
this.enemy_debuff=geDebuffNum()
|
||||
|
||||
this.friend_alive_cd=FightSet.FRIEND_LIVE_CD
|
||||
this.atk_add_friend_atk=0
|
||||
|
||||
@@ -67,7 +67,7 @@ export class Skill extends ecs.Entity {
|
||||
return;
|
||||
}
|
||||
|
||||
console.log("[Skill]:caster=>",caster,config.name+"scomp=>",SComp,"fightcon=>",FIGHTCON)
|
||||
|
||||
|
||||
// 确保caster有必要的属性
|
||||
if (typeof caster.ap === 'undefined') {
|
||||
@@ -80,12 +80,12 @@ export class Skill extends ecs.Entity {
|
||||
return;
|
||||
}
|
||||
|
||||
SComp.ap = this.get_ap(caster,dmg)
|
||||
|
||||
|
||||
|
||||
let ap_data = this.get_ap(caster,dmg,uuid,FIGHTCON)
|
||||
SComp.ap = ap_data.ap
|
||||
SComp.caster_crit = ap_data.crit
|
||||
SComp.caster_crit_d = ap_data.crit_d
|
||||
|
||||
console.log("[Skill]:caster.box_group=>",caster.box_group,config.name+"scomp.group=>",SComp.group)
|
||||
console.log("[Skill]:caster=>",caster,config.name+"scomp=>",SComp,"fightcon=>",FIGHTCON)
|
||||
// 设置技能组件属性
|
||||
Object.assign(SComp, {
|
||||
s_uuid: uuid,
|
||||
@@ -104,35 +104,48 @@ export class Skill extends ecs.Entity {
|
||||
this.add(SComp);
|
||||
}
|
||||
|
||||
get_ap(view:HeroViewComp,dmg:number=0){
|
||||
let buff_key=null
|
||||
if(view.is_master) {buff_key="hero"}
|
||||
if(view.is_friend) {buff_key="friend"}
|
||||
if(view.is_boss) {buff_key="enemy"}
|
||||
if(view.is_kalami) {buff_key="enemy"}
|
||||
if(buff_key==null) return
|
||||
let debuff=this.FIGHTCON[buff_key+"_debuff"]
|
||||
let buff=this.FIGHTCON[buff_key+"_buff"]
|
||||
let buff_ap=(100+buff.ATK-debuff.DEATK)/100 //装备区 总加成
|
||||
get_ap(view:HeroViewComp,dmg:number=0,uuid:number=0,FIGHTCON:FightConComp=null!){
|
||||
let ap=0
|
||||
let crit=0
|
||||
let crit_d=0
|
||||
let buff_ap=1
|
||||
let buff=null
|
||||
if(view.is_master) buff=FIGHTCON.hero_buff
|
||||
if(view.is_friend) buff=FIGHTCON.friend_buff
|
||||
if(view.is_boss) buff=FIGHTCON.enemy_buff
|
||||
if(view.is_kalami) buff=FIGHTCON.enemy_buff
|
||||
if(!buff==null) {
|
||||
buff_ap=(100+buff.ATK)/100 //装备区 总加成
|
||||
}
|
||||
|
||||
// 汇总DEBUFF_DECD并处理count值
|
||||
let BUFF_ATK = 0;
|
||||
for (let i = view.BUFF_ATKS.length - 1; i >= 0; i--) {
|
||||
BUFF_ATK += view.BUFF_ATKS[i].value;
|
||||
view.BUFF_ATKS[i].count--;
|
||||
if (view.BUFF_ATKS[i].count <= 0) {
|
||||
view.BUFF_ATKS.splice(i, 1);
|
||||
let BUFF_ATK = 0
|
||||
let DEBUFF_DEATK = 0
|
||||
if(view.BUFF_ATKS.length>0){
|
||||
for (let i = view.BUFF_ATKS.length - 1; i >= 0; i--) {
|
||||
BUFF_ATK += view.BUFF_ATKS[i].value;
|
||||
view.BUFF_ATKS[i].count--;
|
||||
if (view.BUFF_ATKS[i].count <= 0) {
|
||||
view.BUFF_ATKS.splice(i, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
let DEBUFF_DEATK = 0;
|
||||
for (let i = view.DEBUFF_DEATKS.length - 1; i >= 0; i--) {
|
||||
DEBUFF_DEATK += view.DEBUFF_DEATKS[i].value;
|
||||
view.DEBUFF_DEATKS[i].count--;
|
||||
if (view.DEBUFF_DEATKS[i].count <= 0) {
|
||||
view.DEBUFF_DEATKS.splice(i, 1);
|
||||
if(view.DEBUFF_DEATKS.length>0) {
|
||||
for (let i = view.DEBUFF_DEATKS.length - 1; i >= 0; i--) {
|
||||
DEBUFF_DEATK += view.DEBUFF_DEATKS[i].value;
|
||||
view.DEBUFF_DEATKS[i].count--;
|
||||
if (view.DEBUFF_DEATKS[i].count <= 0) {
|
||||
view.DEBUFF_DEATKS.splice(i, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let BUFF_AP=(100-DEBUFF_DEATK+BUFF_ATK+dmg)/100 //buff区 总加成
|
||||
|
||||
return view.ap*buff_ap*BUFF_AP
|
||||
ap=view.ap*buff_ap*BUFF_AP*SkillSet[uuid].ap/100
|
||||
crit=view.crit+buff.CRITICAL
|
||||
crit_d=view.crit_d+buff.CRITICAL_DMG
|
||||
console.log("[Skill]:ap=>",ap,"crit=>",crit,"crit_d=>",crit_d)
|
||||
return {ap,crit,crit_d}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,18 +70,8 @@ export class SkillCom extends CCComp {
|
||||
oops.message.on(GameEvent.MissionEnd, this.doDestroy, this);
|
||||
this.node.active = true;
|
||||
console.log("[SkillCom]:caster",this.caster)
|
||||
if(this.caster.fac==FacSet.HERO){
|
||||
if(this.caster.is_master){
|
||||
this.caster_crit = this.caster.crit+this.FIGHTCON.hero_buff.CRITICAL+this.FIGHTCON.hero_debuff.CRITICAL
|
||||
this.caster_crit_d = this.caster.crit_d+this.FIGHTCON.hero_buff.CRITICAL_DMG
|
||||
}else{
|
||||
this.caster_crit = this.caster.crit+this.FIGHTCON.friend_buff.CRITICAL+this.FIGHTCON.hero_debuff.CRITICAL
|
||||
this.caster_crit_d = this.caster.crit_d+this.FIGHTCON.friend_buff.CRITICAL_DMG
|
||||
}
|
||||
}else{
|
||||
this.caster_crit = this.caster.crit+this.FIGHTCON.enemy_buff.CRITICAL+this.FIGHTCON.enemy_debuff.CRITICAL
|
||||
this.caster_crit_d = this.caster.crit_d+this.FIGHTCON.enemy_buff.CRITICAL_DMG
|
||||
}
|
||||
|
||||
|
||||
let collider = this.getComponent(Collider2D);
|
||||
if(collider) {
|
||||
collider.group = this.group;
|
||||
@@ -161,7 +151,8 @@ export class SkillCom extends CCComp {
|
||||
if(target == null) return;
|
||||
target.do_atked(this.ap,crit,crit_d)
|
||||
if(SkillSet[this.s_uuid].debuff>0){
|
||||
target.add_debuff(SkillSet[this.s_uuid].debuff,SkillSet[this.s_uuid].deV,SkillSet[this.s_uuid].deC)
|
||||
let debuff =this.get_debuff()
|
||||
target.add_debuff(SkillSet[this.s_uuid].debuff,debuff.deV,debuff.deC)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -174,7 +165,17 @@ export class SkillCom extends CCComp {
|
||||
// this.ent.destroy()
|
||||
}
|
||||
}
|
||||
|
||||
get_debuff(){ //debuff 加成
|
||||
let debuff = {deV:0,deC:0}
|
||||
let buff=null
|
||||
if(this.caster.is_master) buff = this.FIGHTCON.hero_buff
|
||||
if(this.caster.is_friend) buff = this.FIGHTCON.friend_buff
|
||||
if(this.caster.is_boss||this.caster.is_kalami) buff = this.FIGHTCON.enemy_buff
|
||||
if(buff==null) return debuff
|
||||
debuff.deV=buff.DEBUFF_VALUE
|
||||
debuff.deC=buff.DEBUFF_COUNT
|
||||
return debuff
|
||||
}
|
||||
|
||||
private startLinearMove(dt: number) {
|
||||
if (!this.speed || this.is_destroy) return;
|
||||
|
||||
Reference in New Issue
Block a user