More unit tests, fixes
This commit is contained in:
@@ -3,10 +3,9 @@ using PkmnLib.Plugin.Gen7.Scripts.Side;
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "echoed_voice")]
|
||||
public class EchoedVoice : Script, IScriptOnSecondaryEffect, IScriptChangeDamageModifier
|
||||
public class EchoedVoice : Script, IScriptOnSecondaryEffect, IScriptChangeBasePower
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public void ChangeDamageModifier(IExecutingMove move, IPokemon target, byte hit, ref float modifier)
|
||||
public void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower)
|
||||
{
|
||||
var battleData = move.User.BattleData;
|
||||
if (battleData == null)
|
||||
@@ -16,7 +15,8 @@ public class EchoedVoice : Script, IScriptOnSecondaryEffect, IScriptChangeDamage
|
||||
if (echoedVoiceData == null)
|
||||
return;
|
||||
|
||||
modifier *= 2;
|
||||
var newBasePower = basePower + (ushort)(echoedVoiceData.Stacks * 40);
|
||||
basePower = (ushort)Math.Min(newBasePower, 200);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
||||
@@ -9,14 +9,19 @@ public class ElectroBall : Script, IScriptChangeBasePower
|
||||
var user = move.User;
|
||||
var targetSpeed = target.BoostedStats.Speed;
|
||||
var userSpeed = user.BoostedStats.Speed;
|
||||
if (targetSpeed == 0)
|
||||
{
|
||||
basePower = 40;
|
||||
return;
|
||||
}
|
||||
|
||||
var ratio = (float)userSpeed / targetSpeed;
|
||||
basePower = ratio switch
|
||||
{
|
||||
> 4 => 150,
|
||||
> 3 => 120,
|
||||
> 2 => 80,
|
||||
> 1 => 60,
|
||||
>= 4 => 150,
|
||||
>= 3 => 120,
|
||||
>= 2 => 80,
|
||||
>= 1 => 60,
|
||||
_ => 40,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using System.Collections.Frozen;
|
||||
using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
@@ -13,7 +14,8 @@ public class Encore : Script, IScriptOnSecondaryEffect
|
||||
return;
|
||||
|
||||
var lastMove = target.BattleData?.LastMoveChoice;
|
||||
if (lastMove == null || battle.Library.MiscLibrary.IsReplacementChoice(lastMove))
|
||||
if (lastMove == null || battle.Library.MiscLibrary.IsReplacementChoice(lastMove) ||
|
||||
lastMove.ChosenMove.MoveData.HasFlag(MoveFlags.CantRepeat))
|
||||
{
|
||||
move.GetHitData(target, hit).Fail();
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user