예제 #1
0
파일: BattleForm.cs 프로젝트: Tonaplo/RPG
        /// <summary>
        /// Constructor for the Battle Form. Only supports Singleplayer combat atm
        /// </summary>
        /// <param name="_listOfChars"></param>
        /// <param name="_difficulty"></param>
        public BattleForm(List<Core.Units.Character> _listOfChars, int _difficulty, RPG.Core.PlayerSettings settings)
        {
            InitializeComponent();
            this.StartPosition = FormStartPosition.CenterParent;
            this.BackgroundImage = GeneralFunctions.ResizeImage(Properties.Resources.background, labelBackgroundIGNORE.Size);
            Function.SoundManager.PlayMain(settings.SoundOn, this, settings.SoundVolume);

            numberOfPlayers = _listOfChars.Count;

            battleChars = _listOfChars;

            int sum = 0;

            foreach (var item in battleChars)
            {
                sum += item.UnitLevel;
                liveChars.Add(item.UnitName);
            }

            int average = (int)(sum / battleChars.Count);

            enemy = WorldGeneration.GenerateNPC(null, average, _difficulty, EnumMonsterType.Null, battleChars.Count);
            ai = WorldGeneration.GenerateNPCAI(enemy,  battleChars);
            enemy = ai.ModifiedNPC;

            foreach (var item in battleChars)
            {
                ucCharacterBattle ucb = new ucCharacterBattle(item, battleChars.Count);
                ucb.AttackClicked += ucb_AttackClicked;
                flpCharacters.Controls.Add(ucb);
            }

            flpNPCs.Controls.Add(new ucNPC(enemy));
        }
예제 #2
0
파일: Battle.cs 프로젝트: Tonaplo/RPG
        public Battle(List<Core.Units.Character> _listOfChars, int _difficulty)
        {
            battleChars = _listOfChars;

            int sum = 0;

            foreach (var item in battleChars)
            {
                sum += item.UnitLevel;
            }

            int average = (int)(sum/battleChars.Count);

            enemy = WorldGeneration.GenerateNPC("", average, _difficulty, EnumMonsterType.Null, battleChars.Count);
            ai = WorldGeneration.GenerateNPCAI(enemy, battleChars);
        }
예제 #3
0
 /// <summary>
 /// This function generates a random NPC AI based on the NPC, an integer and a list of it's possible targets.
 /// </summary>
 /// <param name="npc">The NPC to generate from</param>
 /// <param name="random">Make it a random ai (true) or base it on the NPC type</param>
 /// <param name="_characters">The targets for the NPC</param>
 /// <returns></returns>
 public static NPCAI GenerateNPCAI(Core.Units.NPC npc, List<Character> _characters)
 {
     NPCAI ai = new NPCAI(npc, _characters);
     return ai;
 }
예제 #4
0
        /// <summary>
        /// This function generates a random NPC AI based on the NPC, an integer and a list of it's possible targets.
        /// </summary>
        /// <param name="npc">The NPC to generate from</param>
        /// <param name="random">Make it a random ai (true) or base it on the NPC type</param>
        /// <param name="_characters">The targets for the NPC</param>
        /// <returns></returns>
        public static NPCAI GenerateNPCAI(Core.Units.NPC npc, List <Character> _characters)
        {
            NPCAI ai = new NPCAI(npc, _characters);

            return(ai);
        }