Files
PkmnLib.NET/Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/MultiAttack.cs
Deukhoofd d2a82b5fe3
All checks were successful
Build / Build (push) Successful in 3m12s
Many more tests and fixes
2026-08-27 17:11:12 +02:00

26 lines
818 B
C#

using PkmnLib.Plugin.Gen7.Scripts.Battle;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "multi_attack")]
public class MultiAttack : Script, IScriptChangeMoveType
{
/// <inheritdoc />
public void ChangeMoveType(IExecutingMove move, IPokemon target, byte hit, ref TypeIdentifier? moveType)
{
if (move.User.ActiveAbility?.Name == "klutz")
return;
if (move.Battle.Volatile.Contains<MagicRoomEffect>())
return;
var item = move.User.HeldItem?.Name.ToString();
var typeLibrary = move.User.Library.StaticLibrary.Types;
if (item?.EndsWith("_memory") != true)
return;
var memoryType = item[..^7];
if (typeLibrary.TryGetTypeIdentifier(memoryType, out var t))
moveType = t;
}
}