临时buff改成时间计算 cd 加速的逻辑改变
This commit is contained in:
@@ -58,7 +58,7 @@ export enum FightSet {
|
|||||||
BLUE_GOLD=2,//蓝色金币
|
BLUE_GOLD=2,//蓝色金币
|
||||||
PURPLE_GOLD=3,//紫色金币
|
PURPLE_GOLD=3,//紫色金币
|
||||||
ORANGE_GOLD=4,//橙色金币
|
ORANGE_GOLD=4,//橙色金币
|
||||||
BURN_COUNT=5,//默认易伤次数
|
BURN_COUNT=5,//默认易伤次数 5秒
|
||||||
STUN_TIME=0.5,//默认晕时间
|
STUN_TIME=0.5,//默认晕时间
|
||||||
WEAPON_LV=2,//武器等级
|
WEAPON_LV=2,//武器等级
|
||||||
SHIELD_LV=3,//护盾等级
|
SHIELD_LV=3,//护盾等级
|
||||||
|
|||||||
@@ -96,14 +96,14 @@ export class HeroViewComp extends CCComp {
|
|||||||
buff_debuff_down:number=0
|
buff_debuff_down:number=0
|
||||||
skill_dmg:number=0
|
skill_dmg:number=0
|
||||||
|
|
||||||
BUFF_DEFS: Array<{value: number, count: number}> = [] //防御提升
|
BUFF_DEFS: Array<{value: number, duration: number}> = [] //防御提升
|
||||||
BUFF_ATKS: Array<{value: number, count: number}> = [] //攻击提升
|
BUFF_ATKS: Array<{value: number, duration: number}> = [] //攻击提升
|
||||||
BUFF_CDS: Array<{value: number, count: number}> = [] //攻击加速
|
BUFF_CDS: Array<{value: number, duration: number}> = [] //攻击加速
|
||||||
BUFF_DEDOWN:Array<{value: number, count: number}> = [] //debuff 概率降低
|
BUFF_DEDOWN:Array<{value: number, duration: number}> = [] //debuff 概率降低
|
||||||
|
|
||||||
DEBUFF_BURNS: Array<{value: number, count: number}> = [] //易伤
|
DEBUFF_BURNS: Array<{value: number, duration: number}> = [] //易伤
|
||||||
DEBUFF_DEATKS: Array<{value: number, count: number}> = [] //减攻击
|
DEBUFF_DEATKS: Array<{value: number, duration: number}> = [] //减攻击
|
||||||
DEBUFF_DECDS: Array<{value: number, count: number}> = [] //减攻击速度
|
DEBUFF_DECDS: Array<{value: number, duration: number}> = [] //减攻击速度
|
||||||
|
|
||||||
DEBUFF_SLOW: number = 0; //减速
|
DEBUFF_SLOW: number = 0; //减速
|
||||||
DEBUFF_FROST: number = 0; //冰冻
|
DEBUFF_FROST: number = 0; //冰冻
|
||||||
@@ -185,6 +185,9 @@ export class HeroViewComp extends CCComp {
|
|||||||
if(this.DEBUFF_STUN > 0){
|
if(this.DEBUFF_STUN > 0){
|
||||||
this.DEBUFF_STUN -=dt;
|
this.DEBUFF_STUN -=dt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 更新所有按时间减少的buff和debuff
|
||||||
|
this.updateBuffsAndDebuffs(dt);
|
||||||
this.in_stop(dt);
|
this.in_stop(dt);
|
||||||
// 处理伤害队列
|
// 处理伤害队列
|
||||||
this.processDamageQueue();
|
this.processDamageQueue();
|
||||||
@@ -245,7 +248,7 @@ export class HeroViewComp extends CCComp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
check_cd(){
|
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(){
|
count_cd(){
|
||||||
this.cd=this.check_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++){
|
for(let i=0;i<this.BUFF_DEDOWN.length;i++){
|
||||||
DEBUFF_DOWN+=this.BUFF_DEDOWN[i].value
|
DEBUFF_DOWN+=this.BUFF_DEDOWN[i].value
|
||||||
this.BUFF_DEDOWN[i].count-=1
|
// 不再在这里减少duration,改为在update中按时间减少
|
||||||
if(this.BUFF_DEDOWN[i].count<=0){
|
|
||||||
this.BUFF_DEDOWN.splice(i,1)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
let n_deR=deR-DEBUFF_DOWN-this.buff_debuff_down // 触发概率
|
let n_deR=deR-DEBUFF_DOWN-this.buff_debuff_down // 触发概率
|
||||||
let r=RandomManager.instance.getRandomInt(0,100) // 随机数
|
let r=RandomManager.instance.getRandomInt(0,100) // 随机数
|
||||||
@@ -409,10 +409,10 @@ export class HeroViewComp extends CCComp {
|
|||||||
|
|
||||||
switch(type){
|
switch(type){
|
||||||
case DebuffAttr.BURN:
|
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
|
break
|
||||||
case DebuffAttr.DECD:
|
case DebuffAttr.DECD:
|
||||||
this.DEBUFF_DECDS.push({value:deV,count:deC})
|
this.DEBUFF_DECDS.push({value:deV,duration:deC})
|
||||||
break
|
break
|
||||||
case DebuffAttr.SLOW:
|
case DebuffAttr.SLOW:
|
||||||
this.DEBUFF_SLOW+=deV
|
this.DEBUFF_SLOW+=deV
|
||||||
@@ -436,7 +436,7 @@ export class HeroViewComp extends CCComp {
|
|||||||
if(deC == 99){
|
if(deC == 99){
|
||||||
this.ap-=deV
|
this.ap-=deV
|
||||||
}else{
|
}else{
|
||||||
this.DEBUFF_DEATKS.push({value:deV,count:deC})
|
this.DEBUFF_DEATKS.push({value:deV,duration:deC})
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
case DebuffAttr.DECOUNT:
|
case DebuffAttr.DECOUNT:
|
||||||
@@ -452,21 +452,80 @@ export class HeroViewComp extends CCComp {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
//console.log("[HeroViewComp]:debuffs",type,deV,deC,deR,this.DEBUFF_BURNS)
|
//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){
|
switch(type){
|
||||||
case BuffAttr.DEF:
|
case BuffAttr.DEF:
|
||||||
this.BUFF_DEFS.push({value:buff,count:count})
|
this.BUFF_DEFS.push({value:buff,duration:duration})
|
||||||
break
|
break
|
||||||
case BuffAttr.ATK:
|
case BuffAttr.ATK:
|
||||||
this.BUFF_ATKS.push({value:buff,count:count})
|
this.BUFF_ATKS.push({value:buff,duration:duration})
|
||||||
break
|
break
|
||||||
case BuffAttr.ATK_CD:
|
case BuffAttr.ATK_CD:
|
||||||
this.BUFF_CDS.push({value:buff,count:count})
|
this.BUFF_CDS.push({value:buff,duration:duration})
|
||||||
break
|
break
|
||||||
case BuffAttr.DEBUFF_DOWN:
|
case BuffAttr.DEBUFF_DOWN:
|
||||||
this.BUFF_DEDOWN.push({value:buff,count:count})
|
this.BUFF_DEDOWN.push({value:buff,duration:duration})
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -522,17 +581,11 @@ export class HeroViewComp extends CCComp {
|
|||||||
let def = 0;
|
let def = 0;
|
||||||
for(let i=0;i<this.DEBUFF_BURNS.length;i++){
|
for(let i=0;i<this.DEBUFF_BURNS.length;i++){
|
||||||
Burn+=this.DEBUFF_BURNS[i].value
|
Burn+=this.DEBUFF_BURNS[i].value
|
||||||
this.DEBUFF_BURNS[i].count-=1
|
// 不再在这里减少duration,改为在update中按时间减少
|
||||||
if(this.DEBUFF_BURNS[i].count<=0){
|
|
||||||
this.DEBUFF_BURNS.splice(i,1)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
for(let i=0;i<this.BUFF_DEFS.length;i++){
|
for(let i=0;i<this.BUFF_DEFS.length;i++){
|
||||||
def+=this.BUFF_DEFS[i].value
|
def+=this.BUFF_DEFS[i].value
|
||||||
this.BUFF_DEFS[i].count-=1
|
// 不再在这里减少duration,改为在update中按时间减少
|
||||||
if(this.BUFF_DEFS[i].count<=0){
|
|
||||||
this.BUFF_DEFS.splice(i,1)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// buff 防御 即免伤
|
// buff 防御 即免伤
|
||||||
|
|
||||||
|
|||||||
@@ -286,25 +286,18 @@ export class SkillConComp extends CCComp {
|
|||||||
}
|
}
|
||||||
count_cd(cd:number,view:HeroViewComp){
|
count_cd(cd:number,view:HeroViewComp){
|
||||||
|
|
||||||
// 汇总DEBUFF_DECD并处理count值
|
// 汇总DEBUFF_DECD,不再按次数减少,改为按时间减少
|
||||||
let decd = 0;
|
let decd = 0;
|
||||||
for (let i = view.DEBUFF_DECDS.length - 1; i >= 0; i--) {
|
for (let i = view.DEBUFF_DECDS.length - 1; i >= 0; i--) {
|
||||||
decd += view.DEBUFF_DECDS[i].value;
|
decd += view.DEBUFF_DECDS[i].value;
|
||||||
view.DEBUFF_DECDS[i].count--;
|
// 不再在这里减少duration,改为在update中按时间减少
|
||||||
// 当count为0时移除该记录
|
|
||||||
if (view.DEBUFF_DECDS[i].count <= 0) {
|
|
||||||
view.DEBUFF_DECDS.splice(i, 1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
let bcd=0
|
let bcd=0
|
||||||
for (let i = view.BUFF_CDS.length - 1; i >= 0; i--) {
|
for (let i = view.BUFF_CDS.length - 1; i >= 0; i--) {
|
||||||
bcd += view.BUFF_CDS[i].value;
|
bcd += view.BUFF_CDS[i].value;
|
||||||
view.BUFF_CDS[i].count--;
|
// 不再在这里减少duration,改为在update中按时间减少
|
||||||
if (view.BUFF_CDS[i].count <= 0) {
|
|
||||||
view.BUFF_CDS.splice(i, 1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return cd*(100-bcd+decd)/100
|
return cd/((bcd+decd)/100+1)
|
||||||
}
|
}
|
||||||
get_count(count:number,view:HeroViewComp){
|
get_count(count:number,view:HeroViewComp){
|
||||||
let re=count+view.wfuny
|
let re=count+view.wfuny
|
||||||
|
|||||||
@@ -132,19 +132,13 @@ export class Skill extends ecs.Entity {
|
|||||||
if(view.BUFF_ATKS.length>0){
|
if(view.BUFF_ATKS.length>0){
|
||||||
for (let i = view.BUFF_ATKS.length - 1; i >= 0; i--) {
|
for (let i = view.BUFF_ATKS.length - 1; i >= 0; i--) {
|
||||||
BUFF_ATK += view.BUFF_ATKS[i].value;
|
BUFF_ATK += view.BUFF_ATKS[i].value;
|
||||||
view.BUFF_ATKS[i].count--;
|
// 不再在这里减少duration,改为在update中按时间减少
|
||||||
if (view.BUFF_ATKS[i].count <= 0) {
|
|
||||||
view.BUFF_ATKS.splice(i, 1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(view.DEBUFF_DEATKS.length>0) {
|
if(view.DEBUFF_DEATKS.length>0) {
|
||||||
for (let i = view.DEBUFF_DEATKS.length - 1; i >= 0; i--) {
|
for (let i = view.DEBUFF_DEATKS.length - 1; i >= 0; i--) {
|
||||||
DEBUFF_DEATK += view.DEBUFF_DEATKS[i].value;
|
DEBUFF_DEATK += view.DEBUFF_DEATKS[i].value;
|
||||||
view.DEBUFF_DEATKS[i].count--;
|
// 不再在这里减少duration,改为在update中按时间减少
|
||||||
if (view.DEBUFF_DEATKS[i].count <= 0) {
|
|
||||||
view.DEBUFF_DEATKS.splice(i, 1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user