yyl
1 天以前 30ba2ef747ced774bef177d5273cb5a3429cff49
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
 
 
public partial class HeroInfo
{
    // 战斗属性的触发几率计算是1对1的,可同时触发多个属性且多次触发,触发几率不会随着目标数量多少而改变,只会根据同一目标的触发次数增多而降低。
    // 即在一回合内,同一个目标反击、连击、击晕、暴击、闪避可以同时并多次触发,触发几率随机触发次数的增加而降低,每个属性开公式来(参数:触发几率、抵抗几率、已触发次数)
    // 优先判断是否命中,必中后同时判断此次攻击是否连击、击晕、暴击生效
    // 反击时必命中目标
    // 武将属性需时时计算,根据技能、BUFF、装备等属性来源改变而改变
 
    // 基础属性
    // 生命
    public int hp = 0;
    // 攻击力
    public int attack = 0;
    // 防御力
    public int defense = 0;
 
 
 
    //战斗属性 击晕、暴击、连击、格挡、反击、吸血
    //眩晕概率
    public int stunRate = 0;
    //暴击概率
    public int critRate = 0;
    //连击概率
    public int comboRate = 0;
    //格挡概率
    public int blockRate = 0;
    //反击概率
    public int counterAttackRate = 0;
    //攻击目标时,造成伤害转化成生命的百分比数值提升
    public int recoverRate = 0;
 
    //战斗抵抗属性
    //眩晕抵抗
    public int stunResist = 0;
    //暴击抵抗
    public int critResist = 0;
    //连击抵抗
    public int comboResist = 0;
    //格挡抵抗
    public int blockResist = 0;
    //反击抵抗
    public int counterAttackResist = 0;
    //减少攻击时吸血转化成生命的百分比数值
    public int recoverResist = 0;
 
    //  特殊属性(待补充)
    //  最终伤害
    public int finalDamageIncrease = 0;
    //  最终免伤
    public int finalDamageReduce;
    //  爆伤
    public int critDamageIncrease;
    //  减少爆伤
    public int critDamageReduce;
    //  治疗增益
    public int healIncrease;
    //  治疗减益
    public int healReduce;
    //  物理增伤
    public int damageIncrease;
    //  减少物伤
    public int damageReduce;
    //  法术增伤
    public int magicIncrease;
    //  减少法伤
    public int magicReduce;
    //  普攻增伤
    public int normalAttackIncrease;
    //  减少普攻伤害
    public int normalAttackReduce;
    //  增加技能伤害
    public int rageSkillAttackIncrease;
    //  减少技能伤害
    public int rageSkillAttackReduce;
    //  增加持续伤害的百分比
    public int continousSkillIncrease;
    //  减少持续伤害的百分比
    public int continousSkillReduce;
    //  增加护盾百分比
    public int shieldSkillIncrease;
    //  减少护盾百分比
    public int shieldSkillReduce;
 
 
    //计算个人/职业/种族养成属性加成
    public void CalculateProperties()
    {
// 武将单体属性,根据继承比例,从全体属性继承得到
// 例如:武将攻击力=
// [(装备基础固定值+其它模块的固定值)* (1+初始加成%+武将升级加成%+武将突破加成%+武将吞噬星级加成%+图鉴加成%)]
// *
// [ 继承比例*(1+羁绊加成%+潜能加成%+天赋加成%+觉醒效果加成%)]
        hp = GetProperties(HeroAttrType.hp);
        attack = GetProperties(HeroAttrType.attack);
        defense = GetProperties(HeroAttrType.defense);
        stunRate = GetProperties(HeroAttrType.stunRate);
        critRate = GetProperties(HeroAttrType.critRate);
        comboRate = GetProperties(HeroAttrType.comboRate);
        blockRate = GetProperties(HeroAttrType.blockRate);
        counterAttackRate = GetProperties(HeroAttrType.counterAttackRate);
        recoverRate = GetProperties(HeroAttrType.recoverRate);
        stunResist = GetProperties(HeroAttrType.stunResist);
        critResist = GetProperties(HeroAttrType.critResist);
        comboResist = GetProperties(HeroAttrType.comboResist);
        blockResist = GetProperties(HeroAttrType.blockResist);
        counterAttackResist = GetProperties(HeroAttrType.counterAttackResist);
        recoverResist = GetProperties(HeroAttrType.recoverResist);
    }
 
    protected int GetProperties(HeroAttrType attrType)
    {
        return GetStableProperties(attrType) 
                    * GetCultivationPercent(attrType)
                    * GetInheritRate(attrType) 
                    * GetInfluenceByInheritPercent(attrType);
    }
 
 
    //  固定值属性
    public int GetStableProperties(HeroAttrType attrType)
    {
        int stableValue = 0;
        stableValue += GetEquipStableProperties(attrType);
        return stableValue;
    }
 
    //  培养百分比
    public int GetCultivationPercent(HeroAttrType attrType)
    {
        int cultivationPercent = 100;
        cultivationPercent += GetQualityCultivationPercent(attrType);//初始加成根据武将品质决定,不同品质武将初始加成不同 HeroInfo.Quality.cs
        cultivationPercent += GetLevelCultivationPercent(attrType);// 等级给的百分比 HeroInfo.Level.cs
        cultivationPercent += GetBreakCultivationPercent(attrType);// 突破给的百分比 HeroInfo.Break.cs
        cultivationPercent += GetStarCultivationPercent(attrType);// 吞噬星级给的百分比 HeroInfo.Star.cs
        cultivationPercent += GetCollectionCultivationPercent(attrType);// 图鉴给的百分比 HeroInfo.Collection.cs
        return cultivationPercent;
    }
 
    //  被继承比例影响的百分比属性
    public int GetInfluenceByInheritPercent(HeroAttrType attrType)
    {
        // (1+羁绊加成%+潜能加成%+天赋加成%+觉醒效果加成%)
 
        int IFByInheritPercent = 100;
        IFByInheritPercent += GetIFByInheritFetterPercent(attrType); //羁绊加成 HeroInfo.Fetter
        IFByInheritPercent += GetIFByInheritBreakPercent(attrType);  //潜能加成 HeroInfo.Break
        IFByInheritPercent += GetIFByInheritTalentPercent(attrType); //天赋加成 HeroInfo.Talent
        IFByInheritPercent += GetIFByInheritAwakePercent(attrType); //觉醒加成 HeroInfo.Awake
        return IFByInheritPercent;
    }
 
    public int CalculatePower()
    {
        //  暂行
        return hp +
                attack +
                defense +
                stunRate +
                critRate +
                comboRate +
                blockRate +
                counterAttackRate +
                recoverRate +
                stunResist +
                critResist +
                comboResist +
                blockResist +
                counterAttackResist +
                recoverResist;
    }
}