Example #1
0
        private void AddSuggest_Click(object sender, EventArgs e)
        {
            HeroGroup heroGroup = new HeroGroup();

            foreach (Hero hero in Session.Project.Heroes)
            {
                RaceData  race   = Sourcebook.GetRace(hero.Race);
                ClassData @class = Sourcebook.GetClass(hero.Class);
                heroGroup.Heroes.Add(new HeroData(race, @class));
            }
            HeroData heroDatum = heroGroup.Suggest();

            if (heroDatum != null)
            {
                Hero hero1 = heroDatum.ConvertToHero();
                Session.Project.Heroes.Add(hero1);
            }
            this.update_view();
        }
Example #2
0
        private void AddSuggest_Click(object sender, EventArgs e)
        {
            HeroGroup group = new HeroGroup();

            // Set up the group
            foreach (Hero hero in Session.Project.Heroes)
            {
                RaceData  rd = Sourcebook.GetRace(hero.Race);
                ClassData cd = Sourcebook.GetClass(hero.Class);

                group.Heroes.Add(new HeroData(rd, cd));
            }

            // Ask for another
            HeroData hd = group.Suggest();

            if (hd != null)
            {
                Hero h = hd.ConvertToHero();
                Session.Project.Heroes.Add(h);
            }

            update_view();
        }