File size: 5,583 Bytes
2f63a42
 
 
 
 
 
88de31c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2f63a42
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3ed500d
2f63a42
 
 
 
 
 
 
 
 
 
 
88de31c
 
 
 
 
 
 
 
 
 
2f63a42
 
 
 
 
 
 
 
88de31c
 
2f63a42
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
from typing import Dict, Union, Tuple

from base.attribute import Attribute
from base.gain import Gain


class WaterWeapon(Gain):
    attr: str
    max_stack = 10

    def __init__(self, value):
        super().__init__(f"{value} 攻击")
        self.value = value

    def add(self, other):
        if isinstance(other, Attribute):
            setattr(other, self.attr, getattr(other, self.attr) + self.value * self.max_stack)

    def sub(self, other):
        if isinstance(other, Attribute):
            setattr(other, self.attr, getattr(other, self.attr) - self.value * self.max_stack)


class PhysicalWaterWeapon(WaterWeapon):
    attr = "physical_attack_power_base"


class MagicalWaterWeapon(WaterWeapon):
    attr = "magical_attack_power_base"


class WindPendant(Gain):
    physical_overcome = [0] * 101 + sum([[0, v] + [0] * 5 for v in [6408, 8330, 9291]], [])
    magical_overcome = [0] * 101 + sum([[v, 0] + [0] * 5 for v in [6408, 8330, 9291]], [])

    def __init__(self, level):
        self.level = level
        super().__init__(f"{self.physical_overcome[self.level] | self.magical_overcome[self.level]} 破防")

    def add(self, other):
        if isinstance(other, Attribute):
            other.physical_overcome_base += self.physical_overcome[self.level]
            other.magical_overcome_base += self.magical_overcome[self.level]

    def sub(self, other):
        if isinstance(other, Attribute):
            other.physical_overcome_base -= self.physical_overcome[self.level]
            other.magical_overcome_base -= self.magical_overcome[self.level]


class CriticalSet(Gain):
    critical_strike_value = 400
    critical_power_value = 41
    critical_strike_attr: str
    critical_power_attr: str

    def __init__(self, gain_name, rate):
        super().__init__(gain_name)
        self.rate = rate

    def add(self, other):
        if isinstance(other, Attribute):
            setattr(
                other, self.critical_strike_attr,
                getattr(other, self.critical_strike_attr) + int(self.critical_strike_value * self.rate)
            )
            setattr(
                other, self.critical_power_attr,
                getattr(other, self.critical_power_attr) + int(self.critical_power_value * self.rate)
            )

    def sub(self, other):
        if isinstance(other, Attribute):
            setattr(
                other, self.critical_strike_attr,
                getattr(other, self.critical_strike_attr) - int(self.critical_strike_value * self.rate)
            )
            setattr(
                other, self.critical_power_attr,
                getattr(other, self.critical_power_attr) - int(self.critical_power_value * self.rate)
            )


class PhysicalCriticalSet(CriticalSet):
    critical_strike_attr = "physical_critical_strike_gain"
    critical_power_attr = "physical_critical_power_gain"

    def __init__(self, rate):
        super().__init__("外功双会套装", rate)


class MagicalCriticalSet(CriticalSet):
    critical_strike_attr = "magical_critical_strike_gain"
    critical_power_attr = "magical_critical_power_gain"

    def __init__(self, rate):
        super().__init__("内功双会套装", rate)


class HatSpecialEnchant(Gain):
    overcome = [0] * 9 + [822, 999, 1098]

    def __init__(self, level):
        self.level = level
        super().__init__(f"{self.overcome[self.level]} 破防")

    def add(self, other):
        if isinstance(other, Attribute):
            other.physical_overcome_base += self.overcome[self.level]

    def sub(self, other):
        if isinstance(other, Attribute):
            other.physical_overcome_base -= self.overcome[self.level]


class JacketSpecialEnchant(Gain):
    physical_ap = [0] * 9 + [371, 450, 495]
    magical_ap = [0] * 9 + [442, 538, 591]

    def __init__(self, level):
        self.level = level
        super().__init__(f"{self.physical_ap[self.level]}/{self.magical_ap[self.level]} 外攻/内攻")

    def add(self, other):
        if isinstance(other, Attribute):
            other.physical_attack_power_base += self.physical_ap[self.level]
            other.magical_attack_power_base += self.magical_ap[self.level]

    def sub(self, other):
        if isinstance(other, Attribute):
            other.physical_attack_power_base -= self.physical_ap[self.level]
            other.magical_attack_power_base -= self.magical_ap[self.level]


class BeltSpecialEnchant(Gain):
    damage_addition = {
        51: 0.7,
        10: 0.3
    }
    duration = 128
    cooldown = 480

    def __init__(self):
        self.all_damage_addition = sum(k * v for k, v in self.damage_addition.items()) * self.duration / self.cooldown
        super().__init__(f"{round(self.all_damage_addition, 2)} 伤害增加")

    def add(self, other):
        if isinstance(other, Attribute):
            other.all_damage_addition += self.all_damage_addition

    def sub(self, other):
        if isinstance(other, Attribute):
            other.all_damage_addition -= self.all_damage_addition


EQUIPMENT_GAINS: Dict[Union[Tuple[int, int], int], Gain] = {
    2400: MagicalWaterWeapon(81),
    2401: PhysicalWaterWeapon(67),
    2497: MagicalWaterWeapon(105),
    2498: PhysicalWaterWeapon(88),
    2539: MagicalWaterWeapon(117),
    2540: PhysicalWaterWeapon(98),
    **{
        (6800, i): WindPendant(i)
        for i in range(101, 117)
    },
    **{
        (15436, i): HatSpecialEnchant(i)
        for i in range(12)
    },
    **{
        (22151, i): JacketSpecialEnchant(i)
        for i in range(12)
    },
    22169: BeltSpecialEnchant(),

}