This commit is contained in:
@@ -14,15 +14,16 @@ public class Acupressure : Script, IScriptOnSecondaryEffect
|
||||
/// <inheritdoc />
|
||||
public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||
{
|
||||
var possibleStats = target.StatBoost.Where(x => x.statistic != Statistic.Hp && x.value < 6).ToArray();
|
||||
// If the target has no stats to raise, the move fails
|
||||
if (target.StatBoost.All(s => s.value == 6))
|
||||
if (!possibleStats.Any())
|
||||
{
|
||||
move.GetHitData(target, hit).Fail();
|
||||
return;
|
||||
}
|
||||
|
||||
// Choose a random stat to raise. 0 is HP, so we start at 1.
|
||||
var stat = (Statistic)move.User.BattleData!.Battle.Random.GetInt(1, (int)Statistic.Speed + 1);
|
||||
var index = move.User.BattleData!.Battle.Random.GetInt(0, possibleStats.Length);
|
||||
var stat = possibleStats[index].statistic;
|
||||
target.ChangeStatBoost(stat, 2, false, false);
|
||||
}
|
||||
}
|
||||
@@ -23,11 +23,10 @@ public class Autotomize : Script, IScriptOnSecondaryEffect
|
||||
public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||
{
|
||||
var user = move.User;
|
||||
if (!user.ChangeStatBoost(Statistic.Speed, 2, true, false))
|
||||
return;
|
||||
|
||||
var existingEffect = user.Volatile.Get<AutotomizeEffect>();
|
||||
var stacks = existingEffect?.Stacks ?? 0;
|
||||
|
||||
if (!user.ChangeStatBoost(Statistic.Speed, 2, true, false) || !(user.WeightInKg - 100f * stacks >= 0.1f))
|
||||
if (!(user.WeightInKg > 0.1f))
|
||||
return;
|
||||
|
||||
user.Volatile.StackOrAdd(ScriptUtils.ResolveName<AutotomizeEffect>(), () => new AutotomizeEffect());
|
||||
|
||||
@@ -27,6 +27,8 @@ public class Drain : Script, IScriptOnInitialize, IScriptOnSecondaryEffect
|
||||
target.RunScriptHook<IScriptCustomTrigger>(x => x.CustomTrigger(CustomTriggers.ModifyDrain, args));
|
||||
invert = args.Invert;
|
||||
healed = args.Healed;
|
||||
if (healed == 0)
|
||||
healed = 1;
|
||||
|
||||
if (invert)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user