Elin Decompiled Documentation EA 23.102 Nightly
Loading...
Searching...
No Matches
Condition.cs
Go to the documentation of this file.
1using System;
2
3public class Condition : BaseCondition
4{
5 public static bool ignoreEffect;
6
7 public virtual bool IsKilled => base.value <= 0;
8
9 public virtual string TextDuration
10 {
11 get
12 {
13 object obj;
14 if (!base.isPerfume)
15 {
16 obj = base.value.ToString();
17 if (obj == null)
18 {
19 return "";
20 }
21 }
22 else
23 {
24 obj = "";
25 }
26 return (string)obj;
27 }
28 }
29
31 {
32 return new NotificationCondition
33 {
34 condition = this
35 };
36 }
37
38 public static T Create<T>(int power = 100, Action<T> onCreate = null) where T : Condition
39 {
40 return (T)Create(typeof(T).Name, power, delegate(Condition c)
41 {
42 onCreate(c as T);
43 });
44 }
45
46 public static Condition Create(string alias, int power = 100, Action<Condition> onCreate = null)
47 {
48 SourceStat.Row row = EClass.sources.stats.alias[alias];
49 Condition condition = ClassCache.Create<Condition>(row.type.IsEmpty(alias), "Elin");
50 condition.power = power;
51 condition.id = row.id;
52 condition._source = row;
53 onCreate?.Invoke(condition);
54 return condition;
55 }
56
57 public virtual void OnStacked(int p)
58 {
59 base.value += EvaluateTurn(p);
60 SetPhase();
61 }
62
63 public Condition SetPerfume(int duration = 3)
64 {
65 base.isPerfume = true;
66 base.value = duration;
67 return this;
68 }
69
70 public override void Tick()
71 {
72 Mod(-1);
73 }
74
75 public virtual void OnCalculateFov(Fov fov, ref int radius, ref float power)
76 {
77 }
78
79 public virtual void OnCreateFov(Fov fov)
80 {
81 }
82
83 public override void OnValueChanged()
84 {
85 if (base.value <= 0)
86 {
87 Kill();
88 }
89 }
90
91 public void Kill(bool silent = false)
92 {
93 base.value = 0;
94 owner.conditions.Remove(this);
95 if (!silent && !owner.isDead && !base.source.textEnd.IsEmpty())
96 {
97 owner.Say(base.source.GetText("textEnd"), owner, RefString1);
98 }
100 OnRemoved();
101 if (elements != null)
102 {
104 }
106 if (ShouldRefresh)
107 {
108 owner.Refresh();
109 }
110 }
111}
virtual bool ShouldRefresh
virtual string Name
virtual string RefString1
virtual int EvaluateTurn(int p)
virtual void OnRemoved()
void Mod(int a, bool force=false)
virtual void PlayEndEffect()
ElementContainer elements
void Say(string lang, string ref1=null, string ref2=null)
Definition: Card.cs:6046
void Refresh(bool calledRecursive=false)
Definition: Chara.cs:1504
void SetDirtySpeed()
Definition: Chara.cs:1605
List< Condition > conditions
Definition: Chara.cs:196
bool isDead
Definition: Chara.cs:374
virtual void OnCalculateFov(Fov fov, ref int radius, ref float power)
Definition: Condition.cs:75
virtual void OnStacked(int p)
Definition: Condition.cs:57
override BaseNotification CreateNotification()
Definition: Condition.cs:30
virtual bool IsKilled
Definition: Condition.cs:7
Condition SetPerfume(int duration=3)
Definition: Condition.cs:63
void Kill(bool silent=false)
Definition: Condition.cs:91
virtual void OnCreateFov(Fov fov)
Definition: Condition.cs:79
override void Tick()
Definition: Condition.cs:70
override void OnValueChanged()
Definition: Condition.cs:83
virtual string TextDuration
Definition: Condition.cs:10
static Condition Create(string alias, int power=100, Action< Condition > onCreate=null)
Definition: Condition.cs:46
static bool ignoreEffect
Definition: Condition.cs:5
static T Create< T >(int power=100, Action< T > onCreate=null)
Definition: Condition.cs:38
Definition: EClass.cs:5
static SourceManager sources
Definition: EClass.cs:42
void SetParent(Card c)
Definition: Fov.cs:6
SourceStat stats