More warning fixes

This commit is contained in:
2025-05-02 16:04:54 +02:00
parent dabb26e4f2
commit b69ba6eaff
56 changed files with 56 additions and 80 deletions

View File

@@ -1,6 +1,5 @@
using PkmnLib.Dynamic.Models;
using PkmnLib.Dynamic.Models.Choices;
using PkmnLib.Static.Utils;
namespace PkmnLib.Dynamic.AI;

View File

@@ -36,7 +36,7 @@ public class RandomAI : PokemonAI
continue;
}
var target = targets[_random.GetInt(targets.Length)];
var moveTurnChoice = new MoveChoice(pokemon, move!, target.side, target.position);
var moveTurnChoice = new MoveChoice(pokemon, move, target.side, target.position);
if (battle.CanUse(moveTurnChoice))
{
return moveTurnChoice;

View File

@@ -1,3 +1,4 @@
using JetBrains.Annotations;
using PkmnLib.Dynamic.ScriptHandling;
using PkmnLib.Static.Utils;
@@ -33,12 +34,19 @@ public interface IMoveChoice : ITurnChoice
/// </summary>
ScriptContainer Script { get; set; }
/// <summary>
/// Additional data that can be used by scripts to store information about the choice.
/// </summary>
Dictionary<StringKey, object?>? AdditionalData { get; }
/// <summary>
/// Volatile effects that are applied to the move choice.
/// </summary>
IScriptSet Volatile { get; }
}
/// <inheritdoc cref="IMoveChoice"/>
[PublicAPI]
public class MoveChoice : TurnChoice, IMoveChoice
{
/// <inheritdoc cref="MoveChoice"/>

View File

@@ -525,7 +525,7 @@ public class PokemonImpl : ScriptSource, IPokemon
return null;
if (!library.StaticLibrary.Moves.TryGet(move.MoveName, out var moveData))
throw new KeyNotFoundException($"Move {move.MoveName} not found");
return new LearnedMoveImpl(moveData, move.LearnMethod, move.CurrentPp);
return (ILearnedMove)new LearnedMoveImpl(moveData, move.LearnMethod, move.CurrentPp);
}).ToArray();
AllowedExperience = serializedPokemon.AllowedExperience;
IsEgg = serializedPokemon.IsEgg;

View File

@@ -0,0 +1,2 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=events_005Chandling/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>