-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplayer.cs
69 lines (58 loc) · 1.89 KB
/
player.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
class power{
public string name,descr,script;
public power(string name,string descr,string script){
this.name=name;
this.descr=descr;
this.script=script;
}
}
public abstract class character{
//type specify the kind of character will be in the inhereited class
//villain (for virtual villains), active (for real players), virtual(for friendly NPC)
public virtual string type {get; protected set;}
public int life,strength,agility,mana;
public Dictionary<string,int>others=new Dictionary<string,int>();
public string c_name="";
public Dictionary<string,int> context(){
Dictionary<string,int>ret=new Dictionary<string,int>();
ret.Add($"{c_name}.life",life);
ret.Add($"{c_name}.strength",strength);
ret.Add($"{c_name}.agility",agility);
ret.Add($"{c_name}.mana",mana);
foreach(var prop in others){
if(!ret.ContainsKey($"{c_name}.{prop.Key}"))ret.Add($"{c_name}.{prop.Key}",prop.Value);
}
return ret;
}
public void upd_param( string s ,int val){
if(s=="life")life=val;
if(s=="strength")strength=val;
if(s=="agility")agility=val;
if(s=="mana")mana=val;
if(others.ContainsKey(s))others[s]=val;
else others.Add(s,val);
}
}
class villain:character{
public villain(){
type= "villain";
}
}
class hero:character{
public string h_ref="",h_hist="";
public int h_id;
Dictionary<string,string>actions=new Dictionary<string, string>();
}
class player:hero{
public int chat_id;
public string name,user;
public List<power>powers=new List<power>();
public bool robot=true;
public List<string>act_order=new List<string>();
public player(int chat_id,string name,string username){
this.chat_id=chat_id;
this.name=name;
this.user=username;
this.type="active";
}
}