File size: 16,024 Bytes
025687f
 
 
b8aecdd
 
 
2f63a42
 
 
 
b8aecdd
 
2f63a42
 
b8aecdd
3ed500d
 
 
 
b8aecdd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
025687f
 
2f63a42
 
 
 
 
 
 
 
 
 
 
 
 
025687f
 
 
 
2f63a42
 
 
 
 
 
 
 
 
025687f
 
2452398
025687f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2f63a42
025687f
 
 
2f63a42
025687f
 
 
2f63a42
025687f
 
 
2f63a42
025687f
 
 
 
 
 
 
 
 
2f63a42
025687f
 
 
2f63a42
025687f
 
 
2f63a42
 
025687f
 
 
2f63a42
025687f
 
 
2f63a42
025687f
 
 
2f63a42
 
025687f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2f63a42
025687f
 
 
2f63a42
 
025687f
 
 
2f63a42
025687f
 
 
2f63a42
025687f
 
 
2f63a42
025687f
 
 
2f63a42
 
025687f
 
 
2f63a42
025687f
 
 
2f63a42
025687f
 
 
 
 
 
 
 
 
2f63a42
025687f
 
 
2f63a42
025687f
 
 
2f63a42
 
025687f
 
 
2f63a42
025687f
 
 
2f63a42
025687f
 
 
2f63a42
025687f
 
 
2f63a42
 
025687f
 
 
2f63a42
025687f
b8aecdd
 
1467c05
 
b8aecdd
2f63a42
 
 
 
b8aecdd
 
 
 
2f63a42
 
 
 
b8aecdd
2f63a42
 
 
b8aecdd
ff5593c
b8aecdd
ff5593c
 
b8aecdd
ff5593c
 
 
b8aecdd
ff5593c
c255694
b8aecdd
 
 
1467c05
 
 
 
b8aecdd
ff5593c
2f63a42
b8aecdd
 
 
ff5593c
b8aecdd
 
 
 
ff5593c
 
 
 
 
b8aecdd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ff5593c
 
 
 
b8aecdd
 
ff5593c
b8aecdd
 
 
2f63a42
b8aecdd
ff5593c
 
 
 
b8aecdd
 
2f63a42
b8aecdd
 
 
2f63a42
b8aecdd
025687f
 
 
 
1467c05
025687f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b8aecdd
 
 
 
 
 
 
2452398
b8aecdd
025687f
b8aecdd
a2a5d31
b8aecdd
025687f
b8aecdd
60d173b
 
 
1467c05
60d173b
 
 
 
 
 
 
 
025687f
b8aecdd
 
025687f
 
b8aecdd
 
025687f
 
ff5593c
 
025687f
 
ff5593c
 
025687f
b8aecdd
ff5593c
 
025687f
 
b8aecdd
 
025687f
ff5593c
 
 
 
b8aecdd
 
 
 
 
 
 
025687f
 
 
b8aecdd
 
025687f
b8aecdd
6d1ec51
 
 
1467c05
6d1ec51
 
 
 
 
 
 
025687f
b8aecdd
 
025687f
b8aecdd
 
 
025687f
 
ff5593c
 
 
 
 
 
025687f
b8aecdd
 
 
025687f
 
b8aecdd
 
025687f
b8aecdd
 
 
025687f
 
b8aecdd
 
025687f
 
b8aecdd
 
 
 
 
 
55f0dce
 
 
 
 
 
1467c05
55f0dce
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
from base.constant import *


class Target:
    target_level: int = 124

    physical_shield_base: int = 0
    magical_shield_base: int = 0
    physical_shield_gain: int = 0
    magical_shield_gain: int = 0

    _all_vulnerable: float = 0
    physical_vulnerable: float = 0
    magical_vulnerable: float = 0

    @property
    def level_shield_base(self):
        return SHIELD_BASE_MAP[self.target_level]

    @property
    def shield_base(self):
        raise NotImplementedError

    @property
    def shield_gain(self):
        raise NotImplementedError

    @property
    def vulnerable(self):
        raise NotImplementedError

    @property
    def all_vulnerable(self):
        return self._all_vulnerable

    @all_vulnerable.setter
    def all_vulnerable(self, all_vulnerable):
        residual = all_vulnerable - self._all_vulnerable
        self.physical_vulnerable += residual
        self.magical_vulnerable += residual
        self._all_vulnerable = all_vulnerable

    @property
    def shield_constant(self):
        return SHIELD_SCALE * (LEVEL_SCALE * self.target_level - LEVEL_CONSTANT)


class Major:
    _all_major_base: int = 0
    _all_major_gain: int = 0
    agility_base: int = 0
    agility_gain: int = 0
    strength_base: int = 0
    strength_gain: int = 0
    spirit_base: int = 0
    spirit_gain: int = 0
    spunk_base: int = 0
    spunk_gain: int = 0

    physical_attack_power_base: int = 0
    physical_attack_power_gain: int = 0
    magical_attack_power_base: int = 0
    magical_attack_power_gain: int = 0

    _all_critical_strike_base: int = 0
    _all_critical_strike_gain: int = 0

    physical_critical_strike_base: int = 0
    physical_critical_strike_gain: int = 0
    magical_critical_strike_base: int = 0
    magical_critical_strike_gain: int = 0

    physical_overcome_base: int = 0
    physical_overcome_gain: int = 0
    magical_overcome_base: int = 0
    magical_overcome_gain: int = 0

    """ Major Attr Function"""

    @property
    def all_major_base(self):
        return self._all_major_base

    @all_major_base.setter
    def all_major_base(self, all_major_base):
        residual = all_major_base - self._all_major_base
        self.agility_base += residual
        self.strength_base += residual
        self.spirit_base += residual
        self.spunk_base += residual
        self._all_major_base = all_major_base

    @property
    def all_major_gain(self):
        return self._all_major_gain

    @all_major_gain.setter
    def all_major_gain(self, all_major_gain):
        residual = all_major_gain - self._all_major_gain
        self.agility_gain += residual
        self.strength_gain += residual
        self.spirit_gain += residual
        self.spunk_gain += residual
        self._all_major_gain = all_major_gain

    @property
    def agility(self):
        return int(self.agility_base * (1 + self.agility_gain / BINARY_SCALE))

    @property
    def strength(self):
        return int(self.strength_base * (1 + self.strength_gain / BINARY_SCALE))

    @property
    def spirit(self):
        return int(self.spirit_base * (1 + self.spirit_gain / BINARY_SCALE))

    @property
    def spunk(self):
        return int(self.spunk_base * (1 + self.spunk_gain / BINARY_SCALE))

    """ Attack Power Function """

    @property
    def attack_power(self):
        raise NotImplementedError

    @property
    def base_physical_attack_power(self):
        return int(self.physical_attack_power_base + self.strength * STRENGTH_TO_ATTACK_POWER)

    @property
    def extra_physical_attack_power(self):
        return 0

    @property
    def physical_attack_power(self):
        return int(self.base_physical_attack_power * (1 + self.physical_attack_power_gain / BINARY_SCALE) +
                   self.extra_physical_attack_power)

    @property
    def base_magical_attack_power(self):
        return int(self.magical_attack_power_base + self.spunk_base * SPUNK_TO_ATTACK_POWER)

    @property
    def extra_magical_attack_power(self):
        return 0

    @property
    def magical_attack_power(self):
        return int(self.base_magical_attack_power * (1 + self.magical_attack_power_gain / BINARY_SCALE) +
                   self.extra_magical_attack_power)

    """ Critical Strike Function"""

    @property
    def critical_strike(self):
        raise NotImplementedError

    @property
    def all_critical_strike_base(self):
        return self._all_critical_strike_base

    @all_critical_strike_base.setter
    def all_critical_strike_base(self, all_critical_strike_base):
        residual = all_critical_strike_base - self._all_critical_strike_base
        self.physical_critical_strike_base += residual
        self.magical_critical_strike_base += residual
        self._all_critical_strike_base = all_critical_strike_base

    @property
    def all_critical_strike_gain(self):
        return self._all_critical_strike_gain

    @all_critical_strike_gain.setter
    def all_critical_strike_gain(self, all_critical_strike_gain):
        residual = all_critical_strike_gain - self._all_critical_strike_gain
        self.physical_critical_strike_gain += residual
        self.magical_critical_strike_gain += residual
        self._all_critical_strike_gain = all_critical_strike_gain

    @property
    def extra_physical_critical_strike(self):
        return 0

    @property
    def base_physical_critical_strike(self):
        return int(self.physical_critical_strike_base + self.agility * AGILITY_TO_CRITICAL_STRIKE +
                   self.extra_physical_critical_strike)

    @property
    def physical_critical_strike_percent(self):
        return self.base_physical_critical_strike / CRITICAL_STRIKE_SCALE

    @property
    def physical_critical_strike(self):
        return self.physical_critical_strike_percent + self.physical_critical_strike_gain / DECIMAL_SCALE

    @property
    def extra_magical_critical_strike(self):
        return 0

    @property
    def base_magical_critical_strike(self):
        return int(self.magical_critical_strike_base + self.extra_magical_critical_strike +
                   self.spirit * SPIRIT_TO_CRITICAL_STRIKE)

    @property
    def magical_critical_strike_percent(self):
        return self.base_magical_critical_strike / CRITICAL_STRIKE_SCALE

    @property
    def magical_critical_strike(self):
        return self.magical_critical_strike_percent + self.magical_critical_strike_gain / DECIMAL_SCALE

    """ Overcome Function"""

    @property
    def overcome(self):
        raise NotImplementedError

    @property
    def base_physical_overcome(self):
        return int(self.physical_overcome_base + self.strength * STRENGTH_TO_OVERCOME)

    @property
    def extra_physical_overcome(self):
        return 0

    @property
    def final_physical_overcome(self):
        return int(self.base_physical_overcome * (1 + self.physical_overcome_gain / BINARY_SCALE) +
                   self.extra_physical_overcome)

    @property
    def physical_overcome(self):
        return self.final_physical_overcome / OVERCOME_SCALE

    @property
    def base_magical_overcome(self):
        return int(self.magical_overcome_base + self.spunk * SPUNK_TO_OVERCOME)

    @property
    def extra_magical_overcome(self):
        return 0

    @property
    def final_magical_overcome(self):
        return int(self.base_magical_overcome * (1 + self.magical_overcome_gain / BINARY_SCALE) +
                   self.extra_magical_overcome)

    @property
    def magical_overcome(self):
        return self.final_magical_overcome / OVERCOME_SCALE


class Minor:
    surplus_base: int = 0
    surplus_gain: int = 0

    strain_base: int = 0
    strain_gain: int = 0

    haste_base: int = 0  # Not Apply

    _all_critical_power_base: int = 0
    _all_critical_power_gain: int = 0

    physical_critical_power_base: int = 0
    physical_critical_power_gain: int = 0
    magical_critical_power_base: int = 0
    magical_critical_power_gain: int = 0

    weapon_damage_rand: int = 0
    weapon_damage_base: int = 0
    weapon_damage_gain: int = 0

    _all_shield_ignore: int = 0

    physical_shield_ignore: int = 0
    magical_shield_ignore: int = 0

    _all_damage_addition: int = 0
    physical_damage_addition: int = 0
    magical_damage_addition: int = 0

    pve_addition: int = 0
    global_damage_factor: float = 1.

    """ Minor Function """

    @property
    def surplus(self):
        return int(self.surplus_base * (1 + self.surplus_gain / BINARY_SCALE))

    @property
    def base_strain(self):
        return self.strain_base / STRAIN_SCALE

    @property
    def strain(self):
        return self.base_strain + self.strain_gain / BINARY_SCALE

    """ Critical Power Function"""

    @property
    def base_critical_power(self):
        raise NotImplementedError

    @property
    def critical_power_gain(self):
        raise NotImplementedError

    @property
    def all_critical_power_base(self):
        return self._all_critical_power_base

    @all_critical_power_base.setter
    def all_critical_power_base(self, all_critical_power_base):
        residual = all_critical_power_base - self._all_critical_power_base
        self.physical_critical_power_base += residual
        self.magical_critical_power_base += residual
        self._all_critical_power_base = all_critical_power_base

    @property
    def all_critical_power_gain(self):
        return self._all_critical_power_gain

    @all_critical_power_gain.setter
    def all_critical_power_gain(self, all_critical_power_gain):
        residual = all_critical_power_gain - self._all_critical_power_gain
        self.physical_critical_power_gain += residual
        self.magical_critical_power_gain += residual
        self._all_critical_power_gain = all_critical_power_gain

    @property
    def base_physical_critical_power(self):
        return self.physical_critical_power_base / CRITICAL_POWER_SCALE

    @property
    def physical_critical_power_percent(self):
        return BASE_CRITICAL_POWER + self.base_physical_critical_power

    @property
    def physical_critical_power(self):
        return self.physical_critical_power_percent + self.physical_critical_power_gain / BINARY_SCALE

    @property
    def base_magical_critical_power(self):
        return self.magical_critical_power_base / CRITICAL_POWER_SCALE

    @property
    def magical_critical_power_percent(self):
        return BASE_CRITICAL_POWER + self.magical_critical_power_base / CRITICAL_POWER_SCALE

    @property
    def magical_critical_power(self):
        return self.magical_critical_power_percent + self.magical_critical_power_gain / BINARY_SCALE

    """ Weapon Damage Function """

    @property
    def weapon_damage(self):
        return int(self.weapon_damage_base * (1 + self.weapon_damage_gain / BINARY_SCALE) + self.weapon_damage_rand / 2)

    """ Others """

    @property
    def shield_ignore(self):
        raise NotImplementedError

    @property
    def all_shield_ignore(self):
        return self._all_shield_ignore

    @all_shield_ignore.setter
    def all_shield_ignore(self, all_shield_ignore):
        residual = all_shield_ignore - self._all_shield_ignore
        self.physical_shield_ignore += residual
        self.magical_shield_ignore += residual
        self._all_shield_ignore = all_shield_ignore

    @property
    def damage_addition(self):
        raise NotImplementedError

    @property
    def all_damage_addition(self):
        return self._all_damage_addition

    @all_damage_addition.setter
    def all_damage_addition(self, all_damage_addition):
        residual = all_damage_addition - self._all_damage_addition
        self.physical_damage_addition += residual
        self.magical_damage_addition += residual
        self._all_damage_addition = all_damage_addition


class Attribute(Major, Minor, Target):
    level: int = 120
    grad_attrs: dict = None

    def __init__(self):
        self.all_major_base += MAJOR_BASE
        self.all_critical_power_base = 0  # init critical power attr

    @property
    def level_reduction(self):
        return LEVEL_REDUCTION * (self.target_level - self.level)


class PhysicalAttribute(Attribute):
    grad_attrs = {
        "agility_base": MAJOR_DELTA,
        "strength_base": MAJOR_DELTA,
        "surplus_base": MINOR_DELTA,
        "strain_base": MINOR_DELTA,
        "physical_attack_power_base": PHYSICAL_DELTA,
        "physical_critical_strike_base": MINOR_DELTA,
        "physical_critical_power_base": MINOR_DELTA,
        "physical_overcome_base": MINOR_DELTA,
        "weapon_damage_base": WEAPON_DELTA
    }

    @property
    def attack_power(self):
        return self.physical_attack_power

    @property
    def critical_strike(self):
        return self.physical_critical_strike

    @property
    def base_critical_power(self):
        return self.base_physical_critical_power

    @property
    def critical_power_gain(self):
        return self.physical_critical_power_gain

    @property
    def overcome(self):
        return self.physical_overcome

    @property
    def damage_addition(self):
        return self.physical_damage_addition

    @property
    def shield_ignore(self):
        return self.physical_shield_ignore

    @property
    def shield_base(self):
        return self.physical_shield_base

    @property
    def shield_gain(self):
        return self.physical_shield_gain

    @property
    def vulnerable(self):
        return self.physical_vulnerable


class MagicalAttribute(Attribute):
    grad_attrs = {
        "spirit_base": MAJOR_DELTA,
        "spunk_base": MAJOR_DELTA,
        "surplus_base": MINOR_DELTA,
        "strain_base": MINOR_DELTA,
        "magical_attack_power_base": MAGICAL_DELTA,
        "magical_critical_strike_base": MINOR_DELTA,
        "magical_critical_power_base": MINOR_DELTA,
        "magical_overcome_base": MINOR_DELTA
    }

    @property
    def attack_power(self):
        return self.magical_attack_power

    @property
    def critical_strike(self):
        return self.magical_critical_strike

    @property
    def base_critical_power(self):
        return self.base_magical_critical_power

    @property
    def critical_power_gain(self):
        return self.magical_critical_power_gain

    @property
    def overcome(self):
        return self.magical_overcome

    @property
    def shield_ignore(self):
        return self.magical_shield_ignore

    @property
    def damage_addition(self):
        return self.magical_damage_addition

    @property
    def shield_base(self):
        return self.magical_shield_base

    @property
    def shield_gain(self):
        return self.magical_shield_gain

    @property
    def vulnerable(self):
        return self.magical_vulnerable


class MixingAttribute(Attribute):
    grad_attrs = {
        "agility_base": MAJOR_DELTA,
        "spunk_base": MAJOR_DELTA,
        "surplus_base": MINOR_DELTA,
        "strain_base": MINOR_DELTA,
        "magical_attack_power_base": MAGICAL_DELTA,
        "physical_critical_strike_base": MINOR_DELTA,
        "physical_critical_power_base": MINOR_DELTA,
        "magical_overcome_base": MINOR_DELTA
    }

    @property
    def attack_power(self):
        return self.magical_attack_power

    @property
    def critical_strike(self):
        return self.physical_critical_strike

    @property
    def base_critical_power(self):
        return self.base_magical_critical_power

    @property
    def critical_power_gain(self):
        return self.physical_critical_power_gain

    @property
    def overcome(self):
        return self.magical_overcome

    @property
    def shield_ignore(self):
        return self.magical_shield_ignore

    @property
    def damage_addition(self):
        return self.magical_damage_addition

    @property
    def shield_base(self):
        return self.magical_shield_base

    @property
    def shield_gain(self):
        return self.magical_shield_gain

    @property
    def vulnerable(self):
        return self.magical_vulnerable