40 lines
1.2 KiB
C#
Raw Permalink Normal View History

2022-10-15 18:39:27 +02:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Programmation_objet_TLESIO21.projet {
public class Character {
private string Name;
private string Description;
private int level;
private List<Pokemon> PC;
#pragma warning disable CS8618 // Un champ non-nullable doit contenir une valeur non-null lors de la fermeture du constructeur. Envisagez de déclarer le champ comme nullable.
public Character(string Name, string Description, List<Pokemon> PC) {
this.Name = Name;
this.Description = Description;
this.PC = PC;
this.level = PC.Count;
}
public override string ToString() {
2022-10-16 11:14:06 +02:00
String sb = this.Name + " est level " + this.level + ". " + this.Description.Replace(". ", ".\n") + ".\nSes pokemon sont :\n";
2022-10-15 18:39:27 +02:00
foreach (Pokemon p in this.PC) {
sb += p.getName() + ". ";
}
return sb + "\n";
}
public String getName() {
return this.Name;
}
public List<Pokemon> getPC() {
return this.PC;
}
}
}