军团活动:fix删除

This commit is contained in:
luying
2021-04-02 15:07:11 +08:00
parent 5a76b9a047
commit dafafae34e
3 changed files with 67 additions and 26 deletions
@@ -246,8 +246,9 @@ export class RaceActivityObject {
if(this.status == 1) { // TODO 写进const表 if(this.status == 1) { // TODO 写进const表
let item = getRaceEventItems(); let item = getRaceEventItems();
this.handleItems(roleId, sid, item); this.handleItems(roleId, sid, item);
this.woodenHorseStartRace(woodenHorse);
} }
return woodenHorse; return await this.getWoodenHorse(guildCode, serverId);
} }
// 获取某个军团的木马状态 // 获取某个军团的木马状态
@@ -259,9 +260,6 @@ export class RaceActivityObject {
let { name: guildName, guildCe } = guild; let { name: guildName, guildCe } = guild;
this.woodenHorses.set(guildCode, new WoodenHorse(guildCode, guildName, guildCe, serverId)); this.woodenHorses.set(guildCode, new WoodenHorse(guildCode, guildName, guildCe, serverId));
this.guildList.push({guildCode, serverId}); this.guildList.push({guildCode, serverId});
if(this.status == 1) { // TODO 写进const表
this.woodenHorseStartRace(this.woodenHorses.get(guildCode));
}
} }
let woodenHorse = this.woodenHorses.get(guildCode); let woodenHorse = this.woodenHorses.get(guildCode);
let events = this.events.get(guildCode)||[]; let events = this.events.get(guildCode)||[];
@@ -298,8 +296,10 @@ export class RaceActivityObject {
this.status = 1; // TODO 写进const表 this.status = 1; // TODO 写进const表
let guildCodes = new Array<string>(); let guildCodes = new Array<string>();
for(let [code, woodenHorse] of this.woodenHorses) { for(let [code, woodenHorse] of this.woodenHorses) {
this.woodenHorseStartRace(woodenHorse); if(woodenHorse.memberCnt > 0) {
guildCodes.push(code); this.woodenHorseStartRace(woodenHorse);
guildCodes.push(code);
}
} }
return guildCodes; return guildCodes;
} }
+8 -6
View File
@@ -104,18 +104,24 @@ export class WoodenHorse {
if(event.endDistance && event.startDistance == event.endDistance) { if(event.endDistance && event.startDistance == event.endDistance) {
isEffective = true; isEffective = true;
} }
delEvents.push(i);
let index = events.findIndex(cur => cur.id == event.id);
events.splice(index, 1);
} }
if(isEffective) { if(isEffective) {
effectiveEvents.push(event); effectiveEvents.push(event);
} }
} }
for(let i of delEvents) events.splice(i, 1); // 删除过期事件
effectiveEvents.sort((a, b) => a.startTime - b.startTime); effectiveEvents.sort((a, b) => a.startTime - b.startTime);
this.speed = GUILDACTIVITY.RACE_INIT_SPEED + this.memberCnt * GUILDACTIVITY.RACE_PER_SPEED; this.speed = GUILDACTIVITY.RACE_INIT_SPEED + this.memberCnt * GUILDACTIVITY.RACE_PER_SPEED;
for(let { id, count, endTime } of effectiveEvents) { for(let { id, count, endTime } of effectiveEvents) {
this.calEvent(id, count, endTime); this.calEvent(id, count, endTime);
} }
if(this.durability <= 0) {
this.status = 0; // TODO 写进const表
this.speed = 0;
}
console.log('**effect', this.speed, JSON.stringify(effectiveEvents)); console.log('**effect', this.speed, JSON.stringify(effectiveEvents));
return false; return false;
} }
@@ -182,10 +188,6 @@ export class WoodenHorse {
} }
break; break;
} }
if(this.durability <= 0) {
this.status = 0; // TODO 写进const表
this.speed = 0;
}
} }
+53 -14
View File
@@ -5,10 +5,13 @@
"info": "每个造成0.2%的耐久度伤害", "info": "每个造成0.2%的耐久度伤害",
"type": 0, "type": 0,
"effectType": 0, "effectType": 0,
"effect": "0.2&", "effect": "5&",
"continueTime": 0, "continueTime": 0,
"continueDistance": 0, "continueDistance": 0,
"effecttime": 5 "effecttime": 5,
"effectinfo": "遭受诸葛连弩袭击",
"object": 2,
"useCount": "5&10"
}, },
{ {
"id": 2, "id": 2,
@@ -19,7 +22,10 @@
"effect": "5&", "effect": "5&",
"continueTime": 5, "continueTime": 5,
"continueDistance": 0, "continueDistance": 0,
"effecttime": 5 "effecttime": 5,
"effectinfo": "遭遇鬼手戏弄,木牛流马无法移动。",
"object": 2,
"useCount": "1&"
}, },
{ {
"id": 3, "id": 3,
@@ -30,7 +36,10 @@
"effect": "2&5", "effect": "2&5",
"continueTime": 5, "continueTime": 5,
"continueDistance": 0, "continueDistance": 0,
"effecttime": 5 "effecttime": 5,
"effectinfo": "大风车吱呀直溜溜地转",
"object": 1,
"useCount": "5&10"
}, },
{ {
"id": 4, "id": 4,
@@ -41,7 +50,10 @@
"effect": "40&5", "effect": "40&5",
"continueTime": 5, "continueTime": 5,
"continueDistance": 0, "continueDistance": 0,
"effecttime": 5 "effecttime": 5,
"effectinfo": "五鬼搬运,千里无踪。万钧之物,不过只手。",
"object": 1,
"useCount": "1&"
}, },
{ {
"id": 5, "id": 5,
@@ -52,7 +64,10 @@
"effect": "20&", "effect": "20&",
"continueTime": 0, "continueTime": 0,
"continueDistance": 0, "continueDistance": 0,
"effecttime": 5 "effecttime": 5,
"effectinfo": "大盾防护",
"object": 1,
"useCount": "1&"
}, },
{ {
"id": 6, "id": 6,
@@ -63,7 +78,10 @@
"effect": "10&", "effect": "10&",
"continueTime": 10, "continueTime": 10,
"continueDistance": 0, "continueDistance": 0,
"effecttime": 0 "effecttime": 0,
"effectinfo": "天师护盾,道法神威,万邪莫侵,无懈可击",
"object": 1,
"useCount": "1&"
}, },
{ {
"id": 7, "id": 7,
@@ -74,7 +92,10 @@
"effect": "20&", "effect": "20&",
"continueTime": 0, "continueTime": 0,
"continueDistance": 100, "continueDistance": 100,
"effecttime": 0 "effecttime": 0,
"effectinfo": "路上捡到了神秘符纸,使用后速度更上一层楼",
"object": 3,
"useCount": "&"
}, },
{ {
"id": 8, "id": 8,
@@ -85,7 +106,10 @@
"effect": "1.5&", "effect": "1.5&",
"continueTime": 0, "continueTime": 0,
"continueDistance": 100, "continueDistance": 100,
"effecttime": 0 "effecttime": 0,
"effectinfo": "将士饱餐一顿,士气高昂,不再沿途休息",
"object": 3,
"useCount": "&"
}, },
{ {
"id": 9, "id": 9,
@@ -96,7 +120,10 @@
"effect": "15&", "effect": "15&",
"continueTime": 0, "continueTime": 0,
"continueDistance": 0, "continueDistance": 0,
"effecttime": 0 "effecttime": 0,
"effectinfo": "路遇巧匠,能工修补,破损的木牛流马得到了修复",
"object": 3,
"useCount": "&"
}, },
{ {
"id": 10, "id": 10,
@@ -107,7 +134,10 @@
"effect": "20&", "effect": "20&",
"continueTime": 0, "continueTime": 0,
"continueDistance": 100, "continueDistance": 100,
"effecttime": 0 "effecttime": 0,
"effectinfo": "蜀道泥泞,难以通行,不得不降低速度",
"object": 3,
"useCount": "&"
}, },
{ {
"id": 11, "id": 11,
@@ -118,7 +148,10 @@
"effect": "1.5&", "effect": "1.5&",
"continueTime": 0, "continueTime": 0,
"continueDistance": 100, "continueDistance": 100,
"effecttime": 0 "effecttime": 0,
"effectinfo": "栈道被人破坏,只能降低速度,派人在前修路,速度降低",
"object": 3,
"useCount": "&"
}, },
{ {
"id": 12, "id": 12,
@@ -129,7 +162,10 @@
"effect": "25&", "effect": "25&",
"continueTime": 0, "continueTime": 0,
"continueDistance": 0, "continueDistance": 0,
"effecttime": 0 "effecttime": 0,
"effectinfo": "山上巨石突然滑动,掉落而下造成木牛流马损伤",
"object": 3,
"useCount": "&"
}, },
{ {
"id": 13, "id": 13,
@@ -140,6 +176,9 @@
"effect": "&", "effect": "&",
"continueTime": 0, "continueTime": 0,
"continueDistance": 0, "continueDistance": 0,
"effecttime": 0 "effecttime": 0,
"effectinfo": "丞相贴心,居然在沿路设有道具补给",
"object": 3,
"useCount": "&"
} }
] ]