-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathKissingPartPreference.cs
More file actions
91 lines (75 loc) · 2.95 KB
/
Copy pathKissingPartPreference.cs
File metadata and controls
91 lines (75 loc) · 2.95 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
using System;
using System.Collections.Generic;
using XRL.Core;
using XRL.UI;
using System.Linq;
using XRL.World.Anatomy;
namespace XRL.World.Parts
{
[Serializable]
public class acegiak_PartPreference : acegiak_KissingPreference
{
string BodyPart = "face";
float Amount = 0.1f;
public acegiak_PartPreference(GameObject GO){
if(GO == null){
return;
}
Body body = GO.GetPart<Body>();
if(body == null){
return;
}
BodyPart bp = body.GetBody();
if(bp == null){
return;
}
Random random = new Random();
List<BodyPart> parts = bp.GetParts().Where(x => !x.Abstract && !x.Extrinsic).ToList();
BodyPart part = parts[random.Next(parts.Count-1)];
this.BodyPart = part.TypeModel().Type;
this.Amount = (float)((random.NextDouble()*2)-1);
}
public acegiak_PartPreference(string partname, float amount){
this.BodyPart = partname;
this.Amount = amount;
}
public override acegiak_KissingPreferenceResult attractionAmount(GameObject kissee, GameObject GO){
bool has = false;
Body part = GO.GetPart<Body>();
//IPart.AddPlayerMessage("They "+(Amount>0?"likes ":"dislikes ")+this.BodyPart);
string reactPath = "part." + this.BodyPart;
if (part == null)
{
//IPart.AddPlayerMessage("You have no body.");
has = false;
reactPath += ".none";
}else if (part.GetDismemberedPartByType(this.BodyPart) != null){
has = false;
reactPath = ".missing";
} else {
// IPart.AddPlayerMessage("You have a body.");
var parts = part.GetPart(this.BodyPart);
//BodyPart bpart = (parts.Count() ? parts[Stat.Rnd2.Next(parts.Count())] : null);
has = (parts.Count() != 0);
reactPath += (has ? ".have" : ".none");
//IPart.AddPlayerMessage("You "+(has?"have ":"have no ")+this.BodyPart);
}
float result = Amount * (has?1:-1);
string explain = ((result>0)?"is attracted to":"is &rnot attracted to")+" your "+((has)?"":"&rlack of ")+BodyPart;
var vars = new Dictionary<string, string>();
vars["*part*"] = BodyPart.ToLower();
vars["*Part*"] = BodyPart;
return new acegiak_KissingPreferenceResult(result,explain,reactPath,vars);
}
public override void Save(SerializationWriter Writer){
base.Save(Writer);
Writer.Write(this.BodyPart);
Writer.Write(Amount);
}
public override void Load(SerializationReader Reader){
base.Load(Reader);
this.BodyPart = Reader.ReadString();
this.Amount = Reader.ReadSingle();
}
}
}