This repository has been archived by the owner on Dec 9, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Program.cs
189 lines (152 loc) · 6.99 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
using Pokedex.Interfaces;
using Pokedex.Models;
using Pokedex.Models.Pokemons;
using Pokedex.Models.PokeMoves;
namespace Pokedex;
public static class Program
{
public static readonly Random Rnd = new();
private static IEnumerable<Pokemon> PokeListBase
{
get
{
var dragonite = new Pokemon(Dragonite.Singleton, 100);
dragonite.SetMoves(new MoveDragonDance(), new MoveEarthquake(),
new MoveIcePunch(), new MoveRoost());
var blissey = new Pokemon(Blissey.Singleton, 100);
blissey.SetMoves(new MoveSeismicToss(), new MoveSoftBoiled(),
new MoveTeleport(), new MoveThunderWave());
var kartana = new Pokemon(Kartana.Singleton, 100);
kartana.SetMoves(new MoveLeafBlade(), new MoveSmartStrike(),
new MoveSwordsDance(), new MoveGigaImpact());
var mew = new Pokemon(Mew.Singleton, 100);
mew.SetMoves(new MoveCosmicPower(), new MoveRoost(),
new MoveFlareBlitz(), new MoveWillOWisp());
var ninetails = new Pokemon(NinetalesAlola.Singleton, 100);
ninetails.SetMoves(new MoveFreezeDry(), new MoveHail(),
new MoveHypnosis(), new MoveBlizzard());
var melmetal = new Pokemon(Melmetal.Singleton, 100);
melmetal.SetMoves(new MoveSuperpower(), new MoveThunderPunch(),
new MoveThunderWave(), new MoveToxic());
var slowbro = new Pokemon(Slowbro.Singleton, 100);
slowbro.SetMoves(new MoveScald(), new MoveSlackOff(),
new MoveTeleport(), new MoveHeadbutt());
var toxapex = new Pokemon(Toxapex.Singleton, 100);
toxapex.SetMoves(new MoveScald(), new MoveRecover(),
new MovePoisonJab(), new MoveToxic());
var tyranitar = new Pokemon(Tyranitar.Singleton, 100);
tyranitar.SetMoves(new MoveRockBlast(), new MoveEarthquake(),
new MoveToxic(), new MoveThunderWave());
var victini = new Pokemon(Victini.Singleton, 100);
victini.SetMoves(new MoveVCreate(), new MoveBoltStrike(),
new MoveUTurn(), new MoveGlaciate());
var zapdos = new Pokemon(Zapdos.Singleton, 100);
zapdos.SetMoves(new MoveVoltSwitch(), new MoveRoost(),
new MoveHurricane(), new MoveHeatWave());
var bisharp = new Pokemon(Bisharp.Singleton, 100);
bisharp.SetMoves(new MoveSwordsDance(), new MoveIronHead(),
new MoveGuillotine(), new MoveFoulPlay());
var dragapult = new Pokemon(Dragapult.Singleton, 100);
dragapult.SetMoves(new MoveShadowBall(), new MoveDracoMeteor(),
new MoveUTurn(), new MoveFlamethrower());
var landorus = new Pokemon(LandorusTherian.Singleton, 100);
landorus.SetMoves(new MoveSwordsDance(), new MoveEarthquake(),
new MoveStoneEdge(), new MoveRockPolish());
var tapukoko = new Pokemon(TapuKoko.Singleton, 100);
tapukoko.SetMoves(new MoveThunderbolt(), new MoveDazzlingGleam(),
new MoveUTurn(), new MoveRoost());
var volcarona = new Pokemon(Volcarona.Singleton, 100);
volcarona.SetMoves(new MoveQuiverDance(), new MoveFireBlast(),
new MoveBugBuzz(), new MoveGigaDrain());
yield return dragonite;
yield return blissey;
yield return kartana;
yield return mew;
yield return ninetails;
yield return melmetal;
yield return slowbro;
yield return toxapex;
yield return tyranitar;
yield return victini;
yield return zapdos;
yield return bisharp;
yield return dragapult;
yield return landorus;
yield return tapukoko;
yield return volcarona;
}
}
private static readonly List<Pokemon> PokeList = PokeListBase.ToList();
public static void Main(string[ ] args)
{
Console.OutputEncoding = System.Text.Encoding.UTF8;
PokeType.InitializeTypes();
// Presentation
Console.WriteLine("Welcome to the Grand Pokemon Championship!");
Console.WriteLine("Here on my left is our first contestant, I call ...");
Console.Write("(Eh, sorry, what's your name again?) ");
string nameA = Console.ReadLine()!;
Console.WriteLine($"As I was saying, I call {nameA} to the stand!");
Console.WriteLine("Here on my right is their opponent, I call ...");
Console.Write("(I'm very bad with names, could you tell me yours again?) ");
string nameB = Console.ReadLine()!;
Console.WriteLine($"I call {nameB} to the stand!");
Console.WriteLine();
Console.WriteLine("I'm going to present you a list of 16 Pokemons, and you're going to choose 6, one at a time.");
bool firstPlayer = Rnd.Next(0, 2) == 0;
Console.WriteLine($"And the first to go will be ... {(firstPlayer ? nameA : nameB)}!");
List<I_Battler> teamA = new(),
teamB = new();
while (teamA.Count < 6
&& teamB.Count < 6)
{
if (firstPlayer)
{
ChoosePokemon(teamA);
Console.WriteLine();
ChoosePokemon(teamB);
} else
{
ChoosePokemon(teamB);
Console.WriteLine();
ChoosePokemon(teamA);
}
Console.WriteLine();
}
Console.WriteLine("Very good!");
Console.WriteLine("Now let the fight ... commence!");
Trainer playerA = new(nameA, teamA.ToArray()),
playerB = new(nameB, teamB.ToArray());
Combat octogon = new(playerA, playerB);
I_Player winner = octogon.DoCombat();
Console.WriteLine($"And the winner is ... {winner.Name}");
}
private static void ChoosePokemon(ICollection<I_Battler> team)
{
for (var i = 0; i < PokeList.Count; i++)
{
Pokemon poke = PokeList[i];
Console.WriteLine($"{i + 1}: {poke}");
}
do
{
Console.Write("Choose a pokemon: ");
string input = Console.ReadLine()!;
if (int.TryParse(input, out int pokeNum) is false)
{
Console.WriteLine("Invalid input");
continue;
}
pokeNum--;
if (pokeNum < 0
|| pokeNum >= PokeList.Count)
{
Console.WriteLine("Input out of bounds");
continue;
}
Console.WriteLine($"{PokeList[pokeNum]} was chosen!");
team.Add(PokeList[pokeNum]);
PokeList.RemoveAt(pokeNum);
} while (false);
}
}