-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPersonnage.cs
56 lines (49 loc) · 1.6 KB
/
Personnage.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
//Nom du programme : PetitJeuDeRole
//Classe : Personnage
//Autheur : Proph
//Mise à jour le : 29/10/2020
using System;
using System.Collections.Generic;
using System.Text;
namespace PetitJeuDeRole
{
public abstract class Personnage : Entite
{
private int niveau;
private int experience;
public Personnage(string nom) : base(nom)
{
this.nom = nom;
niveau = 1;
experience = 0;
}
public void gagnerExperience(int experience)
{
this.experience += experience;
while (this.experience >= experienceRequise())
{
niveau += 1;
Console.ForegroundColor = ConsoleColor.Yellow;
Console.WriteLine("Bravo, vous avez atteint le niveau " + niveau + " !");
pointsDeVie += 10;
degatsMin += 2;
degatsMax += 2;
}
}
public double experienceRequise()
{
return Math.Round(4 * (Math.Pow(niveau, 3) / 5));
}
public string Caracteristiques()
{
return "==================" + "\n" +
this.nom + "\n" +
"------" + "\n" +
"Points de vie : " + pointsDeVie + "\n" +
"Niveau : " + niveau + "\n" +
"Points d'expérience : (" + experience + " / " + experienceRequise() + ")\n" +
"Dégâts : [" + degatsMin + " / " + degatsMax + "]" + "\n" +
"==================";
}
}
}