121212
This commit is contained in:
@@ -66,4 +66,73 @@ public static class GameEnum
|
||||
Awaken,//觉醒配置
|
||||
Quality,//洗练配置
|
||||
}
|
||||
public enum ComputeType
|
||||
{
|
||||
Plus,//加法计算
|
||||
Ride,//乘法计算
|
||||
Reduce,//减法计算
|
||||
Except,//除法计算
|
||||
}
|
||||
public enum AttrCode
|
||||
{
|
||||
AddExp,//经验
|
||||
AddGold,//金币
|
||||
OnAtk,//真伤
|
||||
Durability,//耐久
|
||||
MinAtk,
|
||||
MaxAtk,
|
||||
Atk,//攻击
|
||||
Blood,//体力
|
||||
Defense,//防御
|
||||
Agility,//敏捷
|
||||
Morale,//士气
|
||||
Light,//光
|
||||
LightLess,//光抗
|
||||
Dark,//暗
|
||||
DarkLess,//暗抗
|
||||
Star,//星
|
||||
StarLess,//星抗
|
||||
Thunder,//雷
|
||||
ThunderLess,//雷抗性
|
||||
Wind,//风
|
||||
WindLess,//风抗性
|
||||
Bolt,//电
|
||||
BoltLess,//电抗性
|
||||
Burst,//爆率
|
||||
InBlood,//吸血
|
||||
Crit,//暴击
|
||||
disDefense,//无视防御
|
||||
Dodge,//闪避
|
||||
NoHarm,//免伤
|
||||
Rebound,//反弹
|
||||
Punish,//制裁
|
||||
Slow,//迟缓
|
||||
Poison,//中毒
|
||||
PoisonLess,//抗毒攻
|
||||
Curse,//诅咒
|
||||
Weaken,//弱化
|
||||
Deadly,//致命
|
||||
DeadlyLess,//抗致命
|
||||
Depressed,//消沉 沮丧
|
||||
Breach,//突破
|
||||
Del_Fashion,//卸时装
|
||||
Atk_Next,//连击
|
||||
ReboundLess,//抗反弹
|
||||
Harm_Add,//额外伤害
|
||||
PalsyAtk,//麻痹
|
||||
PalsyAtkLess,//抗麻痹
|
||||
CurseLess,//抗诅咒
|
||||
WeakenLess,//抗弱化
|
||||
DepressedLess,//抗消沉
|
||||
BreachLess,//抗突破
|
||||
Luck,//幸运
|
||||
SlowLess,//抗迟缓
|
||||
Depth,//潜水深度
|
||||
Height,//升空高度
|
||||
Weight,//负重
|
||||
RetBloodLimit,//限制回血特殊属性
|
||||
Stealth,//隐身效果
|
||||
DisStealth,//反隐效果
|
||||
TM,//天幕
|
||||
}
|
||||
}
|
||||
@@ -706,6 +706,12 @@ public class GameEquService(ISqlSugarClient DbClient, IRedisCache redis) : IGame
|
||||
|
||||
#region 强化相关
|
||||
|
||||
public async Task<unit_user_equ> GetUserEquAttr(unit_user_equ equ)
|
||||
{
|
||||
|
||||
return equ;
|
||||
}
|
||||
|
||||
public async Task<game_equ_up> GetUserEquUpData(int lev)
|
||||
{
|
||||
string key = string.Format(BaseCache.BaseCacheKeys, "EquData", "EquUpData");
|
||||
|
||||
198
Service/Application.Domain/Tool/Base/EquTool.cs
Normal file
198
Service/Application.Domain/Tool/Base/EquTool.cs
Normal file
@@ -0,0 +1,198 @@
|
||||
namespace Application.Domain;
|
||||
|
||||
public class EquTool
|
||||
{
|
||||
public static unit_user_equ GetUserEquByIntensify(unit_user_equ equ)
|
||||
{
|
||||
//强化
|
||||
equ = GetIntensifyAttr(equ);
|
||||
List<AttrItem> AttrData = GetUserEquAttrData(equ);
|
||||
equ.minAtk += Convert.ToInt32(GetAttrItemValue(nameof(GameEnum.AttrCode.Atk), AttrData, (decimal)equ.minAtk));
|
||||
equ.minAtk +=
|
||||
Convert.ToInt32(GetAttrItemValue(nameof(GameEnum.AttrCode.MinAtk), AttrData, (decimal)equ.minAtk));
|
||||
equ.maxAtk += Convert.ToInt32(GetAttrItemValue(nameof(GameEnum.AttrCode.Atk), AttrData, (decimal)equ.maxAtk));
|
||||
equ.maxAtk +=
|
||||
Convert.ToInt32(GetAttrItemValue(nameof(GameEnum.AttrCode.MaxAtk), AttrData, (decimal)equ.minAtk));
|
||||
equ.Blood += Convert.ToInt32(GetAttrItemValue(nameof(GameEnum.AttrCode.Blood), AttrData, (decimal)equ.Blood));
|
||||
equ.Defense +=
|
||||
Convert.ToInt32(GetAttrItemValue(nameof(GameEnum.AttrCode.Defense), AttrData, (decimal)equ.Defense));
|
||||
equ.Agility +=
|
||||
Convert.ToInt32(GetAttrItemValue(nameof(GameEnum.AttrCode.Agility), AttrData, (decimal)equ.Agility));
|
||||
equ.Morale +=
|
||||
Convert.ToInt32(GetAttrItemValue(nameof(GameEnum.AttrCode.Morale), AttrData, (decimal)equ.Morale));
|
||||
return equ;
|
||||
}
|
||||
|
||||
private static unit_user_equ GetIntensifyAttr(unit_user_equ equ)
|
||||
{
|
||||
equ.minAtk = GetIntensifyAttrBase(equ.minAtk, equ.intensifyLev);
|
||||
equ.maxAtk = GetIntensifyAttrBase(equ.maxAtk, equ.intensifyLev);
|
||||
equ.Blood = GetIntensifyAttrBase(equ.Blood, equ.intensifyLev);
|
||||
equ.Defense = GetIntensifyAttrBase(equ.Defense, equ.intensifyLev);
|
||||
equ.Agility = GetIntensifyAttrBase(equ.Agility, equ.intensifyLev);
|
||||
|
||||
return equ;
|
||||
}
|
||||
|
||||
private static int GetIntensifyAttrBase(int? onV, int? lev)
|
||||
{
|
||||
if (onV < 1)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int onAttr = Convert.ToInt32(onV);
|
||||
int onLev = Convert.ToInt32(lev); //当前强化等级
|
||||
if (onLev < 1)
|
||||
{
|
||||
return onAttr;
|
||||
}
|
||||
|
||||
int result = onLev * 3;
|
||||
result = result > 57 ? 57 : result;
|
||||
|
||||
if (onLev > 19)
|
||||
{
|
||||
int addLev = onLev - 19;
|
||||
addLev = addLev > 10 ? 10 : addLev;
|
||||
result += addLev * 5;
|
||||
}
|
||||
|
||||
if (onLev > 29)
|
||||
{
|
||||
int addLev = onLev - 29;
|
||||
addLev = addLev > 10 ? 10 : addLev;
|
||||
result += addLev * 10;
|
||||
}
|
||||
|
||||
if (onLev > 39)
|
||||
{
|
||||
int addLev = onLev - 39;
|
||||
addLev = addLev > 10 ? 10 : addLev;
|
||||
result += addLev * 15;
|
||||
}
|
||||
|
||||
if (onLev > 49)
|
||||
{
|
||||
int addLev = onLev - 49;
|
||||
addLev = addLev > 10 ? 10 : addLev;
|
||||
result += addLev * 20;
|
||||
}
|
||||
|
||||
if (onLev > 59)
|
||||
{
|
||||
int addLev = onLev - 59;
|
||||
addLev = addLev > 10 ? 10 : addLev;
|
||||
result += addLev * 25;
|
||||
}
|
||||
|
||||
if (onLev > 69)
|
||||
{
|
||||
int addLev = onLev - 69;
|
||||
addLev = addLev > 10 ? 10 : addLev;
|
||||
int unitAdd = Convert.ToInt32(onAttr * 0.05);
|
||||
unitAdd = unitAdd < 30 ? 30 : unitAdd;
|
||||
result += addLev * unitAdd;
|
||||
}
|
||||
|
||||
if (onLev > 79)
|
||||
{
|
||||
int addLev = onLev - 79;
|
||||
addLev = addLev > 10 ? 10 : addLev;
|
||||
int unitAdd = Convert.ToInt32(onAttr * 0.1);
|
||||
unitAdd = unitAdd < 35 ? 35 : unitAdd;
|
||||
result += addLev * unitAdd;
|
||||
}
|
||||
|
||||
if (onLev > 89)
|
||||
{
|
||||
int addLev = onLev - 89;
|
||||
addLev = addLev > 10 ? 10 : addLev;
|
||||
int unitAdd = Convert.ToInt32(onAttr * 0.15);
|
||||
unitAdd = unitAdd < 40 ? 40 : unitAdd;
|
||||
result += addLev * unitAdd;
|
||||
}
|
||||
|
||||
if (onLev > 99)
|
||||
{
|
||||
int unitAdd = Convert.ToInt32(onAttr * 0.35);
|
||||
unitAdd = unitAdd < 100 ? 100 : unitAdd;
|
||||
result += unitAdd;
|
||||
}
|
||||
|
||||
return Convert.ToInt32(result + onAttr);
|
||||
}
|
||||
|
||||
private static List<AttrItem> GetUserEquAttrData(unit_user_equ equ)
|
||||
{
|
||||
List<AttrItem> AttrData = new List<AttrItem>();
|
||||
//装备本身特性
|
||||
AttrData.AddRange(equ.EquAttr);
|
||||
|
||||
//宝石
|
||||
if (equ.GemMent.Count > 0)
|
||||
{
|
||||
foreach (var item in equ.GemMent)
|
||||
{
|
||||
AttrData.AddRange(item.gemItem.GemAttr);
|
||||
}
|
||||
}
|
||||
|
||||
//附魔
|
||||
if (equ.EquMent != null)
|
||||
{
|
||||
if (equ.EquMent.EquAttr != null)
|
||||
{
|
||||
AttrData.AddRange(equ.EquMent.EquAttr);
|
||||
}
|
||||
}
|
||||
|
||||
//觉醒
|
||||
if (equ.EquAwaken != null)
|
||||
{
|
||||
foreach (var item in equ.EquAwaken)
|
||||
{
|
||||
if (item.awaken != null)
|
||||
{
|
||||
AttrData.AddRange(item.awaken);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return AttrData;
|
||||
}
|
||||
|
||||
public static decimal GetAttrItemValue(string attrCode, List<AttrItem> AttrData, decimal unit)
|
||||
{
|
||||
decimal result = 0.00M;
|
||||
foreach (var item in AttrData)
|
||||
{
|
||||
if (attrCode == item.code)
|
||||
{
|
||||
if (string.IsNullOrEmpty(item.compute))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (item.compute == nameof(GameEnum.ComputeType.Ride))
|
||||
{
|
||||
result += unit * Convert.ToDecimal(item.parameter);
|
||||
}
|
||||
else if (item.compute == nameof(GameEnum.ComputeType.Plus))
|
||||
{
|
||||
result += Convert.ToDecimal(item.parameter);
|
||||
}
|
||||
else if (item.compute == nameof(GameEnum.ComputeType.Reduce))
|
||||
{
|
||||
result = unit - Convert.ToDecimal(item.parameter);
|
||||
}
|
||||
else if (item.compute == nameof(GameEnum.ComputeType.Except))
|
||||
{
|
||||
result = unit / Convert.ToDecimal(item.parameter);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -74,6 +74,7 @@ public class EquController : ControllerBase
|
||||
suit = await _equService.GetEuqSuitInfo(ueInfo.suitCode);
|
||||
}
|
||||
|
||||
ueInfo = EquTool.GetUserEquByIntensify(ueInfo);
|
||||
user = await UserModelTool.GetUserView(ueInfo.owerId);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user