5 using System.Collections.Generic;
10 internal sealed
class CharacterAbilityRemoveRandomIngredient : CharacterAbility
12 private readonly AbilityConditionItem? condition;
14 public CharacterAbilityRemoveRandomIngredient(CharacterAbilityGroup characterAbilityGroup, ContentXElement abilityElement) : base(characterAbilityGroup, abilityElement)
16 var conditionElement = abilityElement.GetChildElement(nameof(AbilityConditionItem));
17 if (conditionElement !=
null)
19 condition =
new AbilityConditionItem(CharacterTalent, conditionElement);
23 protected override void ApplyEffect(AbilityObject abilityObject)
27 List<Item> applicableIngredients = condition ==
null ?
28 ingredients.Items.ToList() :
29 ingredients.Items.Where(it => condition.MatchesItem(it.Prefab)).ToList();
30 if (applicableIngredients.None()) {
return; }
32 ingredients.Items.Remove(applicableIngredients.GetRandom(Rand.RandSync.Unsynced));
virtual void ApplyEffect()