public Tuple <string, string> GetAttackQuote(string QuoteSet, Character ActivePilot, Character EnemyPilot, bool UseRandomIndex, ref int QuoteIndex) { Character.QuoteSet Quote = null; if (!ActivePilot.DicAttackQuoteSet.TryGetValue(QuoteSet, out Quote)) { return(new Tuple <string, string>("", "")); } List <string> ListQuote = null; bool IsVersus = false; if (ActivePilot.ListQuoteSetVersusName.Contains(EnemyPilot.Name)) { IsVersus = true; } //Versus. if (IsVersus) { ListQuote = Quote.ListQuoteVersus; } else//Not versus. { ListQuote = Quote.ListQuote; } if (ListQuote.Count == 0) { return(new Tuple <string, string>("", "")); } //Get a random index if needed. if (UseRandomIndex) { QuoteIndex = Random.Next(ListQuote.Count); } else if (QuoteIndex >= ListQuote.Count) { return(new Tuple <string, string>(Quote.PortraitPath, Quote.ListQuote[0])); } return(new Tuple <string, string>(Quote.PortraitPath, ListQuote[QuoteIndex])); }
public Tuple <string, string> GetQuote(QuoteTypes QuoteType, Character ActivePilot, Character EnemyPilot, bool UseRandomIndex, ref int QuoteIndex) { Character.QuoteSet Quote = null; switch (QuoteType) { case QuoteTypes.BattleStart: Quote = ActivePilot.QuoteSetBattleStart; break; case QuoteTypes.Dodge: Quote = ActivePilot.QuoteSetDodge; break; case QuoteTypes.Damaged: Quote = ActivePilot.QuoteSetDamaged; break; case QuoteTypes.Destroyed: Quote = ActivePilot.QuoteSetDestroyed; break; case QuoteTypes.SupportAttack: Quote = ActivePilot.QuoteSetSupportAttack; break; case QuoteTypes.SupportDefend: Quote = ActivePilot.QuoteSetSupportDefend; break; } List <string> ListQuote = null; bool IsVersus = false; if (ActivePilot.ListQuoteSetVersusName.Contains(EnemyPilot.Name)) { IsVersus = true; } //Versus. if (IsVersus) { //Calculate if it should use a base quote or a Versus quote, favorising the versus ones. int RandomQuoteIndex = Random.Next(Quote.ListQuote.Count + (int)(Quote.ListQuoteVersus.Count * 2.5f)); //Use one of the base quote. if (RandomQuoteIndex < Quote.ListQuote.Count) { //Get a random index if needed. if (UseRandomIndex) { QuoteIndex = Random.Next(ListQuote.Count); } else if (QuoteIndex >= ListQuote.Count) { return(new Tuple <string, string>(Quote.PortraitPath, Quote.ListQuote[0])); } return(new Tuple <string, string>(Quote.PortraitPath, Quote.ListQuote[QuoteIndex])); } //Use a versus quote. else if (Quote.ListQuoteVersus.Count > 0) { //Get a random index if needed. if (UseRandomIndex) { QuoteIndex = Random.Next(Quote.ListQuoteVersus.Count); } else if (QuoteIndex >= Quote.ListQuoteVersus.Count) { return(new Tuple <string, string>(Quote.PortraitPath, Quote.ListQuoteVersus[0])); } return(new Tuple <string, string>(Quote.PortraitPath, Quote.ListQuoteVersus[QuoteIndex])); } } else//Not versus. { if (IsVersus) { ListQuote = Quote.ListQuoteVersus; } else { ListQuote = Quote.ListQuote; } if (ListQuote.Count == 0) { return(new Tuple <string, string>("", "")); } //Get a random index if needed. if (UseRandomIndex) { QuoteIndex = Random.Next(ListQuote.Count); } else if (QuoteIndex >= ListQuote.Count) { return(new Tuple <string, string>(Quote.PortraitPath, Quote.ListQuote[0])); } return(new Tuple <string, string>(Quote.PortraitPath, ListQuote[QuoteIndex])); } return(new Tuple <string, string>("", "")); }