More moves implemented
This commit is contained in:
@@ -6,7 +6,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
public class BanefulBunker : ProtectionScript
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override ProtectionEffectScript GetEffectScript()
|
||||
protected override Script GetEffectScript()
|
||||
{
|
||||
return new BanefulBunkerEffect();
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ public class Counter : Script
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void ChangeDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
|
||||
public override void ChangeMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
|
||||
{
|
||||
var counterHelper = move.User.Volatile.Get<CounterHelperEffect>();
|
||||
if (counterHelper == null || counterHelper.LastHitBy == null || counterHelper.LastHitBy != target)
|
||||
|
||||
@@ -4,7 +4,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
public class DragonRage : Script
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
|
||||
public override void ChangeMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
|
||||
{
|
||||
damage = 40;
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ public class Electrify : Script
|
||||
if (choiceQueue == null)
|
||||
return;
|
||||
|
||||
if (choiceQueue.Where(x => x is IMoveChoice moveChoice && moveChoice.User == target) is not IMoveChoice choice)
|
||||
if (choiceQueue.FirstOrDefault(x => x is IMoveChoice moveChoice && moveChoice.User == target) is not IMoveChoice choice)
|
||||
{
|
||||
move.GetHitData(target, hit).Fail();
|
||||
return;
|
||||
|
||||
13
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/Embargo.cs
Normal file
13
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/Embargo.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "embargo")]
|
||||
public class Embargo : Script
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||
{
|
||||
target.Volatile.Add(new EmbargoEffect());
|
||||
}
|
||||
}
|
||||
31
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/Encore.cs
Normal file
31
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/Encore.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using System.Linq;
|
||||
using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "encore")]
|
||||
public class Encore : Script
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||
{
|
||||
var battle = target.BattleData?.Battle;
|
||||
if (battle == null)
|
||||
return;
|
||||
|
||||
var currentTurn = battle.ChoiceQueue!.LastRanChoice;
|
||||
var lastMove = battle.PreviousTurnChoices
|
||||
.SelectMany(x => x)
|
||||
.OfType<IMoveChoice>()
|
||||
.TakeWhile(x => x != currentTurn)
|
||||
.LastOrDefault(x => x.User == target);
|
||||
if (lastMove == null)
|
||||
{
|
||||
move.GetHitData(target, hit).Fail();
|
||||
return;
|
||||
}
|
||||
|
||||
var effect = new EncoreEffect(target, lastMove.ChosenMove.MoveData.Name, 3);
|
||||
target.Volatile.Add(effect);
|
||||
}
|
||||
}
|
||||
18
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/Endeavor.cs
Normal file
18
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/Endeavor.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "endeavor")]
|
||||
public class Endeavor : Script
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
|
||||
{
|
||||
var user = move.User;
|
||||
var userHealth = user.CurrentHealth;
|
||||
var targetHealth = target.CurrentHealth;
|
||||
if (userHealth >= targetHealth)
|
||||
{
|
||||
return;
|
||||
}
|
||||
damage = targetHealth - userHealth;
|
||||
}
|
||||
}
|
||||
10
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/Endure.cs
Normal file
10
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/Endure.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "endure")]
|
||||
public class Endure : ProtectionScript
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override Script GetEffectScript() => new EndureEffect();
|
||||
}
|
||||
25
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/Entrainment.cs
Normal file
25
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/Entrainment.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "entrainment")]
|
||||
public class Entrainment : Script
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||
{
|
||||
var userAbility = move.User.ActiveAbility;
|
||||
var targetAbility = target.ActiveAbility;
|
||||
if (userAbility == targetAbility || userAbility == null)
|
||||
{
|
||||
move.GetHitData(target, hit).Fail();
|
||||
return;
|
||||
}
|
||||
|
||||
if (userAbility.HasFlag("cant_be_copied") || targetAbility?.HasFlag("cant_be_changed") != false)
|
||||
{
|
||||
move.GetHitData(target, hit).Fail();
|
||||
return;
|
||||
}
|
||||
|
||||
target.ChangeAbility(userAbility);
|
||||
}
|
||||
}
|
||||
13
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/Eruption.cs
Normal file
13
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/Eruption.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "eruption")]
|
||||
public class Eruption : Script
|
||||
{
|
||||
public override void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref byte basePower)
|
||||
{
|
||||
basePower = Math.Max((byte)(150 * move.User.CurrentHealth / move.User.BoostedStats.Hp), (byte)1);
|
||||
}
|
||||
|
||||
}
|
||||
11
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/Explosion.cs
Normal file
11
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/Explosion.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "explosion")]
|
||||
public class Explosion : Script
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void OnAfterHits(IExecutingMove move, IPokemon target)
|
||||
{
|
||||
move.User.Damage(move.User.CurrentHealth * 10, DamageSource.Misc);
|
||||
}
|
||||
}
|
||||
17
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/Facade.cs
Normal file
17
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/Facade.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using PkmnLib.Static.Utils;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "facade")]
|
||||
public class Facade : Script
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref byte basePower)
|
||||
{
|
||||
var status = move.User.StatusScript.Script?.Name;
|
||||
if (status == "paralyzed" || status == "burned" || status == "poisoned")
|
||||
{
|
||||
basePower.MultiplyOrMax(2);
|
||||
}
|
||||
}
|
||||
}
|
||||
14
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/FairyLock.cs
Normal file
14
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/FairyLock.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using PkmnLib.Plugin.Gen7.Scripts.Battle;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "fairy_lock")]
|
||||
public class FairyLock : Script
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||
{
|
||||
var battle = target.BattleData?.Battle;
|
||||
battle?.Volatile.Add(new FairyLockEffect());
|
||||
}
|
||||
}
|
||||
23
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/FakeOut.cs
Normal file
23
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/FakeOut.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "fake_out")]
|
||||
public class FakeOut : Script
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void StopBeforeMove(IExecutingMove move, ref bool stop)
|
||||
{
|
||||
var battleData = move.User.BattleData;
|
||||
if (battleData == null)
|
||||
return;
|
||||
if (battleData.SwitchInTurn != battleData.Battle.CurrentTurnNumber)
|
||||
stop = true;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||
{
|
||||
target.Volatile.Add(new FlinchEffect());
|
||||
}
|
||||
}
|
||||
14
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/FalseSwipe.cs
Normal file
14
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/FalseSwipe.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "false_swipe")]
|
||||
public class FalseSwipe : Script
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
|
||||
{
|
||||
if (target.CurrentHealth - damage < 1)
|
||||
{
|
||||
damage = target.CurrentHealth - 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
16
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/FellStinger.cs
Normal file
16
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/FellStinger.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using PkmnLib.Static;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "fell_stinger")]
|
||||
public class FellStinger : Script
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void OnAfterHits(IExecutingMove move, IPokemon target)
|
||||
{
|
||||
if (target.IsFainted)
|
||||
{
|
||||
move.User.ChangeStatBoost(Statistic.Attack, 2, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
17
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/FinalGambit.cs
Normal file
17
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/FinalGambit.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "final_gambit")]
|
||||
public class FinalGambit : Script
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
|
||||
{
|
||||
damage = move.User.CurrentHealth;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||
{
|
||||
move.User.Damage(move.User.CurrentHealth * 10, DamageSource.Misc);
|
||||
}
|
||||
}
|
||||
29
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/FireFang.cs
Normal file
29
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/FireFang.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
public class FireFang : Script
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||
{
|
||||
var battleData = target.BattleData;
|
||||
if (battleData == null)
|
||||
return;
|
||||
var random = battleData.Battle.Random;
|
||||
if (random.EffectChance(10, move, target, hit))
|
||||
{
|
||||
target.SetStatus("burned");
|
||||
}
|
||||
|
||||
// It also has an independent 10% chance of causing the target to flinch, if the user attacks before the target.
|
||||
var choiceQueue = battleData.Battle.ChoiceQueue;
|
||||
if (choiceQueue?.FirstOrDefault(x => x.User == target) != null)
|
||||
{
|
||||
if (random.EffectChance(10, move, target, hit))
|
||||
{
|
||||
target.Volatile.Add(new FlinchEffect());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
7
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/FirePledge.cs
Normal file
7
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/FirePledge.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "fire_pledge")]
|
||||
public class FirePledge : Script
|
||||
{
|
||||
// TODO: pledge moves
|
||||
}
|
||||
@@ -6,7 +6,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
[Script(ScriptCategory.Move, "protect")]
|
||||
public class ProtectionScript : Script
|
||||
{
|
||||
protected virtual ProtectionEffectScript GetEffectScript() => new();
|
||||
protected virtual Script GetEffectScript() => new ProtectionEffectScript();
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||
|
||||
Reference in New Issue
Block a user