static List <PartialEffect> GetPartialEffects(string filename, bool ignoreFirstLine = true) { List <PartialEffect> effects = new List <PartialEffect>(); using (Microsoft.VisualBasic.FileIO.TextFieldParser parser = new Microsoft.VisualBasic.FileIO.TextFieldParser(filename)) { parser.TextFieldType = Microsoft.VisualBasic.FileIO.FieldType.Delimited; parser.SetDelimiters(","); if (ignoreFirstLine) { parser.ReadFields(); } while (!parser.EndOfData) { string[] fields = parser.ReadFields(); if (fields.Length == 9) { PartialEffect e = new PartialEffect(fields[0], fields[1], fields[2], fields[3], fields[4], fields[5], fields[6], fields[7], fields[8]); effects.Add(e); } } } return(effects); }
public Effect(string name, float magnitude, int duration, int value) { this.partialEffect = PartialEffect.partialEffects.Find(e => e.name == name); this.name = name; this.description = partialEffect.description; this.beneficial = partialEffect.beneficial; this.poisonous = partialEffect.poisonous; this.variableMagnitude = partialEffect.variableMagnitude; this.variableDuration = partialEffect.variableDuration; this.magnitude = magnitude; this.duration = duration; this.value = value; }
public Effect(string name, string magnitude, string duration, string value) { this.partialEffect = PartialEffect.partialEffects.Find(e => e.name == name); this.name = name; this.description = partialEffect.description; this.beneficial = partialEffect.beneficial; this.poisonous = partialEffect.poisonous; this.variableMagnitude = partialEffect.variableMagnitude; this.variableDuration = partialEffect.variableDuration; this.magnitude = Convert.ToSingle(magnitude); this.duration = Convert.ToInt32(duration); this.value = Convert.ToInt32(value); this.base_cost = partialEffect.base_cost; this.base_magnitude = partialEffect.base_magnitude; this.base_duration = partialEffect.base_duration; }