101 lines
2.9 KiB
C#
101 lines
2.9 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
namespace TcgEngine
|
|
{
|
|
public enum ConditionStatType
|
|
{
|
|
None = 0,
|
|
Attack = 10,
|
|
HP = 20,
|
|
Mana = 30,
|
|
ManaFire = 40,
|
|
ManaForest = 50,
|
|
ManaWater = 60,
|
|
}
|
|
|
|
/// <summary>
|
|
/// Compares basic card or player stats such as attack/hp/mana
|
|
/// </summary>
|
|
|
|
[CreateAssetMenu(fileName = "condition", menuName = "TcgEngine/Condition/Stat", order = 10)]
|
|
public class ConditionStat : 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)
|
|
{
|
|
if (type == ConditionStatType.Attack)
|
|
{
|
|
return CompareInt(target.GetAttack(), oper, value);
|
|
}
|
|
|
|
if (type == ConditionStatType.HP)
|
|
{
|
|
return CompareInt(target.GetHP(), oper, value);
|
|
}
|
|
|
|
if (type == ConditionStatType.Mana)
|
|
{
|
|
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;
|
|
}
|
|
|
|
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;
|
|
}
|
|
}
|
|
} |