More abilities
This commit is contained in:
31
Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/RKSSystem.cs
Normal file
31
Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/RKSSystem.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
|
||||
/// <summary>
|
||||
/// RKS System is an ability that changes the Pokémon's type based on its held Memory.
|
||||
///
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/RKS_System_(Ability)">Bulbapedia - RKS System</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "rks_system")]
|
||||
public class RKSSystem : Script
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void OnAfterHeldItemChange(IPokemon pokemon, IItem? previous, IItem? item)
|
||||
{
|
||||
if (pokemon.Species.Name != "silvally")
|
||||
return;
|
||||
if (item is null && pokemon.Form.Name != "default")
|
||||
{
|
||||
pokemon.ChangeForm(pokemon.Species.GetDefaultForm());
|
||||
}
|
||||
else if (item is not null && item.Name.ToString().EndsWith("_memory", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
var memoryPrefix =
|
||||
item.Name.ToString().Replace("_memory", string.Empty, StringComparison.OrdinalIgnoreCase);
|
||||
var formName = $"silvally_{memoryPrefix}";
|
||||
if (pokemon.Species.TryGetForm(formName, out var form))
|
||||
{
|
||||
pokemon.ChangeForm(form);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user