using System; using System.Collections.Generic; namespace MaidStatus { public class ParametersPack { public ParametersPack() { this.dataPacks = new Dictionary(); } public ParametersPack(ParametersPack src) { this.dataPacks = new Dictionary(src.dataPacks); } public static ParametersPack operator +(ParametersPack a, ParametersPack b) { ParametersPack parametersPack = new ParametersPack(); foreach (KeyValuePair keyValuePair in a.dataPacks) { parametersPack.Add(keyValuePair.Key, keyValuePair.Value); if (b.dataPacks.ContainsKey(keyValuePair.Key)) { parametersPack.Add(keyValuePair.Key, b.dataPacks[keyValuePair.Key]); } } foreach (KeyValuePair keyValuePair2 in b.dataPacks) { if (!parametersPack.dataPacks.ContainsKey(keyValuePair2.Key)) { parametersPack.Add(keyValuePair2.Key, keyValuePair2.Value); } } return parametersPack; } public static ParametersPack.StatusType NameToStatusType(string statusName) { ParametersPack.StatusType result = ParametersPack.StatusType.体力; try { result = (ParametersPack.StatusType)Enum.Parse(typeof(ParametersPack.StatusType), statusName); } catch (Exception e) { NDebug.AssertParseError("StatusType", e); } return result; } public Dictionary dataPacks { get; private set; } public void Parse(string texts, char separator = ',') { if (string.IsNullOrEmpty(texts)) { return; } string[] array = texts.Split(new char[] { separator }); foreach (string text in array) { string text2 = text.Replace("\u3000", string.Empty).Replace(" ", string.Empty).Replace("+", "+").Replace("ー", "-").Replace("=", "="); bool flag = text2.IndexOf('=') != -1; bool flag2 = text2.IndexOf('-') != -1; string[] array3 = null; if (flag) { array3 = text2.Split(new char[] { '=' }); } else if (flag2) { array3 = text2.Split(new char[] { '-' }); } else { array3 = text2.Split(new char[] { '+' }); } NDebug.Assert(array3.Length == 2, text2 + "\ntoken count error : " + array3.Length); ParametersPack.StatusType targetStatus = ParametersPack.NameToStatusType(array3[0]); int num = 0; try { num = int.Parse(array3[1]); } catch (Exception) { NDebug.Assert("intのパースに失敗しました\n" + array3[1], false); } if (flag) { this.Set(targetStatus, num); } else { if (flag2) { num *= -1; } this.Add(targetStatus, num); } } } public void Clear() { this.dataPacks.Clear(); } public void Set(ParametersPack.StatusType targetStatus, int setNum) { this.dataPacks[targetStatus] = setNum; } public void Add(ParametersPack.StatusType targetStatus, int addNum) { if (!this.dataPacks.ContainsKey(targetStatus)) { this.dataPacks.Add(targetStatus, 0); } Dictionary dataPacks; (dataPacks = this.dataPacks)[targetStatus] = dataPacks[targetStatus] + addNum; if (this.dataPacks[targetStatus] == 0) { this.dataPacks.Remove(targetStatus); } } public void ApplyAddBonusStatus(BonusStatus bonusStatus) { if (this.dataPacks == null || this.dataPacks.Count <= 0) { return; } Dictionary> dictionary = new Dictionary>(); dictionary.Add(ParametersPack.StatusType.興奮, delegate(int addNum) { bonusStatus.excite += addNum; }); dictionary.Add(ParametersPack.StatusType.官能, delegate(int addNum) { bonusStatus.sensual += addNum; }); dictionary.Add(ParametersPack.StatusType.理性, delegate(int addNum) { bonusStatus.reason += addNum; }); dictionary.Add(ParametersPack.StatusType.体力, delegate(int addNum) { bonusStatus.hp += addNum; }); dictionary.Add(ParametersPack.StatusType.精神, delegate(int addNum) { bonusStatus.mind += addNum; }); dictionary.Add(ParametersPack.StatusType.接待, delegate(int addNum) { bonusStatus.reception += addNum; }); dictionary.Add(ParametersPack.StatusType.お世話, delegate(int addNum) { bonusStatus.care += addNum; }); dictionary.Add(ParametersPack.StatusType.可憐, delegate(int addNum) { bonusStatus.lovely += addNum; }); dictionary.Add(ParametersPack.StatusType.気品, delegate(int addNum) { bonusStatus.elegance += addNum; }); dictionary.Add(ParametersPack.StatusType.料理, delegate(int addNum) { bonusStatus.cooking += addNum; }); dictionary.Add(ParametersPack.StatusType.ボ\u30FCカル, delegate(int addNum) { bonusStatus.vocal += addNum; }); dictionary.Add(ParametersPack.StatusType.ダンス, delegate(int addNum) { bonusStatus.dance += addNum; }); dictionary.Add(ParametersPack.StatusType.AP, delegate(int addNum) { bonusStatus.appealPoint += addNum; }); dictionary.Add(ParametersPack.StatusType.魅惑, delegate(int addNum) { bonusStatus.charm += addNum; }); dictionary.Add(ParametersPack.StatusType.淫欲, delegate(int addNum) { bonusStatus.inyoku += addNum; }); dictionary.Add(ParametersPack.StatusType.M性, delegate(int addNum) { bonusStatus.mvalue += addNum; }); dictionary.Add(ParametersPack.StatusType.変態, delegate(int addNum) { bonusStatus.hentai += addNum; }); dictionary.Add(ParametersPack.StatusType.奉仕, delegate(int addNum) { bonusStatus.housi += addNum; }); dictionary.Add(ParametersPack.StatusType.指導, delegate(int addNum) { bonusStatus.teachRate += addNum; }); foreach (KeyValuePair keyValuePair in this.dataPacks) { if (dictionary.ContainsKey(keyValuePair.Key)) { dictionary[keyValuePair.Key](keyValuePair.Value); } else { NDebug.Assert("ボーナスステータスの適用に[" + keyValuePair.Key.ToString() + "]が指定されていますが未対応です", false); } } } public bool GreaterThanOrEqualToStatus(Status status) { if (this.dataPacks == null || this.dataPacks.Count <= 0) { return true; } Dictionary dictionary = this.CreateCurrentStatusDic(status); foreach (KeyValuePair keyValuePair in this.dataPacks) { NDebug.Assert(dictionary.ContainsKey(keyValuePair.Key), "ParametersPack:" + keyValuePair.Key.ToString() + "はステータスに存在しません"); if (keyValuePair.Value > dictionary[keyValuePair.Key]) { return false; } } return true; } public List> CreateConditionTextAndStaturResults(Status status) { List> list = new List>(); Dictionary dictionary = this.CreateCurrentStatusDic(status); foreach (KeyValuePair keyValuePair in this.dataPacks) { string str = keyValuePair.Key.ToString(); bool value = keyValuePair.Value <= dictionary[keyValuePair.Key]; list.Add(new KeyValuePair(str + " " + keyValuePair.Value.ToString(), value)); } return list; } private Dictionary CreateCurrentStatusDic(Status status) { return new Dictionary { { ParametersPack.StatusType.興奮, status.currentExcite }, { ParametersPack.StatusType.官能, status.currentSensual }, { ParametersPack.StatusType.理性, status.maxReason }, { ParametersPack.StatusType.体力, status.maxHp }, { ParametersPack.StatusType.精神, status.maxMind }, { ParametersPack.StatusType.接待, status.reception }, { ParametersPack.StatusType.お世話, status.care }, { ParametersPack.StatusType.可憐, status.lovely }, { ParametersPack.StatusType.気品, status.elegance }, { ParametersPack.StatusType.魅惑, status.charm }, { ParametersPack.StatusType.料理, status.cooking }, { ParametersPack.StatusType.ボ\u30FCカル, status.vocal }, { ParametersPack.StatusType.ダンス, status.dance }, { ParametersPack.StatusType.AP, status.appealPoint }, { ParametersPack.StatusType.淫欲, status.inyoku }, { ParametersPack.StatusType.M性, status.mvalue }, { ParametersPack.StatusType.変態, status.hentai }, { ParametersPack.StatusType.奉仕, status.housi }, { ParametersPack.StatusType.指導, status.teachRate }, { ParametersPack.StatusType.経験人数, status.sexPlayNumberOfPeople } }; } public enum StatusType { 興奮, 官能, 理性, 体力, 精神, 接待, お世話, 可憐, 気品, 魅惑, 料理, ボ\u30FCカル, ダンス, AP, 淫欲, M性, 変態, 奉仕, 指導, 経験人数 } } }