|
|
|
@ -4,6 +4,7 @@ using System.Collections.Generic; |
|
|
|
using System.Linq; |
|
|
|
using System.Text; |
|
|
|
using System.Text.RegularExpressions; |
|
|
|
using System.Web; |
|
|
|
using Unity.VisualScripting; |
|
|
|
using UnityEngine; |
|
|
|
using static Cinemachine.DocumentationSortingAttribute; |
|
|
|
@ -81,6 +82,10 @@ public class WeaponManager : Singleton<WeaponManager> |
|
|
|
{ |
|
|
|
playerUsingWeapon.resetNodeScore(playerWeaponNodeList); |
|
|
|
enemyUsingWeapon.resetNodeScore(enemyWeaponNodeList); |
|
|
|
MapUnityManager.Instance.switchNodeNum = 0; |
|
|
|
MapUnityManager.Instance.switchRedNodeNum = 0; |
|
|
|
MapUnityManager.Instance.switchBlueNodeNum = 0; |
|
|
|
MapUnityManager.Instance.switchYellowNodeNum = 0; |
|
|
|
} |
|
|
|
|
|
|
|
public void ResetAllNodeBool() |
|
|
|
@ -224,7 +229,7 @@ public class WeaponManager : Singleton<WeaponManager> |
|
|
|
return gem; |
|
|
|
} |
|
|
|
|
|
|
|
public string getEveryNodeAddScoreValue(string level,string condition) |
|
|
|
public string getEveryNodeAddScoreValue(string level) |
|
|
|
{ |
|
|
|
string resultValue = ""; |
|
|
|
HashSet<string> resultSet = new HashSet<string>(); |
|
|
|
@ -263,6 +268,64 @@ public class WeaponManager : Singleton<WeaponManager> |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public bool checkConditionSetRationality(string result,string firstPart,string op) |
|
|
|
{ |
|
|
|
bool isLegal=true; |
|
|
|
if (!op.Equals("<")) |
|
|
|
{ |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
switch (result) |
|
|
|
{ |
|
|
|
case Name.WeaponNodeFunction.everyRedNodeAddScore: |
|
|
|
case Name.WeaponNodeFunction.redNodeCount: |
|
|
|
if (firstPart.Equals(Name.Color.Red)) |
|
|
|
{ |
|
|
|
isLegal = false; |
|
|
|
} |
|
|
|
break; |
|
|
|
case Name.WeaponNodeFunction.everyBlueNodeAddScore: |
|
|
|
case Name.WeaponNodeFunction.blueNodeCount: |
|
|
|
if (firstPart.Equals(Name.Color.Blue)) |
|
|
|
{ |
|
|
|
isLegal = false; |
|
|
|
} |
|
|
|
break; |
|
|
|
case Name.WeaponNodeFunction.everyYellowNodeAddScore: |
|
|
|
case Name.WeaponNodeFunction.yellowNodeCount: |
|
|
|
if (firstPart.Equals(Name.Color.Yellow)) |
|
|
|
{ |
|
|
|
isLegal = false; |
|
|
|
} |
|
|
|
break; |
|
|
|
case Name.WeaponNodeFunction.leastNodeCount: |
|
|
|
case Name.WeaponNodeFunction.mostNodeCount: |
|
|
|
case Name.WeaponNodeFunction.allNodeCount: |
|
|
|
isLegal = false; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
return isLegal; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
public (string,string) getPart1AndOp(string result) |
|
|
|
{ |
|
|
|
HashSet<string> ops = new HashSet<string> { "<", ">" }; |
|
|
|
HashSet<string> colors = new HashSet<string> { Name.Color.Red, Name.Color.Blue, Name.Color.Yellow }; |
|
|
|
string color = MathTool.GetRandomElements(colors, 1).ElementAt(0); |
|
|
|
string op = MathTool.GetRandomElements(ops, 1).ElementAt(0); |
|
|
|
if (checkConditionSetRationality(result, color, op)) |
|
|
|
{ |
|
|
|
return (color, op); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
return getPart1AndOp(result); |
|
|
|
} |
|
|
|
} |
|
|
|
//屏蔽策略
|
|
|
|
public void resultBlockingPolicy(string firstPart, ref HashSet<string> set) |
|
|
|
{ |
|
|
|
@ -303,10 +366,10 @@ public class WeaponManager : Singleton<WeaponManager> |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
public WeaponNodeDataPair getRandomConditionWithLevel(string level) |
|
|
|
public WeaponNodeDataPair getRandomConditionWithLevel(string level,string result) |
|
|
|
{ |
|
|
|
string condition = ""; |
|
|
|
WeaponNodeDataPair result= new WeaponNodeDataPair(); |
|
|
|
WeaponNodeDataPair returnResult= new WeaponNodeDataPair(); |
|
|
|
switch (level) |
|
|
|
{ |
|
|
|
case Name.WeaponNodeLevel.Basic: |
|
|
|
@ -326,37 +389,39 @@ public class WeaponManager : Singleton<WeaponManager> |
|
|
|
string conditionValue = ""; |
|
|
|
List<string> nodesMark = new List<string>(); |
|
|
|
List<string> nodesColor = new List<string>(); |
|
|
|
conditionValue = getConditionValueWithLevel(level, ref condition, ref nodesMark, ref nodesColor); |
|
|
|
result.conditionOrResult = condition; |
|
|
|
result.value = conditionValue; |
|
|
|
result.nodesMark = nodesMark.ToArray(); |
|
|
|
result.nodesColor = nodesColor.ToArray(); |
|
|
|
result.description = Name.getGemConditionDescription(condition, conditionValue, nodesMark.ToArray(), nodesColor.ToArray()); |
|
|
|
return result; |
|
|
|
conditionValue = getConditionValueWithLevelForForge(level, ref condition, ref nodesMark, ref nodesColor,result); |
|
|
|
returnResult.conditionOrResult = condition; |
|
|
|
returnResult.value = conditionValue; |
|
|
|
returnResult.nodesMark = nodesMark.ToArray(); |
|
|
|
returnResult.nodesColor = nodesColor.ToArray(); |
|
|
|
returnResult.description = Name.getGemConditionDescription(condition, conditionValue, nodesMark.ToArray(), nodesColor.ToArray()); |
|
|
|
return returnResult; |
|
|
|
} |
|
|
|
|
|
|
|
public WeaponNodeDataPair getRandomResultWithLevel(string level) |
|
|
|
public WeaponNodeDataPair getRandomResultWithLevel(string level,string condition) |
|
|
|
{ |
|
|
|
string condition = ""; |
|
|
|
WeaponNodeDataPair resultData = new WeaponNodeDataPair(); |
|
|
|
string result = ""; |
|
|
|
//string result = "";
|
|
|
|
HashSet<string> resultSet = new HashSet<string>(); |
|
|
|
switch (level) |
|
|
|
{ |
|
|
|
case Name.WeaponNodeLevel.Basic: |
|
|
|
result = MathTool.GetRandomElements(Name.WeaponNodeFunction.PlayerBasicResultSet, 1).ElementAt(0); |
|
|
|
resultSet = Name.WeaponNodeFunction.PlayerBasicResultSet; |
|
|
|
break; |
|
|
|
case Name.WeaponNodeLevel.Elementary: |
|
|
|
result = MathTool.GetRandomElements(Name.WeaponNodeFunction.PlayerElementaryResultSet, 1).ElementAt(0); |
|
|
|
resultSet = Name.WeaponNodeFunction.PlayerElementaryResultSet; |
|
|
|
break; |
|
|
|
case Name.WeaponNodeLevel.Intermediate: |
|
|
|
result = MathTool.GetRandomElements(Name.WeaponNodeFunction.PlayerIntermediateResultSet, 1).ElementAt(0); |
|
|
|
resultSet = Name.WeaponNodeFunction.PlayerIntermediateResultSet; |
|
|
|
break; |
|
|
|
case Name.WeaponNodeLevel.Advanced: |
|
|
|
result = MathTool.GetRandomElements(Name.WeaponNodeFunction.PlayerAdvancedResultSet, 1).ElementAt(0); |
|
|
|
resultSet = Name.WeaponNodeFunction.PlayerAdvancedResultSet; |
|
|
|
break; |
|
|
|
} |
|
|
|
string resultValue = getResultValueWithLevel(level, ref result, Name.none, Name.none); |
|
|
|
resultData.conditionOrResult = condition; |
|
|
|
checkResultSetRationality(ref resultSet, condition); |
|
|
|
string result = MathTool.GetRandomElements(resultSet, 1).ElementAt(0); |
|
|
|
string resultValue = getResultValueWithLevel(level, ref result, condition, Name.none); |
|
|
|
resultData.conditionOrResult = result; |
|
|
|
resultData.value = resultValue; |
|
|
|
resultData.description = Name.getGemResultDescription(result, resultValue); |
|
|
|
return resultData; |
|
|
|
@ -740,7 +805,6 @@ public class WeaponManager : Singleton<WeaponManager> |
|
|
|
conditionValue = MathTool.GetRandomElements(new HashSet<string> { "3", "4", "5" }, 1).ElementAt(0); |
|
|
|
break; |
|
|
|
case Name.WeaponNodeCondition.everyNumNodeConvert: |
|
|
|
conditionValue = MathTool.GetRandomElements(new HashSet<string> { "7", "8", "9" }, 1).ElementAt(0); |
|
|
|
switch (level) |
|
|
|
{ |
|
|
|
case Name.WeaponNodeLevel.Basic: |
|
|
|
@ -757,6 +821,24 @@ public class WeaponManager : Singleton<WeaponManager> |
|
|
|
break; |
|
|
|
} |
|
|
|
break; |
|
|
|
case Name.WeaponNodeCondition.everyColorNodeConvert: |
|
|
|
condition = MathTool.GetRandomElements(Name.WeaponNodeCondition.PlayerColorConvertSet, 1).ElementAt(0); |
|
|
|
switch (level) |
|
|
|
{ |
|
|
|
case Name.WeaponNodeLevel.Basic: |
|
|
|
conditionValue = MathTool.GetRandomElements(MathTool.GenerateIntegerSet(6, 6), 1).ElementAt(0); |
|
|
|
break; |
|
|
|
case Name.WeaponNodeLevel.Elementary: |
|
|
|
conditionValue = MathTool.GetRandomElements(MathTool.GenerateIntegerSet(5, 5), 1).ElementAt(0); |
|
|
|
break; |
|
|
|
case Name.WeaponNodeLevel.Intermediate: |
|
|
|
conditionValue = MathTool.GetRandomElements(MathTool.GenerateIntegerSet(4, 4), 1).ElementAt(0); |
|
|
|
break; |
|
|
|
case Name.WeaponNodeLevel.Advanced: |
|
|
|
conditionValue = MathTool.GetRandomElements(MathTool.GenerateIntegerSet(3, 3), 1).ElementAt(0); |
|
|
|
break; |
|
|
|
} |
|
|
|
break; |
|
|
|
case Name.WeaponNodeCondition.bombbomb: |
|
|
|
conditionValue = Name.none; |
|
|
|
break; |
|
|
|
@ -813,6 +895,135 @@ public class WeaponManager : Singleton<WeaponManager> |
|
|
|
return conditionValue; |
|
|
|
} |
|
|
|
|
|
|
|
public string getConditionValueWithLevelForForge(string level, ref string condition, ref List<string> nodesMark, ref List<string> nodesColor,string result) |
|
|
|
{ |
|
|
|
string conditionValue = ""; |
|
|
|
switch (condition) |
|
|
|
{ |
|
|
|
case Name.WeaponNodeCondition.position: |
|
|
|
conditionValue = MathTool.GetRandomElements(new HashSet<string> { "0", "1", "2", "3", "4" }, 1).ElementAt(0); |
|
|
|
break; |
|
|
|
case Name.WeaponNodeCondition.positionUnused: |
|
|
|
conditionValue = MathTool.GetRandomElements(new HashSet<string> { "0", "1", "2", "3", "4" }, 1).ElementAt(0); |
|
|
|
break; |
|
|
|
case Name.WeaponNodeCondition.positionUsed: |
|
|
|
conditionValue = MathTool.GetRandomElements(new HashSet<string> { "0", "1", "2", "3", "4" }, 1).ElementAt(0); |
|
|
|
break; |
|
|
|
case Name.WeaponNodeCondition.diffSettle: |
|
|
|
conditionValue = Name.none; |
|
|
|
break; |
|
|
|
case Name.WeaponNodeCondition.usedCard: |
|
|
|
switch (level) |
|
|
|
{ |
|
|
|
case Name.WeaponNodeLevel.Basic: |
|
|
|
conditionValue = MathTool.GetRandomElements(new HashSet<string> { "1" }, 1).ElementAt(0); |
|
|
|
break; |
|
|
|
case Name.WeaponNodeLevel.Elementary: |
|
|
|
conditionValue = MathTool.GetRandomElements(new HashSet<string> { "2", }, 1).ElementAt(0); |
|
|
|
break; |
|
|
|
case Name.WeaponNodeLevel.Intermediate: |
|
|
|
conditionValue = MathTool.GetRandomElements(new HashSet<string> { "3" }, 1).ElementAt(0); |
|
|
|
break; |
|
|
|
case Name.WeaponNodeLevel.Advanced: |
|
|
|
conditionValue = MathTool.GetRandomElements(new HashSet<string> { "4" }, 1).ElementAt(0); |
|
|
|
break; |
|
|
|
} |
|
|
|
break; |
|
|
|
case Name.WeaponNodeCondition.threeColorDiffMoreThan: |
|
|
|
conditionValue = MathTool.GetRandomElements(new HashSet<string> { "3", "4", "5" }, 1).ElementAt(0); |
|
|
|
break; |
|
|
|
case Name.WeaponNodeCondition.everyNumNodeConvert: |
|
|
|
switch (level) |
|
|
|
{ |
|
|
|
case Name.WeaponNodeLevel.Basic: |
|
|
|
conditionValue = MathTool.GetRandomElements(MathTool.GenerateIntegerSet(10, 11), 1).ElementAt(0); |
|
|
|
break; |
|
|
|
case Name.WeaponNodeLevel.Elementary: |
|
|
|
conditionValue = MathTool.GetRandomElements(MathTool.GenerateIntegerSet(7, 9), 1).ElementAt(0); |
|
|
|
break; |
|
|
|
case Name.WeaponNodeLevel.Intermediate: |
|
|
|
conditionValue = MathTool.GetRandomElements(MathTool.GenerateIntegerSet(5, 6), 1).ElementAt(0); |
|
|
|
break; |
|
|
|
case Name.WeaponNodeLevel.Advanced: |
|
|
|
conditionValue = MathTool.GetRandomElements(MathTool.GenerateIntegerSet(3, 4), 1).ElementAt(0); |
|
|
|
break; |
|
|
|
} |
|
|
|
break; |
|
|
|
case Name.WeaponNodeCondition.everyColorNodeConvert: |
|
|
|
condition = MathTool.GetRandomElements(Name.WeaponNodeCondition.PlayerColorConvertSet, 1).ElementAt(0); |
|
|
|
switch (level) |
|
|
|
{ |
|
|
|
case Name.WeaponNodeLevel.Basic: |
|
|
|
conditionValue = MathTool.GetRandomElements(MathTool.GenerateIntegerSet(6, 6), 1).ElementAt(0); |
|
|
|
break; |
|
|
|
case Name.WeaponNodeLevel.Elementary: |
|
|
|
conditionValue = MathTool.GetRandomElements(MathTool.GenerateIntegerSet(5, 5), 1).ElementAt(0); |
|
|
|
break; |
|
|
|
case Name.WeaponNodeLevel.Intermediate: |
|
|
|
conditionValue = MathTool.GetRandomElements(MathTool.GenerateIntegerSet(4, 4), 1).ElementAt(0); |
|
|
|
break; |
|
|
|
case Name.WeaponNodeLevel.Advanced: |
|
|
|
conditionValue = MathTool.GetRandomElements(MathTool.GenerateIntegerSet(3, 3), 1).ElementAt(0); |
|
|
|
break; |
|
|
|
} |
|
|
|
break; |
|
|
|
case Name.WeaponNodeCondition.bombbomb: |
|
|
|
conditionValue = Name.none; |
|
|
|
break; |
|
|
|
case Name.WeaponNodeCondition.node: |
|
|
|
conditionValue = Name.none; |
|
|
|
HashSet<string> nodesA = new HashSet<string>(); |
|
|
|
switch (level) |
|
|
|
{ |
|
|
|
case Name.WeaponNodeLevel.Basic: |
|
|
|
nodesA = MathTool.GetRandomElements(new HashSet<string> { "1_0", "-1_0", "0_1", "0_-1", "-1_1", "-1_-1" }, 3); |
|
|
|
break; |
|
|
|
case Name.WeaponNodeLevel.Elementary: |
|
|
|
nodesA = MathTool.GetRandomElements(new HashSet<string> { "1_0", "-1_0", "0_1", "0_-1", "-1_1", "-1_-1" }, 4); |
|
|
|
break; |
|
|
|
case Name.WeaponNodeLevel.Intermediate: |
|
|
|
nodesA = MathTool.GetRandomElements(new HashSet<string> { "1_0", "-1_0", "0_1", "0_-1", "-1_1", "-1_-1" }, 5); |
|
|
|
break; |
|
|
|
case Name.WeaponNodeLevel.Advanced: |
|
|
|
nodesA = MathTool.GetRandomElements(new HashSet<string> { "1_0", "-1_0", "0_1", "0_-1", "-1_1", "-1_-1" }, 6); |
|
|
|
break; |
|
|
|
} |
|
|
|
nodesA.Add("0_0"); |
|
|
|
nodesMark = nodesA.ToList(); |
|
|
|
for (int i = 0; i < nodesA.Count; i++) |
|
|
|
{ |
|
|
|
nodesColor.Add(MathTool.GetRandomElements(new HashSet<string> { Name.Color.Red, Name.Color.Blue, Name.Color.Yellow }, 1).ElementAt(0)); |
|
|
|
} |
|
|
|
break; |
|
|
|
case Name.WeaponNodeCondition.cardConditionPattern: |
|
|
|
conditionValue = Name.none; |
|
|
|
StringBuilder sb = new StringBuilder(); |
|
|
|
(string part1, string op) = getPart1AndOp(result); |
|
|
|
sb.Append(part1) |
|
|
|
.Append(op); |
|
|
|
string part3 = ""; |
|
|
|
switch (level) |
|
|
|
{ |
|
|
|
case Name.WeaponNodeLevel.Basic: |
|
|
|
part3 = MathTool.GetRandomElements(MathTool.GenerateIntegerSet(6, 9), 1).ElementAt(0); |
|
|
|
break; |
|
|
|
case Name.WeaponNodeLevel.Elementary: |
|
|
|
part3 = MathTool.GetRandomElements(MathTool.GenerateIntegerSet(10, 15), 1).ElementAt(0); |
|
|
|
break; |
|
|
|
case Name.WeaponNodeLevel.Intermediate: |
|
|
|
part3 = MathTool.GetRandomElements(MathTool.GenerateIntegerSet(18, 24), 1).ElementAt(0); |
|
|
|
break; |
|
|
|
case Name.WeaponNodeLevel.Advanced: |
|
|
|
part3 = MathTool.GetRandomElements(MathTool.GenerateIntegerSet(35, 45), 1).ElementAt(0); |
|
|
|
break; |
|
|
|
} |
|
|
|
sb.Append(part3); |
|
|
|
condition = sb.ToString(); |
|
|
|
break; |
|
|
|
} |
|
|
|
return conditionValue; |
|
|
|
} |
|
|
|
|
|
|
|
public string getResultValueWithLevel(string level,ref string result, string condition, string conditionValue) |
|
|
|
{ |
|
|
|
string resultValue = ""; |
|
|
|
@ -905,7 +1116,7 @@ public class WeaponManager : Singleton<WeaponManager> |
|
|
|
case Name.WeaponNodeFunction.everyRedNodeAddScore: |
|
|
|
case Name.WeaponNodeFunction.everyYellowNodeAddScore: |
|
|
|
case Name.WeaponNodeFunction.everyBlueNodeAddScore: |
|
|
|
resultValue = getEveryNodeAddScoreValue(level, condition); |
|
|
|
resultValue = getEveryNodeAddScoreValue(level); |
|
|
|
break; |
|
|
|
case Name.NodeItem.Volcano: |
|
|
|
switch (level) |
|
|
|
@ -933,7 +1144,7 @@ public class WeaponManager : Singleton<WeaponManager> |
|
|
|
resultValue = MathTool.GetRandomElements(targets, 1).ElementAt(0); |
|
|
|
break; |
|
|
|
} |
|
|
|
if (condition.Equals(Name.WeaponNodeCondition.everyNumNodeConvert)&&result.Equals(Name.WeaponNodeFunction.addScore)) |
|
|
|
if (Name.WeaponNodeCondition.PlayerConvertSet.Contains(condition)&&result.Equals(Name.WeaponNodeFunction.addScore)) |
|
|
|
{ |
|
|
|
result = Name.WeaponNodeFunction.addScoreThisTurn; |
|
|
|
} |
|
|
|
@ -1082,6 +1293,11 @@ public class WeaponManager : Singleton<WeaponManager> |
|
|
|
{ Name.WeaponNodeLevel.Elementary, MathTool.GenerateIntegerSet(7, 9) }, |
|
|
|
{ Name.WeaponNodeLevel.Intermediate, MathTool.GenerateIntegerSet(5, 6) }, |
|
|
|
{ Name.WeaponNodeLevel.Advanced, MathTool.GenerateIntegerSet(3, 4) }}; |
|
|
|
Dictionary<string, HashSet<string>> everyColorNodeConvertDict = new Dictionary<string, HashSet<string>> |
|
|
|
{ { Name.WeaponNodeLevel.Basic, MathTool.GenerateIntegerSet(7, 8) }, |
|
|
|
{ Name.WeaponNodeLevel.Elementary, MathTool.GenerateIntegerSet(5, 6) }, |
|
|
|
{ Name.WeaponNodeLevel.Intermediate, MathTool.GenerateIntegerSet(4, 4) }, |
|
|
|
{ Name.WeaponNodeLevel.Advanced, MathTool.GenerateIntegerSet(3, 3) }}; |
|
|
|
Dictionary<string, HashSet<string>> cardConditionPatternDict = new Dictionary<string, HashSet<string>> |
|
|
|
{ { Name.WeaponNodeLevel.Basic, MathTool.GenerateIntegerSet(3, 5) }, |
|
|
|
{ Name.WeaponNodeLevel.Elementary, MathTool.GenerateIntegerSet(6, 8) }, |
|
|
|
@ -1142,6 +1358,17 @@ public class WeaponManager : Singleton<WeaponManager> |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
case Name.WeaponNodeCondition.everyRedNodeConvert: |
|
|
|
case Name.WeaponNodeCondition.everyBlueNodeConvert: |
|
|
|
case Name.WeaponNodeCondition.everyYellowNodeConvert: |
|
|
|
foreach (KeyValuePair<string, HashSet<string>> kvp in everyColorNodeConvertDict) |
|
|
|
{ |
|
|
|
if (kvp.Value.Contains(conditionValue)) |
|
|
|
{ |
|
|
|
rarity = kvp.Key; |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
case Name.WeaponNodeCondition.node: |
|
|
|
if (nodesColor.Length == 3) |
|
|
|
{ |
|
|
|
|