Elin Modding Docs Doc
Loading...
Searching...
No Matches
Affinity.cs
1using System;
2using System.Collections.Generic;
3using UnityEngine;
4
5// Token: 0x02000035 RID: 53
6[Serializable]
7public class Affinity : EClass
8{
9 // Token: 0x1700003E RID: 62
10 // (get) Token: 0x06000176 RID: 374 RVA: 0x0000E046 File Offset: 0x0000C246
11 public static List<Affinity> list
12 {
13 get
14 {
15 return EClass.gamedata.affinities;
16 }
17 }
18
19 // Token: 0x1700003F RID: 63
20 // (get) Token: 0x06000177 RID: 375 RVA: 0x0000E052 File Offset: 0x0000C252
21 public string Name
22 {
23 get
24 {
25 return Lang.GetList("affinity")[Affinity.list.IndexOf(this)];
26 }
27 }
28
29 // Token: 0x06000178 RID: 376 RVA: 0x0000E06C File Offset: 0x0000C26C
30 public static Affinity Get(Chara c)
31 {
32 Affinity.CC = c;
33 foreach (Affinity affinity in Affinity.list)
34 {
35 if (c._affinity < affinity.value)
36 {
37 return affinity;
38 }
39 }
40 return Affinity.list.LastItem<Affinity>();
41 }
42
43 // Token: 0x06000179 RID: 377 RVA: 0x0000E0DC File Offset: 0x0000C2DC
44 public bool CanInvite()
45 {
46 return EClass.debug.inviteAnytime || Affinity.list.IndexOf(this) >= 6;
47 }
48
49 // Token: 0x0600017A RID: 378 RVA: 0x0000E0FD File Offset: 0x0000C2FD
50 public bool CanMarry()
51 {
52 return EClass.debug.marryAnytime || Affinity.list.IndexOf(this) >= 7;
53 }
54
55 // Token: 0x0600017B RID: 379 RVA: 0x0000E120 File Offset: 0x0000C320
56 public Thing OnGift(Thing t)
57 {
58 Thing result = Affinity.CC.AddThing(t.Thing, true, -1, -1);
59 EClass.pc.PlaySound("build_resource", 1f, true);
60 bool flag = t.HasTag(CTAG.gift);
61 bool flag2 = t.category.IsChildOf(Affinity.CC.GetFavCat());
62 bool flag3 = t.id == Affinity.CC.GetFavFood().id;
63 if (EClass.debug.alwaysFavFood && t.trait is TraitFood)
64 {
65 flag3 = true;
66 }
67 int num = Mathf.Clamp(t.GetPrice(CurrencyType.Money, false, PriceType.Default, null) / (flag3 ? 10 : (flag2 ? 20 : 200)), 0, 50) + (flag3 ? 20 : (flag2 ? 5 : 0));
68 num = num * 100 / (100 + Affinity.CC.LV * 10);
69 if (flag)
70 {
71 num += 100;
72 Affinity.CC.Say("give_ring", Affinity.CC, null, null);
73 Affinity.CC.Talk("thanks3", null, null, false);
74 }
75 else if (flag3 || num > 20)
76 {
77 Affinity.CC.Talk("thanks3", null, null, false);
78 }
79 else if (flag2 || num > 10)
80 {
81 Affinity.CC.Talk("thanks", null, null, false);
82 }
83 else
84 {
85 Affinity.CC.Talk("thanks2", null, null, false);
86 }
87 Affinity.CC.ModAffinity(EClass.pc, num, true);
88 return result;
89 }
90
91 // Token: 0x0600017C RID: 380 RVA: 0x0000E284 File Offset: 0x0000C484
92 public void OnTalkRumor()
93 {
94 bool flag = EClass.rnd(60 + EClass.pc.CHA * 2 + EClass.pc.Evalue(291) * 3) > 50 + this.difficulty + EClass.rnd(Affinity.CC.CHA + 1);
95 Affinity.CC.ModAffinity(EClass.pc, flag ? (EClass.rnd(4) + 1) : (-EClass.rnd(4) - 1), false);
96 if (!EClass.debug.unlimitedInterest)
97 {
98 Affinity.CC.interest -= 10 + EClass.rnd(10);
99 }
100 EClass.pc.ModExp(291, 20);
101 }
102
103 // Token: 0x0600017D RID: 381 RVA: 0x0000E334 File Offset: 0x0000C534
104 public int Mod(int a)
105 {
106 if (a < 0)
107 {
108 Affinity.CC._affinity += a;
109 return a;
110 }
111 int num = 0;
112 for (int i = 0; i < a; i++)
113 {
114 Affinity affinity = Affinity.Get(Affinity.CC);
115 if (EClass.rnd(100 + affinity.difficulty) < 100)
116 {
117 Chara cc = Affinity.CC;
118 int affinity2 = cc._affinity;
119 cc._affinity = affinity2 + 1;
120 num++;
121 }
122 }
123 return num;
124 }
125
126 // Token: 0x040000EE RID: 238
127 public static Chara CC;
128
129 // Token: 0x040000EF RID: 239
130 public int value;
131
132 // Token: 0x040000F0 RID: 240
133 public int difficulty;
134}
Definition Chara.cs:12
Definition Thing.cs:10