public static MagicDefinition ReadFromFile(ResourceDataFile dataFile) { MagicDefinition def = new MagicDefinition(); def.MagicId = dataFile.ReadInt(); def.Type = (MagicType)dataFile.ReadInt(); int min = dataFile.ReadInt(); int max = dataFile.ReadInt(); def.Span = new FDSpan(min, max); if (def.Type == MagicType.Attack) { def.ApInvoledRate = dataFile.ReadInt(); } def.HittingRate = dataFile.ReadInt(); def.EffectRange = dataFile.ReadInt(); def.EffectScope = dataFile.ReadInt(); def.MpCost = dataFile.ReadInt(); def.AllowAfterMove = dataFile.ReadBoolean(); def.AiConsiderRate = dataFile.ReadInt(); def.IsCross = false; if (def.EffectScope < 0) { def.EffectScope = -def.EffectScope; def.IsCross = true; } return(def); }
private void LoadMagicDefinitions() { magicDefinitions = new Dictionary <int, MagicDefinition>(); ResourceDataFile fileReader = new ResourceDataFile(@"Data/Magic"); int magicCount = fileReader.ReadInt(); for (int i = 0; i < magicCount; i++) { MagicDefinition def = MagicDefinition.ReadFromFile(fileReader); magicDefinitions[def.MagicId] = def; } }