コード例 #1
0
        // Add Characters
        // Scale them to meet Character Strength...
        public bool AddCharactersToBattle()
        {
            // Check if the Character list is empty
            if (CharactersViewModel.Instance.Dataset.Count < 1)
            {
                return(false);
            }

            // Check if the Character list has enough characters
            if (CharacterList.Count >= 6)
            {
                return(true);
            }

            // If the party does not have 6 characters, add them.
            var ScaleLevelMax = 3;
            var ScaleLevelMin = 1;

            // Get up to 6 Characters
            do
            {
                var Data = GetRandomCharacter(ScaleLevelMin, ScaleLevelMax);
                CharacterList.Add(Data);
            } while (CharacterList.Count < GameGlobals.MaxNumberPartyPlayers);

            return(true);
        }
コード例 #2
0
        // Add Characters
        // Scale them to meet Character Strength...
        public bool AddCharactersToBattle()
        {
            // Check to see if the Character list is full, if so, no need to add more...
            if (CharacterList.Count >= 1)
            {
                return(true);
            }

            var ScaleLevelMax = 2;
            var ScaleLevelMin = 1;

            if (CharactersViewModel.Instance.Dataset.Count < 1)
            {
                return(false);
            }

            // Get 6 Characters
            do
            {
                var myData = GetRandomCharacter(ScaleLevelMin, ScaleLevelMax);
                CharacterList.Add(myData);
            } while (CharacterList.Count < 1);

            return(true);
        }
コード例 #3
0
        // Add Characters
        // Scale them to meet Character Strength...
        public bool AddCharactersToBattle()
        {
            // Check to see if the Character list is full, if so return.
            if (CharacterList.Count >= 6)
            {
                return(true);
            }

            // TODO, determine the character strength
            // add Characters up to that strength...
            var ScaleLevelMax = 2;
            var ScaleLevelMin = 1;

            if (CharactersViewModel.Instance.Dataset.Count < 1)
            {
                return(false);
            }

            // Get exactly 6 charactersrounds
            do
            {
                var myData = GetRandomCharacter(ScaleLevelMin, ScaleLevelMax);
                CharacterList.Add(myData);
            } while (CharacterList.Count < 6);

            return(true);
        }
コード例 #4
0
 /// <summary>
 /// 显示角色列表
 /// </summary>
 public void ShowCharacterTable()
 {
     foreach (var model in GetCharacterList())
     {
         CharacterList.Add(model);
     }
     ShowCharacterList();
 }
コード例 #5
0
 public void WordToCharList()
 {
     char[] inputWordArray = InputWord.ToLower().ToCharArray();
     for (int index = 0; index < inputWordArray.Length; index++)
     {
         CharacterList.Add(inputWordArray[index]);
     }
 }
コード例 #6
0
        private void LoadSettings()
        {
            LogId = Settings.GetString("LogId", null);
            if (LogId == null)
            {
                LogId = Guid.NewGuid().ToString();
                Settings.SetString("LogId", LogId);
            }

            IsGuildChatEnabled = Settings.GetBool("IsGuildChatEnabled", false);
            CustomLogFolder    = Settings.GetString("CustomLogFolder", "");
            EnableUpdates      = Settings.GetBool("EnableUpdates", true);

            for (int i = 0; i < 4; i++)
            {
                string           Name          = Settings.GetString("CharacterName#" + i, "");
                string           GuildName     = Settings.GetString("GuildName#" + i, "");
                bool             IsAutoUpdated = Settings.GetBool("IsAutoUpdated#" + i, false);
                string           Password      = Settings.GetString("Password#" + i, "");
                CharacterSetting NewCharacter  = new CharacterSetting(Name, GuildName, IsAutoUpdated, Password);
                CharacterList.Add(NewCharacter);
            }
        }
コード例 #7
0
        /// <summary>
        /// import character from helden.zip.hld file
        /// </summary>
        public void LoadCharacterList()
        {
            // remove all but StaticCharacter, which is always at position 0
            while (CharacterList.Count > 1)
            {
                CharacterList.RemoveAt(1);
            }

            string filename = Settings.HeldenDateiPath;

            if (string.IsNullOrEmpty(filename) || !File.Exists(filename))
            {
                MessengerInstance.Send(new OpenInfoMessage("Charakter Import", "Bitte wähle einen gültigen Pfad zur helden.zip.hld im Einstellungsmenü"));
            }

            if (File.Exists(filename))
            {
                using ZipArchive zip = ZipFile.Open(filename, ZipArchiveMode.Read);
                foreach (ZipArchiveEntry entry in zip.Entries)
                {
                    if (entry.Name != "held.xml.tree")
                    {
                        using StreamReader characterStreamReader = new(entry.Open(), Encoding.UTF8);
                        XDocument doc = XDocument.Parse(characterStreamReader.ReadToEnd());

                        var pickCharacter = XmlToCharacterModel(doc);

                        pickCharacter.FileName = entry.FullName;

                        CharacterList.Add(pickCharacter);
                    }
                }

                CharacterList = new ObservableCollection <CharacterModel>(CharacterList.OrderByDescending(c => c.Stand));
            }
        }
コード例 #8
0
        /// <summary>
        /// Run Auto Battle
        /// </summary>
        /// <returns></returns>
        public async Task <bool> RunAutoBattle()
        {
            RoundEnum RoundCondition;

            Debug.WriteLine("Auto Battle Starting");

            // Auto Battle, does all the steps that a human would do.

            // Prepare for Battle
            bool Ifeelgood = false;
            var  d20       = DiceHelper.RollDice(1, 20);

            if (d20 < 10)
            {
                //Do not Use Special Ability
                Ifeelgood = false;
            }

            CreateCharacterParty(Ifeelgood);

            // Start Battle in AutoBattle mode
            StartBattle(true);

            // Fight Loop. Continue until Game is Over...
            do
            {
                // Check for excessive duration.
                if (DetectInfinateLoop())
                {
                    Debug.WriteLine("Aborting, More than Max Rounds");
                    EndBattle();
                    return(false);
                }

                Debug.WriteLine("Next Turn");

                // Do the turn...
                // If the round is over start a new one...
                RoundCondition = RoundNextTurn();

                if (RoundCondition == RoundEnum.NewRound)
                {
                    NewRound();
                    Debug.WriteLine("New Round");
                    //if round is 2 reincarnate any character
                    if (BattleScore.RoundCount == 2)
                    {
                        if (BattleScore.CharacterModelDeathList.Count > 0)
                        {
                            BattleScore.CharacterModelDeathList[0].Alive = true;
                            CharacterList.Add(BattleScore.CharacterModelDeathList[0]);
                            BattleMessagesModel.ReincarnatedCharName = BattleScore.CharacterModelDeathList[0].Name;
                            Debug.WriteLine(BattleMessagesModel.GetReincarnatedPlayerMessage());
                            WasReincarnated = true;
                        }
                    }
                }
            } while (RoundCondition != RoundEnum.GameOver);

            Debug.WriteLine("Game Over");

            // Wrap up
            EndBattle();

            return(true);
        }
コード例 #9
0
 public void Add(ICharacter character)
 {
     CharacterList.Add(character);
 }
コード例 #10
0
        /// <summary>
        /// Adds a Character/"band member" to the battle
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        public bool AddBandMember(CharacterModel member)
        {
            CharacterList.Add(new CharacterModel(member));

            return(true);
        }
コード例 #11
0
        /// <summary>
        /// Add the charcter to the character list
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        public bool PopulateCharacterList(CharacterModel data)
        {
            CharacterList.Add(new EntityInfoModel(data));

            return(true);
        }