Fixes and reworking of item use
Build / Build (push) Successful in 57s

This commit is contained in:
Deukhoofd committed 2025-11-08 11:43:07 +01:00
1 parent fa05cdd773
commit 21ec4b28c7
11 files changed
+150 -34

No files matched your search

+15
View File
@@ -351,6 +351,21 @@ public class BattleImpl : ScriptSource, IBattle
if (switchChoice.SwitchTo == switchChoice.User)
return false;
}
else if (choice is IItemChoice itemChoice)
{
if (!Library.ScriptResolver.TryResolveBattleItemScript(itemChoice.Item, out var itemScript))
return false;
if (!itemScript.IsItemUsable)
return false;
if (itemScript.TargetType != ItemTargetType.None)
{
var target = itemChoice.GetTargetPokemon(this);
if (target is null || !itemScript.IsTargetValid(target))
return false;
if (!itemScript.TargetType.IsValidTarget(this, choice.User, target))
return false;
}
}
return true;