9 public override bool CanStack
19 public override bool IsAltar
29 public bool IsBranchAltar
39 public override bool CanOnlyCarry
43 return this.IsBranchAltar;
49 public virtual string idDeity
53 return this.owner.c_idDeity.IsEmpty(
"eyth");
63 return EClass.game.religions.Find(this.idDeity) ??
EClass.game.religions.Eyth;
69 public string StrDeity
73 return this.Deity.NameDomain;
83 return this.idDeity ==
"eyth";
88 public override void OnCreate(
int lv)
90 this.SetDeity(base.GetParam(1,
null) ??
EClass.game.religions.GetRandomReligion(
true,
false).id);
94 public override void OnImportMap()
96 if (this.owner.c_idDeity.IsEmpty())
98 this.SetDeity(base.GetParam(1,
null) ??
EClass.game.religions.GetRandomReligion(
true,
false).id);
103 public void SetDeity(
string id)
105 this.owner.c_idDeity = id;
106 if (this.owner.id ==
"altar")
108 this.owner.ChangeMaterial(this.Deity.source.idMaterial);
113 public override void SetName(ref
string s)
115 if (!this.owner.c_idDeity.IsEmpty())
117 s =
"_of".lang(this.StrDeity, s,
null,
null,
null);
122 public override void TrySetAct(
ActPlan p)
124 if (this.IsBranchAltar)
128 if ((this.IsBranchAltar &&
EClass.Branch.rank != 0) || !
this.IsBranchAltar)
130 p.TrySetAct(
"actOffer", delegate()
134 }, this.owner,
null, 1,
false,
true,
false);
136 if (!this.IsBranchAltar && this.Deity !=
EClass.pc.faith &&
this.Deity.CanJoin)
138 p.TrySetAct(
"actWorship", delegate()
140 LayerDrama.currentReligion = this.Deity;
141 LayerDrama.Activate(
"_adv",
"god",
"worship",
null,
null,
"");
143 }, this.owner,
null, 1,
false,
true,
false);
148 public override bool CanOffer(
Card c)
150 return (c !=
null && c.HasTag(CTAG.godArtifact) && c.c_idDeity ==
this.Deity.id) || (base.CanOffer(c) && (
EClass.pc.faith.GetOfferingValue(c as
Thing, -1) > 0 || c.id ==
"water") && !c.isCopy);
162 if (this.Deity !=
EClass.pc.faith)
164 if (t.blessedState == BlessedState.Cursed)
166 Msg.SayNothingHappen();
169 Msg.Say(
"waterCurse", t,
null,
null,
null);
170 EClass.pc.PlayEffect(
"curse",
true, 0f,
default(Vector3));
171 EClass.pc.PlaySound(
"curse3", 1f,
true);
172 t.SetBlessedState(BlessedState.Cursed);
177 if (t.blessedState == BlessedState.Blessed)
179 Msg.SayNothingHappen();
182 Msg.Say(
"waterBless", t,
null,
null,
null);
183 EClass.pc.PlayEffect(
"revive",
true, 0f,
default(Vector3));
184 EClass.pc.PlaySound(
"revive", 1f,
true);
185 t.SetBlessedState(BlessedState.Blessed);
191 if (!this.IsBranchAltar &&
EClass.pc.IsEyth)
193 EClass.pc.Say(
"god_offerEyth", this.owner, t,
null,
null);
196 EClass.pc.Say(
"god_offer", this.owner, t, this.Deity.Name,
null);
197 if (!this.CanOffer(t))
199 EClass.pc.Say(
"nothingHappens", this.owner, t,
null,
null);
202 Effect.Get(
"debuff").Play(this.owner.pos, 0f,
null,
null);
203 EClass.pc.PlaySound(
"offering", 1f,
true);
204 if (this.IsBranchAltar)
206 Msg.Say(
"nothingHappens");
208 else if (this.IsEyth)
212 Msg.Say(
"nothingHappens");
216 Msg.Say(
"takeover_empty",
EClass.pc.faith.Name,
null,
null,
null);
218 this._OnOffer(c, t, 2);
223 if (t.HasTag(CTAG.godArtifact) && t.c_idDeity ==
this.Deity.id)
226 this.Deity.Reforge(t.id,
null,
true);
231 Msg.Say(
"nothingHappens");
234 if (this.Deity !=
EClass.pc.faith)
237 if (base.GetParam(1,
null) !=
null)
239 Msg.Say(
"nothingHappens");
242 Msg.Say(
"takeover_versus",
EClass.pc.faith.Name,
this.Deity.Name,
null,
null);
245 Msg.Say(
"takeover_success",
EClass.pc.faith.TextGodGender,
null,
null,
null);
246 Msg.Say(
"takeover_success2",
EClass.pc.faith.Name,
null,
null,
null);
248 this._OnOffer(c, t, 5);
252 Msg.Say(
"takeover_fail", this.Deity.Name,
null,
null,
null);
253 this.Deity.PunishTakeOver(
EClass.pc);
258 this._OnOffer(c, t, 0);
267 public void _OnOffer(
Chara c,
Thing t,
int takeoverMod = 0)
269 bool @
bool = t.GetBool(115);
270 int num = this.Deity.GetOfferingValue(t, t.Num);
271 num = num * (c.HasElement(1228, 1) ? 130 : 100) / 100;
272 if (takeoverMod == 0)
276 Msg.Say(
"god_offer1", t,
null,
null,
null);
277 EClass.pc.faith.Talk(
"offer",
null,
null);
281 Msg.Say(
"god_offer2", t,
null,
null,
null);
285 Msg.Say(
"god_offer3", t,
null,
null,
null);
289 Msg.Say(
"god_offer4", t,
null,
null,
null);
294 Msg.Say(
"god_offer1", t,
null,
null,
null);
295 num += this.Deity.GetOfferingValue(t, 1) * takeoverMod;
297 int num2 = Mathf.Max(c.Evalue(306), 1);
298 Element orCreateElement = c.elements.GetOrCreateElement(85);
299 int value = orCreateElement.Value;
300 c.elements.ModExp(orCreateElement.id, num * 2 / 3,
false);
302 if (orCreateElement.vBase >= num2)
304 c.elements.SetBase(orCreateElement.id, num2, 0);
308 num3 = Mathf.Clamp(orCreateElement.vBase * 100 / num2 / 25, 0, 3);
310 if (num3 == 4 || orCreateElement.Value != value)
312 Msg.Say(
"piety" + num3.ToString(), c, c.faith.TextGodGender,
null,
null);
314 Debug.Log(
string.Concat(
new string[]
318 orCreateElement.Value.ToString(),
320 orCreateElement.vExp.ToString()
322 if (orCreateElement.Value > num2 * 8 / 10)
324 c.elements.ModExp(306, num / 5,
false);
326 c.RefreshFaithElement();
329 EClass.player.ModKarma(-1);
334 public void TakeOver()
336 this.SetDeity(
EClass.pc.faith.id);
337 EClass.pc.faith.Talk(
"takeover",
null,
null);
338 EClass.pc.PlayEffect(
"revive",
true, 0f,
default(Vector3));
339 this.owner.PlayEffect(
"aura_heaven",
true, 0f,
default(Vector3));