File size: 1,249 Bytes
ef62e40
2f63a42
 
ef62e40
2f63a42
 
ef62e40
2f63a42
 
 
 
 
 
ef62e40
 
 
 
2f63a42
ef62e40
 
 
2f63a42
 
ef62e40
 
 
 
2f63a42
ef62e40
 
 
f0b1638
 
 
2f63a42
f0b1638
 
 
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
from typing import List, Dict

from base.gain import Gain
from base.skill import Skill


class RecipeGain(Gain):
    def __init__(self, gain_name: str, skill_ids: List[int], value: int):
        super().__init__(gain_name)
        self.skill_ids = skill_ids
        self.value = value


class DamageAdditionRecipe(RecipeGain):
    def add_skills(self, skills: Dict[int, Skill]):
        for skill_id in self.skill_ids:
            skills[skill_id].skill_damage_addition += self.value

    def sub_skills(self, skills: Dict[int, Skill]):
        for skill_id in self.skill_ids:
            skills[skill_id].skill_damage_addition -= self.value


class CriticalStrikeRecipe(RecipeGain):
    def add_skills(self, skills: Dict[int, Skill]):
        for skill_id in self.skill_ids:
            skills[skill_id].skill_critical_strike += self.value

    def sub_skills(self, skills: Dict[int, Skill]):
        for skill_id in self.skill_ids:
            skills[skill_id].skill_critical_strike -= self.value


def damage_addition_recipe(skill_ids, value, name="伤害增加"):
    return DamageAdditionRecipe(name, skill_ids, value)


def critical_strike_recipe(skill_ids, value, name="会心增加"):
    return CriticalStrikeRecipe(name, skill_ids, value)