Replace all raw string comparisons with StringKey, source generator that creates cache keys for all names for Gen7 plugin
All checks were successful
Build / Build (push) Successful in 2m21s
All checks were successful
Build / Build (push) Successful in 2m21s
This commit is contained in:
@@ -3,13 +3,11 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
[Script(ScriptCategory.Move, "dream_eater")]
|
||||
public class DreamEater : Script, IScriptOnSecondaryEffect, IScriptBlockOutgoingHit
|
||||
{
|
||||
private static readonly StringKey AsleepStatus = new("asleep");
|
||||
private static readonly StringKey ComatoseAbility = new("comatose");
|
||||
|
||||
/// <inheritdoc />
|
||||
public void BlockOutgoingHit(IExecutingMove executingMove, IPokemon target, byte hitIndex, ref bool block)
|
||||
{
|
||||
if (!target.HasStatus(AsleepStatus) && target.ActiveAbility?.Name != ComatoseAbility)
|
||||
if (!target.HasStatus(ScriptUtils.ResolveName<Status.Sleep>()) &&
|
||||
target.ActiveAbility?.Name != AbilityNames.Comatose)
|
||||
block = true;
|
||||
}
|
||||
|
||||
@@ -19,7 +17,7 @@ public class DreamEater : Script, IScriptOnSecondaryEffect, IScriptBlockOutgoing
|
||||
var user = move.User;
|
||||
var damage = move.GetHitData(target, hit).Damage;
|
||||
var healed = (uint)(damage * 0.5f);
|
||||
if (move.User.HasHeldItem("big_root"))
|
||||
if (move.User.HasHeldItem(ItemNames.BigRoot))
|
||||
healed = (uint)(healed * 1.3f);
|
||||
|
||||
var args = new CustomTriggers.ModifyDrainArgs(move, target, hit, damage, healed, false);
|
||||
|
||||
Reference in New Issue
Block a user