Surprisingly, more moves
This commit is contained in:
parent
d02c05874b
commit
c22ad1a793
@ -119,6 +119,8 @@ internal static class MoveTurnExecutor
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
var hitIndex = i;
|
var hitIndex = i;
|
||||||
|
executingMove.RunScriptHook(x => x.OnBeforeHit(executingMove, target, hitIndex));
|
||||||
|
|
||||||
var useMove = executingMove.UseMove;
|
var useMove = executingMove.UseMove;
|
||||||
var hitType = useMove.MoveType;
|
var hitType = useMove.MoveType;
|
||||||
executingMove.RunScriptHook(x => x.ChangeMoveType(executingMove, target, hitIndex, ref hitType));
|
executingMove.RunScriptHook(x => x.ChangeMoveType(executingMove, target, hitIndex, ref hitType));
|
||||||
|
@ -312,7 +312,7 @@ public abstract class Script : IDeepCloneable
|
|||||||
/// This function allows a script to change the actual offensive stat values used when calculating damage
|
/// This function allows a script to change the actual offensive stat values used when calculating damage
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public virtual void ChangeOffensiveStatValue(IExecutingMove move, IPokemon target, byte hit, uint defensiveStat,
|
public virtual void ChangeOffensiveStatValue(IExecutingMove move, IPokemon target, byte hit, uint defensiveStat,
|
||||||
ref uint value)
|
ImmutableStatisticSet<uint> targetStats, ref uint value)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -320,7 +320,7 @@ public abstract class Script : IDeepCloneable
|
|||||||
/// This function allows a script to change the actual defensive stat values used when calculating damage.
|
/// This function allows a script to change the actual defensive stat values used when calculating damage.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public virtual void ChangeDefensiveStatValue(IExecutingMove move, IPokemon target, byte hit, uint offensiveStat,
|
public virtual void ChangeDefensiveStatValue(IExecutingMove move, IPokemon target, byte hit, uint offensiveStat,
|
||||||
ref uint value)
|
ImmutableStatisticSet<uint> targetStats, ref uint value)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -610,4 +610,8 @@ public abstract class Script : IDeepCloneable
|
|||||||
public virtual void ChangeCategory(IExecutingMove move, IPokemon target, byte hitIndex, ref MoveCategory category)
|
public virtual void ChangeCategory(IExecutingMove move, IPokemon target, byte hitIndex, ref MoveCategory category)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public virtual void OnBeforeHit(IExecutingMove move, IPokemon target, byte hitIndex)
|
||||||
|
{
|
||||||
|
}
|
||||||
}
|
}
|
@ -62,13 +62,15 @@ public class ScriptContainer : IReadOnlyScriptContainer
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Removes the script from this container.
|
/// Removes the script from this container.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Clear()
|
public Script? Clear()
|
||||||
{
|
{
|
||||||
if (Script is not null)
|
if (Script is not null)
|
||||||
{
|
{
|
||||||
Script.OnRemove();
|
Script.OnRemove();
|
||||||
}
|
}
|
||||||
|
var script = Script;
|
||||||
Script = null;
|
Script = null;
|
||||||
|
return script;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ClearWithoutRemoving()
|
public void ClearWithoutRemoving()
|
||||||
|
@ -83,7 +83,8 @@ public record ImmutableStatisticSet<T> where T : struct
|
|||||||
/// A set of statistics that can be changed.
|
/// A set of statistics that can be changed.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <typeparam name="T"></typeparam>
|
/// <typeparam name="T"></typeparam>
|
||||||
public record StatisticSet<T> : ImmutableStatisticSet<T>, IEnumerable<T>, IDeepCloneable where T : struct
|
public record StatisticSet<T> : ImmutableStatisticSet<T>, IEnumerable<(Statistic statistic, T value)>, IDeepCloneable
|
||||||
|
where T : struct
|
||||||
{
|
{
|
||||||
/// <inheritdoc cref="StatisticSet{T}"/>
|
/// <inheritdoc cref="StatisticSet{T}"/>
|
||||||
public StatisticSet() : base(default, default, default, default, default, default)
|
public StatisticSet() : base(default, default, default, default, default, default)
|
||||||
@ -214,14 +215,14 @@ public record StatisticSet<T> : ImmutableStatisticSet<T>, IEnumerable<T>, IDeepC
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public virtual IEnumerator<T> GetEnumerator()
|
public virtual IEnumerator<(Statistic, T)> GetEnumerator()
|
||||||
{
|
{
|
||||||
yield return Hp;
|
yield return (Statistic.Hp, Hp);
|
||||||
yield return Attack;
|
yield return (Statistic.Attack, Attack);
|
||||||
yield return Defense;
|
yield return (Statistic.Defense, Defense);
|
||||||
yield return SpecialAttack;
|
yield return (Statistic.SpecialAttack, SpecialAttack);
|
||||||
yield return SpecialDefense;
|
yield return (Statistic.SpecialDefense, SpecialDefense);
|
||||||
yield return Speed;
|
yield return (Statistic.Speed, Speed);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
@ -367,16 +368,16 @@ public record StatBoostStatisticSet : ClampedStatisticSet<sbyte>
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override IEnumerator<sbyte> GetEnumerator()
|
public override IEnumerator<(Statistic, sbyte)> GetEnumerator()
|
||||||
{
|
{
|
||||||
yield return Hp;
|
yield return (Statistic.Hp, Hp);
|
||||||
yield return Attack;
|
yield return (Statistic.Attack, Attack);
|
||||||
yield return Defense;
|
yield return (Statistic.Defense, Defense);
|
||||||
yield return SpecialAttack;
|
yield return (Statistic.SpecialAttack, SpecialAttack);
|
||||||
yield return SpecialDefense;
|
yield return (Statistic.SpecialDefense, SpecialDefense);
|
||||||
yield return Speed;
|
yield return (Statistic.Speed, Speed);
|
||||||
yield return Evasion;
|
yield return (Statistic.Evasion, Evasion);
|
||||||
yield return Accuracy;
|
yield return (Statistic.Accuracy, Accuracy);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8239,7 +8239,10 @@
|
|||||||
"flags": [
|
"flags": [
|
||||||
"protect",
|
"protect",
|
||||||
"mirror"
|
"mirror"
|
||||||
]
|
],
|
||||||
|
"effect": {
|
||||||
|
"name": "present"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "prismatic_laser",
|
"name": "prismatic_laser",
|
||||||
@ -8254,7 +8257,10 @@
|
|||||||
"recharge",
|
"recharge",
|
||||||
"protect",
|
"protect",
|
||||||
"mirror"
|
"mirror"
|
||||||
]
|
],
|
||||||
|
"effect": {
|
||||||
|
"name": "requires_recharge"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "protect",
|
"name": "protect",
|
||||||
@ -8265,7 +8271,10 @@
|
|||||||
"priority": 4,
|
"priority": 4,
|
||||||
"target": "Self",
|
"target": "Self",
|
||||||
"category": "status",
|
"category": "status",
|
||||||
"flags": []
|
"flags": [],
|
||||||
|
"effect": {
|
||||||
|
"name": "protect"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "psybeam",
|
"name": "psybeam",
|
||||||
@ -8279,7 +8288,11 @@
|
|||||||
"flags": [
|
"flags": [
|
||||||
"protect",
|
"protect",
|
||||||
"mirror"
|
"mirror"
|
||||||
]
|
],
|
||||||
|
"effect": {
|
||||||
|
"name": "confuse",
|
||||||
|
"chance": 10
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "psych_up",
|
"name": "psych_up",
|
||||||
@ -8292,7 +8305,10 @@
|
|||||||
"category": "status",
|
"category": "status",
|
||||||
"flags": [
|
"flags": [
|
||||||
"ignore-substitute"
|
"ignore-substitute"
|
||||||
]
|
],
|
||||||
|
"effect": {
|
||||||
|
"name": "psych_up"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "psychic",
|
"name": "psychic",
|
||||||
@ -8306,7 +8322,14 @@
|
|||||||
"flags": [
|
"flags": [
|
||||||
"protect",
|
"protect",
|
||||||
"mirror"
|
"mirror"
|
||||||
]
|
],
|
||||||
|
"effect": {
|
||||||
|
"name": "change_target_special_defense",
|
||||||
|
"chance": 10,
|
||||||
|
"parameters": {
|
||||||
|
"amount": -1
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "psychic_fangs",
|
"name": "psychic_fangs",
|
||||||
@ -8321,7 +8344,10 @@
|
|||||||
"contact",
|
"contact",
|
||||||
"protect",
|
"protect",
|
||||||
"mirror"
|
"mirror"
|
||||||
]
|
],
|
||||||
|
"effect": {
|
||||||
|
"name": "brick_break"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "psychic_terrain",
|
"name": "psychic_terrain",
|
||||||
@ -8334,7 +8360,10 @@
|
|||||||
"category": "status",
|
"category": "status",
|
||||||
"flags": [
|
"flags": [
|
||||||
"nonskybattle"
|
"nonskybattle"
|
||||||
]
|
],
|
||||||
|
"effect": {
|
||||||
|
"name": "psychic_terrain"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "psycho_boost",
|
"name": "psycho_boost",
|
||||||
@ -8348,7 +8377,13 @@
|
|||||||
"flags": [
|
"flags": [
|
||||||
"protect",
|
"protect",
|
||||||
"mirror"
|
"mirror"
|
||||||
]
|
],
|
||||||
|
"effect": {
|
||||||
|
"name": "change_user_special_attack",
|
||||||
|
"parameters": {
|
||||||
|
"amount": -2
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "psycho_cut",
|
"name": "psycho_cut",
|
||||||
@ -8362,7 +8397,10 @@
|
|||||||
"flags": [
|
"flags": [
|
||||||
"protect",
|
"protect",
|
||||||
"mirror"
|
"mirror"
|
||||||
]
|
],
|
||||||
|
"effect": {
|
||||||
|
"name": "increased_critical_stage"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "psycho_shift",
|
"name": "psycho_shift",
|
||||||
@ -8376,7 +8414,10 @@
|
|||||||
"flags": [
|
"flags": [
|
||||||
"protect",
|
"protect",
|
||||||
"mirror"
|
"mirror"
|
||||||
]
|
],
|
||||||
|
"effect": {
|
||||||
|
"name": "psycho_shift"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "psyshock",
|
"name": "psyshock",
|
||||||
@ -8390,7 +8431,10 @@
|
|||||||
"flags": [
|
"flags": [
|
||||||
"protect",
|
"protect",
|
||||||
"mirror"
|
"mirror"
|
||||||
]
|
],
|
||||||
|
"effect": {
|
||||||
|
"name": "psyshock"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "psystrike",
|
"name": "psystrike",
|
||||||
@ -8404,7 +8448,10 @@
|
|||||||
"flags": [
|
"flags": [
|
||||||
"protect",
|
"protect",
|
||||||
"mirror"
|
"mirror"
|
||||||
]
|
],
|
||||||
|
"effect": {
|
||||||
|
"name": "psyshock"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "psywave",
|
"name": "psywave",
|
||||||
@ -8418,7 +8465,10 @@
|
|||||||
"flags": [
|
"flags": [
|
||||||
"protect",
|
"protect",
|
||||||
"mirror"
|
"mirror"
|
||||||
]
|
],
|
||||||
|
"effect": {
|
||||||
|
"name": "psywave"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "pulverizing_pancake",
|
"name": "pulverizing_pancake",
|
||||||
@ -8432,6 +8482,7 @@
|
|||||||
"flags": [
|
"flags": [
|
||||||
"contact"
|
"contact"
|
||||||
]
|
]
|
||||||
|
// No secondary effect
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "punishment",
|
"name": "punishment",
|
||||||
@ -8446,7 +8497,10 @@
|
|||||||
"contact",
|
"contact",
|
||||||
"protect",
|
"protect",
|
||||||
"mirror"
|
"mirror"
|
||||||
]
|
],
|
||||||
|
"effect": {
|
||||||
|
"name": "punishment"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "purify",
|
"name": "purify",
|
||||||
@ -8461,7 +8515,10 @@
|
|||||||
"protect",
|
"protect",
|
||||||
"reflectable",
|
"reflectable",
|
||||||
"heal"
|
"heal"
|
||||||
]
|
],
|
||||||
|
"effect": {
|
||||||
|
"name": "purify"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "pursuit",
|
"name": "pursuit",
|
||||||
|
@ -136,9 +136,10 @@ public class Gen7DamageCalculator(bool hasRandomness) : IDamageCalculator
|
|||||||
var origOffensiveStat = offensiveStat;
|
var origOffensiveStat = offensiveStat;
|
||||||
|
|
||||||
executingMove.RunScriptHook(script =>
|
executingMove.RunScriptHook(script =>
|
||||||
script.ChangeOffensiveStatValue(executingMove, target, hitNumber, defensiveStat, ref offensiveStat));
|
script.ChangeOffensiveStatValue(executingMove, target, hitNumber, defensiveStat, targetStats,
|
||||||
executingMove.RunScriptHook(script =>
|
ref offensiveStat));
|
||||||
script.ChangeDefensiveStatValue(executingMove, target, hitNumber, origOffensiveStat, ref defensiveStat));
|
executingMove.RunScriptHook(script => script.ChangeDefensiveStatValue(executingMove, target, hitNumber,
|
||||||
|
origOffensiveStat, targetStats, ref defensiveStat));
|
||||||
|
|
||||||
var modifier = (float)offensiveStat / defensiveStat;
|
var modifier = (float)offensiveStat / defensiveStat;
|
||||||
executingMove.RunScriptHook(script =>
|
executingMove.RunScriptHook(script =>
|
||||||
|
@ -18,7 +18,7 @@ public class Acupressure : Script
|
|||||||
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||||
{
|
{
|
||||||
// If the target has no stats to raise, the move fails
|
// If the target has no stats to raise, the move fails
|
||||||
if (target.StatBoost.All(s => s == 6))
|
if (target.StatBoost.All(s => s.value == 6))
|
||||||
{
|
{
|
||||||
move.GetHitData(target, hit).Fail();
|
move.GetHitData(target, hit).Fail();
|
||||||
return;
|
return;
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
using PkmnLib.Static;
|
||||||
using PkmnLib.Static.Moves;
|
using PkmnLib.Static.Moves;
|
||||||
|
|
||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||||
@ -7,7 +8,7 @@ public class FoulPlay : Script
|
|||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void ChangeOffensiveStatValue(IExecutingMove move, IPokemon target, byte hit, uint _,
|
public override void ChangeOffensiveStatValue(IExecutingMove move, IPokemon target, byte hit, uint _,
|
||||||
ref uint value)
|
ImmutableStatisticSet<uint> targetStats, ref uint value)
|
||||||
{
|
{
|
||||||
value = move.UseMove.Category == MoveCategory.Physical
|
value = move.UseMove.Category == MoveCategory.Physical
|
||||||
? target.BoostedStats.Attack
|
? target.BoostedStats.Attack
|
||||||
|
57
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/Present.cs
Normal file
57
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/Present.cs
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
using PkmnLib.Static.Moves;
|
||||||
|
|
||||||
|
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||||
|
|
||||||
|
[Script(ScriptCategory.Move, "present")]
|
||||||
|
public class Present : Script
|
||||||
|
{
|
||||||
|
private bool _isHealing;
|
||||||
|
private byte _basePower;
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override void OnBeforeHit(IExecutingMove move, IPokemon target, byte hitIndex)
|
||||||
|
{
|
||||||
|
var battleRandom = move.User.BattleData?.Battle.Random;
|
||||||
|
if (battleRandom == null)
|
||||||
|
return;
|
||||||
|
var percentRoll = battleRandom.GetFloat() * 100.0;
|
||||||
|
if (percentRoll < 20.0)
|
||||||
|
{
|
||||||
|
_isHealing = true;
|
||||||
|
_basePower = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_isHealing = false;
|
||||||
|
_basePower = percentRoll switch
|
||||||
|
{
|
||||||
|
< 30 => 120,
|
||||||
|
< 60 => 80,
|
||||||
|
_ => 40,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override void ChangeCategory(IExecutingMove move, IPokemon target, byte hitIndex, ref MoveCategory category)
|
||||||
|
{
|
||||||
|
if (_isHealing)
|
||||||
|
category = MoveCategory.Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref byte basePower)
|
||||||
|
{
|
||||||
|
basePower = _basePower;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||||
|
{
|
||||||
|
if (!_isHealing)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var healAmount = (ushort)(target.MaxHealth / 4);
|
||||||
|
target.Heal(healAmount);
|
||||||
|
}
|
||||||
|
}
|
25
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/PsychUp.cs
Normal file
25
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/PsychUp.cs
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
using System;
|
||||||
|
using PkmnLib.Static;
|
||||||
|
|
||||||
|
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||||
|
|
||||||
|
[Script(ScriptCategory.Move, "psych_up")]
|
||||||
|
public class PsychUp : Script
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||||
|
{
|
||||||
|
var targetStats = target.StatBoost;
|
||||||
|
var userStats = move.User.StatBoost;
|
||||||
|
foreach (Statistic stat in Enum.GetValues(typeof(Statistic)))
|
||||||
|
{
|
||||||
|
var targetStat = targetStats.GetStatistic(stat);
|
||||||
|
var userStat = userStats.GetStatistic(stat);
|
||||||
|
if (targetStat != userStat)
|
||||||
|
{
|
||||||
|
userStats.SetStatistic(stat, targetStat);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
move.User.RecalculateBoostedStats();
|
||||||
|
}
|
||||||
|
}
|
12
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/PsychicTerrain.cs
Normal file
12
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/PsychicTerrain.cs
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||||
|
|
||||||
|
[Script(ScriptCategory.Move, "psychic_terrain")]
|
||||||
|
public class PsychicTerrain : Script
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||||
|
{
|
||||||
|
var battleData = move.User.BattleData;
|
||||||
|
battleData?.Battle.SetTerrain(ScriptUtils.ResolveName<Terrain.PsychicTerrain>());
|
||||||
|
}
|
||||||
|
}
|
19
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/PsychoShift.cs
Normal file
19
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/PsychoShift.cs
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||||
|
|
||||||
|
[Script(ScriptCategory.Move, "psycho_shift")]
|
||||||
|
public class PsychoShift : Script
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||||
|
{
|
||||||
|
var statusScript = move.User.StatusScript;
|
||||||
|
var targetStatusScript = target.StatusScript;
|
||||||
|
if (statusScript.IsEmpty || !targetStatusScript.IsEmpty)
|
||||||
|
{
|
||||||
|
move.GetHitData(target, hit).Fail();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var script = statusScript.Clear();
|
||||||
|
targetStatusScript.Set(script!);
|
||||||
|
}
|
||||||
|
}
|
14
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/Psyshock.cs
Normal file
14
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/Psyshock.cs
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
using PkmnLib.Static;
|
||||||
|
|
||||||
|
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||||
|
|
||||||
|
[Script(ScriptCategory.Move, "psyshock")]
|
||||||
|
public class Psyshock : Script
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override void ChangeDefensiveStatValue(IExecutingMove move, IPokemon target, byte hit, uint offensiveStat,
|
||||||
|
ImmutableStatisticSet<uint> targetStats, ref uint value)
|
||||||
|
{
|
||||||
|
value = targetStats.Defense;
|
||||||
|
}
|
||||||
|
}
|
19
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/Psywave.cs
Normal file
19
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/Psywave.cs
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
using PkmnLib.Static.Utils;
|
||||||
|
|
||||||
|
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||||
|
|
||||||
|
[Script(ScriptCategory.Move, "psywave")]
|
||||||
|
public class Psywave : Script
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override void ChangeMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
|
||||||
|
{
|
||||||
|
if (move.User.BattleData == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var random = move.User.BattleData.Battle.Random.GetInt(0, 10);
|
||||||
|
var level = (uint)move.User.Level;
|
||||||
|
var power = level.MultiplyOrMax(0.5f + 0.1f * random);
|
||||||
|
damage = power;
|
||||||
|
}
|
||||||
|
}
|
21
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/Punishment.cs
Normal file
21
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/Punishment.cs
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
using System.Linq;
|
||||||
|
using PkmnLib.Static;
|
||||||
|
|
||||||
|
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||||
|
|
||||||
|
[Script(ScriptCategory.Move, "punishment")]
|
||||||
|
public class Punishment : Script
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref byte basePower)
|
||||||
|
{
|
||||||
|
if (move.User.BattleData == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var totalPower = 60 + 20 * target.StatBoost.Count(x =>
|
||||||
|
x.statistic is not Statistic.Accuracy and Statistic.Evasion && x.value > 0);
|
||||||
|
if (totalPower > 200)
|
||||||
|
totalPower = 200;
|
||||||
|
basePower = (byte)totalPower;
|
||||||
|
}
|
||||||
|
}
|
18
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/Purify.cs
Normal file
18
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/Purify.cs
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||||
|
|
||||||
|
[Script(ScriptCategory.Move, "purify")]
|
||||||
|
public class Purify : Script
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||||
|
{
|
||||||
|
if (target.StatusScript.IsEmpty)
|
||||||
|
{
|
||||||
|
move.GetHitData(target, hit).Fail();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
target.ClearStatus();
|
||||||
|
target.Heal(target.MaxHealth / 2);
|
||||||
|
}
|
||||||
|
}
|
@ -1,3 +1,5 @@
|
|||||||
|
using PkmnLib.Static;
|
||||||
|
|
||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||||
|
|
||||||
[Script(ScriptCategory.Pokemon, "power_trick")]
|
[Script(ScriptCategory.Pokemon, "power_trick")]
|
||||||
@ -5,14 +7,14 @@ public class PowerTrickEffect : Script
|
|||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void ChangeOffensiveStatValue(IExecutingMove move, IPokemon target, byte hit, uint defensiveStat,
|
public override void ChangeOffensiveStatValue(IExecutingMove move, IPokemon target, byte hit, uint defensiveStat,
|
||||||
ref uint value)
|
ImmutableStatisticSet<uint> targetStats, ref uint value)
|
||||||
{
|
{
|
||||||
value = defensiveStat;
|
value = defensiveStat;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void ChangeDefensiveStatValue(IExecutingMove move, IPokemon target, byte hit, uint offensiveStat,
|
public override void ChangeDefensiveStatValue(IExecutingMove move, IPokemon target, byte hit, uint offensiveStat,
|
||||||
ref uint value)
|
ImmutableStatisticSet<uint> targetStats, ref uint value)
|
||||||
{
|
{
|
||||||
value = offensiveStat;
|
value = offensiveStat;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user