private static void ApplySkillBonus(AosSkillBonuses attrs, int min, int max, int index, int low, int high) { var possibleSkills = (attrs.Owner is Spellbook ? m_PossibleSpellbookSkills : m_PossibleBonusSkills).ToList(); var count = (Core.SE ? possibleSkills.Count : possibleSkills.Count - 2); SkillName sk, check; double bonus; bool found; do { found = false; sk = possibleSkills[Utility.Random(count)]; for (var i = 0; !found && i < 5; ++i) { found = (attrs.GetValues(i, out check, out bonus) && check == sk); } possibleSkills.Remove(sk); --count; }while (found && count > 0); attrs.SetValues(index, sk, Scale(min, max, low, high)); }
private static void ApplySkillBonus(AosSkillBonuses attrs, int min, int max, int index, int low, int high) { SkillName[] possibleSkills; if (attrs.Owner is Spellbook book) { SkillName[] booktypeskills; switch (book.SpellbookType) { default: case SpellbookType.Regular: booktypeskills = new SkillName[] { SkillName.Magery }; break; case SpellbookType.Necromancer: booktypeskills = new SkillName[] { SkillName.Necromancy, SkillName.SpiritSpeak }; break; case SpellbookType.Mystic: booktypeskills = new SkillName[] { SkillName.Mysticism, SkillName.Focus }; break; } List <SkillName> list = new List <SkillName>(); foreach (var name in m_PossibleSpellbookSkills.Concat(booktypeskills)) { list.Add(name); } possibleSkills = list.ToArray(); } else { possibleSkills = m_PossibleBonusSkills; } SkillName sk; bool found; do { found = false; sk = possibleSkills[Utility.Random(possibleSkills.Length)]; for (int i = 0; !found && i < 5; ++i) { found = (attrs.GetValues(i, out SkillName check, out double bonus) && check == sk); } }while (found); attrs.SetValues(index, sk, Scale(min, max, low, high)); }
private static void ApplySkillBonus(AosSkillBonuses attrs, int min, int max, int index, int low, int high) { SkillName sk, check; double bonus; bool found; do { found = false; sk = m_PossibleBonusSkills[Utility.Random(m_PossibleBonusSkills.Length)]; for (int i = 0; !found && i < 5; ++i) { found = (attrs.GetValues(i, out check, out bonus) && check == sk); } } while (found); attrs.SetValues(index, sk, Scale(min, max, low, high)); }
private static void ApplySkillBonus(AosSkillBonuses attrs, int min, int max, int index, int low, int high) { SkillName[] possibleSkills = attrs.Owner is Spellbook ? m_PossibleSpellbookSkills : m_PossibleBonusSkills; SkillName sk; bool found; do { found = false; sk = possibleSkills[Utility.Random(possibleSkills.Length)]; for (int i = 0; !found && i < 5; ++i) { found = (attrs.GetValues(i, out SkillName check, out double bonus) && check == sk); } }while (found); attrs.SetValues(index, sk, Scale(min, max, low, high)); }
private static void ApplySkillBonus( AosSkillBonuses attrs, int min, int max, int index, int low, int high ) { SkillName[] possibleSkills = ( attrs.Owner is Spellbook ? m_PossibleSpellbookSkills : m_PossibleBonusSkills ); int count = ( Core.SE ? possibleSkills.Length : possibleSkills.Length - 2 ); SkillName sk, check; double bonus; bool found; do { found = false; sk = possibleSkills[Utility.Random( count )]; for ( int i = 0; !found && i < 5; ++i ) found = ( attrs.GetValues( i, out check, out bonus ) && check == sk ); } while ( found ); attrs.SetValues( index, sk, Scale( min, max, low, high ) ); }
private static void ApplySkillBonus(AosSkillBonuses attrs, int min, int max, int index, int low, int high) { SkillName[] possibleSkills = m_PossibleBonusSkills; // WIZARD WANTED MAGIC WEAPONS TO HAVE A SKILL BONUS ///// if (attrs.Owner is BaseShield) { possibleSkills = m_PossibleShieldSkills; } else if (attrs.Owner is BaseArmor) { possibleSkills = m_PossibleFightSkills; } else if (attrs.Owner is BaseWeapon) { BaseWeapon bm = (BaseWeapon)attrs.Owner; if (bm.Skill == SkillName.Swords) { possibleSkills = m_PossibleWepSwordsSkills; } else if (bm.Skill == SkillName.Archery) { possibleSkills = m_PossibleWepArcherySkills; } else if (bm.Skill == SkillName.Fencing) { possibleSkills = m_PossibleWepFencingSkills; } else if (bm.Skill == SkillName.Macing) { possibleSkills = m_PossibleWepMacingSkills; } else if (bm.Skill == SkillName.Wrestling) { possibleSkills = m_PossibleWepWrestlingSkills; } } else if (attrs.Owner is Spellbook) { possibleSkills = m_PossibleSpellbookSkills; } else if (attrs.Owner is BaseInstrument) { possibleSkills = m_PossibleBardSkills; } int count = possibleSkills.Length; SkillName sk, check; double bonus; bool found; do { found = false; sk = possibleSkills[Utility.Random(count)]; for (int i = 0; !found && i < 5; ++i) { found = (attrs.GetValues(i, out check, out bonus) && check == sk); } } while (found); attrs.SetValues(index, sk, Scale(min, max, low, high)); }
private static void ApplySkillBonus( AosSkillBonuses attrs, int min, int max, int index, int low, int high ) { SkillName sk, check; double bonus; bool found; do { found = false; sk = m_PossibleBonusSkills[Utility.Random( m_PossibleBonusSkills.Length )]; for ( int i = 0; !found && i < 5; ++i ) found = ( attrs.GetValues( i, out check, out bonus ) && check == sk ); } while ( found ); attrs.SetValues( index, sk, Scale( min, max, low, high ) ); }
private static void ApplySkillBonus(AosSkillBonuses attrs, int min, int max, int index, int low, int high) { var possibleSkills = (attrs.Owner is Spellbook ? m_PossibleSpellbookSkills : m_PossibleBonusSkills).ToList(); var count = (Core.SE ? possibleSkills.Count : possibleSkills.Count - 2); SkillName sk, check; double bonus; bool found; do { found = false; sk = possibleSkills[Utility.Random(count)]; for (var i = 0; !found && i < 5; ++i) { found = (attrs.GetValues(i, out check, out bonus) && check == sk); } possibleSkills.Remove(sk); --count; } while (found && count > 0); attrs.SetValues(index, sk, Scale(min, max, low, high)); }