58 lines
1.7 KiB
C#
58 lines
1.7 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
namespace TcgEngine
|
|
{
|
|
/// <summary>
|
|
/// Compares basic player stats such as attack/hp/mana
|
|
/// </summary>
|
|
|
|
[CreateAssetMenu(fileName = "condition", menuName = "TcgEngine/Condition/PlayerStat", order = 10)]
|
|
public class ConditionPlayerStat : ConditionData
|
|
{
|
|
[Header("Card stat is")]
|
|
public ConditionStatType type;
|
|
public ConditionOperatorInt oper;
|
|
public int value;
|
|
|
|
public override bool IsTargetConditionMet(Game data, AbilityData ability, Card caster, Card target)
|
|
{
|
|
Player ptarget = data.GetPlayer(target.player_id);
|
|
return IsTargetConditionMet(data, ability, caster, ptarget);
|
|
}
|
|
|
|
public override bool IsTargetConditionMet(Game data, AbilityData ability, Card caster, Player target)
|
|
{
|
|
if (type == ConditionStatType.HP)
|
|
{
|
|
return CompareInt(target.hp, oper, value);
|
|
}
|
|
|
|
if (type == ConditionStatType.Mana)
|
|
{
|
|
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;
|
|
}
|
|
}
|
|
} |