-
Notifications
You must be signed in to change notification settings - Fork 9
/
Character.cs
73 lines (59 loc) · 1.78 KB
/
Character.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
using System;
using System.Collections.Generic;
namespace CombatTracker
{
public enum Conditions
{
Blinded,
Charmed,
Deafened,
Frightened,
Grappled,
Incapacitated,
Invisible,
Paralyzed,
Petrified,
Poisoned,
Prone,
Restrained,
Stunned,
Unconscious
}
public class Character : IComparable<Character>
{
public string Name { get; set; }
public short Initiative { get; set; }
public short? MaxHP { get; set; }
public short? HP { get; set; }
public short? TempHP { get; set; }
public short DeathSaves_Fail { get; set; }
public short DeathSaves_Success { get; set; }
public List<Conditions> Conditions { get; set; }
public bool ReactionUsed { get; set; }
public Character(string name, short initiative, short? maxHP, short? HP, short? tempHP, short fail, short success, List<Conditions> conditions, bool reacionUsed)
{
Name = name;
Initiative = initiative;
MaxHP = maxHP;
this.HP = HP;
TempHP = tempHP;
DeathSaves_Fail = fail;
DeathSaves_Success = success;
Conditions = conditions;
ReactionUsed = reacionUsed;
}
public override string ToString()
{
//Determine if the HP part should be shown or not:
if (HP.HasValue)
{
return $"({Initiative})\t{Name}\tHP:{HP}";
}
return $"({Initiative})\t{Name}";
}
public int CompareTo(Character other)
{
return this.Initiative < other.Initiative ? -1 : (this.Initiative == other.Initiative) ? 0 : 1;
}
}
}