More warning fixes
This commit is contained in:
parent
dabb26e4f2
commit
b69ba6eaff
@ -4,6 +4,7 @@ using System.Collections.Immutable;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
|
using JetBrains.Annotations;
|
||||||
using PkmnLib.Dataloader.Models;
|
using PkmnLib.Dataloader.Models;
|
||||||
using PkmnLib.Static;
|
using PkmnLib.Static;
|
||||||
using PkmnLib.Static.Libraries;
|
using PkmnLib.Static.Libraries;
|
||||||
@ -26,11 +27,13 @@ public static class MoveDataLoader
|
|||||||
return library;
|
return library;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[PublicAPI]
|
||||||
public static
|
public static
|
||||||
Func<SerializedMove, StringKey, TypeIdentifier, MoveCategory, byte, byte, byte, MoveTarget, sbyte,
|
Func<SerializedMove, StringKey, TypeIdentifier, MoveCategory, byte, byte, byte, MoveTarget, sbyte,
|
||||||
ISecondaryEffect?, IEnumerable<StringKey>, MoveDataImpl> MoveConstructor =
|
ISecondaryEffect?
|
||||||
(serialized, name, moveType, category, basePower, accuracy, baseUsages, target, priority, secondaryEffect,
|
, IEnumerable<StringKey>, MoveDataImpl> MoveConstructor =
|
||||||
flags) => new MoveDataImpl(name, moveType, category, basePower, accuracy, baseUsages, target, priority,
|
(_, name, moveType, category, basePower, accuracy, baseUsages, target, priority, secondaryEffect, flags) =>
|
||||||
|
new MoveDataImpl(name, moveType, category, basePower, accuracy, baseUsages, target, priority,
|
||||||
secondaryEffect, flags);
|
secondaryEffect, flags);
|
||||||
|
|
||||||
private static MoveDataImpl DeserializeMove(SerializedMove serialized, TypeLibrary typeLibrary)
|
private static MoveDataImpl DeserializeMove(SerializedMove serialized, TypeLibrary typeLibrary)
|
||||||
|
@ -21,7 +21,7 @@ public static class SpeciesDataLoader
|
|||||||
if (obj == null)
|
if (obj == null)
|
||||||
throw new InvalidDataException("Species data is empty.");
|
throw new InvalidDataException("Species data is empty.");
|
||||||
return obj.Where(x => x.Key != "$schema").ToDictionary(x => x.Key,
|
return obj.Where(x => x.Key != "$schema").ToDictionary(x => x.Key,
|
||||||
x => x.Value.Deserialize<SerializedSpecies>(JsonOptions.DefaultOptions));
|
x => x.Value.Deserialize<SerializedSpecies>(JsonOptions.DefaultOptions))!;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static SpeciesLibrary LoadSpecies(Stream[] streams, IReadOnlyTypeLibrary typeLibrary)
|
public static SpeciesLibrary LoadSpecies(Stream[] streams, IReadOnlyTypeLibrary typeLibrary)
|
||||||
@ -159,17 +159,17 @@ public static class SpeciesDataLoader
|
|||||||
Happiness = evolution.Data.GetValue<byte>(),
|
Happiness = evolution.Data.GetValue<byte>(),
|
||||||
ToSpecies = evolution.Species,
|
ToSpecies = evolution.Species,
|
||||||
},
|
},
|
||||||
"happinessday" => new HappinessDayEvolution()
|
"happinessday" => new HappinessDayEvolution
|
||||||
{
|
{
|
||||||
Happiness = evolution.Data.GetValue<byte>(),
|
Happiness = evolution.Data.GetValue<byte>(),
|
||||||
ToSpecies = evolution.Species,
|
ToSpecies = evolution.Species,
|
||||||
},
|
},
|
||||||
"happinessnight" => new HappinessNightEvolution()
|
"happinessnight" => new HappinessNightEvolution
|
||||||
{
|
{
|
||||||
Happiness = evolution.Data.GetValue<byte>(),
|
Happiness = evolution.Data.GetValue<byte>(),
|
||||||
ToSpecies = evolution.Species,
|
ToSpecies = evolution.Species,
|
||||||
},
|
},
|
||||||
"item" => new ItemUseEvolution()
|
"item" => new ItemUseEvolution
|
||||||
{
|
{
|
||||||
Item = evolution.Data.GetValue<string>() ?? throw new InvalidDataException("Item is null."),
|
Item = evolution.Data.GetValue<string>() ?? throw new InvalidDataException("Item is null."),
|
||||||
ToSpecies = evolution.Species,
|
ToSpecies = evolution.Species,
|
||||||
@ -184,17 +184,17 @@ public static class SpeciesDataLoader
|
|||||||
Item = evolution.Data.GetValue<string>() ?? throw new InvalidDataException("Item is null."),
|
Item = evolution.Data.GetValue<string>() ?? throw new InvalidDataException("Item is null."),
|
||||||
ToSpecies = evolution.Species,
|
ToSpecies = evolution.Species,
|
||||||
},
|
},
|
||||||
"holditem" => new HoldItemEvolution()
|
"holditem" => new HoldItemEvolution
|
||||||
{
|
{
|
||||||
Item = evolution.Data.GetValue<string>() ?? throw new InvalidDataException("Item is null."),
|
Item = evolution.Data.GetValue<string>() ?? throw new InvalidDataException("Item is null."),
|
||||||
ToSpecies = evolution.Species,
|
ToSpecies = evolution.Species,
|
||||||
},
|
},
|
||||||
"dayholditem" => new DayHoldItemEvolution()
|
"dayholditem" => new DayHoldItemEvolution
|
||||||
{
|
{
|
||||||
Item = evolution.Data.GetValue<string>() ?? throw new InvalidDataException("Item is null."),
|
Item = evolution.Data.GetValue<string>() ?? throw new InvalidDataException("Item is null."),
|
||||||
ToSpecies = evolution.Species,
|
ToSpecies = evolution.Species,
|
||||||
},
|
},
|
||||||
"nightholditem" => new NightHoldItemEvolution()
|
"nightholditem" => new NightHoldItemEvolution
|
||||||
{
|
{
|
||||||
Item = evolution.Data.GetValue<string>() ?? throw new InvalidDataException("Item is null."),
|
Item = evolution.Data.GetValue<string>() ?? throw new InvalidDataException("Item is null."),
|
||||||
ToSpecies = evolution.Species,
|
ToSpecies = evolution.Species,
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using PkmnLib.Static;
|
|
||||||
using PkmnLib.Static.Libraries;
|
using PkmnLib.Static.Libraries;
|
||||||
|
|
||||||
namespace PkmnLib.Dataloader;
|
namespace PkmnLib.Dataloader;
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
using PkmnLib.Dynamic.Models;
|
using PkmnLib.Dynamic.Models;
|
||||||
using PkmnLib.Dynamic.Models.Choices;
|
using PkmnLib.Dynamic.Models.Choices;
|
||||||
using PkmnLib.Static.Utils;
|
|
||||||
|
|
||||||
namespace PkmnLib.Dynamic.AI;
|
namespace PkmnLib.Dynamic.AI;
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ public class RandomAI : PokemonAI
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
var target = targets[_random.GetInt(targets.Length)];
|
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))
|
if (battle.CanUse(moveTurnChoice))
|
||||||
{
|
{
|
||||||
return moveTurnChoice;
|
return moveTurnChoice;
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
using JetBrains.Annotations;
|
||||||
using PkmnLib.Dynamic.ScriptHandling;
|
using PkmnLib.Dynamic.ScriptHandling;
|
||||||
using PkmnLib.Static.Utils;
|
using PkmnLib.Static.Utils;
|
||||||
|
|
||||||
@ -33,12 +34,19 @@ public interface IMoveChoice : ITurnChoice
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
ScriptContainer Script { get; set; }
|
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; }
|
Dictionary<StringKey, object?>? AdditionalData { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Volatile effects that are applied to the move choice.
|
||||||
|
/// </summary>
|
||||||
IScriptSet Volatile { get; }
|
IScriptSet Volatile { get; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc cref="IMoveChoice"/>
|
/// <inheritdoc cref="IMoveChoice"/>
|
||||||
|
[PublicAPI]
|
||||||
public class MoveChoice : TurnChoice, IMoveChoice
|
public class MoveChoice : TurnChoice, IMoveChoice
|
||||||
{
|
{
|
||||||
/// <inheritdoc cref="MoveChoice"/>
|
/// <inheritdoc cref="MoveChoice"/>
|
||||||
|
@ -525,7 +525,7 @@ public class PokemonImpl : ScriptSource, IPokemon
|
|||||||
return null;
|
return null;
|
||||||
if (!library.StaticLibrary.Moves.TryGet(move.MoveName, out var moveData))
|
if (!library.StaticLibrary.Moves.TryGet(move.MoveName, out var moveData))
|
||||||
throw new KeyNotFoundException($"Move {move.MoveName} not found");
|
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();
|
}).ToArray();
|
||||||
AllowedExperience = serializedPokemon.AllowedExperience;
|
AllowedExperience = serializedPokemon.AllowedExperience;
|
||||||
IsEgg = serializedPokemon.IsEgg;
|
IsEgg = serializedPokemon.IsEgg;
|
||||||
|
2
PkmnLib.Dynamic/PkmnLib.Dynamic.csproj.DotSettings
Normal file
2
PkmnLib.Dynamic/PkmnLib.Dynamic.csproj.DotSettings
Normal 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>
|
@ -1,2 +1,3 @@
|
|||||||
<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">
|
<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:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=EV/@EntryIndexedValue">EV</s:String>
|
||||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=PP/@EntryIndexedValue">PP</s:String></wpf:ResourceDictionary>
|
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=PP/@EntryIndexedValue">PP</s:String></wpf:ResourceDictionary>
|
@ -1,4 +1,3 @@
|
|||||||
using System.Diagnostics.CodeAnalysis;
|
|
||||||
using PkmnLib.Static.Utils;
|
using PkmnLib.Static.Utils;
|
||||||
|
|
||||||
namespace PkmnLib.Static.Libraries;
|
namespace PkmnLib.Static.Libraries;
|
||||||
@ -16,7 +15,7 @@ public interface IReadOnlyTypeLibrary
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the type identifier for a type with an index.
|
/// Gets the type identifier for a type with an index.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool TryGetTypeIdentifierFromIndex(byte index, [MaybeNullWhen(false)] out TypeIdentifier typeIdentifier);
|
bool TryGetTypeIdentifierFromIndex(byte index, out TypeIdentifier typeIdentifier);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the effectiveness for a single attacking type against a single defending type.
|
/// Gets the effectiveness for a single attacking type against a single defending type.
|
||||||
|
@ -35,7 +35,7 @@ public class MoveDataTests
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
await Assert.That(test.Library.ScriptResolver.TryResolve(ScriptCategory.Move, scriptName,
|
await Assert.That(test.Library.ScriptResolver.TryResolve(ScriptCategory.Move, scriptName,
|
||||||
test.Move.SecondaryEffect.Parameters, out var script)).IsTrue();
|
test.Move.SecondaryEffect.Parameters, out _)).IsTrue();
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
using System.Collections;
|
|
||||||
using PkmnLib.Static.Utils;
|
using PkmnLib.Static.Utils;
|
||||||
|
|
||||||
namespace PkmnLib.Tests.Static;
|
namespace PkmnLib.Tests.Static;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
using PkmnLib.Dynamic.Models;
|
using PkmnLib.Dynamic.Models;
|
||||||
using PkmnLib.Plugin.Gen7.Moves;
|
using PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||||
using PkmnLib.Static;
|
using PkmnLib.Static;
|
||||||
|
|
||||||
namespace PkmnLib.Plugin.Gen7.Tests.Scripts.Moves;
|
namespace PkmnLib.Plugin.Gen7.Tests.Scripts.Moves;
|
||||||
|
@ -11,7 +11,7 @@ public class Gen7Plugin : Dynamic.ScriptHandling.Registry.Plugin
|
|||||||
{
|
{
|
||||||
private readonly Gen7PluginConfiguration _configuration;
|
private readonly Gen7PluginConfiguration _configuration;
|
||||||
|
|
||||||
public Gen7Plugin() : base()
|
public Gen7Plugin()
|
||||||
{
|
{
|
||||||
_configuration = new Gen7PluginConfiguration();
|
_configuration = new Gen7PluginConfiguration();
|
||||||
}
|
}
|
||||||
|
@ -57,6 +57,7 @@ public class Gen7BattleStatCalculator : IBattleStatCalculator
|
|||||||
executingMove.RunScriptHook(
|
executingMove.RunScriptHook(
|
||||||
x => x.ChangeAccuracyModifier(executingMove, target, hitIndex, ref accuracyModifier));
|
x => x.ChangeAccuracyModifier(executingMove, target, hitIndex, ref accuracyModifier));
|
||||||
var modifiedAccuracy = (int)(moveAccuracy * accuracyModifier);
|
var modifiedAccuracy = (int)(moveAccuracy * accuracyModifier);
|
||||||
|
// ReSharper disable once AccessToModifiedClosure
|
||||||
executingMove.RunScriptHook(x => x.ChangeAccuracy(executingMove, target, hitIndex, ref modifiedAccuracy));
|
executingMove.RunScriptHook(x => x.ChangeAccuracy(executingMove, target, hitIndex, ref modifiedAccuracy));
|
||||||
if (modifiedAccuracy == 255)
|
if (modifiedAccuracy == 255)
|
||||||
return 255;
|
return 255;
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
using PkmnLib.Static;
|
using PkmnLib.Static;
|
||||||
using PkmnLib.Static.Utils;
|
using PkmnLib.Static.Utils;
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
using PkmnLib.Static.Utils;
|
using PkmnLib.Static.Utils;
|
||||||
|
|
||||||
namespace PkmnLib.Plugin.Gen7.Moves;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The user nimbly strikes the target. If the user is not holding an item, this attack inflicts massive damage.
|
/// The user nimbly strikes the target. If the user is not holding an item, this attack inflicts massive damage.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using PkmnLib.Static;
|
using PkmnLib.Static;
|
||||||
|
|
||||||
namespace PkmnLib.Plugin.Gen7.Moves;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The user applies pressure to stress points, sharply boosting one of its or its allies' stats.
|
/// The user applies pressure to stress points, sharply boosting one of its or its allies' stats.
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
namespace PkmnLib.Plugin.Gen7.Moves;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The user helps the target and makes it use its move right after the user.
|
/// The user helps the target and makes it use its move right after the user.
|
||||||
|
@ -4,7 +4,7 @@ using PkmnLib.Plugin.Gen7.Scripts.Utils;
|
|||||||
using PkmnLib.Static.Moves;
|
using PkmnLib.Static.Moves;
|
||||||
using PkmnLib.Static.Utils;
|
using PkmnLib.Static.Utils;
|
||||||
|
|
||||||
namespace PkmnLib.Plugin.Gen7.Moves;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The user hurriedly and randomly uses a move among those known by ally Pokémon.
|
/// The user hurriedly and randomly uses a move among those known by ally Pokémon.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||||
using PkmnLib.Static.Species;
|
using PkmnLib.Static.Species;
|
||||||
|
|
||||||
namespace PkmnLib.Plugin.Gen7.Moves;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// If it is the opposite gender of the user, the target becomes infatuated and less likely to attack.
|
/// If it is the opposite gender of the user, the target becomes infatuated and less likely to attack.
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using PkmnLib.Plugin.Gen7.Scripts;
|
|
||||||
using PkmnLib.Plugin.Gen7.Scripts.Side;
|
using PkmnLib.Plugin.Gen7.Scripts.Side;
|
||||||
using PkmnLib.Plugin.Gen7.Scripts.Weather;
|
using PkmnLib.Plugin.Gen7.Scripts.Weather;
|
||||||
using PkmnLib.Static.Utils;
|
using PkmnLib.Static.Utils;
|
||||||
|
|
||||||
namespace PkmnLib.Plugin.Gen7.Moves;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// This move reduces damage from physical and special moves for five turns. This can be used only in a hailstorm.
|
/// This move reduces damage from physical and special moves for five turns. This can be used only in a hailstorm.
|
||||||
@ -43,7 +42,7 @@ public class AuroraVeil : Script
|
|||||||
var side = battle.Sides[move.User.BattleData!.SideIndex];
|
var side = battle.Sides[move.User.BattleData!.SideIndex];
|
||||||
|
|
||||||
var numberOfTurns = 5;
|
var numberOfTurns = 5;
|
||||||
var dict = new Dictionary<StringKey, object?>()
|
var dict = new Dictionary<StringKey, object?>
|
||||||
{
|
{
|
||||||
{ "duration", numberOfTurns },
|
{ "duration", numberOfTurns },
|
||||||
};
|
};
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using PkmnLib.Static;
|
using PkmnLib.Static;
|
||||||
|
|
||||||
namespace PkmnLib.Plugin.Gen7.Moves;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The user sheds part of its body to make itself lighter and sharply raise its Speed stat.
|
/// The user sheds part of its body to make itself lighter and sharply raise its Speed stat.
|
||||||
@ -27,7 +27,7 @@ public class Autotomize : Script
|
|||||||
if (user.ChangeStatBoost(Statistic.Speed, 2, true) && user.ChangeWeightInKgBy(-100.0f))
|
if (user.ChangeStatBoost(Statistic.Speed, 2, true) && user.ChangeWeightInKgBy(-100.0f))
|
||||||
{
|
{
|
||||||
var battle = user.BattleData?.Battle;
|
var battle = user.BattleData?.Battle;
|
||||||
battle?.EventHook.Invoke(new DialogEvent("pokemon_became_nimble", new Dictionary<string, object>()
|
battle?.EventHook.Invoke(new DialogEvent("pokemon_became_nimble", new Dictionary<string, object>
|
||||||
{
|
{
|
||||||
{ "pokemon", user },
|
{ "pokemon", user },
|
||||||
}));
|
}));
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
using System;
|
|
||||||
using PkmnLib.Static.Utils;
|
using PkmnLib.Static.Utils;
|
||||||
|
|
||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||||
|
@ -3,7 +3,7 @@ using System.Collections.Generic;
|
|||||||
using PkmnLib.Static;
|
using PkmnLib.Static;
|
||||||
using PkmnLib.Static.Utils;
|
using PkmnLib.Static.Utils;
|
||||||
|
|
||||||
namespace PkmnLib.Dynamic.Events;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||||
|
|
||||||
[Script(ScriptCategory.Move, "change_all_target_stats")]
|
[Script(ScriptCategory.Move, "change_all_target_stats")]
|
||||||
public class ChangeAllTargetStats : Script
|
public class ChangeAllTargetStats : Script
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
using PkmnLib.Static;
|
using PkmnLib.Static;
|
||||||
using PkmnLib.Static.Utils;
|
using PkmnLib.Static.Utils;
|
||||||
|
|
||||||
@ -34,7 +33,7 @@ public class ChangeMultipleTargetStatBoosts : Script
|
|||||||
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||||
{
|
{
|
||||||
EventBatchId batchId = new();
|
EventBatchId batchId = new();
|
||||||
foreach (var stat in _statBoosts!)
|
foreach (var stat in _statBoosts)
|
||||||
{
|
{
|
||||||
target.ChangeStatBoost(stat.Key, stat.Value, true, batchId);
|
target.ChangeStatBoost(stat.Key, stat.Value, true, batchId);
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
using PkmnLib.Static;
|
using PkmnLib.Static;
|
||||||
using PkmnLib.Static.Utils;
|
using PkmnLib.Static.Utils;
|
||||||
|
|
||||||
@ -34,7 +33,7 @@ public class ChangeMultipleUserStatBoosts : Script
|
|||||||
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||||
{
|
{
|
||||||
EventBatchId batchId = new();
|
EventBatchId batchId = new();
|
||||||
foreach (var stat in _statBoosts!)
|
foreach (var stat in _statBoosts)
|
||||||
{
|
{
|
||||||
move.User.ChangeStatBoost(stat.Key, stat.Value, true, batchId);
|
move.User.ChangeStatBoost(stat.Key, stat.Value, true, batchId);
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
using System.Linq;
|
|
||||||
using PkmnLib.Plugin.Gen7.Scripts.Side;
|
using PkmnLib.Plugin.Gen7.Scripts.Side;
|
||||||
|
|
||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||||
|
@ -30,7 +30,7 @@ public class DoublePowerIfTargetDamagedInTurn : Script
|
|||||||
var data = side.VolatileScripts.Get<DoublePowerIfTargetDamagedInTurnData>();
|
var data = side.VolatileScripts.Get<DoublePowerIfTargetDamagedInTurnData>();
|
||||||
if (data == null)
|
if (data == null)
|
||||||
return;
|
return;
|
||||||
if (data._hitPokemon.Contains(target))
|
if (data.HitPokemon.Contains(target))
|
||||||
basePower *= 2;
|
basePower *= 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -25,6 +25,6 @@ public class Drain : Script
|
|||||||
var healed = (uint)(damage * DrainModifier);
|
var healed = (uint)(damage * DrainModifier);
|
||||||
if (move.User.HasHeldItem("big_root"))
|
if (move.User.HasHeldItem("big_root"))
|
||||||
healed = (uint)(healed * 1.3f);
|
healed = (uint)(healed * 1.3f);
|
||||||
user.Heal(healed, false);
|
user.Heal(healed);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -18,6 +18,6 @@ public class DreamEater : Script
|
|||||||
var healed = (uint)(damage * 0.5f);
|
var healed = (uint)(damage * 0.5f);
|
||||||
if (move.User.HasHeldItem("big_root"))
|
if (move.User.HasHeldItem("big_root"))
|
||||||
healed = (uint)(healed * 1.3f);
|
healed = (uint)(healed * 1.3f);
|
||||||
user.Heal(healed, false);
|
user.Heal(healed);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,5 +1,4 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
using PkmnLib.Static.Utils;
|
using PkmnLib.Static.Utils;
|
||||||
|
|
||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||||
|
@ -16,7 +16,7 @@ public class FlareBlitz : Script
|
|||||||
}
|
}
|
||||||
|
|
||||||
var hitData = move.GetHitData(target, hit);
|
var hitData = move.GetHitData(target, hit);
|
||||||
var recoilDamage = (uint)(hitData.Damage * (1 / 3));
|
var recoilDamage = hitData.Damage * (1 / 3);
|
||||||
move.User.Damage(recoilDamage, DamageSource.Misc);
|
move.User.Damage(recoilDamage, DamageSource.Misc);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,5 +1,3 @@
|
|||||||
using PkmnLib.Plugin.Gen7.Scripts.Terrain;
|
|
||||||
|
|
||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||||
|
|
||||||
[Script(ScriptCategory.Move, "floral_healing")]
|
[Script(ScriptCategory.Move, "floral_healing")]
|
||||||
|
@ -1,7 +1,4 @@
|
|||||||
using System;
|
|
||||||
using PkmnLib.Plugin.Gen7.Scripts.Battle;
|
using PkmnLib.Plugin.Gen7.Scripts.Battle;
|
||||||
using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
|
||||||
using PkmnLib.Static.Utils;
|
|
||||||
|
|
||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||||
|
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
using PkmnLib.Plugin.Gen7.Scripts.Terrain;
|
|
||||||
|
|
||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||||
|
|
||||||
[Script(ScriptCategory.Move, "genesis_supernova")]
|
[Script(ScriptCategory.Move, "genesis_supernova")]
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
using PkmnLib.Plugin.Gen7.Scripts.Terrain;
|
|
||||||
|
|
||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||||
|
|
||||||
[Script(ScriptCategory.Move, "grassy_terrain")]
|
[Script(ScriptCategory.Move, "grassy_terrain")]
|
||||||
|
@ -20,7 +20,7 @@ public class HealEachEndOfTurn : Script
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_healPercentage = healPercentage!;
|
_healPercentage = healPercentage;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
using System;
|
|
||||||
using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||||
|
|
||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
using PkmnLib.Static.Utils;
|
|
||||||
|
|
||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||||
|
|
||||||
[Script(ScriptCategory.Move, "mimic")]
|
[Script(ScriptCategory.Move, "mimic")]
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
using PkmnLib.Static;
|
|
||||||
using PkmnLib.Static.Utils;
|
using PkmnLib.Static.Utils;
|
||||||
|
|
||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using PkmnLib.Static;
|
|
||||||
using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||||
using PkmnLib.Static.Utils;
|
using PkmnLib.Static.Utils;
|
||||||
|
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
using System.Collections.Generic;
|
|
||||||
using PkmnLib.Plugin.Gen7.Scripts.Status;
|
using PkmnLib.Plugin.Gen7.Scripts.Status;
|
||||||
|
|
||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
|
||||||
using PkmnLib.Static;
|
using PkmnLib.Static;
|
||||||
using PkmnLib.Static.Utils;
|
using PkmnLib.Static.Utils;
|
||||||
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using PkmnLib.Dynamic.Models.BattleFlow;
|
|
||||||
using PkmnLib.Static.Utils;
|
using PkmnLib.Static.Utils;
|
||||||
|
|
||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||||
|
@ -13,7 +13,7 @@ public class Rest : Script
|
|||||||
move.GetHitData(target, hit).Fail();
|
move.GetHitData(target, hit).Fail();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!move.User.Heal(move.User.MaxHealth, false, forceHeal: false))
|
if (!move.User.Heal(move.User.MaxHealth))
|
||||||
{
|
{
|
||||||
move.GetHitData(target, hit).Fail();
|
move.GetHitData(target, hit).Fail();
|
||||||
return;
|
return;
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
using System.Linq;
|
|
||||||
using PkmnLib.Static.Utils;
|
using PkmnLib.Static.Utils;
|
||||||
|
|
||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using PkmnLib.Static;
|
using PkmnLib.Static;
|
||||||
|
|
||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||||
|
@ -17,7 +17,7 @@ public class SetWeather : Script
|
|||||||
{
|
{
|
||||||
throw new Exception("Weather not provided.");
|
throw new Exception("Weather not provided.");
|
||||||
}
|
}
|
||||||
_weather = weather!.ToString();
|
_weather = weather.ToString();
|
||||||
if (parameters.TryGetValue("turns", out var turns) && turns is int turn)
|
if (parameters.TryGetValue("turns", out var turns) && turns is int turn)
|
||||||
{
|
{
|
||||||
_defaultTurns = turn;
|
_defaultTurns = turn;
|
||||||
|
@ -1,6 +1,4 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
using PkmnLib.Plugin.Gen7.Scripts.Utils;
|
using PkmnLib.Plugin.Gen7.Scripts.Utils;
|
||||||
|
|
||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||||
@ -52,6 +50,6 @@ public class BideEffect : Script
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var opposingSideIndex = (byte)(_owner.BattleData?.SideIndex == 0 ? 1 : 0);
|
var opposingSideIndex = (byte)(_owner.BattleData?.SideIndex == 0 ? 1 : 0);
|
||||||
choice = TurnChoiceHelper.CreateMoveChoice(_owner, "bide", opposingSideIndex, position);
|
choice = _choice = TurnChoiceHelper.CreateMoveChoice(_owner, "bide", opposingSideIndex, position);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,5 +1,4 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
using PkmnLib.Static;
|
using PkmnLib.Static;
|
||||||
using PkmnLib.Static.Libraries;
|
using PkmnLib.Static.Libraries;
|
||||||
using PkmnLib.Static.Utils;
|
using PkmnLib.Static.Utils;
|
||||||
@ -9,14 +8,12 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
|||||||
[Script(ScriptCategory.Pokemon, "foresight")]
|
[Script(ScriptCategory.Pokemon, "foresight")]
|
||||||
public class ForesightEffect : Script
|
public class ForesightEffect : Script
|
||||||
{
|
{
|
||||||
private readonly IReadOnlyTypeLibrary _typeLibrary;
|
|
||||||
private readonly TypeIdentifier _normalType;
|
private readonly TypeIdentifier _normalType;
|
||||||
private readonly TypeIdentifier _fightingType;
|
private readonly TypeIdentifier _fightingType;
|
||||||
private readonly TypeIdentifier _ghostType;
|
private readonly TypeIdentifier _ghostType;
|
||||||
|
|
||||||
public ForesightEffect(IReadOnlyTypeLibrary typeLibrary)
|
public ForesightEffect(IReadOnlyTypeLibrary typeLibrary)
|
||||||
{
|
{
|
||||||
_typeLibrary = typeLibrary;
|
|
||||||
typeLibrary.TryGetTypeIdentifier("normal", out _normalType);
|
typeLibrary.TryGetTypeIdentifier("normal", out _normalType);
|
||||||
typeLibrary.TryGetTypeIdentifier("fighting", out _fightingType);
|
typeLibrary.TryGetTypeIdentifier("fighting", out _fightingType);
|
||||||
typeLibrary.TryGetTypeIdentifier("ghost", out _ghostType);
|
typeLibrary.TryGetTypeIdentifier("ghost", out _ghostType);
|
||||||
|
@ -15,7 +15,7 @@ public class Infatuated : Script
|
|||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void PreventMove(IExecutingMove move, ref bool prevent)
|
public override void PreventMove(IExecutingMove move, ref bool prevent)
|
||||||
{
|
{
|
||||||
if (move.User.BattleData?.Battle?.Random.GetBool() == true)
|
if (move.User.BattleData?.Battle.Random.GetBool() == true)
|
||||||
prevent = true;
|
prevent = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,5 +1,4 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
using PkmnLib.Static;
|
using PkmnLib.Static;
|
||||||
using PkmnLib.Static.Utils;
|
using PkmnLib.Static.Utils;
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ public abstract class OutrageLikeEffect : Script
|
|||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void ForceTurnSelection(byte sideIndex, byte position, ref ITurnChoice? choice)
|
public override void ForceTurnSelection(byte sideIndex, byte position, ref ITurnChoice? choice)
|
||||||
{
|
{
|
||||||
choice = TurnChoiceHelper.CreateMoveChoice(_owner, "_move", _targetSide, _targetPosition);
|
choice = TurnChoiceHelper.CreateMoveChoice(_owner, _move, _targetSide, _targetPosition);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
using PkmnLib.Static;
|
|
||||||
|
|
||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||||
|
|
||||||
[Script(ScriptCategory.Pokemon, "perish_song")]
|
[Script(ScriptCategory.Pokemon, "perish_song")]
|
||||||
|
@ -5,7 +5,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Side;
|
|||||||
[Script(ScriptCategory.Side, "double_power_if_target_damaged_in_turn_data")]
|
[Script(ScriptCategory.Side, "double_power_if_target_damaged_in_turn_data")]
|
||||||
public class DoublePowerIfTargetDamagedInTurnData : Script
|
public class DoublePowerIfTargetDamagedInTurnData : Script
|
||||||
{
|
{
|
||||||
public HashSet<IPokemon> _hitPokemon = new();
|
public readonly HashSet<IPokemon> HitPokemon = [];
|
||||||
|
|
||||||
/// <param name="battle"></param>
|
/// <param name="battle"></param>
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
@ -17,6 +17,6 @@ public class DoublePowerIfTargetDamagedInTurnData : Script
|
|||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void OnDamage(IPokemon pokemon, DamageSource source, uint oldHealth, uint newHealth)
|
public override void OnDamage(IPokemon pokemon, DamageSource source, uint oldHealth, uint newHealth)
|
||||||
{
|
{
|
||||||
_hitPokemon.Add(pokemon);
|
HitPokemon.Add(pokemon);
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user