临时buff改成时间计算 cd 加速的逻辑改变
This commit is contained in:
@@ -96,14 +96,14 @@ export class HeroViewComp extends CCComp {
|
||||
buff_debuff_down:number=0
|
||||
skill_dmg:number=0
|
||||
|
||||
BUFF_DEFS: Array<{value: number, count: number}> = [] //防御提升
|
||||
BUFF_ATKS: Array<{value: number, count: number}> = [] //攻击提升
|
||||
BUFF_CDS: Array<{value: number, count: number}> = [] //攻击加速
|
||||
BUFF_DEDOWN:Array<{value: number, count: number}> = [] //debuff 概率降低
|
||||
BUFF_DEFS: Array<{value: number, duration: number}> = [] //防御提升
|
||||
BUFF_ATKS: Array<{value: number, duration: number}> = [] //攻击提升
|
||||
BUFF_CDS: Array<{value: number, duration: number}> = [] //攻击加速
|
||||
BUFF_DEDOWN:Array<{value: number, duration: number}> = [] //debuff 概率降低
|
||||
|
||||
DEBUFF_BURNS: Array<{value: number, count: number}> = [] //易伤
|
||||
DEBUFF_DEATKS: Array<{value: number, count: number}> = [] //减攻击
|
||||
DEBUFF_DECDS: Array<{value: number, count: number}> = [] //减攻击速度
|
||||
DEBUFF_BURNS: Array<{value: number, duration: number}> = [] //易伤
|
||||
DEBUFF_DEATKS: Array<{value: number, duration: number}> = [] //减攻击
|
||||
DEBUFF_DECDS: Array<{value: number, duration: number}> = [] //减攻击速度
|
||||
|
||||
DEBUFF_SLOW: number = 0; //减速
|
||||
DEBUFF_FROST: number = 0; //冰冻
|
||||
@@ -185,6 +185,9 @@ export class HeroViewComp extends CCComp {
|
||||
if(this.DEBUFF_STUN > 0){
|
||||
this.DEBUFF_STUN -=dt;
|
||||
}
|
||||
|
||||
// 更新所有按时间减少的buff和debuff
|
||||
this.updateBuffsAndDebuffs(dt);
|
||||
this.in_stop(dt);
|
||||
// 处理伤害队列
|
||||
this.processDamageQueue();
|
||||
@@ -245,7 +248,7 @@ export class HeroViewComp extends CCComp {
|
||||
}
|
||||
|
||||
check_cd(){
|
||||
return this.cd/((this.buff_cd+this.TALENT[BuffAttr.ATK_CD])/100+1)
|
||||
return this.cd/((this.buff_cd+this.TALENT[BuffAttr.ATK_CD])/100+1)
|
||||
}
|
||||
count_cd(){
|
||||
this.cd=this.check_cd()
|
||||
@@ -394,10 +397,7 @@ export class HeroViewComp extends CCComp {
|
||||
|
||||
for(let i=0;i<this.BUFF_DEDOWN.length;i++){
|
||||
DEBUFF_DOWN+=this.BUFF_DEDOWN[i].value
|
||||
this.BUFF_DEDOWN[i].count-=1
|
||||
if(this.BUFF_DEDOWN[i].count<=0){
|
||||
this.BUFF_DEDOWN.splice(i,1)
|
||||
}
|
||||
// 不再在这里减少duration,改为在update中按时间减少
|
||||
}
|
||||
let n_deR=deR-DEBUFF_DOWN-this.buff_debuff_down // 触发概率
|
||||
let r=RandomManager.instance.getRandomInt(0,100) // 随机数
|
||||
@@ -409,10 +409,10 @@ export class HeroViewComp extends CCComp {
|
||||
|
||||
switch(type){
|
||||
case DebuffAttr.BURN:
|
||||
this.DEBUFF_BURNS.push({value:deV,count:deC+FightSet.BURN_COUNT})
|
||||
this.DEBUFF_BURNS.push({value:deV,duration:deC+FightSet.BURN_COUNT})
|
||||
break
|
||||
case DebuffAttr.DECD:
|
||||
this.DEBUFF_DECDS.push({value:deV,count:deC})
|
||||
this.DEBUFF_DECDS.push({value:deV,duration:deC})
|
||||
break
|
||||
case DebuffAttr.SLOW:
|
||||
this.DEBUFF_SLOW+=deV
|
||||
@@ -436,7 +436,7 @@ export class HeroViewComp extends CCComp {
|
||||
if(deC == 99){
|
||||
this.ap-=deV
|
||||
}else{
|
||||
this.DEBUFF_DEATKS.push({value:deV,count:deC})
|
||||
this.DEBUFF_DEATKS.push({value:deV,duration:deC})
|
||||
}
|
||||
break
|
||||
case DebuffAttr.DECOUNT:
|
||||
@@ -452,21 +452,80 @@ export class HeroViewComp extends CCComp {
|
||||
break
|
||||
}
|
||||
//console.log("[HeroViewComp]:debuffs",type,deV,deC,deR,this.DEBUFF_BURNS)
|
||||
}
|
||||
}
|
||||
|
||||
add_buff(buff:number,count:number,type:number){
|
||||
// 更新所有按时间减少的buff和debuff
|
||||
updateBuffsAndDebuffs(dt: number) {
|
||||
// 更新BUFF_DEFS
|
||||
for(let i = this.BUFF_DEFS.length - 1; i >= 0; i--) {
|
||||
this.BUFF_DEFS[i].duration -= dt;
|
||||
if(this.BUFF_DEFS[i].duration <= 0) {
|
||||
this.BUFF_DEFS.splice(i, 1);
|
||||
}
|
||||
}
|
||||
|
||||
// 更新BUFF_ATKS
|
||||
for(let i = this.BUFF_ATKS.length - 1; i >= 0; i--) {
|
||||
this.BUFF_ATKS[i].duration -= dt;
|
||||
if(this.BUFF_ATKS[i].duration <= 0) {
|
||||
this.BUFF_ATKS.splice(i, 1);
|
||||
}
|
||||
}
|
||||
|
||||
// 更新BUFF_CDS
|
||||
for(let i = this.BUFF_CDS.length - 1; i >= 0; i--) {
|
||||
this.BUFF_CDS[i].duration -= dt;
|
||||
if(this.BUFF_CDS[i].duration <= 0) {
|
||||
this.BUFF_CDS.splice(i, 1);
|
||||
}
|
||||
}
|
||||
|
||||
// 更新BUFF_DEDOWN
|
||||
for(let i = this.BUFF_DEDOWN.length - 1; i >= 0; i--) {
|
||||
this.BUFF_DEDOWN[i].duration -= dt;
|
||||
if(this.BUFF_DEDOWN[i].duration <= 0) {
|
||||
this.BUFF_DEDOWN.splice(i, 1);
|
||||
}
|
||||
}
|
||||
|
||||
// 更新DEBUFF_BURNS
|
||||
for(let i = this.DEBUFF_BURNS.length - 1; i >= 0; i--) {
|
||||
this.DEBUFF_BURNS[i].duration -= dt;
|
||||
if(this.DEBUFF_BURNS[i].duration <= 0) {
|
||||
this.DEBUFF_BURNS.splice(i, 1);
|
||||
}
|
||||
}
|
||||
|
||||
// 更新DEBUFF_DEATKS
|
||||
for(let i = this.DEBUFF_DEATKS.length - 1; i >= 0; i--) {
|
||||
this.DEBUFF_DEATKS[i].duration -= dt;
|
||||
if(this.DEBUFF_DEATKS[i].duration <= 0) {
|
||||
this.DEBUFF_DEATKS.splice(i, 1);
|
||||
}
|
||||
}
|
||||
|
||||
// 更新DEBUFF_DECDS
|
||||
for(let i = this.DEBUFF_DECDS.length - 1; i >= 0; i--) {
|
||||
this.DEBUFF_DECDS[i].duration -= dt;
|
||||
if(this.DEBUFF_DECDS[i].duration <= 0) {
|
||||
this.DEBUFF_DECDS.splice(i, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
add_buff(buff:number,duration:number,type:number){
|
||||
switch(type){
|
||||
case BuffAttr.DEF:
|
||||
this.BUFF_DEFS.push({value:buff,count:count})
|
||||
this.BUFF_DEFS.push({value:buff,duration:duration})
|
||||
break
|
||||
case BuffAttr.ATK:
|
||||
this.BUFF_ATKS.push({value:buff,count:count})
|
||||
this.BUFF_ATKS.push({value:buff,duration:duration})
|
||||
break
|
||||
case BuffAttr.ATK_CD:
|
||||
this.BUFF_CDS.push({value:buff,count:count})
|
||||
this.BUFF_CDS.push({value:buff,duration:duration})
|
||||
break
|
||||
case BuffAttr.DEBUFF_DOWN:
|
||||
this.BUFF_DEDOWN.push({value:buff,count:count})
|
||||
this.BUFF_DEDOWN.push({value:buff,duration:duration})
|
||||
break
|
||||
}
|
||||
}
|
||||
@@ -522,17 +581,11 @@ export class HeroViewComp extends CCComp {
|
||||
let def = 0;
|
||||
for(let i=0;i<this.DEBUFF_BURNS.length;i++){
|
||||
Burn+=this.DEBUFF_BURNS[i].value
|
||||
this.DEBUFF_BURNS[i].count-=1
|
||||
if(this.DEBUFF_BURNS[i].count<=0){
|
||||
this.DEBUFF_BURNS.splice(i,1)
|
||||
}
|
||||
// 不再在这里减少duration,改为在update中按时间减少
|
||||
}
|
||||
for(let i=0;i<this.BUFF_DEFS.length;i++){
|
||||
def+=this.BUFF_DEFS[i].value
|
||||
this.BUFF_DEFS[i].count-=1
|
||||
if(this.BUFF_DEFS[i].count<=0){
|
||||
this.BUFF_DEFS.splice(i,1)
|
||||
}
|
||||
// 不再在这里减少duration,改为在update中按时间减少
|
||||
}
|
||||
// buff 防御 即免伤
|
||||
|
||||
|
||||
Reference in New Issue
Block a user