示例#1
0
 public void FeatsShouldPass()
 {
     try
     {
         var feat = new Feats()
         {
             FeatID      = 1,
             Name        = "This is a test",
             Description = "This should passish",
             StatTable   = true,
             StatType    = 1,
             Mods        = 1
         };
         Assert.Equal("This is a test", feat.Name);
         Assert.Equal("This should passish", feat.Description);
         Assert.True(feat.StatTable);
         Assert.Equal(1, feat.StatType);
         Assert.Equal(1, feat.StatType);
         Assert.Equal(1, feat.FeatID);
     }
     catch
     {
         return;
     }
 }
示例#2
0
        public void CalculateFeats()
        {
            Feats feat = new Feats();

            PlayerClass.ClassBonusFeats = feat.ClassFeatCalculate(PlayerClass.ChosenClass, PlayerClass.PlayerLevel);
            TotalFeats = Race.RaceBonusFeats + feat.FeatCalculate(PlayerClass.PlayerLevel);
        }
示例#3
0
        public void GivenALevel_ReturnsFeat(int level, int expected)
        {
            Feats feats  = new Feats();
            int   actual = feats.FeatCalculate(level);

            Assert.AreEqual(expected, actual);
        }
        private void Add()
        {
            if (IsSkillChecked)
            {
                if (SelectedSkill != null)
                {
                    PlayerSkills.Add(new PlayerSkillViewModel(SelectedSkill, 0));
                    SkillPoints = SkillPoints - SelectedSkill.Cost;
                    Skills.Remove(SelectedSkill);
                    SelectedSkill = null;
                }
            }
            else
            {
                if (SelectedFeat != null)
                {
                    PlayerFeats.Add(new PlayerFeatViewModel(SelectedFeat, 0));
                    FeatPoints = FeatPoints - SelectedFeat.Cost;
                    Feats.Remove(SelectedFeat);
                    SelectedFeat = null;
                }
            }

            Refresh();
        }
示例#5
0
        public void GivenARace_ReturnRaceFeats(string race, int expected)
        {
            Feats feats  = new Feats();
            int   actual = feats.RacialFeatCalculate(race);

            Assert.AreEqual(expected, actual);
        }
        private void Remove()
        {
            if (IsSkillChecked)
            {
                if (SelectedPlayerSkill != null)
                {
                    Skills.Add(SelectedPlayerSkill.Skill);
                    SkillPoints = SkillPoints + SelectedPlayerSkill.Skill.Cost;
                    PlayerSkills.Remove(SelectedPlayerSkill);
                    SelectedPlayerSkill = null;
                }
            }
            else
            {
                if (SelectedPlayerFeat != null)
                {
                    Feats.Add(SelectedPlayerFeat.Feat);
                    FeatPoints = FeatPoints + SelectedPlayerFeat.Feat.Cost;
                    PlayerFeats.Remove(SelectedPlayerFeat);
                    SelectedPlayerFeat = null;
                }
            }

            Refresh();
        }
示例#7
0
 public FeatStats(FeatStatsType type, Feats feattype, string name, int streanght)
 {
     FeatType = feattype;
     Featname = name;
     Type     = type;
     Streaght = streanght;
 }
示例#8
0
        public void GivenAClass_ClassFeatsAreReturned(string chosenClass, int level, int expected)
        {
            Feats feats  = new Feats();
            int   actual = feats.ClassFeatCalculate(chosenClass, level);

            Assert.AreEqual(expected, actual);
        }
        public static void Variant(Character character)
        {
            character.MinHeight = 60;
            character.MaxHeight = 78;
            character.MinWeight = 100;
            character.MaxWeight = 300;
            character.Speed    += 30;
            character.Vision    = "Lowlight 60ft";
            character.AlignmentOptions.Add("L-G");
            character.AlignmentOptions.Add("L-N");
            character.AlignmentOptions.Add("L-E");
            character.AlignmentOptions.Add("C-G");
            character.AlignmentOptions.Add("C-N");
            character.AlignmentOptions.Add("C-E");
            character.AlignmentOptions.Add("N-G");
            character.AlignmentOptions.Add("TN");
            character.AlignmentOptions.Add("N-E");
            character.AdultAge    = 18;
            character.MaxAgeStart = 80;
            BEHelper.AddLanguage(character, "race");
            string pickMsg = "You get to pick an extra skill proficiency. Enter the skill you'd like here.";
            string skill   = CLIHelper.GetNew(Options.Skills, character.SkillProficiencies, pickMsg);

            character.SkillProficiencies.Add(skill);
            Console.WriteLine("You get to pick 2 Feats");
            Feats.AddFeat(character);
            Feats.AddFeat(character);
        }
示例#10
0
        public void RunAddClass(Character character)
        {
            character.Init += character.DexMod;

            AddClass.AddSpellsKnown(character);
            AddClass.AddSpellSlots(character);
            AddClass.NewClass(character);

            if (character.DemigodDomain == "Knowledge")
            {
                Console.WriteLine("Pick a skill to gain Expertise in");
                var prof = new List <string>();
                prof.AddRange(character.SkillProficiencies);
                string expertise = CLIHelper.PrintChoices(prof);
                BEHelper.AddSkillExpertise(expertise, character);
            }
            if (character.Feats.ContainsKey("Weapon Master"))
            {
                Feats.WeaponMaster(character);
            }

            AddClass.ModifySkills(character);
            BEHelper.AddSpellDesc(character);
            AddClass.DetermineAC(character);
            AddClass.DetermineHP(character);

            Console.Clear();
            Console.WriteLine("\nYou've finished adding your character's class!\n");
        }
示例#11
0
        public void DwarfClericLevel6Returns3()
        {
            Feats feats    = new Feats();
            int   actual   = feats.TotalFeats(6, "Dwarf");
            int   expected = 3;

            Assert.AreEqual(expected, actual);
        }
示例#12
0
        public void HumanFighterLevel10Returns11()
        {
            Feats feats    = new Feats();
            int   actual   = feats.TotalFeats(10, "Human");
            int   expected = 5;

            Assert.AreEqual(expected, actual);
        }
示例#13
0
    private void PopulateFeatDropdown(int index)
    {
        currentFeatOptions = Feats.allEligible(sheet);
        currentFeatOptions.RemoveAll(x => selectedFeatOptions.Contains(x));
        List <string> options = Feats.featsToString(currentFeatOptions);

        options.Insert(0, "None");
        featDropdowns [index].ClearOptions();
        featDropdowns [index].AddOptions(options);
        featDropdowns [index].value = 0;
    }
示例#14
0
 public void RemoveFeat(Feat featToRemove)
 {
     //do some inspection
     try
     {
         Feats.RemoveAll(x => x.fullName == featToRemove.fullName);
     }
     catch (Exception e)
     {
         Debug.Log(e.Message);
     }
 }
示例#15
0
 public void FeatsShouldFail()
 {
     try
     {
         var feats = new Feats()
         {
         };
     }
     catch
     {
         Assert.True(true);
     }
 }
示例#16
0
 private void SelectFeatsTab()
 {
     if (State == CharInventoryState.LevelUp)
     {
         Logger.Warn("You cannot switch to the feats tab while leveling up using this button.");
     }
     else if (CurrentPage != 6)
     {
         Logger.Debug("Switching to feats tab of character sheet.");
         CurrentPage = 6;
         Feats.Show(CurrentCritter);
         Inventory.Hide();
         Skills.Hide();
         Spells.Hide();
     }
 }
        public static void AbilityScoreInc(Character character)
        {
            Console.WriteLine("\nYou have an ability score increase, pick from the options.");
            CLIHelper.Print3Choices("Increase 1 stat by 2", "Increase 2 stats by 1", "Pick a feat");
            int input = CLIHelper.GetNumberInRange(1, 3);

            if (input == 1)
            {
                Console.Write($"\nYour stats are ");
                foreach (var stat in Options.Stats)
                {
                    Console.Write($"{stat}: {character.Stats[stat]}  ");
                }
                Console.WriteLine("\n\nPick the stat you'd like to increase.");
                IncreaseStat(character, 2);
                Console.Clear();
                Console.Write($"\nYour stats are now ");
                foreach (var stat in Options.Stats)
                {
                    Console.Write($"{stat}: {character.Stats[stat]}  ");
                }
                Console.WriteLine("");
            }
            else if (input == 2)
            {
                Console.Write($"\nYour stats are ");
                foreach (var stat in Options.Stats)
                {
                    Console.Write($"{stat}: {character.Stats[stat]}  ");
                }
                Console.WriteLine("\n\nPick the first stat you'd like to increase.");
                IncreaseStat(character, 1);
                Console.WriteLine("Pick the second stat you'd like to increase.");
                IncreaseStat(character, 1);
                Console.Clear();
                Console.Write($"\nYour stats are now ");
                foreach (var stat in Options.Stats)
                {
                    Console.Write($"{stat}: {character.Stats[stat]}  ");
                }
                Console.WriteLine("");
            }
            else
            {
                Feats.AddFeat(character);
            }
        }
示例#18
0
        public async Task <ActionResult> Create(Feats collection)
        {
            try
            {
                using (var httpClient = new HttpClient())
                {
                    var request  = CreateRequestToService(HttpMethod.Post, $"{Configuration["ServiceEndpoints:Feat"]}", collection);
                    var Response = await httpClient.SendAsync(request);
                }

                return(RedirectToAction(nameof(Index)));
            }
            catch
            {
                return(View());
            }
        }
示例#19
0
 private void SelectSpellsTab()
 {
     if (State == CharInventoryState.LevelUp)
     {
         Logger.Warn("You cannot switch to the spells tab while leveling up using this button.");
     }
     else if (State == CharInventoryState.PartyPool)
     {
         Logger.Warn("You cannot switch to the spells tab while in the party pool using this button.");
     }
     else if (CurrentPage != 7)
     {
         Logger.Debug("Switching to spells tab of character sheet.");
         CurrentPage = 7;
         Spells.Show(CurrentCritter);
         Inventory.Hide();
         Skills.Hide();
         Feats.Hide();
     }
 }
示例#20
0
        // GET: Feats/Details/5
        public async Task <ActionResult> Details(int id)
        {
            var model = new Feats();

            using (var httpClient = new HttpClient())
            {
                HttpRequestMessage request = CreateRequestToService(HttpMethod.Get,
                                                                    $"{Configuration["ServiceEndpoints:Feat"]}/{id}");
                var Response = await httpClient.SendAsync(request);

                if (Response.IsSuccessStatusCode)
                {
                    var jsonString = await Response.Content.ReadAsStringAsync();

                    Feats feats = JsonConvert.DeserializeObject <Feats>(jsonString);
                    return(View(feats));
                }
            }

            return(View(model));
        }
示例#21
0
 private void SelectInventoryTab(int inventoryIdx)
 {
     if (State == CharInventoryState.LevelUp)
     {
         Logger.Warn("You cannot switch to the inventory tab while leveling up using this button.");
     }
     else if (CurrentPage != inventoryIdx)
     {
         Logger.Debug($"Switching to inventory {inventoryIdx} of character sheet.");
         CurrentPage = inventoryIdx;
         Inventory.Hide();
         Inventory.Show(CurrentCritter);
         Skills.Hide();
         Feats.Hide();
         Spells.Hide();
         Inventory.BagIndex = inventoryIdx;
     }
     else
     {
         Inventory.BagIndex = inventoryIdx;
     }
 }
示例#22
0
    public Character(string ToonFirstName, string ToonLastName, string ToonAge, string ToonHeight, string ToonWeight, string ToonRace, string ToonSubrace, string ToonClass, string ToonBackground)
    {
        FirstName        = ToonFirstName;
        LastName         = ToonLastName;
        Age              = ToonAge;
        Height           = ToonHeight;
        Weight           = ToonWeight;
        Race             = ToonRace;
        Subrace          = ToonSubrace;
        Class            = ToonClass;
        Background       = ToonBackground;
        HitPoints        = RollHP(Class);
        Level            = 1;
        Initiative       = 0;
        Speed            = 0;
        ProficiencyBonus = 2;
        Dictionary <string, int> Attributes    = new Dictionary <string, int>();
        Dictionary <string, int> AttributeMods = new Dictionary <string, int>();
        //this.InitialiseAttributes();
        //SetAttMods(this);
        Dictionary <string, string> FeatsList  = new Dictionary <string, string>();
        SkillProficiency            Skills     = new SkillProficiency(this);
        Dictionary <string, int>    SkillsList = new Dictionary <string, int>();

        //this.InitialiseSkills(this);

        Skills.PresetBackgroundProfs(this);
        Skills.PresetRaceProfs(this);
        Skills.PresetClassProfs(this);
        Feats Feats = new Feats(this);

        SetHitDie(Class);
        List <string>            ProfSavingThrows = new List <String>();
        Dictionary <string, int> SavingThrows     = new Dictionary <string, int>();

        SetupClass(this);
        //ReCalcSkills(this);
    }
示例#23
0
 public void Post([FromBody] Feats value)
 {
     Repo.CreateFeat(value);
     Repo.Save();
 }
示例#24
0
    public void Show(GameObject obj)
    {
        if (CurrentCritter != null)
        {
            Hide(_state);
        }

        GameSystems.TimeEvent.PauseGameTime();

        if (obj != CurrentCritter)
        {
            ResetPages();
        }

        CurrentCritter      = obj;
        Inventory.Container = obj;
        _mainWidget.Visible = true;
        _mainWidget.BringToFront();
        Stats.Show();
        Portrait.Show(obj);

        if (_state == CharInventoryState.Unknown6)
        {
            CurrentPage = 7;
            Spells.Show(CurrentCritter);
        }
        else if (_state != CharInventoryState.LevelUp)
        {
            switch (CurrentPage)
            {
            case 0:
            case 1:
            case 2:
            case 3:
            case 4:
                Inventory.Show(obj);
                break;

            case 5:
                Skills.Show();
                break;

            case 6:
                Feats.Show(CurrentCritter);
                break;

            case 7:
                Spells.Show(CurrentCritter);
                break;

            default:
                Logger.Warn("Showing default character sheet page (inventory).");
                Inventory.Show(obj);
                break;
            }
        }

        switch (_state)
        {
        case CharInventoryState.Looting:
        case CharInventoryState.Bartering:
        case CharInventoryState.Unknown6:
            Looting.Show(null);
            break;

        case CharInventoryState.LevelUp:
            CurrentPage = 9;
            LevelUp.Show();
            break;
        }

        CenterOnScreen();

        Help.Show();

        HandleLootingTutorialTopics();
    }
示例#25
0
        public override void ReadXML(XmlNode xmlNode)
        {
            base.ReadXML(xmlNode);

            try
            {
                foreach (XmlNode childNode in xmlNode.ChildNodes)
                {
                    if (childNode.Name == "Type")
                    {
                        try
                        {
                            Type = Methods.GetCreatureTypeFromString(childNode.InnerText);
                        }
                        catch (FormatException)
                        {
                            Type = Types.Creature.Humanoid;
                        }
                    }
                    else if (childNode.Name == "ChallengeRating")
                    {
                        ChallengeRating = Convert.ToSingle(childNode.InnerText);
                    }
                    else if (childNode.Name == "AttackSets")
                    {
                        AttackSets.Clear();
                        foreach (XmlNode attackSetNode in childNode.ChildNodes)
                        {
                            if (attackSetNode.Name == "AttackSet")
                            {
                                AttackSets.Add(new AttackSet(attackSetNode));
                            }
                        }
                    }
                    else if (childNode.Name == "Strength")
                    {
                        Strength = Convert.ToInt32(childNode.InnerText);
                    }
                    else if (childNode.Name == "Dexterity")
                    {
                        Dexterity = Convert.ToInt32(childNode.InnerText);
                    }
                    else if (childNode.Name == "Constitution")
                    {
                        Constitution = Convert.ToInt32(childNode.InnerText);
                    }
                    else if (childNode.Name == "Intelligence")
                    {
                        Intelligence = Convert.ToInt32(childNode.InnerText);
                    }
                    else if (childNode.Name == "Wisdom")
                    {
                        Wisdom = Convert.ToInt32(childNode.InnerText);
                    }
                    else if (childNode.Name == "Charisma")
                    {
                        Charisma = Convert.ToInt32(childNode.InnerText);
                    }
                    else if (childNode.Name == "BaseAttackBonus")
                    {
                        BaseAttackBonus = Convert.ToInt32(childNode.InnerText);
                    }
                    else if (childNode.Name == "GrappleModifier")
                    {
                        GrappleModifier = Convert.ToInt32(childNode.InnerText);
                    }
                    else if (childNode.Name == "HitPoints")
                    {
                        HitPoints = Convert.ToInt32(childNode.InnerText);
                    }
                    else if (childNode.Name == "HitDice")
                    {
                        HitDice = Convert.ToInt32(childNode.InnerText);
                    }
                    else if (childNode.Name == "HitDieType")
                    {
                        HitDieType = Methods.GetDieTypeFromString(childNode.InnerText);
                    }
                    else if (childNode.Name == "ArmorClass")
                    {
                        ArmorClass = Convert.ToInt32(childNode.InnerText);
                    }
                    else if (childNode.Name == "TouchArmorClass")
                    {
                        TouchArmorClass = Convert.ToInt32(childNode.InnerText);
                    }
                    else if (childNode.Name == "FlatFootedArmorClass")
                    {
                        FlatFootedArmorClass = Convert.ToInt32(childNode.InnerText);
                    }
                    else if (childNode.Name == "Speed")
                    {
                        Speed.ReadXML(childNode);
                    }
                    else if (childNode.Name == "FortitudeSave")
                    {
                        FortitudeSave = Convert.ToInt32(childNode.InnerText);
                    }
                    else if (childNode.Name == "ReflexSave")
                    {
                        ReflexSave = Convert.ToInt32(childNode.InnerText);
                    }
                    else if (childNode.Name == "WillSave")
                    {
                        WillSave = Convert.ToInt32(childNode.InnerText);
                    }
                    else if (childNode.Name == "Feats")
                    {
                        foreach (XmlNode featNode in childNode.ChildNodes)
                        {
                            if (featNode.Name == "Feat")
                            {
                                Feats.Add(featNode.InnerText);
                            }
                        }
                    }
                    else if (childNode.Name == "Space")
                    {
                        Space = Convert.ToInt32(childNode.InnerText);
                    }
                    else if (childNode.Name == "Reach")
                    {
                        Reach = Convert.ToInt32(childNode.InnerText);
                    }
                    else if (childNode.Name == "Size")
                    {
                        Size = Methods.GetSizeFromString(childNode.InnerText);
                    }
                    else if (childNode.Name == "DamageReductions")
                    {
                        foreach (XmlNode drNode in childNode.ChildNodes)
                        {
                            if (drNode.Name == "DamageReduction")
                            {
                                DamageReduction dr = new DamageReduction();
                                dr.ReadXML(drNode);
                                DamageReductions.Add(dr);
                            }
                        }
                    }
                    else if (childNode.Name == "Immunities")
                    {
                        Immunities.ReadXML(childNode);
                    }
                    else if (childNode.Name == "EnergyResistances")
                    {
                        foreach (XmlNode erNode in childNode.ChildNodes)
                        {
                            if (erNode.Name == "EnergyResistance")
                            {
                                EnergyResistance er = new EnergyResistance();
                                er.ReadXML(erNode);
                                EnergyResistances.Add(er);
                            }
                        }
                    }
                    else if (childNode.Name == "SpellResistance")
                    {
                        SpellResistance = Convert.ToInt32(childNode.InnerText);
                    }
                    else if (childNode.Name == "FastHealing")
                    {
                        FastHealing = Convert.ToInt32(childNode.InnerText);
                    }
                    else if (childNode.Name == "SpecialAttacks")
                    {
                        SpecialAttacks = childNode.InnerText;
                    }
                    else if (childNode.Name == "SpecialQualities")
                    {
                        foreach (string specialQuality in childNode.InnerText.Split(','))
                        {
                            SpecialQualities.Add(specialQuality.Trim());
                        }
                    }
                }
            }
            catch (XmlException e)
            {
                MessageBox.Show(e.ToString());
            }
        }
示例#26
0
    public void Hide(CharInventoryState newState)
    {
        if (CurrentCritter != null)
        {
            GameSystems.TimeEvent.ResumeGameTime();
        }

        if (UiSystems.Popup.IsAnyOpen())
        {
            UiSystems.Popup.CloseAll();
        }

        if (CurrentPage >= 1 && CurrentPage <= 4)
        {
            CurrentPage = 0;
        }

        Inventory.BagIndex = 0;

        if (GameSystems.Combat.IsCombatActive())
        {
            // Clear the flag that allows us to change more than one item while in the inventory menu,
            // without losing even more of our turn.
            var tbStatus = GameSystems.D20.Actions.curSeqGetTurnBasedStatus();
            tbStatus.tbsFlags &= ~TurnBasedStatusFlags.ChangedWornItem;
        }

        if (Inventory.DraggedObject != null)
        {
            Inventory.DraggedObject = null;
            Tig.Mouse.ClearDraggedIcon();
        }

        _mainWidget.Hide();
        Stats.Hide();
        Portrait.Hide();
        Inventory.Hide();
        Skills.Hide();
        Feats.Hide();
        Spells.Hide();
        LevelUp.Hide();

        switch (_state)
        {
        case CharInventoryState.Closed:
            break;

        case CharInventoryState.Looting:
        case CharInventoryState.Bartering:
        case CharInventoryState.Unknown6:
            if (newState != _state)
            {
                Looting.Hide();
            }

            break;

        case CharInventoryState.LevelUp:
            LevelUp.Hide();
            break;

        case CharInventoryState.CastingSpell:
            _itemPickedCallback?.Invoke(null);
            _itemPickedCallback = null;
            break;

        case CharInventoryState.PartyPool:
            break;

        default:
            throw new ArgumentOutOfRangeException();
        }

        State          = newState;
        CurrentCritter = null;
        Help.Hide();
    }
示例#27
0
 public void AddFeat(Feat newFeat)
 {
     //do some inspection
     Feats.Add(newFeat);
 }