From ca64c08f7e9477c9c3a3b2f803f2bcf68d4066ba Mon Sep 17 00:00:00 2001 From: xianyi Date: Mon, 11 Aug 2025 14:09:21 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E4=B8=89=E9=98=B5=E8=90=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/TcgEngine/Resources/GameplayData.asset | 8 +- Assets/TcgEngine/Scenes/Game/Game.unity | 648 +++--------------- .../Scripts/Conditions/ConditionPlayerStat.cs | 18 + .../Scripts/Conditions/ConditionStat.cs | 39 ++ .../Scripts/Conditions/FilterHighestStat.cs | 16 + .../Scripts/Conditions/FilterLowestStat.cs | 15 + Assets/TcgEngine/Scripts/Data/CardData.cs | 29 +- .../Scripts/Effects/EffectAddStat.cs | 40 +- .../Scripts/Effects/EffectAddStatCount.cs | 34 +- .../Scripts/Effects/EffectAddStatRoll.cs | 23 + .../TcgEngine/Scripts/Effects/EffectMana.cs | 29 +- .../Scripts/Effects/EffectSetStat.cs | 30 +- Assets/TcgEngine/Scripts/GameLogic/Card.cs | 87 ++- Assets/TcgEngine/Scripts/GameLogic/Game.cs | 12 +- .../TcgEngine/Scripts/GameLogic/GameLogic.cs | 43 +- Assets/TcgEngine/Scripts/GameLogic/Player.cs | 191 +++++- Assets/TcgEngine/Scripts/UI/PlayerUI.cs | 55 +- 17 files changed, 734 insertions(+), 583 deletions(-) diff --git a/Assets/TcgEngine/Resources/GameplayData.asset b/Assets/TcgEngine/Resources/GameplayData.asset index c569501..940f195 100644 --- a/Assets/TcgEngine/Resources/GameplayData.asset +++ b/Assets/TcgEngine/Resources/GameplayData.asset @@ -13,14 +13,18 @@ MonoBehaviour: m_Name: GameplayData m_EditorClassIdentifier: hp_start: 999 - mana_start: 2 + # 起始mana + mana_start: 1 + # 每回合增加mana mana_per_turn: 1 + # 最大mana上限 mana_max: 10 # 初始化手牌数量 cards_start: 3 cards_per_turn: 1 cards_max: 10 - turn_duration: 60 + # 超时时间 + turn_duration: 600 second_bonus: {fileID: 11400000, guid: 9503f60659f1df04eb3dd7fa925885fb, type: 2} mulligan: 1 deck_size: 8 diff --git a/Assets/TcgEngine/Scenes/Game/Game.unity b/Assets/TcgEngine/Scenes/Game/Game.unity index 2ecb10a..62f194a 100644 --- a/Assets/TcgEngine/Scenes/Game/Game.unity +++ b/Assets/TcgEngine/Scenes/Game/Game.unity @@ -123,6 +123,18 @@ NavMeshSettings: debug: m_Flags: 0 m_NavMeshData: {fileID: 0} +--- !u!114 &56302001 stripped +MonoBehaviour: + m_CorrespondingSourceObject: {fileID: 209928453693938780, guid: b2cda006105c05b428bace831c06c984, + type: 3} + m_PrefabInstance: {fileID: 962576083989124239} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: bf1498eac12d8c14e98918e5ac2baf2c, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!4 &87995967 stripped Transform: m_CorrespondingSourceObject: {fileID: 7426997187891162979, guid: 683a057051c59804eb32a44954f69029, @@ -224,146 +236,24 @@ Transform: m_Father: {fileID: 0} m_RootOrder: 6 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &570405431 stripped +MonoBehaviour: + m_CorrespondingSourceObject: {fileID: 3188539720586938462, guid: c0560a244fe3e0f4ca2ea65c54093d1c, + type: 3} + m_PrefabInstance: {fileID: 1701871964} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: bf1498eac12d8c14e98918e5ac2baf2c, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!4 &572134229 stripped Transform: m_CorrespondingSourceObject: {fileID: 5621716278606480176, guid: 310f492c3e6afc24b9cb0f4f467ec27d, type: 3} m_PrefabInstance: {fileID: 5621716279108096101} m_PrefabAsset: {fileID: 0} ---- !u!1001 &586676445 -PrefabInstance: - m_ObjectHideFlags: 0 - serializedVersion: 2 - m_Modification: - m_TransformParent: {fileID: 962576083989124240} - m_Modifications: - - target: {fileID: 1789197561201869425, guid: c0560a244fe3e0f4ca2ea65c54093d1c, - type: 3} - propertyPath: m_Pivot.x - value: 0.5 - objectReference: {fileID: 0} - - target: {fileID: 1789197561201869425, guid: c0560a244fe3e0f4ca2ea65c54093d1c, - type: 3} - propertyPath: m_Pivot.y - value: 0.5 - objectReference: {fileID: 0} - - target: {fileID: 1789197561201869425, guid: c0560a244fe3e0f4ca2ea65c54093d1c, - type: 3} - propertyPath: m_RootOrder - value: 12 - objectReference: {fileID: 0} - - target: {fileID: 1789197561201869425, guid: c0560a244fe3e0f4ca2ea65c54093d1c, - type: 3} - propertyPath: m_AnchorMax.x - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 1789197561201869425, guid: c0560a244fe3e0f4ca2ea65c54093d1c, - type: 3} - propertyPath: m_AnchorMax.y - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 1789197561201869425, guid: c0560a244fe3e0f4ca2ea65c54093d1c, - type: 3} - propertyPath: m_AnchorMin.x - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 1789197561201869425, guid: c0560a244fe3e0f4ca2ea65c54093d1c, - type: 3} - propertyPath: m_AnchorMin.y - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 1789197561201869425, guid: c0560a244fe3e0f4ca2ea65c54093d1c, - type: 3} - propertyPath: m_SizeDelta.x - value: 450 - objectReference: {fileID: 0} - - target: {fileID: 1789197561201869425, guid: c0560a244fe3e0f4ca2ea65c54093d1c, - type: 3} - propertyPath: m_SizeDelta.y - value: 50 - objectReference: {fileID: 0} - - target: {fileID: 1789197561201869425, guid: c0560a244fe3e0f4ca2ea65c54093d1c, - type: 3} - propertyPath: m_LocalScale.x - value: 0.5 - objectReference: {fileID: 0} - - target: {fileID: 1789197561201869425, guid: c0560a244fe3e0f4ca2ea65c54093d1c, - type: 3} - propertyPath: m_LocalScale.y - value: 0.5 - objectReference: {fileID: 0} - - target: {fileID: 1789197561201869425, guid: c0560a244fe3e0f4ca2ea65c54093d1c, - type: 3} - propertyPath: m_LocalScale.z - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 1789197561201869425, guid: c0560a244fe3e0f4ca2ea65c54093d1c, - type: 3} - propertyPath: m_LocalPosition.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1789197561201869425, guid: c0560a244fe3e0f4ca2ea65c54093d1c, - type: 3} - propertyPath: m_LocalPosition.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1789197561201869425, guid: c0560a244fe3e0f4ca2ea65c54093d1c, - type: 3} - propertyPath: m_LocalPosition.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1789197561201869425, guid: c0560a244fe3e0f4ca2ea65c54093d1c, - type: 3} - propertyPath: m_LocalRotation.w - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 1789197561201869425, guid: c0560a244fe3e0f4ca2ea65c54093d1c, - type: 3} - propertyPath: m_LocalRotation.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1789197561201869425, guid: c0560a244fe3e0f4ca2ea65c54093d1c, - type: 3} - propertyPath: m_LocalRotation.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1789197561201869425, guid: c0560a244fe3e0f4ca2ea65c54093d1c, - type: 3} - propertyPath: m_LocalRotation.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1789197561201869425, guid: c0560a244fe3e0f4ca2ea65c54093d1c, - type: 3} - propertyPath: m_AnchoredPosition.x - value: -153.09961 - objectReference: {fileID: 0} - - target: {fileID: 1789197561201869425, guid: c0560a244fe3e0f4ca2ea65c54093d1c, - type: 3} - propertyPath: m_AnchoredPosition.y - value: -145 - objectReference: {fileID: 0} - - target: {fileID: 1789197561201869425, guid: c0560a244fe3e0f4ca2ea65c54093d1c, - type: 3} - propertyPath: m_LocalEulerAnglesHint.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1789197561201869425, guid: c0560a244fe3e0f4ca2ea65c54093d1c, - type: 3} - propertyPath: m_LocalEulerAnglesHint.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1789197561201869425, guid: c0560a244fe3e0f4ca2ea65c54093d1c, - type: 3} - propertyPath: m_LocalEulerAnglesHint.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1806244588100620830, guid: c0560a244fe3e0f4ca2ea65c54093d1c, - type: 3} - propertyPath: m_Name - value: ManaBar_4 - objectReference: {fileID: 0} - m_RemovedComponents: [] - m_SourcePrefab: {fileID: 100100000, guid: c0560a244fe3e0f4ca2ea65c54093d1c, type: 3} --- !u!1001 &586821846 PrefabInstance: m_ObjectHideFlags: 0 @@ -844,140 +734,6 @@ PrefabInstance: objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: c0560a244fe3e0f4ca2ea65c54093d1c, type: 3} ---- !u!1001 &827800334 -PrefabInstance: - m_ObjectHideFlags: 0 - serializedVersion: 2 - m_Modification: - m_TransformParent: {fileID: 962576083989124241} - m_Modifications: - - target: {fileID: 1789197561201869425, guid: c0560a244fe3e0f4ca2ea65c54093d1c, - type: 3} - propertyPath: m_Pivot.x - value: 0.5 - objectReference: {fileID: 0} - - target: {fileID: 1789197561201869425, guid: c0560a244fe3e0f4ca2ea65c54093d1c, - type: 3} - propertyPath: m_Pivot.y - value: 0.5 - objectReference: {fileID: 0} - - target: {fileID: 1789197561201869425, guid: c0560a244fe3e0f4ca2ea65c54093d1c, - type: 3} - propertyPath: m_RootOrder - value: 13 - objectReference: {fileID: 0} - - target: {fileID: 1789197561201869425, guid: c0560a244fe3e0f4ca2ea65c54093d1c, - type: 3} - propertyPath: m_AnchorMax.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1789197561201869425, guid: c0560a244fe3e0f4ca2ea65c54093d1c, - type: 3} - propertyPath: m_AnchorMax.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1789197561201869425, guid: c0560a244fe3e0f4ca2ea65c54093d1c, - type: 3} - propertyPath: m_AnchorMin.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1789197561201869425, guid: c0560a244fe3e0f4ca2ea65c54093d1c, - type: 3} - propertyPath: m_AnchorMin.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1789197561201869425, guid: c0560a244fe3e0f4ca2ea65c54093d1c, - type: 3} - propertyPath: m_SizeDelta.x - value: 450 - objectReference: {fileID: 0} - - target: {fileID: 1789197561201869425, guid: c0560a244fe3e0f4ca2ea65c54093d1c, - type: 3} - propertyPath: m_SizeDelta.y - value: 50 - objectReference: {fileID: 0} - - target: {fileID: 1789197561201869425, guid: c0560a244fe3e0f4ca2ea65c54093d1c, - type: 3} - propertyPath: m_LocalScale.x - value: 0.5 - objectReference: {fileID: 0} - - target: {fileID: 1789197561201869425, guid: c0560a244fe3e0f4ca2ea65c54093d1c, - type: 3} - propertyPath: m_LocalScale.y - value: 0.5 - objectReference: {fileID: 0} - - target: {fileID: 1789197561201869425, guid: c0560a244fe3e0f4ca2ea65c54093d1c, - type: 3} - propertyPath: m_LocalScale.z - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 1789197561201869425, guid: c0560a244fe3e0f4ca2ea65c54093d1c, - type: 3} - propertyPath: m_LocalPosition.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1789197561201869425, guid: c0560a244fe3e0f4ca2ea65c54093d1c, - type: 3} - propertyPath: m_LocalPosition.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1789197561201869425, guid: c0560a244fe3e0f4ca2ea65c54093d1c, - type: 3} - propertyPath: m_LocalPosition.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1789197561201869425, guid: c0560a244fe3e0f4ca2ea65c54093d1c, - type: 3} - propertyPath: m_LocalRotation.w - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 1789197561201869425, guid: c0560a244fe3e0f4ca2ea65c54093d1c, - type: 3} - propertyPath: m_LocalRotation.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1789197561201869425, guid: c0560a244fe3e0f4ca2ea65c54093d1c, - type: 3} - propertyPath: m_LocalRotation.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1789197561201869425, guid: c0560a244fe3e0f4ca2ea65c54093d1c, - type: 3} - propertyPath: m_LocalRotation.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1789197561201869425, guid: c0560a244fe3e0f4ca2ea65c54093d1c, - type: 3} - propertyPath: m_AnchoredPosition.x - value: 234.5 - objectReference: {fileID: 0} - - target: {fileID: 1789197561201869425, guid: c0560a244fe3e0f4ca2ea65c54093d1c, - type: 3} - propertyPath: m_AnchoredPosition.y - value: 145 - objectReference: {fileID: 0} - - target: {fileID: 1789197561201869425, guid: c0560a244fe3e0f4ca2ea65c54093d1c, - type: 3} - propertyPath: m_LocalEulerAnglesHint.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1789197561201869425, guid: c0560a244fe3e0f4ca2ea65c54093d1c, - type: 3} - propertyPath: m_LocalEulerAnglesHint.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1789197561201869425, guid: c0560a244fe3e0f4ca2ea65c54093d1c, - type: 3} - propertyPath: m_LocalEulerAnglesHint.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1806244588100620830, guid: c0560a244fe3e0f4ca2ea65c54093d1c, - type: 3} - propertyPath: m_Name - value: ManaBar_4 - objectReference: {fileID: 0} - m_RemovedComponents: [] - m_SourcePrefab: {fileID: 100100000, guid: c0560a244fe3e0f4ca2ea65c54093d1c, type: 3} --- !u!1001 &839364591 PrefabInstance: m_ObjectHideFlags: 0 @@ -1273,140 +1029,6 @@ Transform: type: 3} m_PrefabInstance: {fileID: 978862161} m_PrefabAsset: {fileID: 0} ---- !u!1001 &1130443655 -PrefabInstance: - m_ObjectHideFlags: 0 - serializedVersion: 2 - m_Modification: - m_TransformParent: {fileID: 962576083989124241} - m_Modifications: - - target: {fileID: 1789197561201869425, guid: c0560a244fe3e0f4ca2ea65c54093d1c, - type: 3} - propertyPath: m_Pivot.x - value: 0.5 - objectReference: {fileID: 0} - - target: {fileID: 1789197561201869425, guid: c0560a244fe3e0f4ca2ea65c54093d1c, - type: 3} - propertyPath: m_Pivot.y - value: 0.5 - objectReference: {fileID: 0} - - target: {fileID: 1789197561201869425, guid: c0560a244fe3e0f4ca2ea65c54093d1c, - type: 3} - propertyPath: m_RootOrder - value: 12 - objectReference: {fileID: 0} - - target: {fileID: 1789197561201869425, guid: c0560a244fe3e0f4ca2ea65c54093d1c, - type: 3} - propertyPath: m_AnchorMax.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1789197561201869425, guid: c0560a244fe3e0f4ca2ea65c54093d1c, - type: 3} - propertyPath: m_AnchorMax.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1789197561201869425, guid: c0560a244fe3e0f4ca2ea65c54093d1c, - type: 3} - propertyPath: m_AnchorMin.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1789197561201869425, guid: c0560a244fe3e0f4ca2ea65c54093d1c, - type: 3} - propertyPath: m_AnchorMin.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1789197561201869425, guid: c0560a244fe3e0f4ca2ea65c54093d1c, - type: 3} - propertyPath: m_SizeDelta.x - value: 450 - objectReference: {fileID: 0} - - target: {fileID: 1789197561201869425, guid: c0560a244fe3e0f4ca2ea65c54093d1c, - type: 3} - propertyPath: m_SizeDelta.y - value: 50 - objectReference: {fileID: 0} - - target: {fileID: 1789197561201869425, guid: c0560a244fe3e0f4ca2ea65c54093d1c, - type: 3} - propertyPath: m_LocalScale.x - value: 0.5 - objectReference: {fileID: 0} - - target: {fileID: 1789197561201869425, guid: c0560a244fe3e0f4ca2ea65c54093d1c, - type: 3} - propertyPath: m_LocalScale.y - value: 0.5 - objectReference: {fileID: 0} - - target: {fileID: 1789197561201869425, guid: c0560a244fe3e0f4ca2ea65c54093d1c, - type: 3} - propertyPath: m_LocalScale.z - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 1789197561201869425, guid: c0560a244fe3e0f4ca2ea65c54093d1c, - type: 3} - propertyPath: m_LocalPosition.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1789197561201869425, guid: c0560a244fe3e0f4ca2ea65c54093d1c, - type: 3} - propertyPath: m_LocalPosition.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1789197561201869425, guid: c0560a244fe3e0f4ca2ea65c54093d1c, - type: 3} - propertyPath: m_LocalPosition.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1789197561201869425, guid: c0560a244fe3e0f4ca2ea65c54093d1c, - type: 3} - propertyPath: m_LocalRotation.w - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 1789197561201869425, guid: c0560a244fe3e0f4ca2ea65c54093d1c, - type: 3} - propertyPath: m_LocalRotation.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1789197561201869425, guid: c0560a244fe3e0f4ca2ea65c54093d1c, - type: 3} - propertyPath: m_LocalRotation.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1789197561201869425, guid: c0560a244fe3e0f4ca2ea65c54093d1c, - type: 3} - propertyPath: m_LocalRotation.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1789197561201869425, guid: c0560a244fe3e0f4ca2ea65c54093d1c, - type: 3} - propertyPath: m_AnchoredPosition.x - value: 234.5 - objectReference: {fileID: 0} - - target: {fileID: 1789197561201869425, guid: c0560a244fe3e0f4ca2ea65c54093d1c, - type: 3} - propertyPath: m_AnchoredPosition.y - value: 115 - objectReference: {fileID: 0} - - target: {fileID: 1789197561201869425, guid: c0560a244fe3e0f4ca2ea65c54093d1c, - type: 3} - propertyPath: m_LocalEulerAnglesHint.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1789197561201869425, guid: c0560a244fe3e0f4ca2ea65c54093d1c, - type: 3} - propertyPath: m_LocalEulerAnglesHint.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1789197561201869425, guid: c0560a244fe3e0f4ca2ea65c54093d1c, - type: 3} - propertyPath: m_LocalEulerAnglesHint.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1806244588100620830, guid: c0560a244fe3e0f4ca2ea65c54093d1c, - type: 3} - propertyPath: m_Name - value: ManaBar_3 - objectReference: {fileID: 0} - m_RemovedComponents: [] - m_SourcePrefab: {fileID: 100100000, guid: c0560a244fe3e0f4ca2ea65c54093d1c, type: 3} --- !u!1001 &1156614218 PrefabInstance: m_ObjectHideFlags: 0 @@ -1487,6 +1109,18 @@ Transform: type: 3} m_PrefabInstance: {fileID: 1156614218} m_PrefabAsset: {fileID: 0} +--- !u!114 &1236539333 stripped +MonoBehaviour: + m_CorrespondingSourceObject: {fileID: 3188539720586938462, guid: c0560a244fe3e0f4ca2ea65c54093d1c, + type: 3} + m_PrefabInstance: {fileID: 586821846} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: bf1498eac12d8c14e98918e5ac2baf2c, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!1001 &1307629563 PrefabInstance: m_ObjectHideFlags: 0 @@ -1582,140 +1216,18 @@ Transform: type: 3} m_PrefabInstance: {fileID: 1307629563} m_PrefabAsset: {fileID: 0} ---- !u!1001 &1322746473 -PrefabInstance: - m_ObjectHideFlags: 0 - serializedVersion: 2 - m_Modification: - m_TransformParent: {fileID: 962576083989124240} - m_Modifications: - - target: {fileID: 1789197561201869425, guid: c0560a244fe3e0f4ca2ea65c54093d1c, - type: 3} - propertyPath: m_Pivot.x - value: 0.5 - objectReference: {fileID: 0} - - target: {fileID: 1789197561201869425, guid: c0560a244fe3e0f4ca2ea65c54093d1c, - type: 3} - propertyPath: m_Pivot.y - value: 0.5 - objectReference: {fileID: 0} - - target: {fileID: 1789197561201869425, guid: c0560a244fe3e0f4ca2ea65c54093d1c, - type: 3} - propertyPath: m_RootOrder - value: 11 - objectReference: {fileID: 0} - - target: {fileID: 1789197561201869425, guid: c0560a244fe3e0f4ca2ea65c54093d1c, - type: 3} - propertyPath: m_AnchorMax.x - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 1789197561201869425, guid: c0560a244fe3e0f4ca2ea65c54093d1c, - type: 3} - propertyPath: m_AnchorMax.y - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 1789197561201869425, guid: c0560a244fe3e0f4ca2ea65c54093d1c, - type: 3} - propertyPath: m_AnchorMin.x - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 1789197561201869425, guid: c0560a244fe3e0f4ca2ea65c54093d1c, - type: 3} - propertyPath: m_AnchorMin.y - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 1789197561201869425, guid: c0560a244fe3e0f4ca2ea65c54093d1c, - type: 3} - propertyPath: m_SizeDelta.x - value: 450 - objectReference: {fileID: 0} - - target: {fileID: 1789197561201869425, guid: c0560a244fe3e0f4ca2ea65c54093d1c, - type: 3} - propertyPath: m_SizeDelta.y - value: 50 - objectReference: {fileID: 0} - - target: {fileID: 1789197561201869425, guid: c0560a244fe3e0f4ca2ea65c54093d1c, - type: 3} - propertyPath: m_LocalScale.x - value: 0.5 - objectReference: {fileID: 0} - - target: {fileID: 1789197561201869425, guid: c0560a244fe3e0f4ca2ea65c54093d1c, - type: 3} - propertyPath: m_LocalScale.y - value: 0.5 - objectReference: {fileID: 0} - - target: {fileID: 1789197561201869425, guid: c0560a244fe3e0f4ca2ea65c54093d1c, - type: 3} - propertyPath: m_LocalScale.z - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 1789197561201869425, guid: c0560a244fe3e0f4ca2ea65c54093d1c, - type: 3} - propertyPath: m_LocalPosition.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1789197561201869425, guid: c0560a244fe3e0f4ca2ea65c54093d1c, - type: 3} - propertyPath: m_LocalPosition.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1789197561201869425, guid: c0560a244fe3e0f4ca2ea65c54093d1c, - type: 3} - propertyPath: m_LocalPosition.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1789197561201869425, guid: c0560a244fe3e0f4ca2ea65c54093d1c, - type: 3} - propertyPath: m_LocalRotation.w - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 1789197561201869425, guid: c0560a244fe3e0f4ca2ea65c54093d1c, - type: 3} - propertyPath: m_LocalRotation.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1789197561201869425, guid: c0560a244fe3e0f4ca2ea65c54093d1c, - type: 3} - propertyPath: m_LocalRotation.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1789197561201869425, guid: c0560a244fe3e0f4ca2ea65c54093d1c, - type: 3} - propertyPath: m_LocalRotation.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1789197561201869425, guid: c0560a244fe3e0f4ca2ea65c54093d1c, - type: 3} - propertyPath: m_AnchoredPosition.x - value: -153.09961 - objectReference: {fileID: 0} - - target: {fileID: 1789197561201869425, guid: c0560a244fe3e0f4ca2ea65c54093d1c, - type: 3} - propertyPath: m_AnchoredPosition.y - value: -115 - objectReference: {fileID: 0} - - target: {fileID: 1789197561201869425, guid: c0560a244fe3e0f4ca2ea65c54093d1c, - type: 3} - propertyPath: m_LocalEulerAnglesHint.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1789197561201869425, guid: c0560a244fe3e0f4ca2ea65c54093d1c, - type: 3} - propertyPath: m_LocalEulerAnglesHint.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1789197561201869425, guid: c0560a244fe3e0f4ca2ea65c54093d1c, - type: 3} - propertyPath: m_LocalEulerAnglesHint.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1806244588100620830, guid: c0560a244fe3e0f4ca2ea65c54093d1c, - type: 3} - propertyPath: m_Name - value: ManaBar_3 - objectReference: {fileID: 0} - m_RemovedComponents: [] - m_SourcePrefab: {fileID: 100100000, guid: c0560a244fe3e0f4ca2ea65c54093d1c, type: 3} +--- !u!114 &1310842031 stripped +MonoBehaviour: + m_CorrespondingSourceObject: {fileID: 22293539287746189, guid: b2cda006105c05b428bace831c06c984, + type: 3} + m_PrefabInstance: {fileID: 962576083989124239} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: bf1498eac12d8c14e98918e5ac2baf2c, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!1001 &1452264122 PrefabInstance: m_ObjectHideFlags: 0 @@ -1930,6 +1442,18 @@ Camera: type: 3} m_PrefabInstance: {fileID: 4127392486269000878} m_PrefabAsset: {fileID: 0} +--- !u!114 &1516502394 stripped +MonoBehaviour: + m_CorrespondingSourceObject: {fileID: 3188539720586938462, guid: c0560a244fe3e0f4ca2ea65c54093d1c, + type: 3} + m_PrefabInstance: {fileID: 746266444} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: bf1498eac12d8c14e98918e5ac2baf2c, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!1001 &1591726936 PrefabInstance: m_ObjectHideFlags: 0 @@ -2426,6 +1950,18 @@ Transform: type: 3} m_PrefabInstance: {fileID: 1856883457} m_PrefabAsset: {fileID: 0} +--- !u!114 &1858421782 stripped +MonoBehaviour: + m_CorrespondingSourceObject: {fileID: 3188539720586938462, guid: c0560a244fe3e0f4ca2ea65c54093d1c, + type: 3} + m_PrefabInstance: {fileID: 1452264122} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: bf1498eac12d8c14e98918e5ac2baf2c, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!1 &1892906615 GameObject: m_ObjectHideFlags: 0 @@ -2706,6 +2242,11 @@ PrefabInstance: propertyPath: m_AnchoredPosition.y value: -25 objectReference: {fileID: 0} + - target: {fileID: 3846590587645140173, guid: b2cda006105c05b428bace831c06c984, + type: 3} + propertyPath: m_Name + value: ManaBar_0 + objectReference: {fileID: 0} - target: {fileID: 3891856200958776947, guid: b2cda006105c05b428bace831c06c984, type: 3} propertyPath: m_AnchoredPosition.x @@ -2716,6 +2257,11 @@ PrefabInstance: propertyPath: m_AnchoredPosition.y value: 25 objectReference: {fileID: 0} + - target: {fileID: 4019241431521019420, guid: b2cda006105c05b428bace831c06c984, + type: 3} + propertyPath: m_Name + value: ManaBar_0 + objectReference: {fileID: 0} - target: {fileID: 5099985182589560896, guid: b2cda006105c05b428bace831c06c984, type: 3} propertyPath: m_AnchoredPosition.x @@ -2781,6 +2327,21 @@ PrefabInstance: propertyPath: m_AnchoredPosition.y value: 76.16995 objectReference: {fileID: 0} + - target: {fileID: 8064129199798896601, guid: b2cda006105c05b428bace831c06c984, + type: 3} + propertyPath: team_mana_bars.Array.data[0] + value: + objectReference: {fileID: 1310842031} + - target: {fileID: 8064129199798896601, guid: b2cda006105c05b428bace831c06c984, + type: 3} + propertyPath: team_mana_bars.Array.data[1] + value: + objectReference: {fileID: 1516502394} + - target: {fileID: 8064129199798896601, guid: b2cda006105c05b428bace831c06c984, + type: 3} + propertyPath: team_mana_bars.Array.data[2] + value: + objectReference: {fileID: 570405431} - target: {fileID: 8092412741755098697, guid: b2cda006105c05b428bace831c06c984, type: 3} propertyPath: m_IsActive @@ -2796,6 +2357,21 @@ PrefabInstance: propertyPath: m_AnchoredPosition.y value: -50 objectReference: {fileID: 0} + - target: {fileID: 8236030736308582322, guid: b2cda006105c05b428bace831c06c984, + type: 3} + propertyPath: team_mana_bars.Array.data[0] + value: + objectReference: {fileID: 56302001} + - target: {fileID: 8236030736308582322, guid: b2cda006105c05b428bace831c06c984, + type: 3} + propertyPath: team_mana_bars.Array.data[1] + value: + objectReference: {fileID: 1858421782} + - target: {fileID: 8236030736308582322, guid: b2cda006105c05b428bace831c06c984, + type: 3} + propertyPath: team_mana_bars.Array.data[2] + value: + objectReference: {fileID: 1236539333} - target: {fileID: 8559980341625567388, guid: b2cda006105c05b428bace831c06c984, type: 3} propertyPath: m_AnchoredPosition.x diff --git a/Assets/TcgEngine/Scripts/Conditions/ConditionPlayerStat.cs b/Assets/TcgEngine/Scripts/Conditions/ConditionPlayerStat.cs index 5a6b497..bef7e10 100644 --- a/Assets/TcgEngine/Scripts/Conditions/ConditionPlayerStat.cs +++ b/Assets/TcgEngine/Scripts/Conditions/ConditionPlayerStat.cs @@ -34,6 +34,24 @@ namespace TcgEngine return CompareInt(target.mana, oper, value); } + // 新增:火系法力值检查 + if (type == ConditionStatType.ManaFire) + { + return CompareInt(target.mana_fire, oper, value); + } + + // 新增:森林法力值检查 + if (type == ConditionStatType.ManaForest) + { + return CompareInt(target.mana_forest, oper, value); + } + + // 新增:水系法力值检查 + if (type == ConditionStatType.ManaWater) + { + return CompareInt(target.mana_water, oper, value); + } + return false; } } diff --git a/Assets/TcgEngine/Scripts/Conditions/ConditionStat.cs b/Assets/TcgEngine/Scripts/Conditions/ConditionStat.cs index a062a72..6961bef 100644 --- a/Assets/TcgEngine/Scripts/Conditions/ConditionStat.cs +++ b/Assets/TcgEngine/Scripts/Conditions/ConditionStat.cs @@ -10,6 +10,9 @@ namespace TcgEngine Attack = 10, HP = 20, Mana = 30, + ManaFire = 40, + ManaForest = 50, + ManaWater = 60, } /// @@ -41,6 +44,24 @@ namespace TcgEngine return CompareInt(target.GetMana(), oper, value); } + // 新增:火系法力值检查 + if (type == ConditionStatType.ManaFire) + { + return CompareInt(target.GetManaFire(), oper, value); + } + + // 新增:森林法力值检查 + if (type == ConditionStatType.ManaForest) + { + return CompareInt(target.GetManaForest(), oper, value); + } + + // 新增:水系法力值检查 + if (type == ConditionStatType.ManaWater) + { + return CompareInt(target.GetManaWater(), oper, value); + } + return false; } @@ -56,6 +77,24 @@ namespace TcgEngine return CompareInt(target.mana, oper, value); } + // 新增:火系法力值检查 + if (type == ConditionStatType.ManaFire) + { + return CompareInt(target.mana_fire, oper, value); + } + + // 新增:森林法力值检查 + if (type == ConditionStatType.ManaForest) + { + return CompareInt(target.mana_forest, oper, value); + } + + // 新增:水系法力值检查 + if (type == ConditionStatType.ManaWater) + { + return CompareInt(target.mana_water, oper, value); + } + return false; } } diff --git a/Assets/TcgEngine/Scripts/Conditions/FilterHighestStat.cs b/Assets/TcgEngine/Scripts/Conditions/FilterHighestStat.cs index cad93d5..474174d 100644 --- a/Assets/TcgEngine/Scripts/Conditions/FilterHighestStat.cs +++ b/Assets/TcgEngine/Scripts/Conditions/FilterHighestStat.cs @@ -47,6 +47,22 @@ namespace TcgEngine { return card.GetMana(); } + // 新增:火系法力值检查 + if (stat == ConditionStatType.ManaFire) + { + return card.GetManaFire(); + } + // 新增:森林法力值检查 + if (stat == ConditionStatType.ManaForest) + { + return card.GetManaForest(); + } + // 新增:水系法力值检查 + if (stat == ConditionStatType.ManaWater) + { + return card.GetManaWater(); + } + return 0; } } diff --git a/Assets/TcgEngine/Scripts/Conditions/FilterLowestStat.cs b/Assets/TcgEngine/Scripts/Conditions/FilterLowestStat.cs index 33c2529..b36e93f 100644 --- a/Assets/TcgEngine/Scripts/Conditions/FilterLowestStat.cs +++ b/Assets/TcgEngine/Scripts/Conditions/FilterLowestStat.cs @@ -47,6 +47,21 @@ namespace TcgEngine { return card.GetMana(); } + // 新增:火系法力值检查 + if (stat == ConditionStatType.ManaFire) + { + return card.GetManaFire(); + } + // 新增:森林法力值检查 + if (stat == ConditionStatType.ManaForest) + { + return card.GetManaForest(); + } + // 新增:水系法力值检查 + if (stat == ConditionStatType.ManaWater) + { + return card.GetManaWater(); + } return 0; } } diff --git a/Assets/TcgEngine/Scripts/Data/CardData.cs b/Assets/TcgEngine/Scripts/Data/CardData.cs index 14dcbc9..0f0fb6b 100644 --- a/Assets/TcgEngine/Scripts/Data/CardData.cs +++ b/Assets/TcgEngine/Scripts/Data/CardData.cs @@ -36,6 +36,11 @@ namespace TcgEngine public int attack; public int hp; + // 新增:三种元素法力值 + public int mana_fire; + public int mana_forest; + public int mana_water;  + [Header("Traits")] public TraitData[] traits; public TraitStat[] stats; @@ -166,7 +171,23 @@ namespace TcgEngine public bool IsDynamicManaCost() { - return mana > 99; + // 检查通用法力值是否为动态消耗 + if (mana > 99) + return true; + + // 检查火系法力值是否为动态消耗 + if (mana_fire > 99) + return true; + + // 检查森林法力值是否为动态消耗 + if (mana_forest > 99) + return true; + + // 检查水系法力值是否为动态消耗 + if (mana_water > 99) + return true; + + return false; } public bool HasTrait(string trait) @@ -181,7 +202,7 @@ namespace TcgEngine public bool HasTrait(TraitData trait) { - if(trait != null) + if (trait != null) return HasTrait(trait.id); return false; } @@ -201,7 +222,7 @@ namespace TcgEngine public bool HasStat(TraitData trait) { - if(trait != null) + if (trait != null) return HasStat(trait.id); return false; } @@ -221,7 +242,7 @@ namespace TcgEngine public int GetStat(TraitData trait) { - if(trait != null) + if (trait != null) return GetStat(trait.id); return 0; } diff --git a/Assets/TcgEngine/Scripts/Effects/EffectAddStat.cs b/Assets/TcgEngine/Scripts/Effects/EffectAddStat.cs index 19fc538..99c02ae 100644 --- a/Assets/TcgEngine/Scripts/Effects/EffectAddStat.cs +++ b/Assets/TcgEngine/Scripts/Effects/EffectAddStat.cs @@ -13,6 +13,9 @@ namespace TcgEngine public class EffectAddStat : EffectData { public EffectStatType type; + + [Header("Team Mana (only for Mana type)")] + public string team_id = ""; // 当type为Mana时,指定影响的阵营 public override void DoEffect(GameLogic logic, AbilityData ability, Card caster, Player target) { @@ -24,13 +27,23 @@ namespace TcgEngine if (type == EffectStatType.Mana) { - target.mana += ability.value; - target.mana_max += ability.value; - target.mana = Mathf.Max(target.mana, 0); - target.mana_max = Mathf.Clamp(target.mana_max, 0, GameplayData.Get().mana_max); + // 如果指定了阵营,影响阵营mana;否则影响通用mana + if (!string.IsNullOrEmpty(team_id)) + { + target.AddTeamMana(team_id, ability.value, ability.value); + } + else + { + Debug.Log($"AddStat Mana 通用: {ability.value}"); + target.mana += ability.value; + target.mana_max += ability.value; + target.mana = Mathf.Max(target.mana, 0); + target.mana_max = Mathf.Clamp(target.mana_max, 0, GameplayData.Get().mana_max); + } } } + // 永久效果 public override void DoEffect(GameLogic logic, AbilityData ability, Card caster, Card target) { if (type == EffectStatType.Attack) @@ -39,8 +52,16 @@ namespace TcgEngine target.hp += ability.value; if (type == EffectStatType.Mana) target.mana += ability.value; + + if (type == EffectStatType.ManaFire) + target.mana_fire += ability.value; + if (type == EffectStatType.ManaForest) + target.mana_forest += ability.value; + if (type == EffectStatType.ManaWater) + target.mana_water += ability.value; } + // 临时效果 public override void DoOngoingEffect(GameLogic logic, AbilityData ability, Card caster, Card target) { if (type == EffectStatType.Attack) @@ -49,6 +70,13 @@ namespace TcgEngine target.hp_ongoing += ability.value; if (type == EffectStatType.Mana) target.mana_ongoing += ability.value; + + if (type == EffectStatType.ManaFire) + target.mana_fire_ongoing += ability.value; + if (type == EffectStatType.ManaForest) + target.mana_forest_ongoing += ability.value; + if (type == EffectStatType.ManaWater) + target.mana_water_ongoing += ability.value; } } @@ -59,5 +87,9 @@ namespace TcgEngine Attack = 10, HP = 20, Mana = 30, + // 新增:三种元素法力值 + ManaFire = 40, + ManaForest = 50, + ManaWater = 60, } } \ No newline at end of file diff --git a/Assets/TcgEngine/Scripts/Effects/EffectAddStatCount.cs b/Assets/TcgEngine/Scripts/Effects/EffectAddStatCount.cs index e5f1782..3ab4cf1 100644 --- a/Assets/TcgEngine/Scripts/Effects/EffectAddStatCount.cs +++ b/Assets/TcgEngine/Scripts/Effects/EffectAddStatCount.cs @@ -19,6 +19,9 @@ namespace TcgEngine public CardType has_type; public TeamData has_team; public TraitData has_trait; + + [Header("Team Mana (only for Mana type)")] + public string team_id = ""; // 当type为Mana时,指定影响的阵营 public override void DoEffect(GameLogic logic, AbilityData ability, Card caster, Player target) { @@ -31,10 +34,19 @@ namespace TcgEngine if (type == EffectStatType.Mana) { - target.mana += val; - target.mana_max += val; - target.mana = Mathf.Max(target.mana, 0); - target.mana_max = Mathf.Clamp(target.mana_max, 0, GameplayData.Get().mana_max); + // 如果指定了阵营,影响阵营mana;否则影响通用mana + if (!string.IsNullOrEmpty(team_id)) + { + target.AddTeamMana(team_id, val, val); + } + else + { + Debug.Log($"AddStatCount Mana 通用: {val}"); + target.mana += val; + target.mana_max += val; + target.mana = Mathf.Max(target.mana, 0); + target.mana_max = Mathf.Clamp(target.mana_max, 0, GameplayData.Get().mana_max); + } } } @@ -47,6 +59,13 @@ namespace TcgEngine target.hp += val; if (type == EffectStatType.Mana) target.mana += val; + + if (type == EffectStatType.ManaFire) + target.mana_fire += val; + if (type == EffectStatType.ManaForest) + target.mana_forest += val; + if (type == EffectStatType.ManaWater) + target.mana_water += val; } public override void DoOngoingEffect(GameLogic logic, AbilityData ability, Card caster, Card target) @@ -58,6 +77,13 @@ namespace TcgEngine target.hp_ongoing += val; if (type == EffectStatType.Mana) target.mana_ongoing += val; + + if (type == EffectStatType.ManaFire) + target.mana_fire_ongoing += val; + if (type == EffectStatType.ManaForest) + target.mana_forest_ongoing += val; + if (type == EffectStatType.ManaWater) + target.mana_water_ongoing += val; } private int GetCount(Game data, Card caster) diff --git a/Assets/TcgEngine/Scripts/Effects/EffectAddStatRoll.cs b/Assets/TcgEngine/Scripts/Effects/EffectAddStatRoll.cs index ba437b4..b1a9d7e 100644 --- a/Assets/TcgEngine/Scripts/Effects/EffectAddStatRoll.cs +++ b/Assets/TcgEngine/Scripts/Effects/EffectAddStatRoll.cs @@ -31,6 +31,22 @@ namespace TcgEngine target.mana = Mathf.Max(target.mana, 0); target.mana_max = Mathf.Clamp(target.mana_max, 0, GameplayData.Get().mana_max); } + + if (type == EffectStatType.ManaFire) + target.mana_fire += data.rolled_value; + target.mana_fire_max += data.rolled_value; + target.mana_fire = Mathf.Max(target.mana_fire, 0); + target.mana_fire_max = Mathf.Clamp(target.mana_fire_max, 0, GameplayData.Get().mana_max); + if (type == EffectStatType.ManaForest) + target.mana_forest += data.rolled_value; + target.mana_forest_max += data.rolled_value; + target.mana_forest = Mathf.Max(target.mana_forest, 0); + target.mana_forest_max = Mathf.Clamp(target.mana_forest_max, 0, GameplayData.Get().mana_max); + if (type == EffectStatType.ManaWater) + target.mana_water += data.rolled_value; + target.mana_water_max += data.rolled_value; + target.mana_water = Mathf.Max(target.mana_water, 0); + target.mana_water_max = Mathf.Clamp(target.mana_water_max, 0, GameplayData.Get().mana_max); } public override void DoEffect(GameLogic logic, AbilityData ability, Card caster, Card target) @@ -43,6 +59,13 @@ namespace TcgEngine target.hp += data.rolled_value; if (type == EffectStatType.Mana) target.mana += data.rolled_value; + + if (type == EffectStatType.ManaFire) + target.mana_fire += data.rolled_value; + if (type == EffectStatType.ManaForest) + target.mana_forest += data.rolled_value; + if (type == EffectStatType.ManaWater) + target.mana_water += data.rolled_value; } } } \ No newline at end of file diff --git a/Assets/TcgEngine/Scripts/Effects/EffectMana.cs b/Assets/TcgEngine/Scripts/Effects/EffectMana.cs index 7408988..1c037a7 100644 --- a/Assets/TcgEngine/Scripts/Effects/EffectMana.cs +++ b/Assets/TcgEngine/Scripts/Effects/EffectMana.cs @@ -14,19 +14,34 @@ namespace TcgEngine { public bool increase_value; public bool increase_max; + + [Header("Team Mana")] + public string team_id = ""; // 指定影响的阵营,空值表示影响通用mana public override void DoEffect(GameLogic logic, AbilityData ability, Card caster, Player target) { - if (increase_max) + // 如果指定了阵营,影响阵营mana;否则影响通用mana + if (!string.IsNullOrEmpty(team_id)) { - target.mana_max += ability.value; - target.mana_max = Mathf.Clamp(target.mana_max, 0, GameplayData.Get().mana_max); + // 影响阵营mana + int current_add = increase_value ? ability.value : 0; + int max_add = increase_max ? ability.value : 0; + target.AddTeamMana(team_id, current_add, max_add); } - - if(increase_value) + else { - target.mana += ability.value; - target.mana = Mathf.Max(target.mana, 0); + // 影响通用mana(保持原有逻辑) + if (increase_max) + { + target.mana_max += ability.value; + target.mana_max = Mathf.Clamp(target.mana_max, 0, GameplayData.Get().mana_max); + } + + if(increase_value) + { + target.mana += ability.value; + target.mana = Mathf.Max(target.mana, 0); + } } } diff --git a/Assets/TcgEngine/Scripts/Effects/EffectSetStat.cs b/Assets/TcgEngine/Scripts/Effects/EffectSetStat.cs index df62bd2..37164b7 100644 --- a/Assets/TcgEngine/Scripts/Effects/EffectSetStat.cs +++ b/Assets/TcgEngine/Scripts/Effects/EffectSetStat.cs @@ -13,6 +13,9 @@ namespace TcgEngine public class EffectSetStat : EffectData { public EffectStatType type; + + [Header("Team Mana (only for Mana type)")] + public string team_id = ""; // 当type为Mana时,指定影响的阵营 public override void DoEffect(GameLogic logic, AbilityData ability, Card caster, Player target) { @@ -23,8 +26,17 @@ namespace TcgEngine if (type == EffectStatType.Mana) { - target.mana = ability.value; - target.mana = Mathf.Max(target.mana, 0); + // 如果指定了阵营,设置阵营mana;否则设置通用mana + if (!string.IsNullOrEmpty(team_id)) + { + target.SetTeamMana(team_id, ability.value); + } + else + { + Debug.Log($"SetStat Mana 通用: {ability.value}"); + target.mana = ability.value; + target.mana = Mathf.Max(target.mana, 0); + } } } @@ -39,6 +51,13 @@ namespace TcgEngine target.hp = ability.value; target.damage = 0; } + + if (type == EffectStatType.ManaFire) + target.mana_fire = ability.value; + if (type == EffectStatType.ManaForest) + target.mana_forest = ability.value; + if (type == EffectStatType.ManaWater) + target.mana_water = ability.value; } public override void DoOngoingEffect(GameLogic logic, AbilityData ability, Card caster, Card target) @@ -49,6 +68,13 @@ namespace TcgEngine target.hp = ability.value; if (type == EffectStatType.Mana) target.mana = ability.value; + + if (type == EffectStatType.ManaFire) + target.mana_fire = ability.value; + if (type == EffectStatType.ManaForest) + target.mana_forest = ability.value; + if (type == EffectStatType.ManaWater) + target.mana_water = ability.value; } } diff --git a/Assets/TcgEngine/Scripts/GameLogic/Card.cs b/Assets/TcgEngine/Scripts/GameLogic/Card.cs index 00c01ec..249aee8 100644 --- a/Assets/TcgEngine/Scripts/GameLogic/Card.cs +++ b/Assets/TcgEngine/Scripts/GameLogic/Card.cs @@ -22,6 +22,16 @@ namespace TcgEngine public int attack = 0; public int hp = 0; + // 新增:三种元素法力值 + public int mana_fire = 0; + public int mana_forest = 0; + public int mana_water = 0; + + // 新增:三种元素法力值的临时加成 + public int mana_fire_ongoing = 0; + public int mana_forest_ongoing = 0; + public int mana_water_ongoing = 0; + public int mana_ongoing = 0; public int attack_ongoing = 0; public int hp_ongoing = 0; @@ -45,11 +55,18 @@ namespace TcgEngine public Card(string card_id, string uid, int player_id) { this.card_id = card_id; this.uid = uid; this.player_id = player_id; } public virtual void Refresh() { exhausted = false; } - public virtual void ClearOngoing() { ongoing_status.Clear(); ongoing_traits.Clear(); ClearOngoingAbility(); attack_ongoing = 0; hp_ongoing = 0; mana_ongoing = 0; } + public virtual void ClearOngoing() + { + ongoing_status.Clear(); ongoing_traits.Clear(); ClearOngoingAbility(); attack_ongoing = 0; hp_ongoing = 0; mana_ongoing = 0; + // 新增:清除元素法力值临时加成 + mana_fire_ongoing = 0; + mana_forest_ongoing = 0; + mana_water_ongoing = 0; + } public virtual void Clear() { - ClearOngoing(); Refresh(); damage = 0; status.Clear(); + ClearOngoing(); Refresh(); damage = 0; status.Clear(); SetCard(CardData, VariantData); //Reset to initial stats equipped_uid = null; } @@ -67,7 +84,11 @@ namespace TcgEngine variant_id = cvariant.id; attack = icard.attack; hp = icard.hp; + // 设置法力值 mana = icard.mana; + mana_fire = icard.mana_fire; + mana_forest = icard.mana_forest; + mana_water = icard.mana_water; SetTraits(icard); SetAbilities(icard); } @@ -93,7 +114,7 @@ namespace TcgEngine foreach (AbilityData ability in icard.abilities) AddAbility(ability); } - + //------ Custom Traits/Stats --------- public void SetTrait(string id, int value) @@ -200,7 +221,7 @@ namespace TcgEngine all_traits.AddRange(ongoing_traits); return all_traits; } - + //Alternate names since traits/stats are stored in same var public void SetStat(string id, int value) => SetTrait(id, value); public void AddStat(string id, int value) => AddTrait(id, value); @@ -212,6 +233,27 @@ namespace TcgEngine public bool HasStat(string id) => HasTrait(id); public List GetAllStats() => GetAllTraits(); + // 新增:获取元素法力值的方法 + public virtual int GetManaFire() { return Mathf.Max(mana_fire + mana_fire_ongoing, 0); } + public virtual int GetManaForest() { return Mathf.Max(mana_forest + mana_forest_ongoing, 0); } + public virtual int GetManaWater() { return Mathf.Max(mana_water + mana_water_ongoing, 0); } + + +// 新增:设置元素法力值的方法 + public void SetManaFire(int value) { mana_fire = value; } + public void SetManaForest(int value) { mana_forest = value; } + public void SetManaWater(int value) { mana_water = value; } + + // 新增:增加元素法力值的方法 + public void AddManaFire(int value) { mana_fire += value; } + public void AddManaForest(int value) { mana_forest += value; } + public void AddManaWater(int value) { mana_water += value; } + + // 新增:增加元素法力值临时加成的方法 + public void AddManaFireOngoing(int value) { mana_fire_ongoing += value; } + public void AddManaForestOngoing(int value) { mana_forest_ongoing += value; } + public void AddManaWaterOngoing(int value) { mana_water_ongoing += value; } + //------ Status Effects --------- public void AddStatus(StatusData status, int value, int duration) @@ -331,8 +373,8 @@ namespace TcgEngine public void AddAbility(AbilityData ability) { abilities.Add(ability.id); - if (abilities_data != null) - abilities_data.Add(ability); + if (abilities_data != null) + abilities_data.Add(ability); } public void RemoveAbility(AbilityData ability) @@ -457,7 +499,7 @@ namespace TcgEngine // return false; //if (!skip_cost && exhausted) // return false; //no more action - return true; + return true; } public virtual bool CanDoActivatedAbilities() @@ -484,13 +526,14 @@ namespace TcgEngine //---------------- - public CardData CardData - { - get { - if(data == null || data.id != card_id) + public CardData CardData + { + get + { + if (data == null || data.id != card_id) data = CardData.Get(card_id); //Optimization, store for future use return data; - } + } } public VariantData VariantData @@ -507,7 +550,8 @@ namespace TcgEngine public int Hash { - get { + get + { if (hash == 0) hash = Mathf.Abs(uid.GetHashCode()); //Optimization, store for future use return hash; @@ -550,6 +594,14 @@ namespace TcgEngine dest.hp = source.hp; dest.mana = source.mana; + dest.mana_fire = source.mana_fire; + dest.mana_forest = source.mana_forest; + dest.mana_water = source.mana_water; + + dest.mana_fire_ongoing = source.mana_fire_ongoing; + dest.mana_forest_ongoing = source.mana_forest_ongoing; + dest.mana_water_ongoing = source.mana_water_ongoing; + dest.mana_ongoing = source.mana_ongoing; dest.attack_ongoing = source.attack_ongoing; dest.hp_ongoing = source.hp_ongoing; @@ -560,8 +612,8 @@ namespace TcgEngine CardTrait.CloneList(source.ongoing_traits, dest.ongoing_traits); CardStatus.CloneList(source.status, dest.status); CardStatus.CloneList(source.ongoing_status, dest.ongoing_status); - GameTool.CloneList(source.abilities, dest.abilities); - GameTool.CloneList(source.abilities_ongoing, dest.abilities_ongoing); + GameTool.CloneList(source.abilities, dest.abilities); + GameTool.CloneList(source.abilities_ongoing, dest.abilities_ongoing); GameTool.CloneListRefNull(source.abilities_data, ref dest.abilities_data); //No need to deep copy since AbilityData doesn't change dynamically, its just a reference } @@ -615,7 +667,7 @@ namespace TcgEngine } } - if(dest.Count > source.Count) + if (dest.Count > source.Count) dest.RemoveRange(source.Count, dest.Count - source.Count); } } @@ -641,7 +693,8 @@ namespace TcgEngine this.permanent = (duration == 0); } - public StatusData StatusData { + public StatusData StatusData + { get { if (data == null || data.effect != type) diff --git a/Assets/TcgEngine/Scripts/GameLogic/Game.cs b/Assets/TcgEngine/Scripts/GameLogic/Game.cs index 940284d..bd90d31 100644 --- a/Assets/TcgEngine/Scripts/GameLogic/Game.cs +++ b/Assets/TcgEngine/Scripts/GameLogic/Game.cs @@ -106,12 +106,18 @@ namespace TcgEngine return false; Player player = GetPlayer(card.player_id); - if (!skip_cost && !player.CanPayMana(card)) + if (!skip_cost && !player.CanPayTeamMana(card)) return false; //Cant pay mana if (!player.HasCard(player.cards_hand, card)) return false; // Card not in hand - if (player.is_ai && card.CardData.IsDynamicManaCost() && player.mana == 0) - return false; // AI cant play X-cost card at 0 cost + // AI 不能在没有对应阵营mana时使用动态费用卡牌 + if (player.is_ai && card.CardData.IsDynamicManaCost()) + { + string team_id = card.CardData.team?.id; + int available_mana = string.IsNullOrEmpty(team_id) ? player.mana : player.GetTeamMana(team_id); + if (available_mana == 0) + return false; // AI cant play X-cost card at 0 cost + } if (card.CardData.IsBoardCard()) { diff --git a/Assets/TcgEngine/Scripts/GameLogic/GameLogic.cs b/Assets/TcgEngine/Scripts/GameLogic/GameLogic.cs index 9c46f95..05feab4 100644 --- a/Assets/TcgEngine/Scripts/GameLogic/GameLogic.cs +++ b/Assets/TcgEngine/Scripts/GameLogic/GameLogic.cs @@ -124,6 +124,12 @@ namespace TcgEngine.Gameplay player.mana_max = pdeck != null ? pdeck.start_mana : GameplayData.Get().mana_start; player.mana = player.mana_max; + //初始化三种阵营mana + int start_mana = pdeck != null ? pdeck.start_mana : GameplayData.Get().mana_start; + player.SetTeamMana("fire", start_mana, start_mana); + player.SetTeamMana("forest", start_mana, start_mana); + player.SetTeamMana("water", start_mana, start_mana); + //Draw starting cards 开始抽卡 int dcards = pdeck != null ? pdeck.start_cards : GameplayData.Get().cards_start; DrawCard(player, dcards); @@ -147,6 +153,7 @@ namespace TcgEngine.Gameplay StartTurn(); } + //开始回合 public virtual void StartTurn() { if (game_data.state == GameState.GameEnded) @@ -165,11 +172,27 @@ namespace TcgEngine.Gameplay DrawCard(player, GameplayData.Get().cards_per_turn); } + //Mana player.mana_max += GameplayData.Get().mana_per_turn; player.mana_max = Mathf.Min(player.mana_max, GameplayData.Get().mana_max); player.mana = player.mana_max; + //阵营Mana增长:基础每回合+1,场上有对应阵营角色额外+1 + UpdateTeamMana(player, "fire"); + UpdateTeamMana(player, "forest"); + UpdateTeamMana(player, "water"); + + // 回合开始时检查所有阵营mana,如果超过5则设置为5 + if (player.GetTeamMana("fire") > 5) + player.SetTeamMana("fire", 5); + if (player.GetTeamMana("forest") > 5) + player.SetTeamMana("forest", 5); + if (player.GetTeamMana("water") > 5) + player.SetTeamMana("water", 5); + if (player.mana > 5) + player.mana = 5; + //Turn timer and history game_data.turn_timer = GameplayData.Get().turn_duration; player.history_list.Clear(); @@ -425,9 +448,9 @@ namespace TcgEngine.Gameplay { Player player = game_data.GetPlayer(card.player_id); - //Cost + //Cost - 使用阵营mana支付 if (!skip_cost) - player.PayMana(card); + player.PayTeamMana(card); //Play card player.RemoveCardFromAllGroups(card); @@ -1999,6 +2022,22 @@ namespace TcgEngine.Gameplay return random; } + /// + /// 更新指定阵营的mana,基础每回合+1,场上有对应阵营角色额外+角色数量 + /// + private void UpdateTeamMana(Player player, string team_id) + { + int base_increase = GameplayData.Get().mana_per_turn; // 基础增长 + int team_bonus = player.GetBoardTeamCount(team_id); // 场上同阵营角色数量 + int total_increase = base_increase + team_bonus; + + // 增加最大mana + player.AddTeamMana(team_id, 0, total_increase); + + // 当前mana设置为最大值 + player.SetTeamMana(team_id, player.GetTeamManaMax(team_id)); + } + public Game GameData { get { return game_data; } } public ResolveQueue ResolveQueue { get { return resolve_queue; } } } diff --git a/Assets/TcgEngine/Scripts/GameLogic/Player.cs b/Assets/TcgEngine/Scripts/GameLogic/Player.cs index 51db653..62abddd 100644 --- a/Assets/TcgEngine/Scripts/GameLogic/Player.cs +++ b/Assets/TcgEngine/Scripts/GameLogic/Player.cs @@ -23,8 +23,34 @@ namespace TcgEngine public int hp; public int hp_max; + + // 三种阵营mana系统 + [System.Serializable] + public class TeamMana + { + public int current = 0; + public int max = 0; + + public TeamMana(int start_value = 0) + { + current = start_value; + max = start_value; + } + } + // 新mana + + public int mana_fire = 0; + public int mana_forest = 0; + public int mana_water = 0; + + // 保留原有mana属性以兼容现有代码,将作为通用mana使用 public int mana = 0; public int mana_max = 0; + + // 新增:三种元素法力值的最大值 + public int mana_fire_max = 0; + public int mana_forest_max = 0; + public int mana_water_max = 0; public int kill_count = 0; public int cards_played_this_turn = 0; // 本回合已上场的卡牌数量 public Dictionary cards_all = new Dictionary(); //Dictionnary for quick access to any card by UID @@ -591,7 +617,11 @@ namespace TcgEngine dest.hp_max = source.hp_max; dest.mana = source.mana; dest.mana_max = source.mana_max; - dest.kill_count = source.kill_count; + + // 复制新mana + dest.mana_fire = source.mana; + dest.mana_forest = source.mana; + dest.mana_water = source.mana; Card.CloneNull(source.hero, ref dest.hero); Card.CloneDict(source.cards_all, dest.cards_all); @@ -606,6 +636,165 @@ namespace TcgEngine CardStatus.CloneList(source.status, dest.status); CardStatus.CloneList(source.ongoing_status, dest.ongoing_status); } + + //------------- 阵营Mana相关方法 ------------- + + /// + /// 获取指定阵营的当前mana值 + /// + public int GetTeamMana(string team_id) + { + if (team_id == "fire") return mana_fire; + if (team_id == "forest") return mana_forest; + if (team_id == "water") return mana_water; + + Debug.Log($"GetTeamMana: {team_id} not found"); + return 0; + } + + /// + /// 获取指定阵营的最大mana值 + /// + public int GetTeamManaMax(string team_id) + { + return mana_max; + } + + /// + /// 设置指定阵营的mana值 + /// + public void SetTeamMana(string team_id, int current, int max = -1) + { + if (team_id == "fire") + { + mana_fire = current; + if (max >= 0) mana_fire = max; + } + else if (team_id == "forest") + { + mana_forest = current; + if (max >= 0) mana_forest = max; + } + else if (team_id == "water") + { + mana_water = current; + if (max >= 0) mana_water = max; + } + } + + /// + /// 增加指定阵营的mana值 + /// + public void AddTeamMana(string team_id, int current_add = 0, int max_add = 0) + { + if (team_id == "fire") + { + mana_fire += current_add; + mana_fire = Mathf.Max(mana_fire, 0); + mana_fire = Mathf.Clamp(mana_fire, 0, GameplayData.Get().mana_max); + } + else if (team_id == "forest") + { + mana_forest += current_add; + mana_forest = Mathf.Max(mana_forest, 0); + mana_forest = Mathf.Clamp(mana_forest, 0, GameplayData.Get().mana_max); + } + else if (team_id == "water") + { + mana_water += current_add; + mana_water = Mathf.Max(mana_water, 0); + mana_water = Mathf.Clamp(mana_water, 0, GameplayData.Get().mana_max); + } + } + + /// + /// 检查是否有足够的阵营mana支付卡牌费用 + /// + public virtual bool CanPayTeamMana(Card card) + { + if (card.CardData.IsDynamicManaCost()) + return true; + + string team_id = card.CardData.team?.id; + if (string.IsNullOrEmpty(team_id)){ + Debug.Log($"not CanPayTeamMana checking team mana: {mana} >= {card.GetMana()}"); + return mana >= card.GetMana(); // 使用通用mana + } + else + { + Debug.Log($"Checking team mana for {team_id}: {GetTeamMana(team_id)} >= {card.GetMana()}"); + return GetTeamMana(team_id) >= card.GetMana(); + } + } + + /// + /// 支付卡牌的阵营mana费用 + /// + public virtual void PayTeamMana(Card card) + { + if (card.CardData.IsDynamicManaCost()) + return; + + string team_id = card.CardData.team?.id; + if (string.IsNullOrEmpty(team_id)) + { + Debug.Log($"PayTeamMana 通用mana: {mana} -= {card.GetMana()}"); + mana -= card.GetMana(); // 使用通用mana + return; + } + + int cost = card.GetMana(); + if (team_id == "fire") + { + mana_fire -= cost; + mana_fire = Mathf.Max(mana_fire, 0); + } + else if (team_id == "forest") + { + mana_forest -= cost; + mana_forest = Mathf.Max(mana_forest, 0); + } + else if (team_id == "water") + { + mana_water -= cost; + mana_water = Mathf.Max(mana_water, 0); + } + } + + /// + /// 获取场上指定阵营的角色数量 + /// + public int GetBoardTeamCount(string team_id) + { + int count = 0; + Debug.Log($"Checking board for {team_id} characters. Total cards on board: {cards_board.Count}"); + + foreach (Card card in cards_board) + { + if (card.CardData.IsCharacter() && card.CardData.team?.id == team_id) + { + count++; + Debug.Log($"Found {team_id} character: {card.CardData.title}"); + } + } + + Debug.Log($"Total {team_id} characters on board: {count}"); + return count; + } + + /// + /// 测试方法:打印当前所有阵营mana状态 + /// + public void DebugTeamMana() + { + Debug.Log($"=== Player {player_id} Team Mana Debug ==="); + Debug.Log($"General: {mana}/{mana_max}"); + Debug.Log($"Board cards: {cards_board.Count}"); + Debug.Log($"Fire characters on board: {GetBoardTeamCount("fire")}"); + Debug.Log($"Forest characters on board: {GetBoardTeamCount("forest")}"); + Debug.Log($"Water characters on board: {GetBoardTeamCount("water")}"); + Debug.Log("====================================="); + } } [System.Serializable] diff --git a/Assets/TcgEngine/Scripts/UI/PlayerUI.cs b/Assets/TcgEngine/Scripts/UI/PlayerUI.cs index 0c0830c..4e22d1c 100644 --- a/Assets/TcgEngine/Scripts/UI/PlayerUI.cs +++ b/Assets/TcgEngine/Scripts/UI/PlayerUI.cs @@ -17,7 +17,11 @@ namespace TcgEngine.UI public bool is_opponent; public Text pname; public AvatarUI avatar; - public IconBar mana_bar; + public IconBar mana_bar; // 保留原有mana条,作为通用mana显示 + + [Header("Team Mana Bars")] + public IconBar[] team_mana_bars = new IconBar[3]; // ManaBar_0, ManaBar_1, ManaBar_2 + public Text hp_txt; public Text hp_max_txt; @@ -68,8 +72,57 @@ namespace TcgEngine.UI if (player != null) { pname.text = player.username; + + // 更新通用mana条 mana_bar.value = player.mana; mana_bar.max_value = player.mana_max; + + // 更新阵营mana条 - fire, forest, water + if (team_mana_bars.Length >= 3) + { + // ManaBar_0 = fire + if (team_mana_bars[0] != null) + { + team_mana_bars[0].value = player.mana_fire; + team_mana_bars[0].max_value = player.mana_max; + Debug.Log($"Fire Mana: {player.mana_fire}/{player.mana_max}"); + } + else + { + Debug.LogWarning("team_mana_bars[0] is null!"); + } + + // ManaBar_1 = forest + if (team_mana_bars[1] != null) + { + team_mana_bars[1].value = player.mana_forest; + team_mana_bars[1].max_value = player.mana_max; + Debug.Log($"Forest Mana: {player.mana_forest}/{player.mana_max}"); + } + else + { + Debug.LogWarning("team_mana_bars[1] is null!"); + } + + // ManaBar_2 = water + if (team_mana_bars[2] != null) + { + team_mana_bars[2].value = player.mana_water; + team_mana_bars[2].max_value = player.mana_max; + Debug.Log($"Water Mana: {player.mana_water}/{player.mana_max}"); + } + else + { + Debug.LogWarning("team_mana_bars[2] is null!"); + } + } + else + { + Debug.LogWarning($"team_mana_bars.Length = {team_mana_bars.Length}, expected 3"); + } + + + hp_txt.text = prev_hp.ToString(); hp_max_txt.text = "/" + player.hp_max.ToString();