More unit tests, fixes
This commit is contained in:
@@ -4,6 +4,7 @@ public static class MoveFlags
|
||||
{
|
||||
public static readonly StringKey Ballistics = "ballistics";
|
||||
public static readonly StringKey Bite = "bite";
|
||||
public static readonly StringKey CantRepeat = "cant_repeat";
|
||||
public static readonly StringKey Charge = "charge";
|
||||
public static readonly StringKey Contact = "contact";
|
||||
public static readonly StringKey Dance = "dance";
|
||||
|
||||
@@ -3196,7 +3196,8 @@
|
||||
"mirror",
|
||||
"ignore_substitute",
|
||||
"mental",
|
||||
"limit_move_choice"
|
||||
"limit_move_choice",
|
||||
"cant_repeat"
|
||||
],
|
||||
"effect": {
|
||||
"name": "encore"
|
||||
@@ -6968,7 +6969,8 @@
|
||||
"category": "status",
|
||||
"flags": [
|
||||
"protect",
|
||||
"ignore_substitute"
|
||||
"ignore_substitute",
|
||||
"cant_repeat"
|
||||
],
|
||||
"effect": {
|
||||
"name": "mimic"
|
||||
@@ -7054,7 +7056,9 @@
|
||||
"priority": 0,
|
||||
"target": "Any",
|
||||
"category": "status",
|
||||
"flags": [],
|
||||
"flags": [
|
||||
"cant_repeat"
|
||||
],
|
||||
"effect": {
|
||||
"name": "mirror_move"
|
||||
}
|
||||
@@ -10033,7 +10037,8 @@
|
||||
"target": "Any",
|
||||
"category": "status",
|
||||
"flags": [
|
||||
"ignore_substitute"
|
||||
"ignore_substitute",
|
||||
"cant_repeat"
|
||||
],
|
||||
"effect": {
|
||||
"name": "sketch"
|
||||
@@ -12100,7 +12105,9 @@
|
||||
"priority": 0,
|
||||
"target": "Any",
|
||||
"category": "status",
|
||||
"flags": [],
|
||||
"flags": [
|
||||
"cant_repeat"
|
||||
],
|
||||
"effect": {
|
||||
"name": "transform"
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -6,7 +6,7 @@ public class EndureEffect : Script, IScriptOnEndTurn, IScriptChangeIncomingDamag
|
||||
/// <inheritdoc />
|
||||
public void ChangeIncomingDamage(IPokemon pokemon, DamageSource source, ref uint damage)
|
||||
{
|
||||
if (damage > pokemon.CurrentHealth)
|
||||
if (damage >= pokemon.CurrentHealth)
|
||||
damage = pokemon.CurrentHealth - 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,11 +4,22 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Side;
|
||||
/// Just here to indicate that a Pokemon on this side has used Echoed Voice.
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Side, "echoed_voice_data")]
|
||||
public class EchoedVoiceData : Script, IScriptOnEndTurn
|
||||
public class EchoedVoiceData : Script, IScriptOnBeforeMoveChoice, IScriptStack
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public void OnEndTurn(IScriptSource owner, IBattle battle)
|
||||
private int _stacks = 1;
|
||||
|
||||
public int Stacks => _stacks;
|
||||
|
||||
public void OnBeforeMoveChoice(IMoveChoice moveChoice)
|
||||
{
|
||||
RemoveSelf();
|
||||
if (moveChoice.ChosenMove.MoveData.Name != "echoed_voice")
|
||||
{
|
||||
RemoveSelf();
|
||||
}
|
||||
}
|
||||
|
||||
public void Stack()
|
||||
{
|
||||
_stacks++;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user