Elin Decompiled Documentation EA 23.321 Nightly Patch 1
Loading...
Searching...
No Matches
ReligionManager.cs
Go to the documentation of this file.
1using System.Collections.Generic;
2using System.Linq;
3using Newtonsoft.Json;
4using UnityEngine;
5
6public class ReligionManager : EClass
7{
8 public Dictionary<string, Religion> dictAll = new Dictionary<string, Religion>();
9
10 public List<Religion> list = new List<Religion>();
11
12 [JsonProperty]
14
15 [JsonProperty]
17
18 [JsonProperty]
20
21 [JsonProperty]
23
24 [JsonProperty]
26
27 [JsonProperty]
29
30 [JsonProperty]
32
33 [JsonProperty]
35
36 [JsonProperty]
38
39 [JsonProperty]
41
42 [JsonProperty]
44
45 [JsonProperty]
47
48 [JsonProperty]
50
51 public void SetOwner()
52 {
53 list = new List<Religion>
54 {
57 };
58 BaseModManager.PublishEvent("elin.religion_importing", list);
59 foreach (Religion item in list)
60 {
61 dictAll[item.id] = item;
62 }
63 }
64
65 public void OnCreateGame()
66 {
67 SetOwner();
68 foreach (Religion item in list)
69 {
70 item.Init();
71 }
72 }
73
74 public void OnLoad()
75 {
76 SetOwner();
77 foreach (Religion value in dictAll.Values)
78 {
79 value.OnLoad();
80 }
81 }
82
83 public Religion Find(string id)
84 {
85 return dictAll.TryGetValue(id);
86 }
87
88 public Religion GetRandomReligion(bool onlyJoinable = true, bool includeMinor = false)
89 {
90 return list.Where((Religion a) => (!onlyJoinable || a.CanJoin) && (includeMinor || !a.IsMinorGod)).RandomItem();
91 }
92
94 {
95 foreach (Chara item in EClass._map.charas.Concat(EClass.game.cards.globalCharas.Values))
96 {
97 if (item.faith != Healing)
98 {
100 item.AddCard(thing);
101 if (item.ExistsOnMap)
102 {
103 item.TryUse(thing);
104 }
105 }
106 }
107 Debug.Log("hai");
108 return true;
109 }
110
111 public Religion GetArtifactDeity(string id)
112 {
113 return list.LastOrDefault((Religion a) => a.IsValidArtifact(id));
114 }
115
116 public Thing Reforge(string id, Point pos = null, bool first = true)
117 {
118 if (pos == null)
119 {
120 pos = EClass.pc.pos.Copy();
121 }
122 pos.Set(pos.GetNearestPoint(allowBlock: false, allowChara: false, allowInstalled: false, ignoreCenter: true) ?? pos);
123 Thing thing = ThingGen.Create(id);
124 GetArtifactDeity(id)?.OnReforge(thing);
125 EClass._zone.AddCard(thing, pos);
126 pos.PlayEffect("aura_heaven");
127 if (first)
128 {
129 pos.PlaySound("godbless");
130 }
131 return thing;
132 }
133}
static void PublishEvent(string eventId, object data=null)
GlobalCharaList globalCharas
Definition: CardManager.cs:46
Point pos
Definition: Card.cs:60
Effect PlayEffect(string id, bool useRenderPos=true, float range=0f, Vector3 fix=default(Vector3))
Definition: Card.cs:6612
Definition: Chara.cs:10
Definition: EClass.cs:6
static Game game
Definition: EClass.cs:9
static Zone _zone
Definition: EClass.cs:21
static Map _map
Definition: EClass.cs:19
static Chara pc
Definition: EClass.cs:15
CardManager cards
Definition: Game.cs:156
List< Chara > charas
Definition: Map.cs:81
Definition: Point.cs:9
Point Copy()
Definition: Point.cs:491
Point Set(int _x, int _z)
Definition: Point.cs:503
ReligionWind Wind
ReligionOblivion Oblivion
ReligionHarvest Harvest
Religion Find(string id)
Religion GetArtifactDeity(string id)
ReligionMachine Machine
ReligionEyth Eyth
ReligionLuck Luck
bool ジュアさまの薄い本をください()
ReligionStrife Strife
Dictionary< string, Religion > dictAll
Thing Reforge(string id, Point pos=null, bool first=true)
ReligionHarmony Harmony
ReligionMoonShadow MoonShadow
ReligionTrickery Trickery
ReligionElement Element
List< Religion > list
ReligionEarth Earth
ReligionHealing Healing
Religion GetRandomReligion(bool onlyJoinable=true, bool includeMinor=false)
virtual bool IsValidArtifact(string id)
Definition: Religion.cs:311
virtual void OnReforge(Thing t)
Definition: Religion.cs:289
virtual bool IsMinorGod
Definition: Religion.cs:64
virtual void OnLoad()
Definition: Religion.cs:78
virtual bool CanJoin
Definition: Religion.cs:66
static Thing Createジュアさまの薄い本()
Definition: ThingGen.cs:197
static Thing Create(string id, int idMat=-1, int lv=-1)
Definition: ThingGen.cs:53
Definition: Thing.cs:8
Card AddCard(Card t, Point point)
Definition: Zone.cs:2086