public virtual void TestPower(Type type, ActionType actionType, AttackType attackType, string range, DamageTypes damageTypes, string effect, EffectTypes effectTypes, PowerFrequency frequency, PowerSource powerSource, string trigger) { Power power; power = Character.GetPowers().Where(x => (x.GetType() == type)).First(); Assert.NotNull(power, "Power not found"); Assert.AreEqual(actionType, power.Action); Assert.AreEqual(attackType, power.AttackTypeAndRange.AttackType); Assert.AreEqual(range, power.AttackTypeAndRange.Range); Assert.AreEqual(damageTypes, power.DamageTypes); Assert.AreEqual(effect != null, power.HasEffect); if (effect != null) { Assert.AreEqual(effect, power.Effect); } Assert.AreEqual(effectTypes, power.EffectTypes); Assert.AreEqual(frequency, power.Frequency); Assert.AreEqual(powerSource, power.PowerSource); Assert.AreEqual(trigger != null, power.HasTrigger); if (trigger != null) { Assert.AreEqual(trigger, power.Trigger); } }
public void AutoLoadNext() { int powerDistance = 50; if (this.isLoaded) { List <PowerFrequency>[] pfList = new List <PowerFrequency> [TimeSlotUtils.TimeSlotToSize(this.timeslot)]; for (int p = 0; p < this.dayStore[(int)this.day][0].data.timeSlot.Length; p++) { pfList[p] = new List <PowerFrequency>(); } for (int d = 0; d < this.dayStore[(int)this.day].Count; d++) { for (int t = 0; t < this.dayStore[(int)this.day][d].data.timeSlot.Length; t++) { PowerFrequency findPf = pfList[t].Find( (pf) => pf.wh == Math.Floor((Math.Round(this.dayStore[(int)this.day][d].data.timeSlot[t] / 10) * 10) / powerDistance) * powerDistance); if (findPf == null) { pfList[t].Add(new PowerFrequency(Math.Floor((Math.Round(this.dayStore[(int)this.day][d].data.timeSlot[t] / 10) * 10) / powerDistance) * powerDistance)); } else { findPf.IncFrequency(); } } } for (int p = 0; p < this.dayStore[(int)this.day][0].data.timeSlot.Length; p++) { pfList[p].Sort(); if (pfList[p][pfList[p].Count() - 1].wh >= maxWh) { maxWh = pfList[p][pfList[p].Count() - 1].wh; } } if (++this.autoCount >= 10) { this.changed.Invoke(this, new ModelEventArgs(COMMON_ACTIONS.STOP_LOADING)); this.changed.Invoke(this, new ModelEventArgs(VIEW_ACTIONS.AUTO_LOAD_LAST, this.keyword, pfList, this.timeslot)); } else { this.changed.Invoke(this, new ModelEventArgs(VIEW_ACTIONS.AUTO_LOAD_NEXT_SUCCESS, this.keyword, pfList, this.timeslot)); } } }
public override void TestPower(Type type, ActionType actionType, AttackType attackType, string range, DamageTypes damageTypes, string effect, EffectTypes effectTypes, PowerFrequency frequency, PowerSource powerSource, string trigger) { base.TestPower(type, actionType, attackType, range, damageTypes, effect, effectTypes, frequency, powerSource, trigger); }
public async void RequestSimPf() { int powerDistance = 50; await Task.Run(() => { this.similarDatas.ForEach(async(sm) => { List <Data> datas = new List <Data>(); for (int d = 0; d < this.dayStore[(int)this.day].Count; d++) { string path = System.Windows.Forms.Application.StartupPath + @"\" + this.timeslot + @"\clustering_" + this.dayStore[(int)this.day][d].date.ToString("yyyyMMdd") + ".csv"; StreamReader sr = new StreamReader(path, Encoding.GetEncoding("euc-kr")); while (!sr.EndOfStream) { string line = await sr.ReadLineAsync(); string uid = line.Split(',')[0]; if (uid == sm.uid) { datas.Add(new Data(line.Split(',').ToList())); break; } } sr.Close(); } // datas 가 전부 만들어졌을 거임 List <PowerFrequency>[] pfList = new List <PowerFrequency> [TimeSlotUtils.TimeSlotToSize(this.timeslot)]; for (int p = 0; p < datas[0].timeSlot.Length; p++) { pfList[p] = new List <PowerFrequency>(); } for (int d = 0; d < datas.Count; d++) { for (int t = 0; t < datas[d].timeSlot.Length; t++) { PowerFrequency findPf = pfList[t].Find( (pf) => pf.wh == Math.Floor((Math.Round(datas[d].timeSlot[t] / 10) * 10) / powerDistance) * powerDistance); if (findPf == null) { pfList[t].Add(new PowerFrequency(Math.Floor((Math.Round(datas[d].timeSlot[t] / 10) * 10) / powerDistance) * powerDistance)); } else { findPf.IncFrequency(); } } } for (int p = 0; p < datas[0].timeSlot.Length; p++) { pfList[p].Sort(); } // PowerFrequency 도 구성 끝! this.changed.Invoke(this, new ModelEventArgs(VIEW_ACTIONS.REQUEST_SIMPF_SUCCESS, string.Format("{0} ({1})", sm.uid, sm.frequency), pfList, this.timeslot)); }); }); }
public void RequestDayData(bool isNotify = true) { this.maxWh = 0; int powerDistance = 50; if (this.isLoaded) { Console.WriteLine(string.Format("{0} --- DayData", this.day)); List <PowerFrequency>[] pfList = new List <PowerFrequency> [TimeSlotUtils.TimeSlotToSize(this.timeslot)]; // cluster Power Frequency List <PowerFrequency>[] cpfList = new List <PowerFrequency> [TimeSlotUtils.TimeSlotToSize(this.timeslot)]; for (int p = 0; p < this.dayStore[(int)this.day][0].data.timeSlot.Length; p++) { pfList[p] = new List <PowerFrequency>(); cpfList[p] = new List <PowerFrequency>(); } for (int d = 0; d < this.dayStore[(int)this.day].Count; d++) { for (int t = 0; t < this.dayStore[(int)this.day][d].data.timeSlot.Length; t++) { PowerFrequency findPf = pfList[t].Find( (pf) => pf.wh == Math.Floor((Math.Round(this.dayStore[(int)this.day][d].data.timeSlot[t] / 10) * 10) / powerDistance) * powerDistance); if (findPf == null) { pfList[t].Add(new PowerFrequency(Math.Floor((Math.Round(this.dayStore[(int)this.day][d].data.timeSlot[t] / 10) * 10) / powerDistance) * powerDistance)); } else { findPf.IncFrequency(); } } for (int t = 0; t < this.dayStore[(int)this.day][d].cluster.timeSlot.Length; t++) { PowerFrequency findPf = cpfList[t].Find( (pf) => pf.wh == Math.Floor((Math.Round(this.dayStore[(int)this.day][d].cluster.timeSlot[t] / 10) * 10) / powerDistance) * powerDistance); if (findPf == null) { cpfList[t].Add(new PowerFrequency(Math.Floor((Math.Round(this.dayStore[(int)this.day][d].cluster.timeSlot[t] / 10) * 10) / powerDistance) * powerDistance)); } else { findPf.IncFrequency(); } } } for (int p = 0; p < this.dayStore[(int)this.day][0].data.timeSlot.Length; p++) { pfList[p].Sort(); cpfList[p].Sort(); if (pfList[p][pfList[p].Count() - 1].wh >= maxWh) { maxWh = pfList[p][pfList[p].Count() - 1].wh; } } /* * for (int p = 0; p < this.dayStore[(int)this.day][0].data.timeSlot.Length; p++) * { * pfList[p].ForEach((pf) => * { * Console.WriteLine(pf.ToString()); * }); * } */ this.powerFrequencies = pfList; this.clusterPowerFrequencies = cpfList; if (isNotify) { this.changed.Invoke(this, new ModelEventArgs(VIEW_ACTIONS.REQUEST_DAYDATA_SUCCESS, this.dayStore[(int)this.day].ToArray(), this.powerFrequencies, this.clusterPowerFrequencies, this.timeslot, this.maxWh)); } } }
/// <summary> /// Get a printable version of the <see cref="PowerFrequency"/> enum value. /// </summary> /// <param name="powerFrequency"> /// The frequency. /// </param> /// <returns> /// A printable version. /// </returns> /// <exception cref="ArgumentException"> /// Unknown frequency. /// </exception> public static string GetPowerFrequency(PowerFrequency powerFrequency) { switch(powerFrequency) { case PowerFrequency.AtWill: return "at will"; case PowerFrequency.Encounter: return "encounter"; case PowerFrequency.Consumable: return "consumable"; default: throw new ArgumentException( string.Format("Unknown frequency '{0}'", powerFrequency)); } }