军团活动:修复粮草先行到达条件

This commit is contained in:
luying
2021-09-27 17:38:58 +08:00
parent b72dc3b702
commit 4267209009
7 changed files with 40 additions and 65 deletions
+7
View File
@@ -303,4 +303,11 @@ export enum RACE_EVENT_TYPE {
export enum RACE_EVENT_EFFECT_TYPE {
GOOD = 1, // 好事件
BAD = 2, // 坏事件
}
// 粮草先行状态
export enum RACE_ACTIVITY_STATUS {
WAITING = 0, // 未开始
START = 1, // 已开始
END = 2 // 已结束
}
+14 -8
View File
@@ -1,7 +1,7 @@
import { GUILDACTIVITY } from "../../pubUtils/dicParam";
import { SimpleGuildRankParam, SimpleRoleRankParam } from '../rank'
import { prop } from "@typegoose/typegoose";
import { CITY_STATUS, RACE_EVENT } from "../../consts";
import { CITY_STATUS, RACE_ACTIVITY_STATUS, RACE_EVENT } from "../../consts";
import { gameData, getRaceEventItems } from "../../pubUtils/data";
import { getRandEelm } from "../../pubUtils/util";
import { RewardInter } from "../../pubUtils/interface";
@@ -68,15 +68,15 @@ export class WoodenHorse {
* @returns {boolean} needSendEnd 是否跑到终点发送结束新号
*/
public calCurWoodenHorse(events: Event[]): boolean {
if(this.status == 2) return false; // TODO 写进const表
if(this.status == 0 && this.stopContinueTime && Date.now() > this.stopContinueTime) {
this.status = 1; this.stopContinueTime = 0;
if(this.status == RACE_ACTIVITY_STATUS.END) return false;
if(this.status == RACE_ACTIVITY_STATUS.WAITING && this.stopContinueTime && Date.now() > this.stopContinueTime) {
this.status = RACE_ACTIVITY_STATUS.START; this.stopContinueTime = 0;
}
if(this.status == 1) {
if(this.status == RACE_ACTIVITY_STATUS.START) {
if(this.distance >= GUILDACTIVITY.RACEACTIVITY_LENGTH) {
this.distance = GUILDACTIVITY.RACEACTIVITY_LENGTH;
this.status = 2;
this.status = RACE_ACTIVITY_STATUS.END;
return true;
}
@@ -117,12 +117,18 @@ export class WoodenHorse {
this.calEvent(id, count, endTime);
}
if(this.durability <= 0) {
this.status = 0; // TODO 写进const表
this.status = RACE_ACTIVITY_STATUS.END;
this.speed = 0;
return true
}
return false;
}
public isOver() {
if(this.status == RACE_ACTIVITY_STATUS.END) return true;
return false
}
private calEvent(id: number, count: number = 1, endTime?: number) {
let { effect } = gameData.raceActivityEvents.get(id);
@@ -142,7 +148,7 @@ export class WoodenHorse {
case RACE_EVENT.GUISHOUYINFU:
if (this.shieldTime < Date.now()) {
this.stopContinueTime = endTime;
this.status = 0; // TODO 写进const表
this.status = RACE_ACTIVITY_STATUS.WAITING;
this.time = endTime;
this.speed = 0;
}