Elin Decompiled Documentation EA 23.102 Nightly
Loading...
Searching...
No Matches
QuestTaskHunt.cs
Go to the documentation of this file.
1using System;
2using System.Collections.Generic;
3using Newtonsoft.Json;
4
5public class QuestTaskHunt : QuestTask
6{
7 public enum Type
8 {
10 Race
11 }
12
13 public enum Setup
14 {
15 Random,
17 }
18
19 [JsonProperty]
20 public int numHunted;
21
22 [JsonProperty]
23 public int numRequired;
24
25 [JsonProperty]
26 public string idRace;
27
28 [JsonProperty]
29 public Type type;
30
31 public Setup setup;
32
34
35 public override string RefDrama2
36 {
37 get
38 {
39 if (type != Type.Race)
40 {
41 return "";
42 }
43 return Race.GetName();
44 }
45 }
46
47 public override string RefDrama3 => numRequired.ToString() ?? "";
48
49 public override bool IsComplete()
50 {
51 return numHunted >= numRequired;
52 }
53
54 public static List<SourceChara.Row> ListTargets(string idRace)
55 {
56 List<SourceChara.Row> list = new List<SourceChara.Row>();
57 foreach (SourceChara.Row row in EClass.sources.charas.rows)
58 {
59 if (row.quality == 0 && row.race == idRace && row.chance > 0 && row.hostility != "Friend")
60 {
61 list.Add(row);
62 }
63 }
64 return list;
65 }
66
67 public override void OnInit()
68 {
69 if (setup == Setup.FighterGuild)
70 {
71 numRequired = 20;
72 idRace = "yeek";
73 type = Type.Race;
74 }
75 else if (type == Type.Race)
76 {
77 for (int i = 0; i < 100; i++)
78 {
79 SourceRace.Row row = EClass.sources.races.rows.RandomItem();
80 if (ListTargets(row.id).Count != 0)
81 {
82 idRace = row.id;
83 }
84 }
85 numRequired = 3 + owner.difficulty * 2 + EClass.rnd(5);
86 }
87 else
88 {
89 numRequired = 10 + owner.difficulty * 3 + EClass.rnd(5);
90 }
91 }
92
93 public override void OnKillChara(Chara c)
94 {
95 if (c.IsPCFaction)
96 {
97 return;
98 }
99 if (type == Type.Race)
100 {
101 if (c.race.id == idRace)
102 {
103 CountKill();
104 }
105 }
106 else if (c.OriginalHostility <= Hostility.Enemy)
107 {
108 CountKill();
109 }
110 void CountKill()
111 {
112 numHunted++;
114 {
116 }
117 else
118 {
119 owner.bonusMoney += EClass.curve(3 + c.LV, 50, 10) * ((type != Type.Race) ? 1 : 2);
120 }
121 }
122 }
123
124 public override string GetTextProgress()
125 {
126 if (type == Type.Race)
127 {
128 return "progressHuntRace".lang(numHunted.ToString() ?? "", numRequired.ToString() ?? "", Race.GetName());
129 }
130 return "progressHunt".lang(numHunted.ToString() ?? "", numRequired.ToString() ?? "");
131 }
132
133 public override void OnGetDetail(ref string detail, bool onJournal)
134 {
135 if (type != Type.Race || !onJournal)
136 {
137 return;
138 }
139 List<SourceChara.Row> list = ListTargets(idRace);
140 int num = 0;
141 detail = detail + Environment.NewLine + Environment.NewLine + "target_huntRace".lang() + Environment.NewLine;
142 foreach (SourceChara.Row item in list)
143 {
144 detail = detail + item.GetName().ToTitleCase(wholeText: true) + " (" + EClass.sources.races.map[idRace].GetName() + ")";
145 num++;
146 if (num > 5)
147 {
148 break;
149 }
150 detail += Environment.NewLine;
151 }
152 }
153}
Hostility
Definition: Hostility.cs:2
int LV
Definition: Card.cs:370
Definition: Chara.cs:10
Hostility OriginalHostility
Definition: Chara.cs:456
override bool IsPCFaction
Definition: Chara.cs:656
SourceRace.Row race
Definition: Chara.cs:449
Definition: EClass.cs:5
static int curve(int a, int start, int step, int rate=75)
Definition: EClass.cs:55
static int rnd(int a)
Definition: EClass.cs:50
static SourceManager sources
Definition: EClass.cs:42
override void OnKillChara(Chara c)
override bool IsComplete()
override string RefDrama3
static List< SourceChara.Row > ListTargets(string idRace)
override void OnInit()
SourceRace.Row Race
override string RefDrama2
override void OnGetDetail(ref string detail, bool onJournal)
override string GetTextProgress()
SourceRace races
SourceChara charas