-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathRomanceArmorPreference.cs
More file actions
147 lines (120 loc) · 5.43 KB
/
Copy pathRomanceArmorPreference.cs
File metadata and controls
147 lines (120 loc) · 5.43 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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
using System;
using System.Collections.Generic;
using XRL.Core;
using XRL.UI;
using XRL.World;
using XRL.Rules;
using XRL.World.Encounters;
using Qud.API;
using System.Linq;
using HistoryKit;
using XRL.World.Anatomy;
namespace XRL.World.Parts
{
[Serializable]
public class acegiak_ArmorPreference : acegiak_RomancePreference
{
string wantedType = "Body";
float amount = 0;
string ExampleName = "Club";
List<string> tales = new List<string>();
public acegiak_ArmorPreference(acegiak_Romancable romancable){
GameObject sample = GameObjectFactory.Factory.CreateSampleObject(EncountersAPI.GetARandomDescendantOf("Armor"));
sample.MakeUnderstood();
this.wantedType = GetSkill(sample);
this.ExampleName = sample.ShortDisplayName;
Romancable = romancable;
amount = (float)((Stat.Rnd2.NextDouble()*2f)-0.9f);
//IPart.AddPlayerMessage("They "+(amount>0?"like":"dislike")+" "+this.wantedType);
}
public GameObject exampleObject(){
GameObject sample = EncountersAPI.GetAnObject((GameObjectBlueprint b) =>
b.InheritsFrom("Armor")
&& (b.GetPartParameter<string>("Armor","WornOn","") == this.wantedType ));
sample.MakeUnderstood();
return sample;
}
public string exampleObjectName(){
var obj = exampleObject();
return obj.a + obj.DisplayNameOnlyDirectAndStripped;
}
public override acegiak_RomancePreferenceResult GiftRecieve(GameObject from, GameObject gift){
//IPart.AddPlayerMessage("checked armor part:"+gift.DisplayNameOnly+" "+GetSkill(gift)+"/"+wantedType+"("+amount.ToString()+")");
if(GetSkill(gift) == wantedType){
return new acegiak_RomancePreferenceResult(amount,(amount >= 0 ?"&Glikes&Y the ":"&rdislikes&Y the ")+gift.pRender.DisplayName+"&Y.");
}
return null;
}
string GetSkill(GameObject GO){
if(GO.GetPart<Armor>() != null && GO.GetPart<Armor>().WornOn != null){
return GO.GetPart<Armor>().WornOn;
}
return "Body";
}
public override acegiak_RomanceChatNode BuildNode(acegiak_RomanceChatNode node){
float g = (float)Stat.Rnd2.NextDouble();
var vars = new Dictionary<string, string>();
vars["*type*"] = wantedType;
if(g<0.50 ){
SetSampleObject(vars, exampleObject());
return Build_QA_Node(node, "armor.qa.seen", (amount > 0) ? "gen_good" : "gen_bad", vars);
}else{
return Build_QA_Node(node, "armor.qa.show_me", (amount > 0) ? "gen_good" : "gen_bad", vars);
}
}
public override acegiak_RomancePreferenceResult DateAssess(GameObject Date, GameObject DateObject){
List<BodyPart> equippedParts = XRLCore.Core.Game.Player.Body.GetPart<Body>().GetEquippedParts();
foreach (BodyPart item in equippedParts)
{
if(item.Equipped != null){
if(item.Equipped.GetPart<Armor>() != null && item.Equipped.GetPart<Armor>().WornOn == this.wantedType){
return new acegiak_RomancePreferenceResult(amount,(amount > 0?Romancable.ParentObject.GetVerb("like"):Romancable.ParentObject.GetVerb("dislike"))+" your "+item.Equipped.DisplayNameOnly);
}
}
}
return null;
}
public override string GetStory(acegiak_RomanceChatNode node, HistoricEntitySnapshot entity){
var vars = new Dictionary<string, string>();
vars["*type*"] = wantedType;
string storyTag = ((amount > 0) ?
"<spice.eros.opinion.armor.like.story.!random>" :
"<spice.eros.opinion.armor.dislike.story.!random>");
while(this.tales.Count < 5){
SetSampleObject(vars, exampleObject());
this.tales.Add(//" &K"+storyTag.Substring(1,storyTag.Count()-2)+"&y\n"+
acegiak_RomanceText.ExpandString(
storyTag, entity, null, vars));
}
return tales[Stat.Rnd2.Next(tales.Count)];
}
public override string getstoryoption(string key){
var vars = new Dictionary<string, string>();
vars["*type*"] = wantedType;
SetSampleObject(vars, exampleObject());
return acegiak_RomanceText.ExpandString(
"<spice.eros.opinion.armor." + ((amount > 0) ? "like." : "dislike.") + key + ".!random>",
null, null, vars);
}
public override void Save(SerializationWriter Writer){
base.Save(Writer);
Writer.Write(wantedType);
Writer.Write(amount);
Writer.Write(ExampleName);
Writer.Write(tales.Count);
foreach(string tale in tales){
Writer.Write(tale);
}
}
public override void Load(SerializationReader Reader){
this.wantedType = Reader.ReadString();
this.amount = Reader.ReadSingle();
this.ExampleName = Reader.ReadString();
int countTales = Reader.ReadInt32();
this.tales = new List<string>();
for(int i = 0; i < countTales; i++){
this.tales.Add(Reader.ReadString());
}
}
}
}