Elin Decompiled Documentation EA 23.195 Nightly
Loading...
Searching...
No Matches
ZoneEventSiege.cs
Go to the documentation of this file.
1using System.Collections.Generic;
2using Newtonsoft.Json;
3using UnityEngine;
4
6{
7 [JsonProperty]
8 public List<int> uids = new List<int>();
9
10 [JsonProperty]
11 public int lv = 10;
12
13 [JsonProperty]
14 public int idx;
15
16 [JsonProperty]
17 public int max = 10;
18
19 public List<Chara> members = new List<Chara>();
20
21 public override string id => "trial_siege";
22
23 public override float roundInterval => Mathf.Max(0.1f, 1.5f - 0.01f * (float)lv);
24
25 public override Playlist playlist => EClass.Sound.playlistBattle;
26
27 public virtual Chara CreateChara(Point p)
28 {
29 bool flag = idx == max - 1;
30 int num;
31 object obj;
32 if (lv >= 50)
33 {
34 num = ((idx == max - 2) ? 1 : 0);
35 if (num != 0)
36 {
37 obj = SpawnSetting.Evolved(lv);
38 goto IL_005a;
39 }
40 }
41 else
42 {
43 num = 0;
44 }
46 goto IL_005a;
47 IL_005a:
48 SpawnSetting spawnSetting = (SpawnSetting)obj;
49 spawnSetting.dangerLv = lv + 1;
50 if (num == 0)
51 {
52 return EClass._zone.SpawnMob(p, spawnSetting);
53 }
54 return EClass._zone.TryGenerateEvolved(force: true, p);
55 }
56
57 public override void OnInit()
58 {
60 Msg.Say("startSiege");
62 }
63
64 public override void OnVisit()
65 {
67 members.Clear();
68 foreach (int uid in uids)
69 {
70 foreach (Chara chara in EClass._map.charas)
71 {
72 if (chara.uid == uid)
73 {
74 members.Add(chara);
75 }
76 }
77 }
78 }
79
80 public void SpawnMob()
81 {
82 Point spawnPos = GetSpawnPos();
83 Chara chara = CreateChara(spawnPos);
84 chara.hostility = Hostility.Enemy;
85 members.Add(chara);
86 uids.Add(chara.uid);
87 chara.PlayEffect("teleport");
88 chara.PlaySound("spell_funnel");
89 idx++;
90 }
91
92 public virtual Point GetSpawnPos()
93 {
94 return EClass._map.GetRandomEdge();
95 }
96
97 public override void OnTickRound()
98 {
99 if (idx < max)
100 {
101 SpawnMob();
102 }
103 if (ShouldEnd())
104 {
105 Kill();
106 }
107 }
108
109 public override void OnCharaDie(Chara c)
110 {
111 if (ShouldEnd())
112 {
113 Kill();
114 }
115 }
116
117 public bool ShouldEnd()
118 {
119 bool result = idx >= max;
120 foreach (Chara member in members)
121 {
122 if (!member.IsPCFactionOrMinion && member.IsAliveInCurrentZone)
123 {
124 if (member.ai is GoalIdle)
125 {
126 member.SetAI(new GoalSiege());
127 }
128 result = false;
129 }
130 }
131 return result;
132 }
133
134 public override void OnKill()
135 {
136 Msg.Say("endSiege");
137 SE.Play("kill_boss");
139 EClass._zone.AddCard(ThingGen.CreateTreasure("chest_boss", lv, TreasureType.SurvivalRaid), GetSpawnPos().GetNearestPoint(allowBlock: false, allowChara: false, allowInstalled: false, ignoreCenter: true) ?? EClass.pc.pos).Install();
140 }
141}
Hostility
Definition: Hostility.cs:2
TreasureType
Definition: TreasureType.cs:2
bool IsPCFactionOrMinion
Definition: Card.cs:2234
SoundSource PlaySound(string id, float v=1f, bool spatial=true)
Definition: Card.cs:5912
Point pos
Definition: Card.cs:57
int uid
Definition: Card.cs:120
Effect PlayEffect(string id, bool useRenderPos=true, float range=0f, Vector3 fix=default(Vector3))
Definition: Card.cs:5946
Card Install()
Definition: Card.cs:3639
Definition: Chara.cs:10
override bool IsAliveInCurrentZone
Definition: Chara.cs:559
AIAct ai
Definition: Chara.cs:200
AIAct SetAI(AIAct g)
Definition: Chara.cs:8488
Definition: EClass.cs:5
static Zone _zone
Definition: EClass.cs:20
static Map _map
Definition: EClass.cs:18
static Player player
Definition: EClass.cs:12
static Chara pc
Definition: EClass.cs:14
static SoundManager Sound
Definition: EClass.cs:46
new Point GetRandomEdge(int r=3)
Definition: Map.cs:2233
List< Chara > charas
Definition: Map.cs:81
Definition: Msg.cs:5
static string Say(string idLang, string ref1, string ref2=null, string ref3=null, string ref4=null)
Definition: Msg.cs:58
int sieges
Definition: Player.cs:81
Stats stats
Definition: Player.cs:960
Definition: Point.cs:9
static SpawnSetting Boss(int filterLv, int fixedLv=-1)
Definition: SpawnSetting.cs:47
static SpawnSetting DefenseEnemy(int lv)
static SpawnSetting Evolved(int fixedLv=-1)
Definition: SpawnSetting.cs:35
static Thing CreateTreasure(string id, int lv, TreasureType type=TreasureType.Map)
Definition: ThingGen.cs:244
override void OnTickRound()
List< Chara > members
override Playlist playlist
virtual Chara CreateChara(Point p)
override void OnKill()
override float roundInterval
override void OnInit()
override void OnCharaDie(Chara c)
virtual Point GetSpawnPos()
List< int > uids
override void OnVisit()
void Kill()
Definition: ZoneEvent.cs:114
Chara TryGenerateEvolved(bool force=false, Point p=null)
Definition: Zone.cs:2563
void RefreshBGM()
Definition: Zone.cs:2895
Chara SpawnMob(Point pos=null, SpawnSetting setting=null)
Definition: Zone.cs:2689
Card AddCard(Card t, Point point)
Definition: Zone.cs:1935