Implements 11 more moves
This commit is contained in:
27
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/BaseChargeMove.cs
Normal file
27
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/BaseChargeMove.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
public abstract class BaseChargeMove<TVolatile> : Script where TVolatile : Script
|
||||
{
|
||||
public abstract TVolatile CreateVolatile(IPokemon user);
|
||||
|
||||
public override void PreventMove(IExecutingMove move, ref bool prevent)
|
||||
{
|
||||
if (move.User.Volatile.Contains<TVolatile>())
|
||||
return;
|
||||
|
||||
move.User.Volatile.Add(CreateVolatile(move.User));
|
||||
move.User.BattleData?.Battle.EventHook.Invoke(new DialogEvent("began_charging", new Dictionary<string, object>()
|
||||
{
|
||||
{ "user", move.User },
|
||||
}));
|
||||
prevent = true;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnBeforeMove(IExecutingMove move)
|
||||
{
|
||||
move.User.Volatile.Remove(ScriptUtils.ResolveName<TVolatile>());
|
||||
}
|
||||
}
|
||||
11
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/ForceCritical.cs
Normal file
11
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/ForceCritical.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "force_critical")]
|
||||
public class ForceCritical : Script
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeCriticalStage(IExecutingMove move, IPokemon target, byte hit, ref byte stage)
|
||||
{
|
||||
stage = 100;
|
||||
}
|
||||
}
|
||||
23
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/FreezeShock.cs
Normal file
23
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/FreezeShock.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "freeze_shock")]
|
||||
public class FreezeShock : BaseChargeMove<FreezeShockEffect>
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override FreezeShockEffect CreateVolatile(IPokemon user) => new(user);
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||
{
|
||||
var battleData = target.BattleData;
|
||||
if (battleData == null)
|
||||
return;
|
||||
|
||||
if (battleData.Battle.Random.EffectChance(30, move, target, hit))
|
||||
{
|
||||
target.SetStatus("paralyzed");
|
||||
}
|
||||
}
|
||||
}
|
||||
14
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/Frustration.cs
Normal file
14
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/Frustration.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using System;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "frustration")]
|
||||
public class Frustration : Script
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref byte basePower)
|
||||
{
|
||||
var friendship = move.User.Happiness;
|
||||
basePower = Math.Min((byte)1, (byte)((255 - friendship) * 2 / 5));
|
||||
}
|
||||
}
|
||||
18
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/FuryCutter.cs
Normal file
18
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/FuryCutter.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "fury_cutter")]
|
||||
public class FuryCutter : Script
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref byte basePower)
|
||||
{
|
||||
var userEffect = move.User.Volatile.Get<FuryCutterEffect>();
|
||||
if (userEffect == null)
|
||||
return;
|
||||
|
||||
userEffect.TurnCount++;
|
||||
basePower = (byte)(basePower * (userEffect.TurnCount + 1));
|
||||
}
|
||||
}
|
||||
26
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/FusionBolt.cs
Normal file
26
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/FusionBolt.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using System.Linq;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "fusion_bolt")]
|
||||
public class FusionBolt : Script
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeDamageModifier(IExecutingMove move, IPokemon target, byte hit, ref float modifier)
|
||||
{
|
||||
var battleData = target.BattleData;
|
||||
if (battleData == null)
|
||||
return;
|
||||
|
||||
// Grab the choices for the current turn, that have been executed before this move.
|
||||
var choice = battleData.Battle.PreviousTurnChoices.Last().TakeWhile(x => x != move.MoveChoice)
|
||||
// Of these, find the move choice that used Fusion Flare.
|
||||
.OfType<MoveChoice>().FirstOrDefault(x => x.ChosenMove.MoveData.Name == "fusion_flare");
|
||||
|
||||
// If Fusion Flare was used, Fusion Bolt's power is doubled.
|
||||
if (choice != null)
|
||||
{
|
||||
modifier *= 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
26
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/FusionFlare.cs
Normal file
26
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/FusionFlare.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using System.Linq;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "fusion_flare")]
|
||||
public class FusionFlare : Script
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeDamageModifier(IExecutingMove move, IPokemon target, byte hit, ref float modifier)
|
||||
{
|
||||
var battleData = target.BattleData;
|
||||
if (battleData == null)
|
||||
return;
|
||||
|
||||
// Grab the choices for the current turn, that have been executed before this move.
|
||||
var choice = battleData.Battle.PreviousTurnChoices.Last().TakeWhile(x => x != move.MoveChoice)
|
||||
// Of these, find the move choice that used Fusion Bolt.
|
||||
.OfType<MoveChoice>().FirstOrDefault(x => x.ChosenMove.MoveData.Name == "fusion_bolt");
|
||||
|
||||
// If Fusion Bolt was used, Fusion Flare's power is doubled.
|
||||
if (choice != null)
|
||||
{
|
||||
modifier *= 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
20
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/FutureSight.cs
Normal file
20
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/FutureSight.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||
using PkmnLib.Static.Utils;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "future_sight")]
|
||||
public class FutureSight : Script
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void StopBeforeMove(IExecutingMove move, ref bool prevent)
|
||||
{
|
||||
var battleData = move.User.BattleData;
|
||||
if (battleData == null)
|
||||
return;
|
||||
battleData.Battle.Volatile.Add(new FutureSightEffect(move.MoveChoice));
|
||||
|
||||
prevent = true;
|
||||
}
|
||||
}
|
||||
11
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/GastroAcid.cs
Normal file
11
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/GastroAcid.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "gastro_acid")]
|
||||
public class GastroAcid : Script
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||
{
|
||||
target.SuppressAbility();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user