Elin Decompiled Documentation EA 23.319 Nightly Patch 1
Loading...
Searching...
No Matches
ConBuffStats.cs
Go to the documentation of this file.
1using System.Collections.Generic;
2using UnityEngine;
3
4public class ConBuffStats : Condition
5{
6 public override string Name => (IsDebuff ? "debuff" : "buff").lang();
7
8 public override ConditionType Type
9 {
10 get
11 {
12 if (!IsDebuff)
13 {
14 return ConditionType.Buff;
15 }
16 return ConditionType.Debuff;
17 }
18 }
19
20 public bool IsDebuff => base.refVal2 == 222;
21
22 public override int MaxDuration
23 {
24 get
25 {
26 if (!IsDebuff)
27 {
28 return 0;
29 }
30 return base.MaxDuration;
31 }
32 }
33
34 public override bool AllowMultipleInstance => true;
35
36 public override bool UseElements => true;
37
38 public override bool IsOverrideConditionMet(Condition c, int turn)
39 {
40 if ((c as ConBuffStats).IsDebuff == IsDebuff)
41 {
42 return base.IsOverrideConditionMet(c, turn);
43 }
44 return true;
45 }
46
47 public override int EvaluateTurn(int p)
48 {
49 if (base.refVal2 == 268)
50 {
51 return 7;
52 }
53 return base.EvaluateTurn(p) * ((base.refVal == 79) ? 50 : 100) / 100;
54 }
55
56 public override bool ShouldOverride(Condition c)
57 {
58 return true;
59 }
60
61 public override int GetPhase()
62 {
63 return 0;
64 }
65
66 public override Color GetColor(SkinColorProfile c)
67 {
68 if (!IsDebuff)
69 {
70 return c.textGood;
71 }
72 return c.textBad;
73 }
74
75 public override string GetPhaseStr()
76 {
77 return GetText();
78 }
79
80 public override string GetText()
81 {
82 string[] list = Lang.GetList("buff_" + EClass.sources.elements.map[base.refVal].alias);
83 if (list != null)
84 {
85 if (!IsDebuff)
86 {
87 return list[0];
88 }
89 return list[1];
90 }
91 return base.GetPhaseStr();
92 }
93
94 public override void PlayEffect()
95 {
97 {
98 owner.PlaySound(IsDebuff ? "debuff" : "buff");
99 owner.PlayEffect(IsDebuff ? "debuff" : "buff");
100 owner.Say(IsDebuff ? "buffStats_curse" : "buffStats", owner, EClass.sources.elements.map[base.refVal].GetName().ToLower());
101 }
102 }
103
104 public override bool CanStack(Condition c)
105 {
106 if (c is ConBuffStats conBuffStats)
107 {
108 return conBuffStats.refVal == base.refVal;
109 }
110 return true;
111 }
112
113 public override void SetOwner(Chara _owner, bool onDeserialize = false)
114 {
115 base.SetOwner(_owner);
116 elements.SetBase(base.refVal, CalcValue() * ((!IsDebuff) ? 1 : (-1)));
118 }
119
120 public int CalcValue()
121 {
122 if (base.refVal2 == 268)
123 {
124 return 100 + (int)Mathf.Sqrt(base.power) * 2;
125 }
126 if (base.refVal == 79)
127 {
128 return (int)Mathf.Max(5f, Mathf.Sqrt(base.power) * 1.5f + 20f);
129 }
130 return (int)Mathf.Max(5f, Mathf.Sqrt(base.power) * 2f - 15f);
131 }
132
133 public override void OnWriteNote(List<string> list)
134 {
135 list.Add((IsDebuff ? "hintDebuffStats" : "hintBuffStats").lang(base.sourceElement.GetName(), CalcValue().ToString() ?? ""));
136 }
137}
ConditionType
Definition: ConditionType.cs:2
ElementContainer elements
override string ToString()
SoundSource PlaySound(string id, float v=1f, bool spatial=true)
Definition: Card.cs:6562
Effect PlayEffect(string id, bool useRenderPos=true, float range=0f, Vector3 fix=default(Vector3))
Definition: Card.cs:6596
void Say(string lang, string ref1=null, string ref2=null)
Definition: Card.cs:7240
Definition: Chara.cs:10
override void PlayEffect()
Definition: ConBuffStats.cs:94
override int EvaluateTurn(int p)
Definition: ConBuffStats.cs:47
override bool IsOverrideConditionMet(Condition c, int turn)
Definition: ConBuffStats.cs:38
override string Name
Definition: ConBuffStats.cs:6
override bool ShouldOverride(Condition c)
Definition: ConBuffStats.cs:56
override bool UseElements
Definition: ConBuffStats.cs:36
override bool CanStack(Condition c)
override int MaxDuration
Definition: ConBuffStats.cs:23
override ConditionType Type
Definition: ConBuffStats.cs:9
override string GetPhaseStr()
Definition: ConBuffStats.cs:75
override void SetOwner(Chara _owner, bool onDeserialize=false)
override int GetPhase()
Definition: ConBuffStats.cs:61
override Color GetColor(SkinColorProfile c)
Definition: ConBuffStats.cs:66
override string GetText()
Definition: ConBuffStats.cs:80
override bool AllowMultipleInstance
Definition: ConBuffStats.cs:34
override void OnWriteNote(List< string > list)
static bool ignoreEffect
Definition: Condition.cs:6
Definition: EClass.cs:6
static SourceManager sources
Definition: EClass.cs:43
void SetParent(Card c)
Element SetBase(string alias, int v, int potential=0)
Definition: Lang.cs:7
static string[] GetList(string id)
Definition: Lang.cs:113
SourceElement elements