军团活动:粮草先行优化
This commit is contained in:
@@ -89,17 +89,17 @@ export class WoodenHorse {
|
||||
shield: number = 0; // 护盾数量
|
||||
@prop({required: true})
|
||||
shieldTime: number = 0; // 天师盾符
|
||||
@prop({required: true})
|
||||
stopContinueTime: number = 0; // 鬼手阴符
|
||||
|
||||
remainItems: Map<number, { total: number, max: number }> = new Map();
|
||||
isRobot: boolean = false; // debug接口生成
|
||||
|
||||
constructor(guildCode: string, guildName: string, guildCe: number, serverId: number, allStartTime: number) {
|
||||
constructor(guildCode: string, guildName: string, guildCe: number, serverId: number, allStartTime: number, isRobot: boolean) {
|
||||
this.guildCode = guildCode;
|
||||
this.guildName = guildName;
|
||||
this.guildCe = guildCe;
|
||||
this.serverId = serverId;
|
||||
this.allStartTime = allStartTime;
|
||||
this.isRobot = isRobot;
|
||||
}
|
||||
|
||||
public startRace(allStartTime: number) {
|
||||
@@ -116,9 +116,6 @@ export class WoodenHorse {
|
||||
*/
|
||||
public calCurWoodenHorse(events: Event[]): boolean {
|
||||
if(this.status == RACE_ACTIVITY_STATUS.END) return false;
|
||||
if(this.status == RACE_ACTIVITY_STATUS.PAUSE && this.stopContinueTime && Date.now() > this.stopContinueTime) {
|
||||
this.status = RACE_ACTIVITY_STATUS.START; this.stopContinueTime = 0;
|
||||
}
|
||||
|
||||
if(this.status == RACE_ACTIVITY_STATUS.START) {
|
||||
if(this.distance >= GUILDACTIVITY.RACEACTIVITY_LENGTH) {
|
||||
@@ -165,7 +162,7 @@ export class WoodenHorse {
|
||||
this.calEvent(id, count, endTime);
|
||||
}
|
||||
if(this.durability <= 0) {
|
||||
this.status = RACE_ACTIVITY_STATUS.END;
|
||||
this.status = RACE_ACTIVITY_STATUS.BREAK;
|
||||
this.speed = 0;
|
||||
}
|
||||
return false;
|
||||
@@ -189,10 +186,8 @@ export class WoodenHorse {
|
||||
break;
|
||||
case RACE_EVENT.GUISHOUYINFU:
|
||||
if (this.shieldTime < Date.now()) {
|
||||
this.stopContinueTime = endTime;
|
||||
this.status = RACE_ACTIVITY_STATUS.PAUSE;
|
||||
this.time = endTime;
|
||||
this.speed = 0;
|
||||
this.speed = effect[1];
|
||||
}
|
||||
break;
|
||||
case RACE_EVENT.FENGCHE:
|
||||
@@ -263,10 +258,8 @@ export class WoodenHorse {
|
||||
}
|
||||
|
||||
public getTreatTime() {
|
||||
console.log('#######', this.time, this.allStartTime)
|
||||
return {...this, time: this.time - this.allStartTime }
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export class Event {
|
||||
@@ -309,6 +302,16 @@ export class Event {
|
||||
setStartTime(time: number) {
|
||||
this.startTime = time;
|
||||
}
|
||||
|
||||
needReCalHorse() {
|
||||
let importantEvents = [
|
||||
RACE_EVENT.LIANNU, // 连弩,可能durability突然变0
|
||||
RACE_EVENT.GUISHOUYINFU, // 鬼手阴符
|
||||
RACE_EVENT.FENGCHE, // 风车
|
||||
RACE_EVENT.WUGUIBANYUNFU, // 五鬼搬运符
|
||||
];
|
||||
return importantEvents.indexOf(this.id) != -1
|
||||
}
|
||||
}
|
||||
|
||||
export interface GuildRankParams {
|
||||
|
||||
Reference in New Issue
Block a user