More moves
This commit is contained in:
30
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/PainSplit.cs
Normal file
30
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/PainSplit.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "pain_split")]
|
||||
public class PainSplit : Script
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||
{
|
||||
var userHp = move.User.CurrentHealth;
|
||||
var targetHp = target.CurrentHealth;
|
||||
var averageHp = (userHp + targetHp) / 2;
|
||||
var evtBatch = new EventBatchId();
|
||||
if (userHp > averageHp)
|
||||
{
|
||||
move.User.Damage(userHp - averageHp, DamageSource.Misc, evtBatch, true);
|
||||
}
|
||||
else if (userHp < averageHp)
|
||||
{
|
||||
move.User.Heal(averageHp - userHp, false, evtBatch, true);
|
||||
}
|
||||
if (targetHp > averageHp)
|
||||
{
|
||||
target.Damage(targetHp - averageHp, DamageSource.Misc, evtBatch, true);
|
||||
}
|
||||
else if (targetHp < averageHp)
|
||||
{
|
||||
target.Heal(averageHp - targetHp, false, evtBatch, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user