コード例 #1
0
ファイル: FightState.cs プロジェクト: GabrielWilds/JSLCode
        public void StatusReport(Character currentActor)
        {
            int nameSpace = 16;
            for (int i = 0; i < teams.Length; i++)
            {
                Console.Write("__Team ");
                if (teams[i].Leader is Player)
                    Console.ForegroundColor = ConsoleColor.Yellow;
                Console.Write(teams[i].TeamName);
                Console.ResetColor();
                Console.WriteLine("__");

                for (int x = 0; x < teams[i].Members.Length; x++)
                {
                    string charName = teams[i].Members[x].Name;
                    if (teams[i].Members[x] is Player)
                        charName = "Your Status:";

                    int namePadding = nameSpace - charName.Length;

                    for (int y = 0; y < namePadding; y++)
                        charName = charName.Insert(charName.Length, " ");
                    if (!teams[i].Members[x].IsDead)
                        Console.WriteLine(charName + "| " + teams[i].Members[x].HP.ToString("00") + "\\" + teams[i].Members[x].MaxHP.ToString("00") + " | " + teams[i].Members[x].AT.ToString("00"));
                    else
                    {
                        Console.ForegroundColor = ConsoleColor.DarkGray;
                        Console.WriteLine(teams[i].Members[x].Name + ": Dead");
                        Console.ResetColor();
                    }

                }

            }
        }
コード例 #2
0
ファイル: Character.cs プロジェクト: Torniojaws/arena
		public void attack(Character target) {
			Console.WriteLine(name + " attacks " + target.name + "!");
			target.receiveDamage(damage);
		}
コード例 #3
0
ファイル: Combat.cs プロジェクト: GabrielWilds/JSLCode
        public static FightState RandomFight(Player player)
        {
            String path = "npc.txt";
            String[] monsters = File.ReadAllLines(path);

            int teamCount = Randomizer.RandomNumber(1, 4);
            int monsterCount = Randomizer.RandomNumber(teamCount, teamCount * Randomizer.RandomNumber(1, 3));
            Team[] teams = new Team[teamCount + 1];
            for (int i = 0; i < teams.Length; i++)
            {
                Team team = new Team();
                teams[i] = team;
            }
            Character[] playerTeam = new Character[1];
            playerTeam[0] = player;
            teams[0].SetTeam(playerTeam);

            for (int i = 1; i < teams.Length; i++)
            {
                NPC[] team = new NPC[monsterCount];
                for (int x = 0; x < team.Length; x++)
                {
                    NPC monster = new NPC(null, 0, 0, 0, 0, 0, 0, 0, 0);
                    monster = GetMonster(monsters, Randomizer.RandomNumber(monsters.Length));
                    team[x] = monster;
                }
                teams[i].SetTeam(team);
            }
            FightState state = new FightState(teams);

            return state;
        }