kwsch / pkNX

Pokémon (Nintendo Switch) ROM Editor & Randomizer
https://projectpokemon.org/home/forums/topic/48647-pknx-nintendo-switch-rom-editor-randomizer/
GNU General Public License v3.0
338 stars 106 forks source link

Add value options for multiple Move variables #352

Open drvictorvs opened 7 months ago

drvictorvs commented 7 months ago

Unfortunately, I'm not at all familiar with C# and I can't compile on my current PC to test, so I won't make the rest of the changes. By analogy to the other fields, for Inflict, I imagine they'd be:

In pkNXStructures.FlatBuffers.SWSH/Gen8/Waza.cs:

- int IMove.Inflict  { get => Inflict; set => Inflict = (byte)value; }
+ public MoveInflict Inflict { get => (MoveInflict)RawInflict; set => RawInflict = (byte)value; }

In pkNXStructures/Move.cs:

- public int Inflict { get; set; }
+ public MoveInflict int Inflict { get; set; }

In pkNXStructures/Move6.cs:

- public override int Inflict { get => BitConverter.ToUInt16(Data, 0x08); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x08); }
+ public override MoveInflict Inflict { get => (Inflict)Data[0x08]); set => Data[0x08] = (byte)value; }

In pkNXStructures/Move7.cs:

- public override int Inflict { get => BitConverter.ToUInt16(Data, 0x08); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x08); }
+ public override MoveInflict Inflict { get => (Inflict)Data[0x08]); set => Data[0x08] = (byte)value; }

Admittedly, the commits have been a bit messy, and I simply followed the existing file structure even though it's not really efficient for such few options, but I hope this helps the project.

drvictorvs commented 7 months ago

By the way, I've only checked in SwSh, but the Healing field seems to also be used to specify non-recoil self damage for moves for which the opponent is also damaged. For instance, Clangorous Soul has Healing value 223, and Struggle has Healing value 231. I'm not sure whether using those values for item healing would also lead to such damage, but if not, then the Move Editor dialog might need to handle the Healing field differently than the Item Editor does.

Just for reference, these are my notes regarding Healing:

Healing: 
Note: Some healing is implemented as negative recoil.
0) None
25) Quarter
50) Half
223) Minus Third
231) Struggle (Gen 1, 50% dmg dealt/Gen 2-3 25% dmg dealt/Gen 3-9 25% maximum HP)

RawHealing:
Note: Some healing is implemented as negative recoil.
-3) Quarter
-2) Half
-1) Full
-33) Combined with Healing 223 - Minus Third
-25) Combined with Healing 231 - Struggle (see above)

Note that the 25 and 50 values come from the transformation that pkNX itself does, since I'm using Dump data.