Browse Source

随机获得遗物

pull/72/head
yjm484 1 year ago
parent
commit
54949c886f
  1. 2
      ColorlessWorld-2024-4-2/Assets/GameDate/LevelDate/LevelState_1.asset
  2. 2
      ColorlessWorld-2024-4-2/Assets/Scripts/Enemy/BlackSheep.cs
  3. 6
      ColorlessWorld-2024-4-2/Assets/Scripts/Enemy/DarkCloud.cs
  4. 4
      ColorlessWorld-2024-4-2/Assets/Scripts/Enemy/Grinfiend.cs
  5. 14
      ColorlessWorld-2024-4-2/Assets/Scripts/Enemy/Mushroom.cs
  6. 16
      ColorlessWorld-2024-4-2/Assets/Scripts/Enemy/Polymaw.cs
  7. 39
      ColorlessWorld-2024-4-2/Assets/Scripts/Legacy/LegacyManager.cs
  8. 10
      ColorlessWorld-2024-4-2/Assets/Scripts/Tool/MathTool.cs

2
ColorlessWorld-2024-4-2/Assets/GameDate/LevelDate/LevelState_1.asset

@ -749,4 +749,4 @@ MonoBehaviour:
column: 4
fatherLevelNodes: []
nextLevelNodes: []
fightEenemyPool: weak
fightEenemyPool: Boss

2
ColorlessWorld-2024-4-2/Assets/Scripts/Enemy/BlackSheep.cs

@ -70,7 +70,7 @@ public class BlackSheep : MonoBehaviour
case EnemyActionAction_Attack:
yield return StartCoroutine(MeleeAttackAction());
break;
case EnemyActionAction_Shield:
case EnemyAction_AttackAndShield:
yield return StartCoroutine(ShieldAction());
break;
case EnemyAction_ShootAndPollute:

6
ColorlessWorld-2024-4-2/Assets/Scripts/Enemy/DarkCloud.cs

@ -120,6 +120,8 @@ public class DarkCloud : MonoBehaviour
{
if (!enemyNode.EnemyState.abnormalCondition.ContainsKey(AbnormalCondition.disarm))
{
enemyNode.anim.SetTrigger("Action");
yield return new WaitForSeconds(0.5f);
AttackDamage(enemyNode.EnemyState.damage);
}
@ -143,6 +145,8 @@ public class DarkCloud : MonoBehaviour
{
if (!enemyNode.EnemyState.abnormalCondition.ContainsKey(AbnormalCondition.disarm))
{
enemyNode.anim.SetTrigger("Action");
yield return new WaitForSeconds(0.5f);
AttackDamage(enemyNode.EnemyState.damage);
GameManager.Instance.playerOn.switchColor(Name.NodeColor.Black);
@ -162,6 +166,8 @@ public class DarkCloud : MonoBehaviour
MapUnity currentNode = GameManager.Instance.X[enemyNode.positionX].Y[enemyNode.positionY];
HashSet<MapUnity> targetNodes=new HashSet<MapUnity> { currentNode };
getNodeTools.getCircleNodeForEnemy(targetNodes,1);
enemyNode.anim.SetTrigger("Action");
yield return new WaitForSeconds(0.5f);
foreach (MapUnity node in targetNodes)
{
node.switchColor(Name.NodeColor.Black);

4
ColorlessWorld-2024-4-2/Assets/Scripts/Enemy/Grinfiend.cs

@ -107,6 +107,8 @@ public class Grinfiend : MonoBehaviour
{
if (!enemyNode.EnemyState.abnormalCondition.ContainsKey(AbnormalCondition.disarm))
{
enemyNode.anim.SetTrigger("Action");
yield return new WaitForSeconds(0.5f);
AttackDamage(enemyNode.EnemyState.damage);
}
@ -182,6 +184,8 @@ public class Grinfiend : MonoBehaviour
MapUnity currentNode = GameManager.Instance.X[enemyNode.positionX].Y[enemyNode.positionY];
if (getNodeTools.canRemoteAttack(currentNode, enemyNode.EnemyState.attackRange))
{
enemyNode.anim.SetTrigger("Action");
yield return new WaitForSeconds(0.5f);
switch (action)
{
case "para":

14
ColorlessWorld-2024-4-2/Assets/Scripts/Enemy/Mushroom.cs

@ -84,6 +84,8 @@ public class Mushroom : MonoBehaviour
MapUnity currentNode = GameManager.Instance.X[enemyNode.positionX].Y[enemyNode.positionY];
HashSet<MapUnity> targetNodes = new HashSet<MapUnity> { currentNode };
getNodeTools.getCircleNode(targetNodes, 1);
enemyNode.anim.SetTrigger("Action");
yield return new WaitForSeconds(0.5f);
foreach (MapUnity node in targetNodes)
{
node.switchColor(Name.NodeColor.Black);
@ -104,6 +106,8 @@ public class Mushroom : MonoBehaviour
{
if (!enemyNode.EnemyState.abnormalCondition.ContainsKey(AbnormalCondition.disarm))
{
enemyNode.anim.SetTrigger("Action");
yield return new WaitForSeconds(0.5f);
AttackDamage(enemyNode.EnemyState.damage);
}
}
@ -116,6 +120,8 @@ public class Mushroom : MonoBehaviour
{
if (!enemyNode.EnemyState.abnormalCondition.ContainsKey(AbnormalCondition.disarm))
{
enemyNode.anim.SetTrigger("Action");
yield return new WaitForSeconds(0.5f);
AttackDamage(enemyNode.EnemyState.damage);
}
}
@ -129,6 +135,8 @@ public class Mushroom : MonoBehaviour
{
if (!enemyNode.EnemyState.abnormalCondition.ContainsKey(AbnormalCondition.disarm))
{
enemyNode.anim.SetTrigger("Action");
yield return new WaitForSeconds(0.5f);
Usermanager.Instance.SufferPlayerAbnormalCondition(AbnormalCondition.weak, 1);
AttackDamage(enemyNode.EnemyState.damage);
}
@ -142,6 +150,8 @@ public class Mushroom : MonoBehaviour
{
if (!enemyNode.EnemyState.abnormalCondition.ContainsKey(AbnormalCondition.disarm))
{
enemyNode.anim.SetTrigger("Action");
yield return new WaitForSeconds(0.5f);
Usermanager.Instance.SufferPlayerAbnormalCondition(AbnormalCondition.weak, 1);
AttackDamage(enemyNode.EnemyState.damage);
}
@ -156,6 +166,8 @@ public class Mushroom : MonoBehaviour
{
if (!enemyNode.EnemyState.abnormalCondition.ContainsKey(AbnormalCondition.disarm))
{
enemyNode.anim.SetTrigger("Action");
yield return new WaitForSeconds(0.5f);
Usermanager.Instance.SufferPlayerAbnormalCondition(AbnormalCondition.downSpeed, 1);
AttackDamage(enemyNode.EnemyState.damage);
}
@ -169,6 +181,8 @@ public class Mushroom : MonoBehaviour
{
if (!enemyNode.EnemyState.abnormalCondition.ContainsKey(AbnormalCondition.disarm))
{
enemyNode.anim.SetTrigger("Action");
yield return new WaitForSeconds(0.5f);
Usermanager.Instance.SufferPlayerAbnormalCondition(AbnormalCondition.downSpeed, 1);
AttackDamage(enemyNode.EnemyState.damage);
}

16
ColorlessWorld-2024-4-2/Assets/Scripts/Enemy/Polymaw.cs

@ -145,6 +145,8 @@ public class Polymaw : MonoBehaviour
Debug.Log("if³É¹¦");
if (!enemyNode.EnemyState.abnormalCondition.ContainsKey(AbnormalCondition.disarm))
{
enemyNode.anim.SetTrigger("Action");
yield return new WaitForSeconds(0.5f);
AttackDamage();
}
}
@ -158,6 +160,8 @@ public class Polymaw : MonoBehaviour
{
if (!enemyNode.EnemyState.abnormalCondition.ContainsKey(AbnormalCondition.disarm))
{
enemyNode.anim.SetTrigger("Action");
yield return new WaitForSeconds(0.5f);
AttackDamage();
}
}
@ -177,6 +181,8 @@ public class Polymaw : MonoBehaviour
Debug.Log("attackRangeÊÇ"+ enemyNode.EnemyState.attackRange);
if (!enemyNode.EnemyState.abnormalCondition.ContainsKey(AbnormalCondition.disarm))
{
enemyNode.anim.SetTrigger("Action");
yield return new WaitForSeconds(0.5f);
AttackDamage();
foreach (MapUnity node in targetNodes)
{
@ -190,10 +196,12 @@ public class Polymaw : MonoBehaviour
yield return StartCoroutine(moveTowardsPlayer());
yield return new WaitForSeconds(1);
currentNode = GameManager.Instance.X[enemyNode.positionX].Y[enemyNode.positionY];
if (getNodeTools.canRemoteAttack(currentNode, enemyNode.EnemyState.attackRange))
if (getNodeTools.canRemoteAttack(enemyOn, enemyNode.EnemyState.attackRange))
{
if (!enemyNode.EnemyState.abnormalCondition.ContainsKey(AbnormalCondition.disarm))
{
enemyNode.anim.SetTrigger("Action");
yield return new WaitForSeconds(0.5f);
AttackDamage();
foreach (MapUnity node in targetNodes)
{
@ -212,6 +220,8 @@ public class Polymaw : MonoBehaviour
Debug.Log("if³É¹¦");
if (!enemyNode.EnemyState.abnormalCondition.ContainsKey(AbnormalCondition.disarm))
{
enemyNode.anim.SetTrigger("Action");
yield return new WaitForSeconds(0.5f);
AttackDamage();
}
@ -226,6 +236,8 @@ public class Polymaw : MonoBehaviour
{
if (!enemyNode.EnemyState.abnormalCondition.ContainsKey(AbnormalCondition.disarm))
{
enemyNode.anim.SetTrigger("Action");
yield return new WaitForSeconds(0.5f);
AttackDamage();
}
}
@ -239,6 +251,8 @@ public class Polymaw : MonoBehaviour
MapUnity currentNode = GameManager.Instance.X[enemyNode.positionX].Y[enemyNode.positionY];
HashSet<MapUnity> targetNodes = new HashSet<MapUnity> { currentNode };
getNodeTools.getCircleNode(targetNodes, 2);
enemyNode.anim.SetTrigger("Action");
yield return new WaitForSeconds(0.5f);
foreach (MapUnity node in targetNodes)
{
node.switchColor(Name.NodeColor.Black);

39
ColorlessWorld-2024-4-2/Assets/Scripts/Legacy/LegacyManager.cs

@ -15,6 +15,18 @@ public class LegacyManager : Singleton <LegacyManager>
//遗物字典(读表)
public Dictionary<string, List<string>> relicsDictionary = new Dictionary<string, List<string>>();
public HashSet<string> shopRelicsSet = new HashSet<string>
{Name.Legacy.LegacyNode_VulcanHammer,Name.Legacy.LegacyNode_Starfish,
Name.Legacy.LegacyNode_SuspiciousMushroom
}
;
public HashSet<string> commonRelicsSet = new HashSet<string>
{Name.Legacy.LegacyNode_EnchantedConch,Name.Legacy.LegacyNode_GoldVines,
Name.Legacy.LegacyNode_SnakeGall,Name.Legacy.LegacyNode_AgnisTorch
}
;
[Header("从玩家数据读过来的遗物类名表")]
public List<string> relicClassNameList = new List<string>();
@ -48,6 +60,33 @@ public class LegacyManager : Singleton <LegacyManager>
relicClassNameList.Add(className);
}
public HashSet<string> getRandomRelicForShop(int count)
{
HashSet<string> trueSet = new HashSet<string>(shopRelicsSet);
foreach (string relic in relicClassNameList)
{
if (trueSet.Contains(relic))
{
trueSet.Remove(relic);
}
}
return MathTool.GetRandomElements(trueSet, count);
}
public HashSet<string> getRandomRelicForCommon(int count)
{
HashSet<string> trueSet = new HashSet<string>(commonRelicsSet);
foreach (string relic in relicClassNameList)
{
if (trueSet.Contains(relic))
{
trueSet.Remove(relic);
}
}
return MathTool.GetRandomElements(trueSet, count);
}
public void ShowLegacyClassAsOwned()
{
for(int i=0;i<relicClassNameList .Count;i++)

10
ColorlessWorld-2024-4-2/Assets/Scripts/Tool/MathTool.cs

@ -129,6 +129,16 @@ public class MathTool
}
return new HashSet<MapUnity>(set.OrderBy(x => rand.Next()).Take(a));
}
public static HashSet<string> GetRandomElements(HashSet<string> set, int a)
{
System.Random rand = new System.Random();
if (a >= set.Count)
{
return new HashSet<string>(set);
}
return new HashSet<string>(set.OrderBy(x => rand.Next()).Take(a));
}
}

Loading…
Cancel
Save