-
Notifications
You must be signed in to change notification settings - Fork 17
Ilja Maksakov RPG #80
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
Acerlaorion
wants to merge
10
commits into
ISUCT:Ilja_Maksakov
Choose a base branch
from
Acerlaorion:Ilja_Maksakov
base: Ilja_Maksakov
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
10 commits
Select commit
Hold shift + click to select a range
608d1ae
RPG
Acerlaorion 5f2f1a3
Merge branch 'Ilja_Maksakov' of https://github.com/Acerlaorion/Tprogr…
Acerlaorion dceb146
Site
Acerlaorion 77d0e55
Исправил ввод, сделал скилы листом, атаку сделал скилом, добавил счет…
Acerlaorion b8e2602
Merge branch 'Ilja_Maksakov' of https://github.com/Acerlaorion/Tprogr…
Acerlaorion cd690a2
bugfix
Acerlaorion 72d3de6
Fix
Acerlaorion 5a1111b
Fix
Acerlaorion 4c982e1
Опечатка
Acerlaorion 8e2630e
.
Acerlaorion 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,21 @@ | ||
| using System; | ||
| using System.Collections.Generic; | ||
| using System.Text; | ||
|
|
||
| namespace RPG | ||
| { | ||
| public class Archer : Player | ||
| { | ||
| public Archer() | ||
| : this("Незадано") | ||
| { | ||
| } | ||
| public Archer(string name) | ||
| : base(name) | ||
| { | ||
| Skills.Add(new ArcherSkill()); | ||
| Class = "Archer"; | ||
| } | ||
|
|
||
| } | ||
| } |
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,25 @@ | ||
| using System; | ||
| using System.Collections.Generic; | ||
| using System.Text; | ||
|
|
||
| namespace RPG | ||
| { | ||
| public class ArcherSkill : IUseSkill | ||
| { | ||
| public int TimesUsedSkill = 0; | ||
| public void UseSkill(Player user) | ||
| { | ||
| if (TimesUsedSkill < 1) | ||
| { | ||
| user.Opponent.Effects.Add(new FireArrow()); | ||
| Logger.LogText($"({user.Class}) {user.Name} использует (Огненные стрелы) на ({user.Opponent.Class}) {user.Opponent.Name}."); | ||
| TimesUsedSkill++; | ||
| } | ||
| else | ||
| { | ||
| user.Usingskill = new Attack(); | ||
| user.UseSkill(); | ||
| } | ||
| } | ||
| } | ||
| } |
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,15 @@ | ||
| using System; | ||
| using System.Collections.Generic; | ||
| using System.Text; | ||
|
|
||
| namespace RPG | ||
| { | ||
| public class Attack : IUseSkill | ||
| { | ||
| public void UseSkill(Player user) | ||
| { | ||
| user.Opponent.HP -= user.Strength; | ||
| Logger.LogText($"({user.Class}) {user.Name} наносит урон {user.Strength} противнику ({user.Opponent.Class}) {user.Opponent.Name}."); | ||
| } | ||
| } | ||
| } | ||
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,74 @@ | ||
| using System; | ||
| using System.Collections.Generic; | ||
| using System.Text; | ||
|
|
||
| namespace RPG | ||
| { | ||
| public static class ClassBattle | ||
| { | ||
| public static Player Battle(Player w) | ||
| { | ||
| Random rnd = new Random(); | ||
| while (w.HP > 0 && w.Opponent.HP > 0) | ||
| { | ||
| int RandomSkill1 = rnd.Next(0, w.Skills.Count); | ||
| int RandomSkill2 = rnd.Next(0, w.Opponent.Skills.Count); | ||
| w.ProcEffects(); | ||
| if (w.isStunned == false) | ||
| { | ||
| w.Usingskill = w.Skills[RandomSkill1]; | ||
| w.UseSkill(); | ||
| } | ||
| else | ||
| { | ||
| w.isStunned = false; | ||
| for (int i = 0; i < w.Effects.Count; i++) | ||
| { | ||
| if (w.Effects[i] is Skip) | ||
| { | ||
| w.Effects.RemoveAt(i); | ||
| i--; | ||
| } | ||
| } | ||
| } | ||
| w.Opponent.ProcEffects(); | ||
| if (w.Opponent.HP > 0) | ||
| { | ||
| if (w.Opponent.isStunned == false) | ||
| { | ||
| w.Opponent.Usingskill = w.Opponent.Skills[RandomSkill2]; | ||
| w.Opponent.UseSkill(); | ||
| } | ||
| else | ||
| { | ||
| w.Opponent.isStunned = false; | ||
| for (int i = 0; i < w.Effects.Count; i++) | ||
| { | ||
| if (w.Opponent.Effects[i] is Skip) | ||
| { | ||
| w.Opponent.Effects.RemoveAt(i); | ||
| i--; | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| if (w.HP < 1) | ||
| { | ||
| Logger.LogText($"({w.Class}) {w.Name} погиб!\n"); | ||
| w.Opponent.HP = rnd.Next(1, 100); | ||
| w.Opponent.Effects.Clear(); | ||
| return w; | ||
| } | ||
| else if (w.Opponent.HP < 1) | ||
| { | ||
| Logger.LogText($"({w.Opponent.Class}) {w.Opponent.Name} погиб!\n"); | ||
| w.HP = rnd.Next(1, 100); | ||
| w.Effects.Clear(); | ||
| return w.Opponent; | ||
| } | ||
| throw new Exception("Fatal error"); | ||
|
|
||
| } | ||
| } | ||
| } |
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,16 @@ | ||
| using System; | ||
| using System.Collections.Generic; | ||
| using System.Text; | ||
|
|
||
| namespace RPG | ||
| { | ||
| public class FireArrow : IEffect | ||
| { | ||
| public const int DamageFireArrow = 2; | ||
| public void Proc(Player owner) | ||
| { | ||
| owner.HP -= DamageFireArrow; | ||
| Logger.LogText($"({owner.Class}) {owner.Name} получает урон {DamageFireArrow} от эффекта Fire Arrow."); | ||
| } | ||
| } | ||
| } |
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,73 @@ | ||
| using System; | ||
| using System.Collections.Generic; | ||
| namespace RPG | ||
| { | ||
| class Game | ||
| { | ||
| static void Main(string[] args) | ||
| { | ||
| string[] names = { "WhiteCat", "Vaxei", "Alumetri", "idke", "Micca", "FlyingTuna", "Karthy", "RyuK", "Varvalian", | ||
| "Mathi", "FGSky", "fieryrage", "firebat92", "chocomint", "Abyssal", "Aireu"}; | ||
| int n = 0; | ||
| try | ||
| { | ||
| Console.Write($"Введите кол-во игроков(1-16):"); | ||
| string nString = Console.ReadLine(); | ||
| n = Convert.ToInt32(nString); | ||
| } | ||
| catch (System.FormatException) | ||
| { | ||
| Console.Write($"Введите кол-во игроков(1-16):"); | ||
| string nString = Console.ReadLine(); | ||
| n = Convert.ToInt32(nString); | ||
| } | ||
| while (n % 2 != 0 || n <= 0) | ||
| { | ||
| Console.Write($"Введите кол-во игроков(1-16):"); | ||
| n = Convert.ToInt32(Console.ReadLine()); | ||
| } | ||
| Random rnd = new Random(); | ||
| List<Player> players = new List<Player>(); | ||
| List<Player> winners = new List<Player>(); | ||
| int k = 0; | ||
| int kon = 1; | ||
| while (players.Count < n) | ||
| { | ||
| int c1 = rnd.Next(0, 3); | ||
| switch (c1) | ||
| { | ||
| case 0: | ||
| players.Add(new Knight(names[k])); | ||
| break; | ||
| case 1: | ||
| players.Add(new Archer(names[k])); | ||
| break; | ||
| case 2: | ||
| players.Add(new Mage(names[k])); | ||
| break; | ||
| } | ||
| k++; | ||
| } | ||
| Logger.LogText($"{kon++}-й Кон\n"); | ||
| while (players.Count + winners.Count > 1) | ||
| { | ||
| if (players.Count >=2) | ||
| { | ||
| Player tempPlayer = ClassBattle.Battle(players[PickPlayers.PickOp(players)]); | ||
| winners.Add(tempPlayer.Opponent); | ||
| players.Remove(tempPlayer.Opponent); | ||
| players[players.IndexOf(tempPlayer)].Opponent.Opponent = null; | ||
| players.Remove(tempPlayer); | ||
| } | ||
| else | ||
| { | ||
| Logger.LogText($"{kon}-й Кон\n"); | ||
| players.AddRange(winners); | ||
| winners.Clear(); | ||
| kon++; | ||
| } | ||
| } | ||
| Logger.LogText($"({winners[0].Class}) {winners[0].Name} WINNER!!!"); | ||
| } | ||
| } | ||
| } |
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,11 @@ | ||
| using System; | ||
| using System.Collections.Generic; | ||
| using System.Text; | ||
|
|
||
| namespace RPG | ||
| { | ||
| public interface IEffect | ||
| { | ||
| void Proc(Player owner); | ||
| } | ||
| } |
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,11 @@ | ||
| using System; | ||
| using System.Collections.Generic; | ||
| using System.Text; | ||
|
|
||
| namespace RPG | ||
| { | ||
| public interface IUseSkill | ||
| { | ||
| void UseSkill(Player user); | ||
| } | ||
| } |
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,21 @@ | ||
| using System; | ||
| using System.Collections.Generic; | ||
| using System.Text; | ||
|
|
||
| namespace RPG | ||
| { | ||
| public class Knight : Player | ||
| { | ||
| public Knight() | ||
| : this("Незадано") | ||
| { | ||
| } | ||
| public Knight(string name) | ||
| :base(name) | ||
| { | ||
| Skills.Add(new KnightSkill()); | ||
| Class = "Knight"; | ||
| } | ||
|
|
||
| } | ||
| } |
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,15 @@ | ||
| using System; | ||
| using System.Collections.Generic; | ||
| using System.Text; | ||
|
|
||
| namespace RPG | ||
| { | ||
| public class KnightSkill : IUseSkill | ||
| { | ||
| public void UseSkill(Player user) | ||
| { | ||
| user.Opponent.HP -= user.Strength * 1.3; | ||
| Logger.LogText($"({user.Class}) {user.Name} использует (Удар возмездия) и наносит урон {user.Strength * 1.3} противнику ({user.Opponent.Class}){user.Opponent.Name}."); | ||
| } | ||
| } | ||
| } |
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,18 @@ | ||
| using System; | ||
| using System.Collections.Generic; | ||
| using System.Text; | ||
|
|
||
| namespace RPG | ||
| { | ||
| public static class Logger | ||
| { | ||
| public static void LogVS(Player player1) | ||
| { | ||
| Console.WriteLine($"{player1.Class} {player1.Name} vs {player1.Opponent.Class} {player1.Opponent.Name}."); | ||
| } | ||
| public static void LogText(string message) | ||
| { | ||
| Console.WriteLine(message); | ||
| } | ||
| } | ||
| } |
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,21 @@ | ||
| using System; | ||
| using System.Collections.Generic; | ||
| using System.Text; | ||
|
|
||
| namespace RPG | ||
| { | ||
| public class Mage : Player | ||
| { | ||
| public Mage() | ||
| : this("Незадано") | ||
| { | ||
| } | ||
| public Mage(string name) | ||
| : base(name) | ||
| { | ||
| Class = "Mage"; | ||
| Skills.Add(new MageSkill()); | ||
| } | ||
|
|
||
| } | ||
| } |
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,17 @@ | ||
| using System; | ||
| using System.Collections.Generic; | ||
| using System.Text; | ||
| using System.Linq; | ||
|
|
||
| namespace RPG | ||
| { | ||
| public class MageSkill : IUseSkill | ||
| { | ||
| public void UseSkill(Player user) | ||
| { | ||
| user.Opponent.Effects.Add(new Skip()); | ||
| Logger.LogText($"({user.Class}) {user.Name} использует (Заворожение) на ({user.Opponent.Class}) {user.Opponent.Name}."); | ||
|
|
||
| } | ||
| } | ||
| } |
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,23 @@ | ||
| using System; | ||
| using System.Collections.Generic; | ||
| using System.Text; | ||
|
|
||
| namespace RPG | ||
| { | ||
| public class PickPlayers | ||
| { | ||
| public static int PickOp(List<Player> players) | ||
| { | ||
| Random rnd = new Random(); | ||
| int randomplayer1 = rnd.Next(0, players.Count); | ||
| int randomplayer2 = rnd.Next(0, players.Count); | ||
| while(randomplayer1 == randomplayer2) | ||
| { | ||
| randomplayer2 = rnd.Next(0, players.Count); | ||
| } | ||
| players[randomplayer1].Opponent = players[randomplayer2]; | ||
| players[randomplayer2].Opponent = players[randomplayer1]; | ||
| return randomplayer1; | ||
| } | ||
| } | ||
| } |
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.