49 lines
1.6 KiB
C#
49 lines
1.6 KiB
C#
using System.Collections;
|
||
using System.Collections.Generic;
|
||
using UnityEngine;
|
||
using TcgEngine.Gameplay;
|
||
|
||
namespace TcgEngine
|
||
{
|
||
/// <summary>
|
||
/// Effect to gain/lose mana (player)
|
||
/// </summary>
|
||
|
||
[CreateAssetMenu(fileName = "effect", menuName = "TcgEngine/Effect/Mana", order = 10)]
|
||
public class EffectMana : EffectData
|
||
{
|
||
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)
|
||
{
|
||
// 如果指定了阵营,影响阵营mana;否则影响通用mana
|
||
if (!string.IsNullOrEmpty(team_id))
|
||
{
|
||
// 影响阵营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);
|
||
}
|
||
else
|
||
{
|
||
// 影响通用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);
|
||
}
|
||
}
|
||
}
|
||
|
||
}
|
||
} |