public MoveData(DataRow row) { this.id = (ushort)(long)row["ID"]; this.name = row["Name"] as string; this.description = row["Description"] as string; this.type = GetPokemonTypeFromString(row["Type"] as string); this.power = (byte)(long)row["Power"]; this.accuracy = (byte)(long)row["Accuracy"]; this.pp = (byte)(long)row["PP"]; this.category = GetMoveCategoryFromString(row["Category"] as string); this.conditionType = GetConditionTypeFromString(row["ConditionType"] as string); this.contestDescription = row["ContestDescription"] as string; this.appeal = (byte)(long)row["Appeal"]; this.jam = (byte)(long)row["Jam"]; }
void SetHiddenPowerType(PokemonTypes type);
public void SetHiddenPowerType(PokemonTypes type) { if (type < PokemonTypes.Fighting || type > PokemonTypes.Dark) return; // Invalid Hidden Power type // The minus two is because the types enum is offset by two due to including the Unknown and Normal types byte typeBits = (byte)(((int)type - 2 - 30) * 63 / 50); // The minimum value for this move type // Now we could say that we're done since we have the info to change the IVs. // But let's make sure the IVs are as close to the originals as possible. BitArray originalTypeBits = GetHiddenPowerTypeBits(); int minDeviation = ByteHelper.GetBitDeviation(ByteHelper.GetBits(typeBits), originalTypeBits); byte minDeviationTypeBits = typeBits; while (typeBits + 1 <= 0x3F && GetHiddenPowerType((byte)(typeBits + 1)) == type) { typeBits++; int newDeviation = ByteHelper.GetBitDeviation(ByteHelper.GetBits(typeBits), originalTypeBits); if (newDeviation < minDeviation) { minDeviation = newDeviation; minDeviationTypeBits = typeBits; } } SetHiddenPowerTypeBits(new BitArray(minDeviationTypeBits)); }