商店: 修复消耗
This commit is contained in:
@@ -222,6 +222,10 @@ export class RaceActivityObject {
|
||||
private events: Map<string, Event[]> = new Map(); // 每个军团遇到的事件
|
||||
private items: Map<string, RewardInter[]> = new Map(); // 每个玩家的道具 roleId => [{id, count}]
|
||||
|
||||
public getItem(roleId: string) {
|
||||
return this.items.get(roleId)||[]
|
||||
}
|
||||
|
||||
// 是否加入过
|
||||
public hasJoin(guildCode: string, roleId: string) {
|
||||
let member = this.members.get(guildCode)||[];
|
||||
@@ -425,7 +429,7 @@ export class WoodenHorse {
|
||||
@prop({required: true})
|
||||
status: number = 0; // 状态 0-停止 1-开启 2-结束
|
||||
@prop({required: true})
|
||||
speed: number = 0; // 速度
|
||||
speed: number = GUILDACTIVITY.RACE_INIT_SPEED; // 速度
|
||||
@prop({required: true})
|
||||
durability: number = 100; // 耐久度
|
||||
@prop({required: true})
|
||||
@@ -470,7 +474,9 @@ export class WoodenHorse {
|
||||
this.status = 2;
|
||||
return true;
|
||||
}
|
||||
this.distance += Math.floor((Date.now() - this.time)/1000 * 10 * this.speed)/10; // 1位小数点
|
||||
console.log('*********', this.distance, Date.now(), this.speed)
|
||||
|
||||
this.distance = Math.floor((this.distance + (Date.now() - this.time)/1000 * this.speed ) * 1000)/1000; // 1位小数点
|
||||
this.time = Date.now();
|
||||
}
|
||||
let effectiveEvents = new Array<Event>();
|
||||
@@ -501,7 +507,7 @@ export class WoodenHorse {
|
||||
}
|
||||
for(let i of delEvents) events.splice(i, 1); // 删除过期事件
|
||||
effectiveEvents.sort((a, b) => a.startTime - b.startTime);
|
||||
this.speed = this.memberCnt * 10;
|
||||
this.speed = GUILDACTIVITY.RACE_INIT_SPEED + this.memberCnt * GUILDACTIVITY.RACE_PER_SPEED;
|
||||
for(let { id, count, endTime } of effectiveEvents) {
|
||||
this.calEvent(id, count, endTime);
|
||||
}
|
||||
@@ -511,7 +517,6 @@ export class WoodenHorse {
|
||||
private calEvent(id: number, count: number = 1, endTime?: number) {
|
||||
let { effect } = gameData.raceActivityEvents.get(id);
|
||||
|
||||
console.log('**********', effect, id)
|
||||
switch (id) {
|
||||
case RACE_EVENT.LIANNU:
|
||||
if (this.shieldTime < Date.now()) {
|
||||
|
||||
Reference in New Issue
Block a user