public EquipStats(EquipStats es) { FieldInfo[] fields1 = GetType().GetFields(); FieldInfo[] fields2 = es.GetType().GetFields(); for (int i = 0; i < fields1.Length; i++) { fields1[i].SetValue(this, (float)fields2[i].GetValue(es)); } }
//Construct the equipment. public Equipment GetEquipment(Equipment e, EquipType et, EquipStats es) { //Roll until we get one. while (true) { Equipment r = Equipment.GetItem(e, et); if (r.MainStat.stat == es) { return(r); } } }
public static EquipStats operator-(EquipStats es1, EquipStats es2) { EquipStats es = new EquipStats(); FieldInfo[] fields = es.GetType().GetFields(); FieldInfo[] fields1 = es1.GetType().GetFields(); FieldInfo[] fields2 = es2.GetType().GetFields(); for (int i = 0; i < fields.Length; i++) { fields[i].SetValue(es, (float)fields1[i].GetValue(es1) - (float)fields2[i].GetValue(es2)); } return(es); }
public Equip(Equip e) { name = e.name; id = e.id; description = e.description; iconPath = e.iconPath; itemType = ItemType.equip; equipType = e.equipType; stats = new EquipStats(e.stats); modelPath = e.modelPath; animPath = e.animPath; }
public Equip(string name, string id, string description, string iconPath, ItemType itemType, EquipType equipType, EquipStats stats, string modelPath, string animPath) { this.name = name; this.id = id; this.description = description; this.iconPath = iconPath; this.itemType = itemType; this.equipType = equipType; this.stats = new EquipStats(stats); this.modelPath = modelPath; this.animPath = animPath; }
public Equip() { name = ""; id = ""; description = ""; iconPath = ""; itemType = ItemType.equip; equipType = EquipType.primary; stats = new EquipStats(); modelPath = ""; animPath = ""; }
private short ChooseDefensiveStat(EquipStats stats, AnalyzerSettings.DefensiveStat stat) { switch (stat) { case AnalyzerSettings.DefensiveStat.DEF: return(stats.Def.GetValueOrDefault(0)); case AnalyzerSettings.DefensiveStat.RES: return(stats.Res.GetValueOrDefault(0)); default: return(stats.Def.GetValueOrDefault(0)); } }
private short ChooseOffensiveStat(EquipStats stats, AnalyzerSettings.OffensiveStat stat) { switch (stat) { case AnalyzerSettings.OffensiveStat.ATK: return(stats.Atk.GetValueOrDefault(0)); case AnalyzerSettings.OffensiveStat.MAG: return(stats.Mag.GetValueOrDefault(0)); case AnalyzerSettings.OffensiveStat.MND: return(stats.Mnd.GetValueOrDefault(0)); default: return(stats.Atk.GetValueOrDefault(0)); } }
//Get a stat value. public float GetStatValue(EquipStats es) { //Is this stat our main stat? if (MainStat.stat == es) { return(GetComponentValue(MainStat)); } else { //Is this any of our substats? if (SubStats.Find(n => n.stat == es) != null) { return(GetComponentValue(SubStats.Find(n => n.stat == es))); } } //Otherwise, return 0. return(0); }
public float GetEquipStatsPercentage(EquipStats es) { float r = 0; if (weapon != null) { r += weapon.GetStatValue(es); } if (armor != null) { r += armor.GetStatValue(es); } if (accessory != null) { r += accessory.GetStatValue(es); } return(1 + (r / 100)); }
//Get all values of one stat on all of our equipment. public float GetEquipStats(EquipStats es) { float r = 0; if (weapon != null) { r += weapon.GetStatValue(es); } if (armor != null) { r += armor.GetStatValue(es); } if (accessory != null) { r += accessory.GetStatValue(es); } return(r); }
void Awake() { cc = GetComponent <CharacterController>(); anim = GetComponentInChildren <Animator>(); view = GetComponent <NetView>(); maxStats = new CharStats(1f); currentStats = new CharStats(maxStats); currentStats.movtSpd = 250f; maxEquipStats = new EquipStats(1f); currentEquipStats = new EquipStats(maxEquipStats); canMove = true; canCast = true; primaryWeapType = WeaponType.unarmed; }
public void Run() { // First run through and compute the effective stats of each item based // on the value of the item level consideration setting. DebugParallelForEach(mItems.Where(x => !x.Ignore), item => { byte effective_level = item.Item.Level; switch (mSettings.LevelConsideration) { case AnalyzerSettings.ItemLevelConsideration.Current: effective_level = item.Item.Level; break; case AnalyzerSettings.ItemLevelConsideration.CurrentRankMaxLevel: effective_level = item.Item.LevelMax; break; case AnalyzerSettings.ItemLevelConsideration.FullyMaxed: effective_level = StatCalculator.MaxLevel( StatCalculator.Evolve(item.Item.BaseRarity, SchemaConstants.EvolutionLevel.PlusPlus)); break; } item.NonSynergizedStats = StatCalculator.ComputeStatsForLevel(item.Item.BaseRarity, item.BaseStats, item.MaxStats, effective_level); effective_level = StatCalculator.EffectiveLevelWithSynergy(effective_level); item.SynergizedStats = StatCalculator.ComputeStatsForLevel(item.Item.BaseRarity, item.BaseStats, item.MaxStats, effective_level); }); RealmSynergy.SynergyValue[] synergy_values = RealmSynergy.Values.ToArray(); AnalyzerSettings.DefensiveStat[] defensive_stats = Enum.GetValues(typeof(AnalyzerSettings.DefensiveStat)).Cast <AnalyzerSettings.DefensiveStat>().ToArray(); AnalyzerSettings.OffensiveStat[] offensive_stats = Enum.GetValues(typeof(AnalyzerSettings.OffensiveStat)).Cast <AnalyzerSettings.OffensiveStat>().ToArray(); List <AnalysisItem>[,] best_defensive_items = new List <AnalysisItem> [synergy_values.Length, defensive_stats.Length]; List <AnalysisItem>[,] best_offensive_items = new List <AnalysisItem> [synergy_values.Length, offensive_stats.Length]; // Sort the item list MxN different ways, once for each combination of (realm,stat) DebugParallelForEach(CartesianProduct(synergy_values, defensive_stats), x => { RealmSynergy.SynergyValue synergy = x.Key; AnalyzerSettings.DefensiveStat stat = x.Value; List <AnalysisItem> sorted_items = new List <AnalysisItem>(mItems.Where(y => !y.Ignore)); sorted_items.Sort((a, b) => { EquipStats a_stats = a.GetEffectiveStats(synergy); EquipStats b_stats = b.GetEffectiveStats(synergy); short a_value = ChooseDefensiveStat(a_stats, stat); short b_value = ChooseDefensiveStat(b_stats, stat); return(-a_value.CompareTo(b_value)); }); best_defensive_items[(int)synergy.Realm + 1, (int)stat] = sorted_items; }); DebugParallelForEach(CartesianProduct(synergy_values, offensive_stats), x => { RealmSynergy.SynergyValue synergy = x.Key; AnalyzerSettings.OffensiveStat stat = x.Value; List <AnalysisItem> sorted_items = new List <AnalysisItem>(mItems.Where(y => !y.Ignore)); sorted_items.Sort((a, b) => { EquipStats a_stats = a.GetEffectiveStats(synergy); EquipStats b_stats = b.GetEffectiveStats(synergy); short a_value = ChooseOffensiveStat(a_stats, stat); short b_value = ChooseOffensiveStat(b_stats, stat); return(-a_value.CompareTo(b_value)); }); best_offensive_items[(int)synergy.Realm + 1, (int)stat] = sorted_items; }); // Compute the top N items for each character. DebugParallelForEach(mBuddies.Where(x => x.Settings.Score), buddy => { buddy.TopNDefense = new List <AnalysisItem> [synergy_values.Length, defensive_stats.Length]; buddy.TopNOffense = new List <AnalysisItem> [synergy_values.Length, offensive_stats.Length]; for (int x = 0; x < best_defensive_items.GetLength(0); ++x) { for (int y = 0; y < best_defensive_items.GetLength(1); ++y) { List <AnalysisItem> best_items = best_defensive_items[x, y]; buddy.TopNDefense[x, y] = best_items.Where(item => item.EnabledUsers.Contains(buddy)).Take(mTopN).ToList(); } } for (int x = 0; x < best_offensive_items.GetLength(0); ++x) { for (int y = 0; y < best_offensive_items.GetLength(1); ++y) { List <AnalysisItem> best_items = best_offensive_items[x, y]; buddy.TopNOffense[x, y] = best_items.Where(item => item.EnabledUsers.Contains(buddy)).Take(mTopN).ToList(); } } }); // Finally, go through each item and assign it a score based on how many times it appears in someone's Top N list. DebugParallelForEach(mItems.Where(x => !x.Ignore), item => { bool is_weapon = false; switch (item.Item.Type) { case SchemaConstants.ItemType.Weapon: is_weapon = true; break; case SchemaConstants.ItemType.Armor: is_weapon = false; break; default: return; } // In the worst case the item appears 0 times in the top N for any character and any realm. In the best // case it appears somewhere in the top N for every character who can use it, and in every single realm. // Furthermore, we weight appearances by their rank, so the max *score* is that value times the best // possible rank. int usable_by = item.EnabledUsers.Count; int max_denormalized_score = mTopN * usable_by * synergy_values.Length; int denormalized_score = 0; foreach (AnalysisBuddy buddy in mBuddies.Where(b => b.Settings.Score)) { AnalyzerSettings.PartyMemberSettings buddy_settings = mSettings[buddy.Buddy.Name]; List <AnalysisItem>[,] rank_array = is_weapon ? buddy.TopNOffense : buddy.TopNDefense; int stat_index = is_weapon ? (int)buddy_settings.OffensiveStat : (int)buddy_settings.DefensiveStat; for (int realm = 0; realm < rank_array.GetLength(0); ++realm) { List <AnalysisItem> top_n_for_stat = rank_array[realm, stat_index]; int index = top_n_for_stat.IndexOf(item); if (index == -1) { continue; } denormalized_score += top_n_for_stat.Count - index; } } System.Diagnostics.Debug.Assert(denormalized_score <= max_denormalized_score); item.Result.IsValid = true; item.Result.Score = (double)denormalized_score / (double)max_denormalized_score; item.Result.Score *= 100.0; }); }
public PlasmaLanceItemInfo(ItemType Type, string Name, string Desc, Texture Tex, int Value = -1, EquipStats Stats = default, Texture HeldTex = null) : base(Type, Name, Desc, Tex, Value, Stats, HeldTex) { }