diff --git a/stages/St-01/Readme.md b/stages/St-01/Readme.md new file mode 100644 index 0000000..cbd9b1e --- /dev/null +++ b/stages/St-01/Readme.md @@ -0,0 +1,5 @@ +# Stage №1 + +* **Студент:** *Квасницкий Александр Александрович* +* **Stage:** *0* +--- \ No newline at end of file diff --git a/stages/St-01/src/Program.cs b/stages/St-01/src/Program.cs new file mode 100644 index 0000000..5447b71 --- /dev/null +++ b/stages/St-01/src/Program.cs @@ -0,0 +1,210 @@ +using HelpMethods; +using System; + +namespace Test +{ + internal class Program + { + static Random rand = new Random(); + static void Main(string[] args) + { + // System's varibles + short + hp = 60, + number = 25, + attack2Damage = 20, + retreatCost = 1; + + double + height = 0.4, + weight = 6.0; + + // User's varibles + string + stage, + name, + category, + attack1Name, + attack1Desc, + attack2Name, + attack2Desc, + weakness, + resistance; + + SetValues(out stage, + out name, + out category, + out attack1Name, + out attack1Desc, + out attack2Name, + out attack2Desc, + out weakness, + out resistance); + + ShowCard(hp, + number, + attack2Damage, + retreatCost, + height, + weight, + stage, + name, + category, + attack1Name, + attack1Desc, + attack2Name, + attack2Desc, + weakness, + resistance); + } + + static void ShowCard(short hp, + short number, + short attack2Damage, + short retreatCost, + double height, + double weight, + string stage, + string name, + string category, + string attack1Name, + string attack1Desc, + string attack2Name, + string attack2Desc, + string weakness, + string resistance) + { + // Seporation line + const string + SEP_1 = "======================================================================\n", + SEP_2 = "\n----------------------------------------------------------------------\n"; + + + // Constants + const byte + GLOBAL_MAX_LENGTH = 70, + MAX_LENGTH_FOR_DESC = 62, + RESERVED_CHAR_NUMBER_FOR_HEAD = 11, + RESERVED_CHAR_NUMBER_FOR_DESC = 8, + RESERVED_CHAR_NUMBER_FOR_DESC_PART_2 = 17; + + const sbyte FORMATED_MARGINE = -14; + + + // Calculation of free space + short + sumCharForHead = (short)(stage.Length + name.Length + hp.ToString().Length + RESERVED_CHAR_NUMBER_FOR_HEAD), + sumCharForDescPart_2 = (short)(RESERVED_CHAR_NUMBER_FOR_DESC_PART_2 + attack2Name.Length + attack2Damage.ToString().Length); + + + // Creating a large gap + string margine1 = String.Empty; + for (byte _char = 0; _char < GLOBAL_MAX_LENGTH - sumCharForHead; _char++) + margine1 += ' '; + + string margine2 = String.Empty; + for (byte _char = 0; _char < GLOBAL_MAX_LENGTH - sumCharForDescPart_2; _char++) + margine2 += ' '; + + + // Formate: Attack & Description + string + margine3 = " ", + desc1_Part1 = attack1Desc, + desc1_Part2 = String.Empty, + desc2_Part1 = attack2Desc, + desc2_Part2 = String.Empty; + + if(attack1Desc.Length > MAX_LENGTH_FOR_DESC) + { + desc1_Part1 = String.Empty; + + for (byte i = 0; i < MAX_LENGTH_FOR_DESC; i++) + desc1_Part1 += attack1Desc[i]; + + for(byte i = MAX_LENGTH_FOR_DESC; i < attack1Desc.Length; i++) + desc1_Part2 += attack1Desc[i]; + } + + if (attack2Desc.Length > MAX_LENGTH_FOR_DESC) + { + desc2_Part1 = String.Empty; + + for (byte i = 0; i < MAX_LENGTH_FOR_DESC; i++) + desc2_Part1 += attack2Desc[i]; + + for (byte i = MAX_LENGTH_FOR_DESC; i < attack2Desc.Length; i++) + desc2_Part2 += attack2Desc[i]; + } + + + // Print card + Console.Write(SEP_1 + $"[{stage}] {name}{margine1}HP: {hp} [⚡]"); + Console.Write(SEP_2 + $"№ {number} | Вид: {category} | Рост: {height} м | Вес: {weight} кг"); + Console.Write(SEP_2 + $"[Атака 1] {attack1Name}\n"); + Console.Write($"Эффект: {desc1_Part1}\n{margine3}{desc1_Part2}\n\n"); + Console.Write($"[Атака 2] {attack2Name}{margine2}Урон: {attack2Damage}+\n"); + Console.Write($"Эффект: {desc2_Part1}\n{margine3}{desc2_Part2}"); + Console.Write(SEP_2 + $"{"Слабость:",FORMATED_MARGINE}{weakness}\n{"Устойчивость:",FORMATED_MARGINE}{resistance}\n{"Отступление:",FORMATED_MARGINE}{retreatCost}\n" + SEP_1); + } + + static void SetValues(out string stage, + out string name, + out string category, + out string attack1Name, + out string attack1Desc, + out string attack2Name, + out string attack2Desc, + out string weakness, + out string resistance) + { + Console.Write("Enter the stage.\t[ not more than 7 chars ]\nStage: "); + stage = StringHelp.CutString(Console.ReadLine(), 7).Trim(); + if (stage == String.Empty) + stage = "Default"; + + Console.Write("Enter the name.\t[ not more than 10 chars ]\nName: "); + name = StringHelp.CutString(Console.ReadLine(), 10).Trim(); + if (name == String.Empty) + name = "Unknown"; + + Console.Write("Enter the category.\t[ not more than 10 chars ]\nCategory: "); + category = StringHelp.CutString(Console.ReadLine(), 10).Trim(); + if (category == String.Empty) + category = "Unknown"; + + Console.Write("Enter the name for first attack.\t[ not more than 35 chars ]\nAttack name: "); + attack1Name = StringHelp.CutString(Console.ReadLine(), 35).Trim(); + if (attack1Name == String.Empty) + attack1Name = "Unknown"; + + Console.Write("Enter the description for first attack.\t[ not more than 124 chars ]\nDescription: "); + attack1Desc = StringHelp.CutString(Console.ReadLine(), 124).Trim(); + if (attack1Desc == String.Empty) + attack1Desc = "Unknown"; + + Console.Write("Enter the name for second attack.\t[ not more than 35 chars ]\nAttack name: "); + attack2Name = StringHelp.CutString(Console.ReadLine(), 35).Trim(); + if (attack2Name == String.Empty) + attack2Name = "Unknown"; + + Console.Write("Enter the description for second attack.\t[ not more than 124 chars ]\nDescription: "); + attack2Desc = StringHelp.CutString(Console.ReadLine(), 124).Trim(); + if (attack2Desc == String.Empty) + attack2Desc = "Unknown"; + + Console.Write("Enter the weakness.\t[ not more than 20 chars ]\nWeakness: "); + weakness = StringHelp.CutString(Console.ReadLine(), 20).Trim(); + if (weakness == String.Empty) + weakness = "Default"; + + Console.Write("Enter the resistance.\t[ not more than 20 chars ]\nResistance: "); + resistance = StringHelp.CutString(Console.ReadLine(), 20).Trim(); + if (resistance == String.Empty) + resistance = "Default"; + + StringHelp.Br(); + SystemHelp.Waiting(true); + } + } +} \ No newline at end of file diff --git a/stages/St-01/src/Test.csproj b/stages/St-01/src/Test.csproj new file mode 100644 index 0000000..81f2966 --- /dev/null +++ b/stages/St-01/src/Test.csproj @@ -0,0 +1,58 @@ + + + + + Debug + AnyCPU + {0580ACC5-9C57-48B6-A97B-75103119F024} + Exe + Test + Test + v4.8 + latest + 512 + true + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + False + .\MyDll.dll + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/stages/St-01/src/lib/MyDll.dll b/stages/St-01/src/lib/MyDll.dll new file mode 100644 index 0000000..26eb050 Binary files /dev/null and b/stages/St-01/src/lib/MyDll.dll differ diff --git a/stages/St-02/Readme.md b/stages/St-02/Readme.md new file mode 100644 index 0000000..cbd9b1e --- /dev/null +++ b/stages/St-02/Readme.md @@ -0,0 +1,5 @@ +# Stage №1 + +* **Студент:** *Квасницкий Александр Александрович* +* **Stage:** *0* +--- \ No newline at end of file diff --git a/stages/St-03/Readme.md b/stages/St-03/Readme.md new file mode 100644 index 0000000..cbd9b1e --- /dev/null +++ b/stages/St-03/Readme.md @@ -0,0 +1,5 @@ +# Stage №1 + +* **Студент:** *Квасницкий Александр Александрович* +* **Stage:** *0* +--- \ No newline at end of file diff --git a/stages/St-04/Readme.md b/stages/St-04/Readme.md new file mode 100644 index 0000000..cbd9b1e --- /dev/null +++ b/stages/St-04/Readme.md @@ -0,0 +1,5 @@ +# Stage №1 + +* **Студент:** *Квасницкий Александр Александрович* +* **Stage:** *0* +--- \ No newline at end of file diff --git a/stages/St-05/Readme.md b/stages/St-05/Readme.md new file mode 100644 index 0000000..cbd9b1e --- /dev/null +++ b/stages/St-05/Readme.md @@ -0,0 +1,5 @@ +# Stage №1 + +* **Студент:** *Квасницкий Александр Александрович* +* **Stage:** *0* +--- \ No newline at end of file