Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions .github/workflows/dotnetcore.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
name: .NET Core

on: [push, pull_request]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1
strategy:
matrix:
dotnet: [ '2.1', '3.1.x', '6.0.x' ]
steps:\
- uses: actions/checkout@v2
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 2.1.802
dotnet-version: ${{ matrix.dotnet-version }}
include-prerelease: true
- name: Build with dotnet
run: |
cd CourseApp
dotnet build --configuration Release
- name: Run tests
run: |
cd CourseApp.Tests
dotnet test
dotnet test
2 changes: 1 addition & 1 deletion CourseApp.Tests/CourseApp.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
<TargetFramework>netcoreapp6</TargetFramework>
<TreatWarningsAsErrors>True</TreatWarningsAsErrors>
<IsPackable>false</IsPackable>
</PropertyGroup>
Expand Down
13 changes: 0 additions & 13 deletions CourseApp.Tests/DemoTest.cs

This file was deleted.

4 changes: 2 additions & 2 deletions CourseApp/.vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/bin/Debug/netcoreapp2.1/CourseApp.dll",
"program": "${workspaceFolder}/bin/Debug/netcoreapp6.0/CourseApp.dll",
"args": [],
"cwd": "${workspaceFolder}",
"console": "internalConsole",
"console": "externalTerminal",
"stopAtEntry": false
},
{
Expand Down
2 changes: 1 addition & 1 deletion CourseApp/CourseApp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.1</TargetFramework>
<TargetFramework>netcoreapp6.0</TargetFramework>
<TreatWarningsAsErrors>True</TreatWarningsAsErrors>
</PropertyGroup>

Expand Down
11 changes: 11 additions & 0 deletions CourseApp/Interface/IPlayer.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
namespace CourseApp
{
public interface IPlayer
{
string Name { get; set; }

double Health { get; set; }

int Strength { get; set; }
}
}
9 changes: 7 additions & 2 deletions CourseApp/Program.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
namespace CourseApp
{
using System;
using System.Collections.Generic;

public class Program
{
public static void Main(string[] args)
{
Console.WriteLine($"Hello world");
int participants = 0;
Game start = new Game();
participants = start.StartTheTournament(participants);
Arena arena = new Arena();
arena.Tour(participants);
Console.ReadLine();
}
}
}
}
26 changes: 26 additions & 0 deletions CourseApp/RPGSaga/Archer.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
namespace CourseApp
{
using System;

public class Archer : Player
{
public Archer(string name, double health, int strength)
: base(name, health, strength)
{
ClassPlayer = "Лучник";
UltimateName = "Ядовитая стрела";
}

public override int Ultimate(Player player, Player rival)
{
UltimateDamage = 2;
Logger.LoggerOutput($"{ClassPlayer} {Name} использовал особую способность {UltimateName}!");
return Strength += UltimateDamage;
}

public override string InfoOutput()
{
return $"Призвание: {ClassPlayer} ; Имя бойца: {Name} ; Здоровье бойца: {Health} ; Сила бойца {Strength}";
}
}
}
25 changes: 25 additions & 0 deletions CourseApp/RPGSaga/Knight.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
namespace CourseApp
{
using System;

public class Knight : Player
{
public Knight(string name, double health, int strength)
: base(name, health, strength)
{
ClassPlayer = "Рыцарь";
UltimateName = "Сокрушительный удар";
}

public override int Ultimate(Player player, Player rival)
{
Logger.LoggerOutput($"{ClassPlayer} {Name} использовал особую способность {UltimateName}!");
return Strength = (int)(Strength * 1.3);
}

public override string InfoOutput()
{
return $"Призвание: {ClassPlayer} ; Имя бойца: {Name} ; Здоровье бойца: {Health} ; Сила бойца {Strength}";
}
}
}
12 changes: 12 additions & 0 deletions CourseApp/RPGSaga/Logger.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
namespace CourseApp
{
using System;

public class Logger
{
public static void LoggerOutput(string logger)
{
Console.WriteLine(logger);
}
}
}
83 changes: 83 additions & 0 deletions CourseApp/RPGSaga/Player.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
namespace CourseApp
{
using System;

public abstract class Player : IPlayer
{
public Player(string name, double health, int strength)
{
Name = name;
Health = health;
Strength = strength;
Afk = 0;
Effect = false;
DefaultHealth = health;
}

public int Afk { get; set; }

public double DefaultHealth { get; set; }

public string Name { get; set; }

public string ClassPlayer { get; set; }

public bool Effect { get; set; }

public string UltimateName { get; set; }

public int UltimateDamage { get; set; }

public int DamageInfo { get; set; }

public double Health { get; set; }

public int Strength { get; set; }

public virtual int Ultimate(Player player, Player rival)
{
return 0;
}

public int AtTheAttackWarrior(Player warrior, Player warriorRival)
{
if (warrior.Effect)
{
warrior.Effect = false;
return DamageInfo = warrior.Ultimate(warrior, warriorRival);
}
else
{
return DamageInfo = Strength;
}
}

public int AtTheAttackWarriorRival(Player warrior, Player warriorRival)
{
if (warriorRival.Effect)
{
warriorRival.Effect = false;
return DamageInfo = warriorRival.Ultimate(warrior, warriorRival);
}
else
{
return DamageInfo = Strength;
}
}

public virtual string InfoOutput()
{
return $"Имя бойца: {Name} ; Здоровье бойца: {Health} ; Сила бойца: {Strength}";
}

public void GetDamage(int damage)
{
Health -= damage;
}

public void ResetHealth()
{
Health = DefaultHealth;
}
}
}
36 changes: 36 additions & 0 deletions CourseApp/RPGSaga/Wizard.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
namespace CourseApp
{
using System;

public class Wizard : Player
{
public Wizard(string name, double health, int strength)
: base(name, health, strength)
{
ClassPlayer = "Чародей";
UltimateName = "Каменный дождь";
}

public override int Ultimate(Player player, Player rival)
{
if (player.Effect)
{
player.Afk = 1;
rival.Afk = 2;
}
else if (rival.Effect)
{
player.Afk = 2;
rival.Afk = 1;
}

Logger.LoggerOutput($"{ClassPlayer} {Name} особую способность {UltimateName}!");
return 0;
}

public override string InfoOutput()
{
return $"Призвание: {ClassPlayer} ; Имя бойца: {Name} ; Здоровье бойца: {Health} ; Сила бойца {Strength}";
}
}
}
Loading