Пример #1
0
        public DatabaseCard.Effect ParseEffects(string description, string language)
        {
            DatabaseCard.Effect effect = new DatabaseCard.Effect();

            if (String.IsNullOrEmpty(description))
            {
                return(effect);
            }

            int indexEffect           = description.IndexOf(string.Format("[ {0} ]", m_Descriptions["MonsterEffect"][language]));
            int indexFlavor           = description.IndexOf(string.Format("[ {0} ]", m_Descriptions["FlavorText"][language]));
            int indexPendEffect       = description.IndexOf(string.Format("[ {0} ]", m_Descriptions["PendulumEffect"][language]));
            int indexDeckMasterEffect = description.IndexOf("[ Deck Master Effect ]");
            int indexBarrier          = description.IndexOf("---");

            effect.CardEffect = description.Substring(indexEffect > -1 ? indexEffect + m_Descriptions["MonsterEffect"][language].Length + 4 :
                                                      (indexFlavor > -1 ? indexFlavor + m_Descriptions["FlavorText"][language].Length + 4 : 0)).Trim();
            if (indexPendEffect > -1 && indexBarrier > -1)
            {
                effect.PendulumEffect = description.Substring(indexPendEffect + m_Descriptions["PendulumEffect"][language].Length + 4,
                                                              indexBarrier - indexPendEffect - m_Descriptions["PendulumEffect"][language].Length - 4).Trim();
            }
            else if (indexDeckMasterEffect > -1 && indexBarrier > -1)
            {
                effect.DeckMasterEffect = description.Substring(indexDeckMasterEffect + "Deck Master Effect".Length + 4,
                                                                indexBarrier - indexDeckMasterEffect - "Deck Master Effect".Length - 4).Trim();
            }

            return(effect);
        }
Пример #2
0
 public string ToDescriptionString(DatabaseCard.Effect effect, string language /*, string pendulumScale = ""*/)
 {
     if (string.IsNullOrEmpty(effect.DeckMasterEffect) && string.IsNullOrEmpty(effect.PendulumEffect))
     {
         return(effect.CardEffect);
     }
     return(this.DescriptionFormat
            //.Replace("{PendScaleDesc}", m_Descriptions["PendulumScale"][language])
            .Replace("{PendEffectDesc}", m_Descriptions["PendulumEffect"][language])
            .Replace("{MonsterEffectDesc}", m_Descriptions["MonsterEffect"][language])
            //.Replace("{PendScale}", pendulumScale == null ? "" : pendulumScale)
            .Replace("{PendEffect}", !string.IsNullOrEmpty(effect.DeckMasterEffect) ? effect.DeckMasterEffect : effect.PendulumEffect)
            .Replace("{MonsterEffect}", effect.CardEffect));
 }