Exemplo n.º 1
0
        public void AddExperiencePoints(int points)
        {
            var result  = Progression.AddExperience(points);
            var service = new TraitService();

            if (result.DidLevel)
            {
                Vitals.MaximumHealthPoints += HealthMultiplierWhenLevel * result.CurrentLevel;
                service.AddPoints(TraitPointsToUseWhenLevel, Traits);
            }
        }
Exemplo n.º 2
0
        // ta fram bestämda värden för olika egenskaper baserat på värden från traits
        // exempel inom vilket omfång kan karaktären slå i styrka
        // beräkna om när man levlar och ökar på varje trait

        // kanske ska lägga egenskaperna för att generera saker via hjälten
        // exempelvis ha en metod på Hero som beräknar chansen att undvika slag
        // då hämtar den Trait för Dexterity och dess värde


        public Hero(Gender gender, GeneratedName generatedName)
        {
            Gender      = gender;
            Race        = race;
            FirstName   = generatedName.FirstName;
            FamilyName  = generatedName.LastName;
            OneWordName = generatedName.OneWordName;

            PhysicalAttributes = new PhysicalAttributes(race);

            Progression = new Progression();
            Vitals      = new Vitals();

            var service = new TraitService();

            Traits = service.GetTraitsWithPoints();
        }
Exemplo n.º 3
0
        private void Save()
        {
            IRegistrationService regService   = new RegistrationService();
            ITraitService        traitService = new TraitService();
            Boolean ret     = false;
            string  message = String.Empty;
            Trait   trait   = new Trait()
            {
                Description = txtDescription.Text.ToString(),
                CurrTrait   = chkCurrent.Checked,
                Category    = Int32.Parse(cmbCategory.SelectedValue.ToString())
            };

            if (ExistingTraits.Exists(t => t.Category == trait.Category && t.Description == trait.Description && t.CurrTrait == trait.CurrTrait))
            {
                MessageBox.Show(this, "Trait for that Category already Exists", "Trait Exists");
            }
            else
            {
                if (Op.Equals("edit"))
                {
                    trait.TraitsID = SelectedTrait.TraitsID;
                    ret            = traitService.UpdateTrait(ref trait, ref message);
                }
                else
                {
                    ret = traitService.CreateTrait(ref trait, ref message);
                    if (ret && trait.CurrTrait)
                    {
                        List <Trait> updatedTraits = new List <Trait>(traitService.GetAllTraits());
                        Trait        savedTrait    = new Trait();
                        savedTrait = updatedTraits.Find(t => t.Category == trait.Category && t.Description == trait.Description && t.CurrTrait == trait.CurrTrait);
                        ret        = regService.UpdateStudentCharacters(savedTrait);
                    }
                }

                if (ret)
                {
                    MessageBox.Show(this, "Saved Successfully");
                }
            }

            this.Close();
        }
Exemplo n.º 4
0
        private void LoadMe()
        {
            var list = new[]
            {
                new { Number = 1, Name = "Pre-school" },
                new { Number = 2, Name = "Elementary" },
                new { Number = 3, Name = "Secondary" }
            };

            cmbCategory.DataSource    = list;
            cmbCategory.ValueMember   = "Number";
            cmbCategory.DisplayMember = "Name";

            txtDescription.Text = String.Empty;
            chkCurrent.Checked  = true;

            ITraitService traitService = new TraitService();

            ExistingTraits = new List <Trait>(traitService.GetAllTraits());
        }
Exemplo n.º 5
0
        public void LoadTraits()
        {
            ITraitService traitService = new TraitService();
            string        message      = String.Empty;

            try
            {
                var traits = traitService.GetAllTraits();
                traitList           = new List <Trait>(traits);
                gvTraits.DataSource = traitList;
                gvTraits.Refresh();

                if (gvTraits.RowCount != 0)
                {
                    gvTraits.Rows[0].IsSelected = true;
                }
            }
            catch (Exception ex)
            {
                message = "Error Loading Traits List";
                MessageBox.Show(ex.ToString());
            }
        }