-
Notifications
You must be signed in to change notification settings - Fork 24
Shkarpitskij aleksandr nikolaevich #14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Sasha1602
wants to merge
12
commits into
ISUCT:Shkarpitskij_Aleksandr_Nikolaevich
Choose a base branch
from
Sasha1602:Shkarpitskij_Aleksandr_Nikolaevich
base: Shkarpitskij_Aleksandr_Nikolaevich
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
91356be
Шкарпицкий Александр 2/42
Sasha1602 980402b
исправленное
Sasha1602 63acd9c
переделанная работа с классами Шкарпицкий 2/42
Sasha1602 c9af1df
тесты Шкарпицкий 2/42
Sasha1602 2d08eaf
изменения
Sasha1602 fd243f7
Дополнение к первому заданию
Sasha1602 0309e0f
стайлкоп True
Sasha1602 88718f8
/
Sasha1602 c651f9a
.
Sasha1602 73befb6
.
Sasha1602 e430566
Merge remote-tracking branch 'origin/Shkarpitskij_Aleksandr_Nikolaevi…
Sasha1602 ed46441
RPG Saga
Sasha1602 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,134 @@ | ||
| namespace CourseApp.Tests | ||
| { | ||
| using Character; | ||
| using Xunit; | ||
|
|
||
| public class CharacterTest | ||
| { | ||
| [Fact] | ||
|
|
||
| public void TestGur() | ||
Sasha1602 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| { | ||
| var guard = new Guardian("Leo", "zweihender", 95); | ||
| Assert.Equal("zweihender", guard.TypeOfWeapon); | ||
| Assert.Equal(95, guard.Lvl); | ||
| } | ||
|
|
||
| [Fact] | ||
|
|
||
Sasha1602 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| public void TestMag() | ||
| { | ||
| var magian = new TheMagian("Rise", "CristalStaff", 85); | ||
| Assert.Equal("Rise", magian.Name); | ||
| Assert.Equal("CristalStaff", magian.TypeOfWeapon); | ||
| Assert.Equal(85, magian.Lvl); | ||
| } | ||
|
|
||
| [Fact] | ||
|
|
||
| public void TestArcher() | ||
| { | ||
| var archer = new Archer("Azir", "Black Onion", 79); | ||
| Assert.Equal("Azir", archer.Name); | ||
| Assert.Equal("Black Onion", archer.TypeOfWeapon); | ||
| Assert.Equal(79, archer.Lvl); | ||
| } | ||
|
|
||
| [Fact] | ||
|
|
||
| public void TestArcherGetInfo() | ||
| { | ||
| var arch = new Archer("Azir", "Black Onion", 79); | ||
| var res = arch.GetInfo(); | ||
| Assert.Equal("Я заступил на службу в 12:00 ", res); | ||
| Character archer = arch; // ссылка типа базового класса на дочерний | ||
| Assert.Equal(res, archer.GetInfo()); | ||
| } | ||
|
|
||
| [Fact] | ||
|
|
||
| public void TestGuardianGetInfo() | ||
| { | ||
| var guar = new Guardian("Leo", "zweihender", 95); | ||
| var rs = guar.GetInfo(); | ||
| Assert.Equal("Я работаю в элитных войсках короля Людовика 2 ", rs); | ||
| Character guard = guar; | ||
| Assert.Equal(rs, guard.GetInfo()); | ||
| } | ||
|
|
||
| [Fact] | ||
|
|
||
| public void TestTheMagianGetInfo() | ||
| { | ||
| var mag = new TheMagian("Rise", "CristalStaff", 85); | ||
| var result = mag.GetInfo(); | ||
| Assert.Equal("Я служу для защиты нашего прекрасного замка ", result); | ||
| Character magian = mag; | ||
| Assert.Equal(result, magian.GetInfo()); | ||
| } | ||
|
|
||
| [Fact] | ||
| public void TestTheMagianToString() | ||
| { | ||
| var mag = new TheMagian("Rise", "CristalStaff", 85); | ||
| var result = mag.ToString(); | ||
| Assert.Equal("Какой же красивый замок", result); | ||
| Character magian = mag; | ||
| Assert.Equal(result, magian.ToString()); | ||
| } | ||
|
|
||
| [Fact] | ||
|
|
||
| public void TestArcherToString() | ||
| { | ||
| var ar = new Archer("Azir", "Black Onion", 79); | ||
| var resul = ar.ToString(); | ||
| Assert.Equal("Ура у меня всё хорошо!", resul); | ||
| Character arc = ar; | ||
| Assert.Equal(resul, arc.ToString()); | ||
| } | ||
|
|
||
| [Fact] | ||
|
|
||
| public void TestGuardianToString() | ||
| { | ||
| var gurd = new Guardian("Leo", "zweihender", 95); | ||
| var resul = gurd.ToString(); | ||
| Assert.Equal("Как хорошо, что меня ещё не уволили)", resul); | ||
| Character gur = gurd; | ||
| Assert.Equal(resul, gur.ToString()); | ||
| } | ||
|
|
||
| [Fact] | ||
|
|
||
| public void TestGuardianGuild() | ||
| { | ||
| var guard = new Guardian("Leo", "zweihender", 95); | ||
| var result = guard.Guild(); | ||
| Assert.Equal("я состою в гильдии Пылающий Вепрь", result); | ||
| Character gur = guard; | ||
| Assert.Equal(result, gur.Guild()); | ||
| } | ||
|
|
||
| [Fact] | ||
|
|
||
| public void TestArcherGuild() | ||
| { | ||
| var archer = new Archer("Azir", "Black Onion", 79); | ||
| var resul = archer.Guild(); | ||
| Assert.Equal("я состою в гильдии Милость Дриады", resul); | ||
| Character arc = archer; | ||
| Assert.Equal(resul, arc.Guild()); | ||
| } | ||
|
|
||
| [Fact] | ||
| public void TestTheMagianGuild() | ||
| { | ||
| var mag = new TheMagian("Rise", "CristalStaff", 85); | ||
| var result = mag.Guild(); | ||
| Assert.Equal("я состою в гильдии Банши", result); | ||
| Character magian = mag; | ||
| Assert.Equal(result, magian.Guild()); | ||
| } | ||
| } | ||
| } | ||
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| namespace Character; | ||
|
|
||
| using System; | ||
|
|
||
| public class Archer : Character | ||
| { | ||
| private static string bw = "Bow of the erd tree"; | ||
|
|
||
| public Archer(string name, string typeOfWeapon, int lvl) | ||
| : base(name, typeOfWeapon, lvl) | ||
| { | ||
| } | ||
|
|
||
| public static void Bow(string bow) | ||
Sasha1602 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| { | ||
| if (bow == bw) | ||
| { | ||
| Ability(100); | ||
| } | ||
| else | ||
| { | ||
| Ability(80); | ||
| } | ||
| } | ||
|
|
||
| public static void Ability(int arrows) | ||
Sasha1602 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| { | ||
| if (arrows < 90) | ||
| { | ||
| Console.WriteLine("Azir тебе разрешено защищать только стены города"); | ||
| Console.WriteLine(); | ||
| } | ||
| else | ||
| { | ||
| Console.WriteLine("Azir тебе разрешено защищать саму принцессу"); | ||
| Console.WriteLine(); | ||
| } | ||
| } | ||
|
|
||
| public override string Guild() | ||
| { | ||
| return "я состою в гильдии Милость Дриады"; | ||
| } | ||
|
|
||
| public override string GetInfo() | ||
| { | ||
| return $"Я заступил на службу в 12:00 "; | ||
| } | ||
|
|
||
| public override string ToString() | ||
| { | ||
| return "Ура у меня всё хорошо!"; | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| namespace Character; | ||
|
|
||
| using System; | ||
|
|
||
| public abstract class Character | ||
| { | ||
| private int level; | ||
|
|
||
| public Character(string name, string typeOfWeapon, int lvl) | ||
| { | ||
| this.Name = name; | ||
| this.TypeOfWeapon = typeOfWeapon; | ||
| this.Lvl = lvl; | ||
| } | ||
|
|
||
| public int Lvl | ||
| { | ||
| get | ||
| { | ||
| return level; | ||
| } | ||
|
|
||
| set | ||
| { | ||
| if (level < value) | ||
| { | ||
| level = value; | ||
| } | ||
| } | ||
| } | ||
|
|
||
| public string TypeOfWeapon { get; set; } | ||
|
|
||
| public string Name { get; set; } | ||
|
|
||
| public void Print() | ||
| { | ||
| Console.Write($"{Name} {Lvl} {TypeOfWeapon}"); | ||
| } | ||
|
|
||
| public virtual string Guild() | ||
| { | ||
| return "1535"; | ||
| } | ||
Sasha1602 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| /*public void MaxLevel() | ||
| { | ||
| Console.WriteLine($"Ваш уровень {Lvl} /99"); | ||
| } | ||
|
|
||
| public void Damag() | ||
| { | ||
| Console.WriteLine($"Вам выпало легендарный оружие {TypeOfWeapon}"); | ||
| }*/ | ||
Sasha1602 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| public virtual string GetInfo() | ||
Sasha1602 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| { | ||
| return "54891"; | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| namespace Character; | ||
|
|
||
| using System; | ||
|
|
||
| public class Guardian : Character | ||
| { | ||
| public Guardian(string name, string typeOfWeapon, int lvl) | ||
| : base(name, typeOfWeapon, lvl) | ||
| { | ||
| } | ||
|
|
||
| public void Protect(bool protect) | ||
| { | ||
| if (protect != true) | ||
| { | ||
| Console.WriteLine("Я не защищаю принцессу"); | ||
| Console.WriteLine(); | ||
| } | ||
| else | ||
| { | ||
| Console.WriteLine("Я защищаю принцессу"); | ||
| Console.WriteLine(); | ||
| } | ||
| } | ||
|
|
||
| public override string Guild() | ||
| { | ||
| return "я состою в гильдии Пылающий Вепрь"; | ||
| } | ||
|
|
||
| public override string GetInfo() | ||
| { | ||
| return $"Я работаю в элитных войсках короля Людовика 2 "; | ||
| } | ||
|
|
||
| public override string ToString() | ||
| { | ||
| return "Как хорошо, что меня ещё не уволили)"; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| namespace Character; | ||
|
|
||
| using System; | ||
|
|
||
| public class TheMagian : Character | ||
| { | ||
| public TheMagian(string name, string typeOfWeapon, int lvl) | ||
| : base(name, typeOfWeapon, lvl) | ||
| { | ||
| } | ||
|
|
||
| public void Opponent(int grupOfOpponent) | ||
| { | ||
| if (grupOfOpponent < 40) | ||
| { | ||
| Console.WriteLine($"Им не нужна моя помощь"); | ||
| Console.WriteLine(); | ||
| } | ||
| else | ||
| { | ||
| Console.WriteLine($"Им нужна моя помощь"); | ||
| Console.WriteLine(); | ||
| } | ||
| } | ||
|
|
||
| public override string Guild() | ||
| { | ||
| return "я состою в гильдии Банши"; | ||
| } | ||
|
|
||
| public override string GetInfo() | ||
| { | ||
| return $"Я служу для защиты нашего прекрасного замка "; | ||
| } | ||
|
|
||
| public override string ToString() | ||
| { | ||
| return "Какой же красивый замок"; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.