Filters
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using TcgEngine;
[CreateAssetMenu(fileName = "filter", menuName = "TcgEngine/Filter/HighestAttack", order = 10)]
public class FilterHighestAttack : FilterData
{
public override List<Card> FilterTargets(Game data, AbilityData ability, Card caster, List<Card> source, List<Card> dest)
{
//Find highest attack value
int highest= 0;
foreach (Card card in source)
{
int attack= card.GetAttack();
if (attack > highest)
highest= attack;
}
//Add all highest (more than one card can be targeted)
foreach (Card card in source)
{
int attack = card.GetAttack();
if (attack == highest)
dest.Add(card);
}
return dest; //Return all cards with highest attack
}
}
Last updated