28 lines
945 B
C#
28 lines
945 B
C#
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
|
|
|
[Script(ScriptCategory.Move, "techno_blast")]
|
|
public class TechnoBlast : Script, IScriptChangeMoveType
|
|
{
|
|
private static readonly Dictionary<StringKey, StringKey> DriveTypes = new()
|
|
{
|
|
{ ItemNames.BurnDrive, TypeNames.Fire },
|
|
{ ItemNames.ChillDrive, TypeNames.Ice },
|
|
{ ItemNames.DouseDrive, TypeNames.Water },
|
|
{ ItemNames.ShockDrive, TypeNames.Electric },
|
|
};
|
|
|
|
/// <inheritdoc />
|
|
public void ChangeMoveType(IExecutingMove move, IBattlePokemon target, byte hit, ref TypeIdentifier? moveType)
|
|
{
|
|
var heldItem = move.User.HeldItem;
|
|
if (heldItem == null)
|
|
return;
|
|
var typeLibrary = target.Library.StaticLibrary.Types;
|
|
|
|
if (DriveTypes.TryGetValue(heldItem.Name, out var typeName) &&
|
|
typeLibrary.TryGetTypeIdentifier(typeName, out var type))
|
|
{
|
|
moveType = type;
|
|
}
|
|
}
|
|
} |