You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
102 lines
3.4 KiB
102 lines
3.4 KiB
import { CONFIDANTE_TYPE, SOUL_PARAMS, TALENT_TYPE, TREASURE_TYPE } from "../const/GGameData";
|
|
import { EGlobalEvent } from "../MesEvent/EGlobalEvent";
|
|
import MesMgr from "../MesEvent/MesMgr";
|
|
import UIMgr from "../Mgr_UI/UIMgr";
|
|
import { DateDataProxy } from "./DataTypeProxy/DateDataProxy";
|
|
import { GameDataProxy } from "./DataTypeProxy/GameDataProxy";
|
|
import { LocalDataMgr } from "./LocalDataMgr";
|
|
|
|
export default class SoulDataMgr {
|
|
private constructor() { };
|
|
private static _ins: SoulDataMgr = null;
|
|
public static get Ins() {
|
|
if (!this._ins) { this._ins = new SoulDataMgr(); }
|
|
return this._ins;
|
|
}
|
|
// 是否爆发
|
|
public crit: boolean = false;
|
|
private critEnd: number = 0;
|
|
private critMsEnd: number = 0;
|
|
|
|
public get _GameData() {
|
|
return GameDataProxy.Ins.data;
|
|
}
|
|
|
|
rebuild() {
|
|
this.crit = false;
|
|
this.critEnd = 0;
|
|
this.critMsEnd = 0;
|
|
}
|
|
|
|
setCrit() {
|
|
this.crit = true;
|
|
const talenttime = LocalDataMgr.Talent.getProp1(TALENT_TYPE.SOUL_MAXTIME);
|
|
const conftime = LocalDataMgr.Confidante.getProp(CONFIDANTE_TYPE.御器爆发);
|
|
const alltimes = (SOUL_PARAMS.CRIT_DURATION + talenttime) * (1 + conftime * 0.01);
|
|
this.critEnd = DateDataProxy.Ins.seconds + alltimes;
|
|
this.critMsEnd = this.critEnd * 1000;
|
|
talenttime > 0 && UIMgr.Ins.ShowTipsUI(`天赋爆发,额外<color=#218026>+${talenttime}</color>秒`);
|
|
conftime > 0 && UIMgr.Ins.ShowTipsUI(`经脉爆发,额外<color=#218026>+${conftime}%</color>秒`);
|
|
MesMgr.event(EGlobalEvent.CHANGE_SOUL);
|
|
}
|
|
checkCrit() {
|
|
if (DateDataProxy.Ins.msSeconds > this.critMsEnd) {
|
|
this.crit = false;
|
|
MesMgr.event(EGlobalEvent.CHANGE_SOUL);
|
|
}
|
|
}
|
|
|
|
// 返回爆发时的剩余时间(毫秒)
|
|
public get critleftMs(): number {
|
|
return this.crit? Math.max(0, this.critMsEnd - DateDataProxy.Ins.msSeconds) : 0;
|
|
}
|
|
|
|
public get unlock(): boolean {
|
|
return this._GameData.unlock;
|
|
}
|
|
public set unlock(value: boolean) {
|
|
this._GameData.unlock = value;
|
|
}
|
|
|
|
public get level(): number {
|
|
return this._GameData.level;
|
|
}
|
|
public set level(value: number) {
|
|
this._GameData.level = value;
|
|
}
|
|
|
|
public get exp(): number {
|
|
return this._GameData.exp;
|
|
}
|
|
public set exp(value: number) {
|
|
if(this.level < SOUL_PARAMS.MAX_LEVEL){
|
|
// 缓存神器数据,避免重复调用
|
|
// const shenqi = Tianjige_Data.Instance.get_shenqi(801);
|
|
// if (shenqi && shenqi.isOwned) {
|
|
// value *= 1 + shenqi.effect_y / 100;
|
|
// }
|
|
if (value > this.nextExp) {
|
|
value -= this.nextExp;
|
|
this.level++;
|
|
}
|
|
this._GameData.exp = value;
|
|
}
|
|
}
|
|
|
|
public get nextExp() {
|
|
return Math.floor(300 * Math.pow(this.level + 1.01, 3) + 2966);
|
|
}
|
|
|
|
public get attackSpeed(): number {
|
|
let Num = this.crit ? SOUL_PARAMS.CRIT_SPEED : SOUL_PARAMS.SPEED + this._GameData.level * SOUL_PARAMS.SPEED_ADD;
|
|
Num += LocalDataMgr.Treasure.getProp1(TREASURE_TYPE.SPEED);
|
|
return Math.min(SOUL_PARAMS.MAX_SPEED, Num);
|
|
//return Num += app.service.game.model.cabinet.getProp1(r.SPEED), Math.min(SOUL_PARAMS.MAX_SPEED, Num);
|
|
}
|
|
|
|
public get attackInterval(): number {
|
|
return 1 / this.attackSpeed;
|
|
}
|
|
|
|
|
|
}
|