Example #1
0
        private void setUP_Talente()
        {
            talentList          = getTalentList();
            talentTaWDictionary = getTalentTaWDictionary();

            for (int i = 0; i < talentList.Count; i++)
            {
                charakter.addTalent(talentList[i]);
            }
            List <String> keys = new List <string>(talentTaWDictionary.Keys);

            for (int i = 0; i < talentTaWDictionary.Keys.Count; i++)
            {
                int             taw    = 0;
                InterfaceTalent talent = charakter.getTalent(keys[i]);
                if (talentTaWDictionary.TryGetValue(keys[i], out taw))
                {
                    if (talent == null)
                    {
                        throw new Exception("TestFalsch Talent fehlt. " + keys[i]);
                    }
                    talent.setTaw(taw.ToString());
                }
                else
                {
                    throw new Exception();
                }
            }
        }
Example #2
0
        public void TalentTest_setTaWwithoutTaW()
        {
            InterfaceTalent talent = getTalentWithDeviateRequirement();

            talent.setTaw("0");
            Assert.Fail();
        }
Example #3
0
        public void TalentTest_setTaW()
        {
            InterfaceTalent talent = getTalentWithoutDeviateRequirement();
            int             TaW    = random.Next(maxTaW);

            Assert.AreEqual("-", talent.getTaW());

            talent.setCharacter(charakter);
            talent.setTaw(TaW.ToString());

            Assert.AreEqual(TaW.ToString(), talent.getTaW());
            Assert.AreEqual(getProbeStringOne(), talent.getProbeStringOne());

            talent.setTaw("-");
            Assert.AreEqual("-", talent.getTaW());
        }
Example #4
0
        public void TalentTest_Deviate()
        {
            InterfaceTalent      talent      = getTalentWithDeviate();
            List <TalentDeviate> deviateList = getTalentDeviateList();

            charakter.addTalent(talent);

            Assert.AreEqual(getDeviateString(deviateList), talent.getDeviateString());
            Assert.AreEqual(deviateList.Count, talent.getDeviateList().Count);

            if (deviateList.Count > 0)
            {
                Assert.AreEqual(deviateList, talent.getDeviateList());
            }

            talent.setTaw("0");
            for (int i = 0; i < deviateList.Count; i++)
            {
                InterfaceTalent Dtalent = charakter.getTalent(deviateList[i].getName());
                Assert.AreEqual("0", Dtalent.getTAWBonus());
            }

            for (int i = 0; i < deviateList.Count; i++)
            {
                InterfaceTalent Dtalent = charakter.getTalent(deviateList[i].getName());
                talent.setTaw((deviateList[i].getRequiredTaW()).ToString());
                Assert.AreEqual("1", Dtalent.getTAWBonus());
            }

            //Das Doppelte ist für den Test des Entfernens (TAW sinkt) erforderlich
            talent.setTaw("0");
            for (int i = 0; i < deviateList.Count; i++)
            {
                InterfaceTalent Dtalent = charakter.getTalent(deviateList[i].getName());
                Assert.AreEqual("0", Dtalent.getTAWBonus());
            }
        }
Example #5
0
        private static void loadTalent(XmlNode TalentNode, Charakter charakter)
        {
            String Name = null;
            String Taw  = null;
            String AT   = null;
            String PA   = null;

            foreach (XmlNode node in TalentNode)
            {
                switch (node.Name)
                {
                case ManagmentXMLStrings.Name: Name = node.InnerText; break;

                case ManagmentXMLStrings.TAW: Taw = node.InnerText; break;

                case ManagmentXMLStrings.attack: AT = node.InnerText; break;

                case ManagmentXMLStrings.Parade: PA = node.InnerText; break;

                default: throw new Exception();
                }
            }

            Name = Name.Replace(".", " ");

            InterfaceTalent talent = charakter.getTalent(Name);

            if (talent == null)
            {
                return;
            }
            talent.setTaw(Taw);

            if (AT != null & PA != null)
            {
                TalentFighting ftalent = (TalentFighting)talent;

                int x = 0;

                Int32.TryParse(AT, out x);
                ftalent.setAT(x);

                Int32.TryParse(PA, out x);
                ftalent.setPA(x);
            }
        }
Example #6
0
        public void setTaw(String TaW, String TalentName)
        {
            InterfaceTalent talent = Charakter.getTalent(TalentName);

            talent.setTaw(TaW);
        }
Example #7
0
        private static void loadTalentNode(XmlNode TalentNode, Charakter charakter)
        {
            String Name           = null;
            String Taw            = null;
            String AT             = null;
            String PA             = null;
            String speakingMother = null;

            foreach (XmlNode node in TalentNode)
            {
                switch (node.Name)
                {
                case ManagmentXMLStrings.Name: Name = node.InnerText; break;

                case ManagmentXMLStrings.TAW: Taw = node.InnerText; break;

                case ManagmentXMLStrings.attack: AT = node.InnerText; break;

                case ManagmentXMLStrings.Parade: PA = node.InnerText; break;

                case ManagmentXMLStrings.SpeakingMother: speakingMother = node.InnerText; break;

                default: throw new Exception(node.Name + " " + node.InnerText);
                }
            }
            if (Name == null)
            {
                Exception e = new MissingMemberException("Corrput File. Talent Without Name");
                Log.throwError(e);
                throw e;
            }

            Name = Name.Replace(".", " ");

            InterfaceTalent talent = charakter.getTalent(Name);

            if (talent == null)
            {
                talent = tControll.getTalent(Name);
                if (talent == null)
                {
                    Log.writeLogLine("LoadCharakterXML: Das Talent exestiert im aktuellen Kontext nicht " + Name);
                    return;
                }
                charakter.addTalent(talent);
            }
            talent.setTaw(Taw);

            if (AT != null & PA != null)
            {
                TalentFighting ftalent = (TalentFighting)talent;

                int x = 0;

                Int32.TryParse(AT, out x);
                ftalent.setAT(x);

                Int32.TryParse(PA, out x);
                ftalent.setPA(x);
            }
            if (speakingMother != null)
            {
                LanguageAbstractTalent lt = (LanguageAbstractTalent)talent;
                lt.setMotherMark(speakingMother);
            }
        }