More moves
This commit is contained in:
22
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/Outrage.cs
Normal file
22
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/Outrage.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "outrage")]
|
||||
public class Outrage : Script
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||
{
|
||||
if (move.User.Volatile.Contains<OutrageEffect>())
|
||||
return;
|
||||
|
||||
var battleData = move.User.BattleData;
|
||||
if (battleData == null)
|
||||
return;
|
||||
|
||||
var turns = battleData.Battle.Random.GetBool() ? 2 : 3;
|
||||
move.User.Volatile.Add(new OutrageEffect(move.User, turns, move.MoveChoice.TargetSide,
|
||||
move.MoveChoice.TargetPosition));
|
||||
}
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
22
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/ParabolicCharge.cs
Normal file
22
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/ParabolicCharge.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using System.Linq;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "parabolic_charge")]
|
||||
public class ParabolicCharge : Script
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void OnAfterMove(IExecutingMove move)
|
||||
{
|
||||
if (move.User.IsFainted)
|
||||
return;
|
||||
var totalDamage = move.Hits.Sum(x => x.Damage);
|
||||
var halfDamage = totalDamage / 2;
|
||||
if (halfDamage == 0)
|
||||
return;
|
||||
if (halfDamage > uint.MaxValue)
|
||||
halfDamage = uint.MaxValue;
|
||||
|
||||
move.User.Heal((uint)halfDamage);
|
||||
}
|
||||
}
|
||||
37
Plugins/PkmnLib.Plugin.Gen7/Scripts/Pokemon/OutrageEffect.cs
Normal file
37
Plugins/PkmnLib.Plugin.Gen7/Scripts/Pokemon/OutrageEffect.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
using PkmnLib.Plugin.Gen7.Scripts.Utils;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||
|
||||
[Script(ScriptCategory.Pokemon, "outrage")]
|
||||
public class OutrageEffect : Script
|
||||
{
|
||||
private readonly IPokemon _owner;
|
||||
private int _turns;
|
||||
private readonly byte _targetSide;
|
||||
private readonly byte _targetPosition;
|
||||
|
||||
public OutrageEffect(IPokemon owner, int turns, byte targetSide, byte targetPosition)
|
||||
{
|
||||
_owner = owner;
|
||||
_turns = turns;
|
||||
_targetSide = targetSide;
|
||||
_targetPosition = targetPosition;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void ForceTurnSelection(byte sideIndex, byte position, ref ITurnChoice? choice)
|
||||
{
|
||||
choice = TurnChoiceHelper.CreateMoveChoice(_owner, "outrage", _targetSide, _targetPosition);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnAfterHits(IExecutingMove move, IPokemon target)
|
||||
{
|
||||
_turns--;
|
||||
if (_turns <= 0)
|
||||
{
|
||||
RemoveSelf();
|
||||
_owner.Volatile.Add(new Confusion());
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user