Even more moves
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2025-05-05 16:58:03 +02:00
parent 292c303fc0
commit 7727f92f4e
132 changed files with 624 additions and 171 deletions

View File

@@ -1,5 +1,3 @@
using PkmnLib.Static;
namespace PkmnLib.Plugin.Gen7.Scripts.Side;
[Script(ScriptCategory.Side, "mist")]

View File

@@ -0,0 +1,44 @@
using System;
using System.Collections.Generic;
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Side;
[Script(ScriptCategory.Side, "spikes")]
public class SpikesEffect : Script
{
private int _layers = 1;
/// <inheritdoc />
public override void Stack()
{
if (_layers < 3)
_layers++;
}
/// <inheritdoc />
public override void OnSwitchIn(IPokemon pokemon, byte position)
{
if (pokemon.IsFloating)
return;
var modifier = _layers switch
{
1 => 1 / 16f,
2 => 3 / 16f,
3 => 1 / 4f,
_ => throw new ArgumentOutOfRangeException(),
};
var damage = (uint)(pokemon.MaxHealth * modifier);
EventBatchId eventBatch = new();
pokemon.Damage(damage, DamageSource.Misc, eventBatch);
pokemon.BattleData?.Battle.EventHook.Invoke(new DialogEvent("spikes_damage", new Dictionary<string, object>
{
{ "pokemon", pokemon },
})
{
BatchId = eventBatch,
});
}
}

View File

@@ -0,0 +1,33 @@
using System.Collections.Generic;
using PkmnLib.Dynamic.Models.BattleFlow;
namespace PkmnLib.Plugin.Gen7.Scripts.Side;
public class SpotlightEffect : Script
{
private readonly byte _position;
private readonly IBattleSide _side;
public SpotlightEffect(IBattleSide side, byte position)
{
_side = side;
_position = position;
}
/// <inheritdoc />
public override void ChangeIncomingTargets(IMoveChoice moveChoice, ref IReadOnlyList<IPokemon?> targets)
{
if (!TargetResolver.IsValidTarget(_side.Index, _position, moveChoice.ChosenMove.MoveData.Target,
moveChoice.User))
return;
if (_side.Pokemon[_position] == null)
return;
targets = [_side.Pokemon[_position]!];
}
/// <inheritdoc />
public override void OnEndTurn(IBattle battle)
{
RemoveSelf();
}
}

View File

@@ -0,0 +1,26 @@
using System.Collections.Generic;
namespace PkmnLib.Plugin.Gen7.Scripts.Side;
[Script(ScriptCategory.Side, "stealth_rock")]
public class StealthRockEffect : Script
{
/// <inheritdoc />
public override void OnSwitchIn(IPokemon pokemon, byte position)
{
var typeLibrary = pokemon.Library.StaticLibrary.Types;
var effectiveness = 1.0f;
if (typeLibrary.TryGetTypeIdentifier("rock", out var rockType))
{
effectiveness = typeLibrary.GetEffectiveness(rockType, pokemon.Types);
}
var damage = (uint)(pokemon.MaxHealth / 8f * effectiveness);
EventBatchId batchId = new();
pokemon.Damage(damage, DamageSource.Misc, batchId);
pokemon.BattleData?.Battle.EventHook.Invoke(new DialogEvent("stealth_rock_damage",
new Dictionary<string, object>
{
{ "pokemon", pokemon },
}));
}
}

View File

@@ -0,0 +1,13 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Side;
[Script(ScriptCategory.Side, "sticky_web")]
public class StickyWebEffect : Script
{
/// <inheritdoc />
public override void OnSwitchIn(IPokemon pokemon, byte position)
{
if (pokemon.IsFloating)
return;
pokemon.ChangeStatBoost(Statistic.Speed, -1, false);
}
}