Implements Paralysis
This commit is contained in:
parent
0d03a8f28d
commit
9d2c2de17a
@ -69,6 +69,8 @@ public static class MoveTurnExecutor
|
||||
|
||||
var executingMove = new ExecutingMoveImpl(targets, numberOfHits, chosenMove, useMove, moveChoice, battle);
|
||||
|
||||
battle.EventHook.Invoke(new MoveUseEvent(executingMove));
|
||||
|
||||
var prevented = false;
|
||||
executingMove.RunScriptHook(x => x.PreventMove(executingMove, ref prevented));
|
||||
if (prevented)
|
||||
@ -79,8 +81,6 @@ public static class MoveTurnExecutor
|
||||
if (!executingMove.ChosenMove.TryUse(ppUsed))
|
||||
return;
|
||||
|
||||
battle.EventHook.Invoke(new MoveUseEvent(executingMove));
|
||||
|
||||
var failed = false;
|
||||
executingMove.RunScriptHook(x => x.FailMove(executingMove, ref failed));
|
||||
if (failed)
|
||||
|
@ -1,4 +1,5 @@
|
||||
using PkmnLib.Static.Moves;
|
||||
using PkmnLib.Static.Utils;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Status;
|
||||
|
||||
@ -30,6 +31,15 @@ public class Burned : Script
|
||||
if (_target == null)
|
||||
return;
|
||||
var damage = (uint)(_target.MaxHealth / 16f);
|
||||
_target.Damage(damage, DamageSource.Status);
|
||||
var eventBatch = new EventBatchId();
|
||||
battle.EventHook.Invoke(new DialogEvent("hurt_by_burn", new Dictionary<string, object>
|
||||
{
|
||||
{ "pokemon", _target },
|
||||
{ "damage", damage },
|
||||
})
|
||||
{
|
||||
BatchId = eventBatch,
|
||||
});
|
||||
_target.Damage(damage, DamageSource.Status, eventBatch);
|
||||
}
|
||||
}
|
@ -3,5 +3,21 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Status;
|
||||
[Script(ScriptCategory.Status, "paralyzed")]
|
||||
public class Paralyzed : Script
|
||||
{
|
||||
// TODO: Implement the Paralyzed status effect.
|
||||
/// <inheritdoc />
|
||||
public override void ChangeSpeed(ITurnChoice choice, ref uint speed)
|
||||
{
|
||||
speed = (uint)(speed * 0.5f);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void PreventMove(IExecutingMove move, ref bool prevent)
|
||||
{
|
||||
if (move.Battle.Random.GetInt(0, 100) >= 25)
|
||||
return;
|
||||
prevent = true;
|
||||
move.Battle.EventHook.Invoke(new DialogEvent("paralysis_prevent_move", new Dictionary<string, object>
|
||||
{
|
||||
{ "pokemon", move.User },
|
||||
}));
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user