-
Notifications
You must be signed in to change notification settings - Fork 5
/
alg.dart
50 lines (43 loc) · 1.02 KB
/
alg.dart
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
part of md5;
class Alg {
static double getAt(Plr p, bool isMag, R r) {
int atk;
if (isMag) {
atk = p.mag;
} else {
atk = p.atk;
}
int a = ([r.r127, r.r127, r.r127, atk + 64, atk]..sort())[2];
int b = ([r.r63 + 64, r.r63 + 64, atk + 64]..sort())[1];
return a * b * p.atboost;
}
static int getDf(Plr p, bool isMag, R r) {
if (isMag) {
return p.mdf + 64;
}
return p.def + 64;//([r.r63 + 64, r.r63 + def, def + 64]..sort())[1];
}
static bool dodge(int alA, int alD, R r) {
int ch = 24 + alD - alA;
if (ch < 7) ch = 7;
if (ch > 64) ch = ch ~/ 4 + 48;
return r.nextByte() <= ch;
}
static bool dodgeHpBase(int alA, int alD, int hp, R r) {
int ch = 50 + alA - alD;
if (ch < 7) ch = 7;
return r.nextInt(hp) >= (ch * 4);
}
static double rateLowHp(Plr p) {
return 1/rateHiHp(p);
}
static double rateHiHp(Plr p) {
if (p.hp < 20) {
return 30.0;
}
if (p.hp > 300) {
return 300.0;
}
return p.hp.toDouble();
}
}