Exemple #1
0
        public void Charakter_getFeature()
        {
            List <Feature> keys = new List <Feature>(featureDictionary.Keys);

            for (int i = 0; i < keys.Count; i++)
            {
                int          pos  = 0;
                DSA_FEATURES type = keys[i].getFeatureType();
                featureDictionary.TryGetValue(keys[i], out pos);

                Feature currentFeature   = keys[i];
                Feature charakterFeature = charakter.getFeature(type, pos);

                Assert.AreEqual(currentFeature.getDescription(), charakterFeature.getDescription());
                Assert.AreEqual(currentFeature.getGP(), charakterFeature.getGP());
                Assert.AreEqual(currentFeature.getName(), charakterFeature.getName());
                Assert.AreEqual(currentFeature.getSimpleDescription(), charakterFeature.getSimpleDescription());
                Assert.AreEqual(currentFeature.getFeatureType(), charakterFeature.getFeatureType());

                testFeatureAdvanced(currentFeature, charakterFeature);
                testFeatureAttribute(currentFeature, charakterFeature);
                testFeatureEnergie(currentFeature, charakterFeature);
                testFeatureTalente(currentFeature, charakterFeature);
            }
        }
Exemple #2
0
        public Feature Feature(int number, DSA_FEATURES type)
        {
            CreateFeature createFeature;
            Feature       feature = Charakter.getFeature(type, number);


            if (feature == null)
            {
                createFeature = new CreateFeature(Charakter.getTalentList_allTalents(), type);
            }
            else
            {
                createFeature = new CreateFeature(feature, Charakter.getTalentList_allTalents(), type);
            }
            createFeature.ShowDialog();
            feature = createFeature.feature();

            if (feature == null)
            {
                return(null);
            }

            Charakter.addFeature(number, feature);

            return(feature);
        }
Exemple #3
0
        private String getEnergieString(DSA_FEATURES type)
        {
            String ret = "";
            int    x   = 0;

            for (int i = 0; i < Enum.GetNames(typeof(DSA_ENERGIEN)).Length; i++)
            {
                energieBonus.TryGetValue((DSA_ENERGIEN)i, out x);
                if (x != 0)
                {
                    if (type == DSA_FEATURES.NACHTEIL && (DSA_ENERGIEN)i != DSA_ENERGIEN.KARMAENERGIE)
                    {
                        x = -x;
                    }
                    if (0 != String.Compare(ret, ""))
                    {
                        ret = ret + ", " + x + energienAcronyms[i];
                    }
                    else
                    {
                        ret = x + energienAcronyms[i];
                    }
                }
            }
            return(ret);
        }
Exemple #4
0
        private String getAttributeString(DSA_FEATURES type)
        {
            String ret = "";
            int    x   = 0;

            for (int i = 0; i < Enum.GetNames(typeof(DSA_ATTRIBUTE)).Length; i++)
            {
                attributeBonus.TryGetValue((DSA_ATTRIBUTE)i, out x);
                if (x != 0)
                {
                    if (type == DSA_FEATURES.NACHTEIL)
                    {
                        x = -x;
                    }

                    if (0 != String.Compare(ret, ""))
                    {
                        ret = ret + ", " + x + attributeAcronyms[i];
                    }
                    else
                    {
                        ret = x + attributeAcronyms[i];
                    }
                }
            }
            return(ret);
        }
Exemple #5
0
        private void calculate(DSA_FEATURES type, int number, ACTION action)
        {
            Dictionary <int, Feature> dictionary = null;
            Feature currentFeature;
            int     factor = 1;

            switch (type)
            {
            case DSA_FEATURES.VORTEIL: dictionary = AdvantageFeatures; break;

            case DSA_FEATURES.NACHTEIL: dictionary = DisAdvantageFeatures; break;
            }
            if (action == ACTION.REMOVE)
            {
                factor = factor * (-1);
            }

            if (dictionary.TryGetValue(number, out currentFeature) == false)
            {
                return;
            }

            CalculateAttributeBonus(currentFeature, factor);

            switch (type)
            {
            case DSA_FEATURES.VORTEIL: CalculaeEnergieBonus(currentFeature, factor); break;

            case DSA_FEATURES.NACHTEIL: CalculaeEnergieMali(currentFeature, factor); break;
            }

            CalculateAdvancedBonus(currentFeature, factor);
            CalculateTalentBonus(currentFeature, factor);
        }
 private void setUP(DSA_FEATURES type)
 {
     attributeBonus = new Dictionary <DSA_ATTRIBUTE, int>();
     energieBonus   = new Dictionary <DSA_ENERGIEN, int>();
     advancedBonus  = new Dictionary <DSA_ADVANCEDVALUES, int>();
     talentBoni     = new Dictionary <InterfaceTalent, int>();
     this.type      = type;
 }
        public Feature(String Name, String Description, String Value, String GP, DSA_FEATURES type)
        {
            setName(Name);
            setDescription(Description);
            setValue(Value);
            setGP(GP);

            setUP(type);
        }
        public Feature(DSA_FEATURES type)
        {
            setUP(type);

            setName("");
            setDescription("");
            setValue("");
            setGP("");
        }
Exemple #9
0
        public Feature GetFeature(DSA_FEATURES type, int number)
        {
            Feature feature = null;

            switch (type)
            {
            case DSA_FEATURES.VORTEIL: AdvantageFeatures.TryGetValue(number, out feature); break;

            case DSA_FEATURES.NACHTEIL: DisAdvantageFeatures.TryGetValue(number, out feature); break;
            }
            return(feature);
        }
Exemple #10
0
        public CreateFeature(Feature feature, List <InterfaceTalent> talentList, DSA_FEATURES ftype)
        {
            setUP(talentList, ftype);
            Feature = feature;

            txtName.Text        = feature.getName();
            txtDescription.Text = feature.getSimpleDescription();
            txtGP.Text          = feature.getGP();
            txtValue.Text       = feature.getValue();

            txtCharisma.Text         = feature.getAttributeBonus(DSA_ATTRIBUTE.CH).ToString();
            txtFingerfertigkeit.Text = feature.getAttributeBonus(DSA_ATTRIBUTE.FF).ToString();
            txtGewandheit.Text       = feature.getAttributeBonus(DSA_ATTRIBUTE.GE).ToString();
            txtIntuition.Text        = feature.getAttributeBonus(DSA_ATTRIBUTE.IN).ToString();
            txtKlugheit.Text         = feature.getAttributeBonus(DSA_ATTRIBUTE.KL).ToString();
            txtKonstitution.Text     = feature.getAttributeBonus(DSA_ATTRIBUTE.KO).ToString();
            txtKörperkraft.Text      = feature.getAttributeBonus(DSA_ATTRIBUTE.KK).ToString();
            txtMut.Text          = feature.getAttributeBonus(DSA_ATTRIBUTE.MU).ToString();
            txtSozialstatus.Text = feature.getAttributeBonus(DSA_ATTRIBUTE.SO).ToString();

            txtAstralenergie.Text  = feature.getEnergieBonus(DSA_ENERGIEN.ASTRALENERGIE).ToString();
            txtAusdauer.Text       = feature.getEnergieBonus(DSA_ENERGIEN.AUSDAUER).ToString();
            txtKarmaenergie.Text   = feature.getEnergieBonus(DSA_ENERGIEN.KARMAENERGIE).ToString();
            txtLebensenergie.Text  = feature.getEnergieBonus(DSA_ENERGIEN.LEBENSENERGIE).ToString();
            txtMagieresistenz.Text = feature.getEnergieBonus(DSA_ENERGIEN.MAGIERESISTENZ).ToString();

            txtAttacke.Text           = feature.getAdvancedValues(DSA_ADVANCEDVALUES.ATTACKE_BASIS).ToString();
            txtArtefaktKontrolle.Text = feature.getAdvancedValues(DSA_ADVANCEDVALUES.ARTEFAKTKONTROLLE).ToString();
            txtBeherschungswert.Text  = feature.getAdvancedValues(DSA_ADVANCEDVALUES.BEHERSCHUNGSWERT).ToString();
            txtEntrückung.Text        = feature.getAdvancedValues(DSA_ADVANCEDVALUES.ENTRÜCKUNG).ToString();
            txtFernkampf.Text         = feature.getAdvancedValues(DSA_ADVANCEDVALUES.FERNKAMPF_BASIS).ToString();
            txtGeschwindigkeit.Text   = feature.getAdvancedValues(DSA_ADVANCEDVALUES.GESCHWINDIGKEIT).ToString();
            txtInitiative.Text        = feature.getAdvancedValues(DSA_ADVANCEDVALUES.INITATIVE_BASIS).ToString();
            txtParade.Text            = feature.getAdvancedValues(DSA_ADVANCEDVALUES.PARADE_BASIS).ToString();
            txtWundschwelle.Text      = feature.getAdvancedValues(DSA_ADVANCEDVALUES.WUNDSCHWELLE).ToString();


            List <InterfaceTalent> talentWithBonuwTaw = feature.getTalentListwithBonus();

            foreach (InterfaceTalent talent in talentWithBonuwTaw)
            {
                int x = feature.getTaWBonus(talent);
                talente.Add(talent, x);

                ListViewItem lvi = new ListViewItem();
                lvi.Text = talent.getName();
                lvi.SubItems.Add(x.ToString());

                ListTalente.Items.Add(lvi);
            }
        }
Exemple #11
0
        public void Charakter_getFeatureTaWBonus()
        {
            List <Feature> keys = new List <Feature>(featureDictionary.Keys);

            for (int i = 0; i < keys.Count; i++)
            {
                DSA_FEATURES type = keys[i].getFeatureType();

                for (int j = 0; j < talentList.Count; j++)
                {
                    Assert.AreEqual(managmentFeature.getTalentTawBonus(talentList[j]), charakter.getTaWBons(talentList[j]));
                }
            }
        }
Exemple #12
0
        private void setUP(List <InterfaceTalent> talentList, DSA_FEATURES ftype)
        {
            InitializeComponent();
            talente = new Dictionary <InterfaceTalent, int>();

            Feature = null;
            cbTalente.DataSource = talentList;

            ListTalente.Clear();

            ListTalente.Columns.Add(new ColumnHeader().Text = "Name");
            ListTalente.Columns.Add(new ColumnHeader().Text = "TaW");

            this.ftype = ftype;
        }
Exemple #13
0
        public Feature Feature(int number, DSA_FEATURES type)
        {
            Feature feature = Charakter.getFeature(type, number);
            ControllView_CreateFeature viewController = new ControllView_CreateFeature(Charakter.getTalentList_allTalents());

            if (feature == null)
            {
                feature = new Feature(type);
            }

            feature = viewController.editFeature(feature);
            Charakter.addFeature(number, feature);

            return(feature);
        }
Exemple #14
0
        public void addFeature(Feature feature, int number)
        {
            DSA_FEATURES type = feature.getFeatureType();

            if (HighestNumber < number)
            {
                HighestNumber = number;
            }

            switch (type)
            {
            case DSA_FEATURES.VORTEIL: addAdvantage(feature, number); break;

            case DSA_FEATURES.NACHTEIL: addDisAdvantage(feature, number); break;
            }
        }
Exemple #15
0
        private String getTalentString(DSA_FEATURES type)
        {
            String ret = "";

            foreach (InterfaceTalent talent in talentBoni.Keys)
            {
                int x = 0;
                talentBoni.TryGetValue(talent, out x);
                if (type == DSA_FEATURES.NACHTEIL)
                {
                    x = -x;
                }
                ret = ret + talent.getName() + "(" + x + ")";
            }
            return(ret);
        }
Exemple #16
0
        private String getAdvancedString(DSA_FEATURES type)
        {
            String ret = "";
            int    x   = 0;

            for (int i = 0; i < Enum.GetNames(typeof(DSA_ADVANCEDVALUES)).Length; i++)
            {
                advancedBonus.TryGetValue((DSA_ADVANCEDVALUES)i, out x);
                if (x != 0)
                {
                    if (type == DSA_FEATURES.NACHTEIL)
                    {
                        x = -x;
                    }
                    ret = ret + " " + x + advancedAcronyms[i];
                }
            }
            return(ret);
        }
Exemple #17
0
        private void checkEnergieValues(Feature feature)
        {
            DSA_FEATURES type = feature.getFeatureType();
            int          enumLenghtAdvanced = Enum.GetNames(typeof(DSA_ENERGIEN)).Length;

            for (int i = 0; i < enumLenghtAdvanced; i++)
            {
                int valueout;
                if (!energieBonus.TryGetValue((DSA_ENERGIEN)i, out valueout))
                {
                    throw new Exception("Test_Programming_Error");
                }
                if (type == DSA_FEATURES.NACHTEIL && (DSA_ENERGIEN)i != DSA_ENERGIEN.KARMAENERGIE)
                {
                    valueout = valueout * (-1);
                }

                Assert.AreEqual(valueout, feature.getEnergieBonus((DSA_ENERGIEN)i));
            }
        }
Exemple #18
0
        private void checkAdvancedValues(Feature feature)
        {
            DSA_FEATURES type = feature.getFeatureType();
            int          enumLenghtAdvanced = Enum.GetNames(typeof(DSA_ADVANCEDVALUES)).Length;

            for (int i = 0; i < enumLenghtAdvanced; i++)
            {
                int valueout;
                if (!advancedBonus.TryGetValue((DSA_ADVANCEDVALUES)i, out valueout))
                {
                    throw new Exception("Test_Programming_Error");
                }
                if (type == DSA_FEATURES.NACHTEIL)
                {
                    valueout = valueout * (-1);
                }

                Assert.AreEqual(valueout, feature.getAdvancedValues((DSA_ADVANCEDVALUES)i));
            }
        }
        private static void loadFeature(XmlNode featureNode, Charakter charakter, DSA_FEATURES type)
        {
            int    i           = 0;
            String BasicString = "Number";

            foreach (XmlNode node in featureNode)
            {
                i++;
                Feature feature = loadFeature(node, charakter, i, type);
                feature.setType(type);

                int    number = 0;
                String Number = node.Name.Substring(BasicString.Length, node.Name.Length - BasicString.Length);

                if (!Int32.TryParse(Number, out number))
                {
                    throw new Exception();
                }
                charakter.addFeature(type, number, feature);
            }
        }
Exemple #20
0
        private String getDescription(DSA_FEATURES type)
        {
            Char[] trimSymbol = new Char[] { ' ', ',' };

            String totalDescription = String.Copy(this.Description);

            totalDescription = totalDescription + ", " + getAttributeString();
            totalDescription = totalDescription.TrimEnd(trimSymbol);
            totalDescription = totalDescription.TrimEnd(trimSymbol);
            totalDescription = totalDescription + ", " + getEnergieString();
            totalDescription = totalDescription.TrimEnd(trimSymbol);
            totalDescription = totalDescription.TrimEnd(trimSymbol);
            totalDescription = totalDescription + ", " + getAdvancedString();
            totalDescription = totalDescription.TrimEnd(trimSymbol);
            totalDescription = totalDescription.TrimEnd(trimSymbol);
            totalDescription = totalDescription + ", " + getTalentString();
            totalDescription = totalDescription.TrimStart(trimSymbol);
            totalDescription = totalDescription.TrimEnd(trimSymbol);

            return(totalDescription);
        }
        private static void loadFeature(XmlNode featureNode, Charakter charakter, DSA_FEATURES type)
        {
            int    i           = 0;
            String BasicString = "Number";

            foreach (XmlNode node in featureNode)
            {
                i++;
                Feature feature = loadFeature(node, charakter, i, type);

                int    number = 0;
                String Number = node.Name.Substring(BasicString.Length, node.Name.Length - BasicString.Length);

                if (!Int32.TryParse(Number, out number))
                {
                    Exception e = new Exception("Fehler bei der Featurenummerierung");
                    Log.throwError(e);
                    throw e;
                }
                charakter.addFeature(number, feature);
            }
        }
Exemple #22
0
        private Feature createFeature(DSA_FEATURES type)
        {
            Feature newFeature = new Feature(txtName.Text, txtDescription.Text, txtValue.Text, txtGP.Text, type);

            newFeature.setAttributeBonus(DSA_ATTRIBUTE.MU, convertToInt(txtMut.Text));
            newFeature.setAttributeBonus(DSA_ATTRIBUTE.KL, convertToInt(txtKlugheit.Text));
            newFeature.setAttributeBonus(DSA_ATTRIBUTE.IN, convertToInt(txtIntuition.Text));
            newFeature.setAttributeBonus(DSA_ATTRIBUTE.CH, convertToInt(txtCharisma.Text));
            newFeature.setAttributeBonus(DSA_ATTRIBUTE.FF, convertToInt(txtFingerfertigkeit.Text));
            newFeature.setAttributeBonus(DSA_ATTRIBUTE.GE, convertToInt(txtGewandheit.Text));
            newFeature.setAttributeBonus(DSA_ATTRIBUTE.KO, convertToInt(txtKonstitution.Text));
            newFeature.setAttributeBonus(DSA_ATTRIBUTE.KK, convertToInt(txtKörperkraft.Text));
            newFeature.setAttributeBonus(DSA_ATTRIBUTE.SO, convertToInt(txtSozialstatus.Text));

            newFeature.setEnergieBonus(DSA_ENERGIEN.ASTRALENERGIE, convertToInt(txtAstralenergie.Text));
            newFeature.setEnergieBonus(DSA_ENERGIEN.AUSDAUER, convertToInt(txtAusdauer.Text));
            newFeature.setEnergieBonus(DSA_ENERGIEN.KARMAENERGIE, convertToInt(txtKarmaenergie.Text));
            newFeature.setEnergieBonus(DSA_ENERGIEN.LEBENSENERGIE, convertToInt(txtLebensenergie.Text));
            newFeature.setEnergieBonus(DSA_ENERGIEN.MAGIERESISTENZ, convertToInt(txtMagieresistenz.Text));

            newFeature.setAdvancedValues(DSA_ADVANCEDVALUES.ARTEFAKTKONTROLLE, convertToInt(txtArtefaktKontrolle.Text));
            newFeature.setAdvancedValues(DSA_ADVANCEDVALUES.ATTACKE_BASIS, convertToInt(txtAttacke.Text));
            newFeature.setAdvancedValues(DSA_ADVANCEDVALUES.BEHERSCHUNGSWERT, convertToInt(txtBeherschungswert.Text));
            newFeature.setAdvancedValues(DSA_ADVANCEDVALUES.ENTRÜCKUNG, convertToInt(txtEntrückung.Text));
            newFeature.setAdvancedValues(DSA_ADVANCEDVALUES.FERNKAMPF_BASIS, convertToInt(txtFernkampf.Text));
            newFeature.setAdvancedValues(DSA_ADVANCEDVALUES.GESCHWINDIGKEIT, convertToInt(txtGeschwindigkeit.Text));
            newFeature.setAdvancedValues(DSA_ADVANCEDVALUES.INITATIVE_BASIS, convertToInt(txtInitiative.Text));
            newFeature.setAdvancedValues(DSA_ADVANCEDVALUES.PARADE_BASIS, convertToInt(txtParade.Text));
            newFeature.setAdvancedValues(DSA_ADVANCEDVALUES.WUNDSCHWELLE, convertToInt(txtWundschwelle.Text));

            foreach (InterfaceTalent talent in talente.Keys)
            {
                int x;
                talente.TryGetValue(talent, out x);
                newFeature.addTalent(talent, x);
            }

            return(newFeature);
        }
Exemple #23
0
        public CreateFeature(List <InterfaceTalent> talentList, DSA_FEATURES ftype)
        {
            setUP(talentList, ftype);

            txtName.Text        = "";
            txtDescription.Text = "";
            txtGP.Text          = "";
            txtValue.Text       = "";

            String zero = (0).ToString();

            txtCharisma.Text         = zero;
            txtFingerfertigkeit.Text = zero;
            txtGewandheit.Text       = zero;
            txtIntuition.Text        = zero;
            txtKlugheit.Text         = zero;
            txtKonstitution.Text     = zero;
            txtKörperkraft.Text      = zero;
            txtMut.Text          = zero;
            txtSozialstatus.Text = zero;

            txtAstralenergie.Text  = zero;
            txtAusdauer.Text       = zero;
            txtKarmaenergie.Text   = zero;
            txtLebensenergie.Text  = zero;
            txtMagieresistenz.Text = zero;

            txtAttacke.Text           = zero;
            txtParade.Text            = zero;
            txtFernkampf.Text         = zero;
            txtInitiative.Text        = zero;
            txtBeherschungswert.Text  = zero;
            txtArtefaktKontrolle.Text = zero;
            txtWundschwelle.Text      = zero;
            txtEntrückung.Text        = zero;
            txtGeschwindigkeit.Text   = zero;
        }
 private static void saveFeature(Charakter charakter, XmlDocument characterFile, XmlElement element, DSA_FEATURES type)
 {
     for (int i = 0; i <= charakter.getHighistFeatureNumber(); i++)
     {
         Feature feature = charakter.getFeature(type, i);
         if (feature != null)
         {
             XmlElement newFeature = characterFile.CreateElement(ManagmentXMLStrings.Number + i.ToString());
             saveFeature(feature, characterFile, newFeature);
             element.AppendChild(newFeature);
         }
     }
 }
Exemple #25
0
 public Feature getFeature(DSA_FEATURES type, int number)
 {
     return(featureManagment.GetFeature(type, number));
 }
        private static Feature loadFeature(XmlNode featureNode, Charakter charakter, int number, DSA_FEATURES type)
        {
            Feature feature = new Feature(type);

            foreach (XmlNode node in featureNode)
            {
                switch (node.Name)
                {
                case ManagmentXMLStrings.Name: feature.setName(node.InnerText); break;

                case ManagmentXMLStrings.Description: feature.setDescription(node.InnerText); break;

                case ManagmentXMLStrings.Value: feature.setValue(node.InnerText); break;

                case ManagmentXMLStrings.GP: feature.setGP(node.InnerText); break;

                case ManagmentXMLStrings.AttributeElement: LoadAttribute(node, feature); break;

                case ManagmentXMLStrings.EnergienElement: LoadEnergien(node, feature); break;

                case ManagmentXMLStrings.AdvancedElement: LoadFeatureAdvanced(node, feature); break;

                case ManagmentXMLStrings.Talente: LoadFeatureTalente(node, charakter, feature); break;
                }
            }

            return(feature);
        }
Exemple #27
0
 public Feature FeatureExisting(int number, DSA_FEATURES type)
 {
     return(Charakter.getFeature(type, number));
 }