More moves
This commit is contained in:
@@ -1,7 +1,32 @@
|
||||
using PkmnLib.Static.Moves;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Side;
|
||||
|
||||
[Script(ScriptCategory.Side, "light_screen")]
|
||||
public class LightScreenEffect : Script
|
||||
public class LightScreenEffect(int turns) : Script
|
||||
{
|
||||
// TODO: Implement LightScreenEffect
|
||||
private int _turns = turns;
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void ChangeIncomingMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
|
||||
{
|
||||
if (move.UseMove.Category != MoveCategory.Special ||
|
||||
// Critical hits are not affected by the barrier
|
||||
move.GetHitData(target, hit).IsCritical)
|
||||
return;
|
||||
var battleData = target.BattleData;
|
||||
// If not a 1v1 battle, damage reduction is only 1/3rd.
|
||||
if (battleData?.Battle.PositionsPerSide > 1)
|
||||
damage = (uint)(damage * (2.0f / 3.0f));
|
||||
else
|
||||
damage = (uint)(damage * 0.5f);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnEndTurn(IBattle battle)
|
||||
{
|
||||
_turns -= 1;
|
||||
if (_turns <= 0)
|
||||
RemoveSelf();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user