|
|
@ -3,8 +3,8 @@ import { Entry } from './bean'; |
|
|
|
//装备质量
|
|
|
|
//装备质量
|
|
|
|
export const qualitys = ['shabby', 'ordinary', 'artifact', 'epic', 'unique', 'colorful']; |
|
|
|
export const qualitys = ['shabby', 'ordinary', 'artifact', 'epic', 'unique', 'colorful']; |
|
|
|
export const extra_quality = ['yuangu', 'taigu']; |
|
|
|
export const extra_quality = ['yuangu', 'taigu']; |
|
|
|
export const extra_quality_rate = [0.1, 0.1]; |
|
|
|
export const extra_quality_rate = [0.1, 0.01]; |
|
|
|
export const extra_quality_lv = 20; |
|
|
|
export const extra_quality_lv = 50; |
|
|
|
|
|
|
|
|
|
|
|
//装备颜色
|
|
|
|
//装备颜色
|
|
|
|
export const quality_collor = { |
|
|
|
export const quality_collor = { |
|
|
@ -53,15 +53,13 @@ class BaseInitor implements EntryInitor { |
|
|
|
factor1: number; |
|
|
|
factor1: number; |
|
|
|
factor2: number; |
|
|
|
factor2: number; |
|
|
|
constant: number; |
|
|
|
constant: number; |
|
|
|
defCoefficient: number = 1; |
|
|
|
|
|
|
|
constructor(type: string, factor1: number, factor2: number, constant: number) { |
|
|
|
constructor(type: string, factor1: number, factor2: number, constant: number) { |
|
|
|
this.type = type; |
|
|
|
this.type = type; |
|
|
|
this.factor1 = factor1; |
|
|
|
this.factor1 = factor1; |
|
|
|
this.factor2 = factor2; |
|
|
|
this.factor2 = factor2; |
|
|
|
this.constant = constant; |
|
|
|
this.constant = constant; |
|
|
|
} |
|
|
|
} |
|
|
|
init(lv: number, qualityCoefficient: number, valCoefficient?: number, extraQuality?: string): Entry { |
|
|
|
init(lv: number, qualityCoefficient: number, valCoefficient: number, extraQuality?: string): Entry { |
|
|
|
valCoefficient = valCoefficient || this.defCoefficient; |
|
|
|
|
|
|
|
const num1 = lv * valCoefficient * this.factor1; |
|
|
|
const num1 = lv * valCoefficient * this.factor1; |
|
|
|
const num2 = Math.random() * lv * this.factor2 + this.constant; |
|
|
|
const num2 = Math.random() * lv * this.factor2 + this.constant; |
|
|
|
const manNum2 = lv * this.factor2 + this.constant; |
|
|
|
const manNum2 = lv * this.factor2 + this.constant; |
|
|
@ -69,27 +67,26 @@ class BaseInitor implements EntryInitor { |
|
|
|
const value = Math.round((num1 + num2) * qualityCoefficient) || 1; |
|
|
|
const value = Math.round((num1 + num2) * qualityCoefficient) || 1; |
|
|
|
const max = Math.round((num1 + manNum2) * qualityCoefficient) || 1; |
|
|
|
const max = Math.round((num1 + manNum2) * qualityCoefficient) || 1; |
|
|
|
const min = Math.round((num1 + minNum2) * qualityCoefficient) || 1; |
|
|
|
const min = Math.round((num1 + minNum2) * qualityCoefficient) || 1; |
|
|
|
return new Entry(this.type, value, '+' + value, max, min); |
|
|
|
return this.createEntry(value, max, min, extraQuality); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
class PercentInitor extends BaseInitor { |
|
|
|
createEntry(value, max, min, extraQuality): Entry { |
|
|
|
init(lv: number, qualityCoefficient: number, valCoefficient?: number, extraQuality?: string): Entry { |
|
|
|
const unity = attr_unitys[this.type] || ''; |
|
|
|
const entry = super.init(lv, qualityCoefficient, valCoefficient, extraQuality); |
|
|
|
if (extraQuality == extra_quality[1]) { |
|
|
|
entry.showVal += '%'; |
|
|
|
return new Entry(this.type, max, '+' + max + unity, max, max); |
|
|
|
return entry; |
|
|
|
} |
|
|
|
|
|
|
|
return new Entry(this.type, value, '+' + value + unity, max, min); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
class CritInitor extends BaseInitor { |
|
|
|
class CritInitor extends BaseInitor { |
|
|
|
constructor(type: string, factor1: number, factor2: number, constant: number) { |
|
|
|
constructor(type: string, factor1: number, factor2: number, constant: number) { |
|
|
|
super(type, factor1, factor2, constant); |
|
|
|
super(type, factor1, factor2, constant); |
|
|
|
this.defCoefficient = 0; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
init(lv: number, qualityCoefficient: number, valCoefficient?: number, extraQuality?: string): Entry { |
|
|
|
init(lv: number, qualityCoefficient: number, valCoefficient: number, extraQuality?: string): Entry { |
|
|
|
valCoefficient = valCoefficient || this.defCoefficient; |
|
|
|
|
|
|
|
const value = this.call(Math.random() * this.factor1, lv, valCoefficient, qualityCoefficient); |
|
|
|
const value = this.call(Math.random() * this.factor1, lv, valCoefficient, qualityCoefficient); |
|
|
|
const max = this.call(this.factor1, lv, valCoefficient, qualityCoefficient); |
|
|
|
const max = this.call(this.factor1, lv, valCoefficient, qualityCoefficient); |
|
|
|
const min = this.call(0, lv, valCoefficient, qualityCoefficient); |
|
|
|
const min = this.call(0, lv, valCoefficient, qualityCoefficient); |
|
|
|
return new Entry(this.type, value, '+' + value + '%', max, min); |
|
|
|
return this.createEntry(value, max, min, extraQuality); |
|
|
|
} |
|
|
|
} |
|
|
|
call(num1, lv, valCoefficient, qualityCoefficient): number { |
|
|
|
call(num1, lv, valCoefficient, qualityCoefficient): number { |
|
|
|
const lvFactor = (0.5 * lv) / 100 + 0.5; |
|
|
|
const lvFactor = (0.5 * lv) / 100 + 0.5; |
|
|
@ -98,24 +95,23 @@ class CritInitor extends BaseInitor { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
class DmgInitor extends BaseInitor { |
|
|
|
class DmgInitor extends BaseInitor { |
|
|
|
init(lv: number, qualityCoefficient: number, valCoefficient?: number, extraQuality?: string): Entry { |
|
|
|
init(lv: number, qualityCoefficient: number, valCoefficient: number, extraQuality?: string): Entry { |
|
|
|
valCoefficient = valCoefficient || 1; |
|
|
|
|
|
|
|
const value = Math.round((lv * this.factor1 * (Math.random() + this.factor2) + this.constant) * qualityCoefficient * valCoefficient) || 1; |
|
|
|
const value = Math.round((lv * this.factor1 * (Math.random() + this.factor2) + this.constant) * qualityCoefficient * valCoefficient) || 1; |
|
|
|
const max = Math.round((lv * this.factor1 * (1 + this.factor2) + this.constant) * qualityCoefficient * valCoefficient) || 1; |
|
|
|
const max = Math.round((lv * this.factor1 * (1 + this.factor2) + this.constant) * qualityCoefficient * valCoefficient) || 1; |
|
|
|
const min = Math.round((lv * this.factor1 * this.factor2 + this.constant) * qualityCoefficient * valCoefficient) || 1; |
|
|
|
const min = Math.round((lv * this.factor1 * this.factor2 + this.constant) * qualityCoefficient * valCoefficient) || 1; |
|
|
|
return new Entry(this.type, value, '+' + value + '%', max, min); |
|
|
|
return this.createEntry(value, max, min, extraQuality); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
export const entry_initor = { |
|
|
|
export const entry_initor = { |
|
|
|
atk: new BaseInitor('atk', 1, 0.5, 1), |
|
|
|
atk: new BaseInitor('atk', 1, 0.5, 1), |
|
|
|
atkPercent: new PercentInitor('atkPercent', 0.11, 0.1, 4), |
|
|
|
atkPercent: new BaseInitor('atkPercent', 0.11, 0.1, 4), |
|
|
|
hp: new BaseInitor('hp', 5, 0.5, 1), |
|
|
|
hp: new BaseInitor('hp', 5, 0.5, 1), |
|
|
|
hpPercent: new PercentInitor('hpPercent', 0.1, 0.1, 4), |
|
|
|
hpPercent: new BaseInitor('hpPercent', 0.1, 0.1, 4), |
|
|
|
def: new BaseInitor('def', 1, 0.5, 1), |
|
|
|
def: new BaseInitor('def', 1, 0.5, 1), |
|
|
|
defPercent: new PercentInitor('defPercent', 0.13, 0.1, 4), |
|
|
|
defPercent: new BaseInitor('defPercent', 0.13, 0.1, 4), |
|
|
|
bloc: new BaseInitor('bloc', 0.25, 1 / 3, 1), |
|
|
|
bloc: new BaseInitor('bloc', 0.25, 1 / 3, 1), |
|
|
|
blocPercent: new PercentInitor('blocPercent', 0.1, 0.1, 4), |
|
|
|
blocPercent: new BaseInitor('blocPercent', 0.1, 0.1, 4), |
|
|
|
crit: new CritInitor('crit', 5, 2, 5), |
|
|
|
crit: new CritInitor('crit', 5, 2, 5), |
|
|
|
critDmg: new CritInitor('critDmg', 15, 7, 16), |
|
|
|
critDmg: new CritInitor('critDmg', 15, 7, 16), |
|
|
|
critAvoid: new CritInitor('critAvoid', 5, 0, 7), |
|
|
|
critAvoid: new CritInitor('critAvoid', 5, 0, 7), |
|
|
|