-
Notifications
You must be signed in to change notification settings - Fork 34
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
CodeWars, Dog class #16
base: Belov_Stepan_Maksimovich
Are you sure you want to change the base?
Conversation
CourseApp.Tests/GlobalUsings.cs
Outdated
@@ -0,0 +1,3 @@ | |||
#pragma warning disable SA1200 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
а это зачем?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Линтер указывает на ошибку в том, что using директивы расположены неправильно. Считает, что using должен располагаться после пространства имён. Я поправил, докинул в каждый класс с тестами "using Xuint" и удалил этот файл.
На будущее хотел бы спросить, есть ли какой-то более важный плюс у этого global, чем просто везде не указывать, одинаковые using'и?
public string Name | ||
{ | ||
get => _name; | ||
|
||
set => _name = value; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Если вы внутри не меняете поведение - то сделайте стандартно
public string Name | |
{ | |
get => _name; | |
set => _name = value; | |
} | |
public string Name {get; set; } |
CourseApp/DogClass/Dog.cs
Outdated
public int Age | ||
{ | ||
get => _age; | ||
|
||
set => _age = value; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
возраст я могу сделать отрицательным?
set => _flock = value; | ||
} | ||
|
||
public void PrintInfo() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
переопределите ToString
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
параметр flock? или метод PrintInfo?
} | ||
else | ||
{ | ||
enemy.Health -= Damage + 2; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
а вдруг у него иммунитет на данный вид атаки? почему вы вдруг у него без его ведома меняете здоровье?
set => _health = value; | ||
} | ||
|
||
#pragma warning disable SA1201 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
вот так себе идея отключать так предупреждения - если не нужны - отключите в конфигурации
_name = names[_rand.Next(0, 4)]; | ||
_health = _rand.Next(10, 100); | ||
_damage = _rand.Next(5, 30); | ||
_spellUsed = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
и как в этом случае тест написать?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Так герои то должны полностью без участия пользователя создаваться и палками друг в друга кидаться. Разве нет?
CourseApp/RpgSaga/Hero.cs
Outdated
while (person1._health > 0 || person2._health > 0) | ||
{ | ||
person2 = person1.Attack(person2); | ||
Thread.Sleep(1000); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
это зачем? не его это дело - можете паузу в самой игре добавлять
Dockerfile
Outdated
ENTRYPOINT ["dotnet", "CourseApp.dll"]~ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
что за ~
No description provided.