From d165af063d7365e143d92c3a950a0b52e683a66e Mon Sep 17 00:00:00 2001
From: yyl <yyl>
Date: 星期五, 23 一月 2026 15:33:29 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.1.20:10010/r/Project_SG_scripts
---
Main/System/Main/FightPowerManager.cs | 158 ++++++++++++++++++++++++++++++++++++++++++++++++----
1 files changed, 146 insertions(+), 12 deletions(-)
diff --git a/Main/System/Main/FightPowerManager.cs b/Main/System/Main/FightPowerManager.cs
index a408d50..4055c16 100644
--- a/Main/System/Main/FightPowerManager.cs
+++ b/Main/System/Main/FightPowerManager.cs
@@ -123,23 +123,38 @@
int teamTypeCalc = 1; //涓嶅悓闃靛鎴樺姏涓嶅悓
bool isPreviewTeamPower; //棰勮闃靛锛堥槦浼嶏級鎴樺姏
int dropIndexCalc = -1; //鎺夎惤瑁呭鍦ㄩ樀瀹圭殑绱㈠紩锛岀敤浜庨瑙堟垬鍔涘姣�
+ int minggePresetID; //鍛芥牸棰勮ID
+ int minggeDropIndex; //鎺夎惤鍛芥牸鍦ㄨ儗鍖呯殑绱㈠紩 锛岀敤浜庨瑙堟垬鍔涘姣�
//璁$畻闃靛鎴樺姏锛岃澶囧姣旂瓑鎯呭喌闇�瑕佷唬鍏�
/// <summary>
///
/// </summary>
- /// <param name="teamType">闃靛绫诲瀷</param>
+ /// <param name="teamType">闃靛绫诲瀷锛氭柟妗圛D涓嬬殑闃熶紞</param>
/// <param name="dropindex">鎺夎惤瑁呭鐨勭储寮曪紝-1浠h〃涓嶆浛鎹㈣绠�</param>
/// <param name="ispreview">棰勮闃靛鎴樺姏</param>
- public void InitFightPowerParam(int teamType = 1, int dropindex = -1, bool ispreview = false)
+ public void InitFightPowerParam(int teamType = 0, int dropindex = -1, bool ispreview = false,
+ int _minggePresetID = 0, int _minggeDropIndex = -1)
{
#if !UNITY_EDITOR
openLog = false;
#endif
+ if (teamType == 0)
+ {
+ // 娌℃湁璁剧疆榛樿浣跨敤涓婚樀瀹�
+ teamType = TeamManager.Instance.GetMainTeamID();
+ }
+ if (_minggePresetID == 0)
+ {
+ // 娌℃湁璁剧疆榛樿褰撳墠娴佹淳涓嬪懡鏍兼柟妗�
+ _minggePresetID = FuncPresetManager.Instance.GetFuncPresetID((int)FuncPresetType.Mingge);
+ }
teamTypeCalc = teamType;
+ minggePresetID = _minggePresetID;
isPreviewTeamPower = ispreview;
dropIndexCalc = dropindex;
+ minggeDropIndex = _minggeDropIndex;
#if UNITY_EDITOR
FightPowerDebug("鎴樺姏锛氬垵濮嬪寲鍙傛暟 dropIndex锛�" + dropIndexCalc + " 闃靛瀷锛�" + teamTypeCalc + " ispreview:" + ispreview);
#endif
@@ -158,6 +173,7 @@
public Dictionary<int, int> equipAttrs = new Dictionary<int, int>(); //瑁呭灞炴��
// public Dictionary<string, int> lineUpPerDict = new Dictionary<string, int>(); //闃靛灞炴�у姞鎴�
public Dictionary<int, int> countryAttrs = new Dictionary<int, int>(); //闃靛鍥藉锛堝厜鐜級灞炴��
+ public Dictionary<int, int> minggeAttrs = new Dictionary<int, int>(); //鍛芥牸灞炴�� 鎶�鑳芥垬鍔涗负鍥哄畾鐨勫彧绠椾釜鏁板尯鍒嵆鍙�
float allHeroAddPer = 0; //鎵�鏈夋灏嗗姞鎴�
@@ -216,13 +232,18 @@
void RefrehEquipAttrs()
{
equipAttrs.Clear(); //韬笂瑁呭灞炴�ч噸缃�
+ ItemModel dropEquip = null;
+ if (dropIndexCalc != -1)
+ {
+ dropEquip = PackManager.Instance.GetItemByIndex(PackType.DropItem, dropIndexCalc);
+ }
+
for (int i = 0; i < EquipModel.TotleEquip; i++)
{
var equip = EquipModel.Instance.GetEquip(i);
if (dropIndexCalc != -1)
{
- var dropEquip = PackManager.Instance.GetItemByIndex(PackType.DropItem, dropIndexCalc);
- if (dropEquip.config.EquipPlace - 1 == i)
+ if (dropEquip != null && dropEquip.config.EquipPlace - 1 == i)
{
equip = dropEquip; //鏇挎崲璁$畻鎬绘垬鍔�
}
@@ -288,6 +309,59 @@
#endif
}
+ //绫讳技瑁呭闇�瑕佸疄鏃舵浛鎹㈠姣旓紱鍔熻兘澶勬煡鐪嬮噸绠椾竴娆℃樉绀�
+ void RefrehMinggeAttrs()
+ {
+ minggeAttrs.Clear(); //韬笂鍛芥牸灞炴�ч噸缃�
+ ItemModel dropEquip = null;
+ int packIndex = -1;
+ if (minggeDropIndex != -1)
+ {
+ dropEquip = PackManager.Instance.GetItemByIndex(PackType.MinggeDrop, minggeDropIndex);
+ packIndex = MinggeManager.Instance.GetPackIndex(minggePresetID, dropEquip.config.EquipPlace);
+ }
+
+ var starIndex = (minggePresetID - 1) * MinggeManager.TotleEquip;
+
+ for (int i = starIndex; i < starIndex + MinggeManager.TotleEquip; i++)
+ {
+ var equip = PackManager.Instance.GetItemByIndex(PackType.Mingge, i);
+ if (minggeDropIndex != -1)
+ {
+ if (dropEquip != null && packIndex == i)
+ {
+ equip = dropEquip; //鏇挎崲璁$畻鎬绘垬鍔�
+ }
+ }
+ if (equip == null)
+ {
+ continue;
+ }
+
+ var fightIDAttrs = EquipModel.Instance.GetEquipFightAttrs(equip);
+ var fightValueAttrs = EquipModel.Instance.GetEquipFightValues(equip);
+ if (fightIDAttrs != null)
+ {
+ for (int j = 0; j < fightIDAttrs.Count; j++)
+ {
+ if (!minggeAttrs.ContainsKey(fightIDAttrs[j]))
+ {
+ minggeAttrs[fightIDAttrs[j]] = fightValueAttrs[j];
+ }
+ else
+ {
+ minggeAttrs[fightIDAttrs[j]] += fightValueAttrs[j];
+ }
+ }
+ }
+ }
+
+#if UNITY_EDITOR
+ FightPowerDebug("鎴樺姏锛氬懡鏍煎睘鎬� " + JsonMapper.ToJson(minggeAttrs));
+#endif
+ }
+
+
#endregion
//鍗曞睘鎬у叕寮忓垎鍩虹涓夌淮鍜屾垬鏂楀睘鎬�
@@ -316,7 +390,7 @@
public double GetPropertyVaule(int attrType, HeroInfo hero, int type)
{
// propertyVariables.Clear();
-
+
propertyVariables[LV_VALUE] = lvAttrs.ContainsKey(attrType) ? lvAttrs[attrType] : 0;
propertyVariables[EQUIP_VALUE] = equipAttrs.ContainsKey(attrType) ? equipAttrs[attrType] : 0;
// propertyVariables[BOOK_VALUE] = 0;
@@ -335,8 +409,8 @@
propertyVariables[FATES_PER] = HeroFatesManager.Instance.GetAttrPer(attrType) / 10000.0f;
propertyVariables[DINGJUNGE_VALUE] = 0; //榛樿涓嶉渶瑕佸姞锛岀埇濉旂壒娈婄敤锛岄厤鍚堝叕寮�
propertyVariables[DINGJUNGE_PER] = 0; //榛樿涓嶉渶瑕佸姞锛岀埇濉旂壒娈婄敤锛岄厤鍚堝叕寮�
- propertyVariables[MINGGE_VALUE] = 0;
- propertyVariables[MINGGE_PER] = 0;
+ propertyVariables[MINGGE_VALUE] = minggeAttrs.ContainsKey(attrType) ? minggeAttrs[attrType] : 0;
+ propertyVariables[MINGGE_PER] = (minggeAttrs.ContainsKey(attrType) ? minggeAttrs[attrType] : 0) / 10000.0f;
//鍏ㄤ綋鍗$墝鍔犳垚
propertyVariables[HERO_CARDPER] = allHeroAddPer;
@@ -439,6 +513,7 @@
RefreshLVAttrs();
RefreshOfficialAttrs();
RefrehEquipAttrs();
+ RefrehMinggeAttrs();
RefreshTeamAttrs();
// --- 绠楀崟姝﹀皢鍔熻兘灞炴�ф垬鍔� 鍚庣浉鍔�---
@@ -465,8 +540,9 @@
}
+ fightPower += GetMinggeSkillPower();
// #if UNITY_EDITOR
- FightPowerDebug("鎴樺姏锛氳绠楀畬姣� " + fightPower);
+ FightPowerDebug("鎴樺姏锛氳绠楀畬姣� " + fightPower);
// #endif
return fightPower;
}
@@ -583,6 +659,49 @@
return fightPower + skillPower;
}
+ //鍛芥牸鎶�鑳芥垬鍔涳細鎶�鑳芥垬鍔�*涓暟锛涘鏋滄槸鏇挎崲鐨勮鍒ゆ柇鏄惁鎶�鑳戒釜鏁板彉鍖�
+ long GetMinggeSkillPower()
+ {
+ //褰撳墠鏂规鎶�鑳戒俊鎭�
+ int _skillTypeID = 0; //鍙栧叾涓竴涓敤浜庤绠楀嵆鍙�
+ var count = MinggeManager.Instance.GetMinggeSkillCountByPresetID(minggePresetID, out _skillTypeID);
+
+ ItemModel dropEquip = null;
+ if (minggeDropIndex != -1)
+ {
+ dropEquip = PackManager.Instance.GetItemByIndex(PackType.MinggeDrop, minggeDropIndex);
+ //甯︽妧鑳界殑鍛芥牸 闇�鍒ゆ柇鏄惁鎶�鑳戒釜鏁板彉鍖�
+ if (MinggeManager.Instance.minggeSkillEquipPlaceList.Contains(dropEquip.config.EquipPlace))
+ {
+ var packIndex = MinggeManager.Instance.GetPackIndex(minggePresetID, minggeDropIndex);
+ //瑕佸姣旂殑瑁呭
+ var equip = PackManager.Instance.GetItemByIndex(PackType.Mingge, packIndex);
+ if (equip == null)
+ {
+ count++;
+ if (_skillTypeID == 0)
+ {
+ _skillTypeID = EquipModel.Instance.GetEquipSkillID(dropEquip);
+ }
+ }
+
+ }
+ }
+
+ if (_skillTypeID == 0)
+ return 0;
+
+
+ //鍔犱笂鎶�鑳芥垬鍔�
+ fightPowerVariables.Clear();
+ fightPowerVariables[PLAYER_LV] = PlayerDatas.Instance.baseData.LV;
+ fightPowerVariables[OFFICIAL_LV] = PlayerDatas.Instance.baseData.realmLevel;
+ fightPowerVariables[SKILL_POWER] = SkillConfig.Get(_skillTypeID).FightPower;
+
+ long skillPower = (long)FightPowerFormula.GetSkillsFightPower(fightPowerVariables);
+
+ return skillPower * count;
+ }
/// <summary>
@@ -594,13 +713,26 @@
{
InitFightPowerParam();
var fightPower = CalculatePower();
-
+
InitFightPowerParam(dropindex: item.gridIndex);
var tmpFightPower = CalculatePower();
return tmpFightPower - fightPower;
}
-
+ /// <summary>
+ /// 鍛芥牸瑁呭瀵规瘮
+ /// </summary>
+ /// minggePresetID 鎸囪瀵规瘮鐨勫摢濂楁柟妗堜笅鐨勫懡鏍硷紝鐜╁鍙互鐐瑰嚮鍒囨崲瀵规瘮锛岃嚜鍔ㄩ粯璁や細閬嶅巻鎵�鏈夋縺娲绘柟妗�
+ public long GetFightPowerMinggeChange(ItemModel item, int minggePresetID)
+ {
+ InitFightPowerParam(_minggePresetID: minggePresetID);
+ var fightPower = CalculatePower();
+
+ InitFightPowerParam(_minggePresetID: minggePresetID, _minggeDropIndex: item.gridIndex);
+ var tmpFightPower = CalculatePower();
+ return tmpFightPower - fightPower;
+ }
+
// 鍗曡嫳闆勬煡鐪嬫垬鍔�
// 1. 涓婇樀鑻遍泟鏄剧ず锛屽湪涓荤嚎闃靛涓嬬殑鎴樺姏
@@ -627,11 +759,13 @@
InitFightPowerParam(ispreview: ispreview);
RefreshLVAttrs();
RefreshOfficialAttrs();
+ RefrehMinggeAttrs();
RefrehEquipAttrs();
RefreshTeamAttrs();
var fightPower = CalculateTeamHeroPower(heroInfo);
-
+ fightPower += GetMinggeSkillPower();
+
//璁$畻瀹屾仮澶嶉槦浼�
if (ispreview)
team.RestoreTeam();
@@ -642,7 +776,7 @@
//鏌ョ湅闃靛鎴樺姏
public long GetTeamFightPower(int team, bool isPreview)
{
- InitFightPowerParam(team, -1, isPreview);
+ InitFightPowerParam(team, ispreview:isPreview);
return CalculatePower();
}
#endregion
--
Gitblit v1.8.0