Пример #1
0
 public Entity(int ID, EntityTypes entityType, bool combatFlag, char symbol, string name, Stats stats, Position currentPosition, Position previousPosition, ConsoleColor color, bool alive, bool show)
 {
     initialize(ID, entityType, combatFlag, symbol, name, stats, currentPosition, previousPosition, color, alive, show);
     moved = true;
 }
        public GenerateDefaultGameFiles()
        {
            Player player = new Player();
            Monster monster = new Monster();

            player.ID = 4324;
            player.name = "DefaultPlayer";
            player.previousPosition.x = 0;
            player.previousPosition.y = 0;
            player.stats.attack = 10;
            player.stats.defense = 5;
            player.stats.experience = 2;
            player.stats.health = 50;
            player.symbol = 'P';

            FileManager.savePlayer("PlayerDefaultTemplate.xml", player);

            monster.ID = 231;
            monster.name = "DefaultMonster";
            monster.currentPosition.x = 2;
            monster.currentPosition.y = 4;
            monster.previousPosition.x = 2;
            monster.previousPosition.y = 3;
            monster.stats.attack = 2;
            monster.stats.defense = 1;
            monster.stats.experience = 0;
            monster.stats.health = 10;
            monster.symbol = 'M';

            FileManager.saveMonster("MonsterDefaultTemplate.xml", monster);

            Dictionary<int, Stats> levelStats = new Dictionary<int, Stats>();

            Stats stats1 = new Stats();
            stats1.attack = 10;
            stats1.defense = 5;
            stats1.experience = 0;
            stats1.health = 50;
            stats1.level = 1;

            levelStats.Add(1, stats1);

            Stats stats2 = new Stats();
            stats2.attack = 15;
            stats2.defense = 7;
            stats2.experience = 50;
            stats2.health = 70;
            stats2.level = 2;

            levelStats.Add(2, stats2);

            Stats stats3 = new Stats();
            stats3.attack = 19;
            stats3.defense = 10;
            stats3.experience = 120;
            stats3.health = 96;
            stats3.level = 3;

            levelStats.Add(3, stats3);

            Stats stats4 = new Stats();
            stats4.attack = 22;
            stats4.defense = 12;
            stats4.experience = 200;
            stats4.health = 112;
            stats4.level = 4;

            levelStats.Add(4, stats4);

            Stats stats5 = new Stats();
            stats5.attack = 29;
            stats5.defense = 16;
            stats5.experience = 340;
            stats5.health = 140;
            stats5.level = 5;

            levelStats.Add(5, stats5);

            //TODO: Still need to save the levelStats, but solving how to save
            //a dictionary or IDictionary is the first thing that needs to be
            //figured out in order to finally save the xml file.
            //currently we are only saving the stats as a text file of
            //a concatinated string in the form key,value.attack,value.defence,etc...
            FileManager.saveLevelStatsToText("LevelingDefault.txt", levelStats);

            string[] mapDefault = {
                                    @"A╔═══════\════════╗B",
                                    @" ║▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒║ ",
                                    @" ║▒▒╔═══/═════╗▒▒▒║ ",
                                    @" ║▒▒║▒▒▒▒▒▒▒▒▒║▒▒▒║ ",
                                    @" ║▒▒╚══╗▒▒▒▒▒▒║▒▒▒║ ",
                                    @" /▒▒▒▒▒║▒▒▒▒▒▒║▒▒▒/ ",
                                    @" ║▒▒▒▒▒/▒▒▒▒▒▒║▒▒▒║ ",
                                    @" ║▒▒▒▒▒╚══════╝▒▒▒║ ",
                                    @" ║▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒║ ",
                                    @"D╚═══════\════════╝C"

                                };

            FileManager.saveTextFile("map.txt", mapDefault);

            string[] inputText = {
                                    "UpArrow,MovePlayerUp",
                                    "DownArrow,MovePlayerDown",
                                    "LeftArrow,MovePlayerLeft",
                                    "RightArrow,MovePlayerRight",
                                    "Escape,Escape"
                                 };

            FileManager.saveTextFile("input.txt", inputText);

            string[] mapListText = {"map.txt"};

            FileManager.saveTextFile("mapList.txt", mapListText);

            string[] collisionMappingText = {
                                                "wall:║,╔,═,╗,╝,╚",
                                                "door:\\,/",
                                                "floor: ,▒",
                                            };

            FileManager.saveTextFile("collisionMappings.txt", collisionMappingText);
        }
Пример #3
0
 public void initialize(int ID, EntityTypes entityType, bool combatFlag, char symbol, string name, Stats stats, Position currentPosition, Position previousPosition, ConsoleColor color, bool alive, bool show)
 {
     this.ID                 = ID;
     this.entityType         = entityType;
     this.combatFlag         = combatFlag;
     this.name               = name;
     this.stats              = stats;
     this.symbol             = symbol;
     this.currentPosition    = currentPosition;
     this.previousPosition   = previousPosition;
     this.color              = color;
     this.alive              = alive;
     this.show               = true;
     this.inventory          = new Inventory();
 }
Пример #4
0
        public static Dictionary<int, Stats> loadLevelStats(string fileName)
        {
            Dictionary<int, Stats> levelStats = new Dictionary<int,Stats>();

            string[] statsStrings = loadTextFile(getPath(PATH_ROOT, PATH_SETTING, fileName));

            foreach (string line in statsStrings)
            {
                string[] str = line.Split(VALUE_SEPERATOR);

                Stats stats = new Stats();

                stats.attack = Convert.ToInt32(str[1]);
                stats.defense = Convert.ToInt32(str[2]);
                stats.experience = Convert.ToInt32(str[3]);
                stats.health = Convert.ToInt32(str[4]);
                stats.level = Convert.ToInt32(str[5]);
                stats.movementSpeed = Convert.ToInt32(str[6]);
                stats.attackAccuracy = Convert.ToInt32(str[7]);
                stats.defenseAccuracy = Convert.ToInt32(str[8]);
                stats.attackSpeed = Convert.ToInt32(str[9]);
                levelStats.Add(Convert.ToInt32(str[0]), stats);
            }

            return levelStats;
        }