init
This commit is contained in:
33
Assets/TcgEngine/Scripts/Conditions/ConditionSelf.cs
Normal file
33
Assets/TcgEngine/Scripts/Conditions/ConditionSelf.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace TcgEngine
|
||||
{
|
||||
/// <summary>
|
||||
/// Condition that check if the target is the same as the caster
|
||||
/// </summary>
|
||||
|
||||
[CreateAssetMenu(fileName = "condition", menuName = "TcgEngine/Condition/CardSelf", order = 10)]
|
||||
public class ConditionSelf : ConditionData
|
||||
{
|
||||
[Header("Target is caster")]
|
||||
public ConditionOperatorBool oper;
|
||||
|
||||
public override bool IsTargetConditionMet(Game data, AbilityData ability, Card caster, Card target)
|
||||
{
|
||||
return CompareBool(caster == target, oper);
|
||||
}
|
||||
|
||||
public override bool IsTargetConditionMet(Game data, AbilityData ability, Card caster, Player target)
|
||||
{
|
||||
bool same_owner = caster.player_id == target.player_id;
|
||||
return CompareBool(same_owner, oper);
|
||||
}
|
||||
|
||||
public override bool IsTargetConditionMet(Game data, AbilityData ability, Card caster, Slot target)
|
||||
{
|
||||
return CompareBool(caster.slot == target, oper);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user