-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathSkill.cs
More file actions
54 lines (51 loc) · 1.53 KB
/
Copy pathSkill.cs
File metadata and controls
54 lines (51 loc) · 1.53 KB
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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace TTRPG_manager
{
public class Skill : ICloneable, INameable
{
private string _name;
public string Name
{
get => _name;
set
{
_name = value;
safeName = MakeSafeName(_name);
}
}
public string safeName { get; set; }
private string MakeSafeName(string name)
{
if (string.IsNullOrEmpty(name))
return string.Empty;
// Remove all non-alphanumeric characters
return System.Text.RegularExpressions.Regex.Replace(name, "[^a-zA-Z0-9]", "");
}
public string Description { get; set; }
public string DamageType { get; set; }
public int DamageAmount { get; set; }
public int Cooldown { get; set; }
public int BaseCooldown { get; set; }
public int MPCost { get; set; }
public int HPCost { get; set; }
public int SkillLevel { get; set; }
public int RemainingUses { get; set; }
public int MaxUses { get; set; }
public object Clone()
{
return this.MemberwiseClone();
}
public void UpSP(int amount)
{
this.Cooldown = Math.Min(this.BaseCooldown, this.Cooldown + amount);
}
public void DownSP(int amount)
{
this.Cooldown = Math.Max(0, this.Cooldown - amount);
}
}
}