Elin Decompiled Documentation EA 23.102 Nightly
Loading...
Searching...
No Matches
ThingGen Class Reference
Inheritance diagram for ThingGen:
CardGen EClass

Static Public Member Functions

static Thing _Create (string id, int idMat=-1, int lv=-1)
 
static Thing TestCreate ()
 
static Thing CreateCurrency (int a, string id="money")
 
static Thing CreateParcel (string idLang=null, params Thing[] things)
 
static Thing Create (string id, int idMat=-1, int lv=-1)
 
static Thing Create (string id, string idMat)
 
static Thing CreateFromFilter (string id, int lv=-1)
 
static Thing CreateRawMaterial (SourceMaterial.Row m)
 
static Thing CreateFromCategory (string idCat, int lv=-1)
 
static Thing CreateFromTag (string idTag, int lv=-1)
 
static Thing CreateBill (int pay, bool tax)
 
static Thing CreateBlock (int id, int idMat)
 
static Thing CreateFloor (int id, int idMat, bool platform=false)
 
static Thing CreateObj (int id, int idMat)
 
static Thing CreateMap (string idSource=null, int lv=-1)
 
static Thing CreatePlan (int ele)
 
static Thing CreateRecipe (string id)
 
static Thing CreateSpellbook (string alias, int num=1)
 
static Thing CreateSpellbook (int ele, int num=1)
 
static Thing CreateScroll (int ele, int num=1)
 
static Thing CreatePotion (int ele, int num=1)
 
static Thing CreatePerfume (int ele, int num=1)
 
static Thing CreateLetter (string idLetter)
 
static Thing CreateCardboardBox (int uidZone=-1)
 
static Thing CreateTreasure (string id, int lv, TreasureType type=TreasureType.Map)
 
static void CreateTreasureContent (Thing t, int lv, TreasureType type, bool clearContent)
 
static void TryLickChest (Thing chest)
 
- Static Public Member Functions inherited from EClass
static int rnd (int a)
 
static int curve (int a, int start, int step, int rate=75)
 
static int rndHalf (int a)
 
static float rndf (float a)
 
static int rndSqrt (int a)
 
static void Wait (float a, Card c)
 
static void Wait (float a, Point p)
 
static int Bigger (int a, int b)
 
static int Smaller (int a, int b)
 

Additional Inherited Members

- Static Public Attributes inherited from EClass
static Core core
 
- Properties inherited from EClass
static Game game [get]
 
static bool AdvMode [get]
 
static Player player [get]
 
static Chara pc [get]
 
static UI ui [get]
 
static Map _map [get]
 
static Zone _zone [get]
 
static FactionBranch Branch [get]
 
static FactionBranch BranchOrHomeBranch [get]
 
static Faction Home [get]
 
static Faction Wilds [get]
 
static Scene scene [get]
 
static BaseGameScreen screen [get]
 
static GameSetting setting [get]
 
static GameData gamedata [get]
 
static ColorProfile Colors [get]
 
static World world [get]
 
static SourceManager sources [get]
 
static SourceManager editorSources [get]
 
static SoundManager Sound [get]
 
static CoreDebug debug [get]
 

Detailed Description

Definition at line 4 of file ThingGen.cs.

Member Function Documentation

◆ _Create()

static Thing ThingGen._Create ( string  id,
int  idMat = -1,
int  lv = -1 
)
inlinestatic

Definition at line 6 of file ThingGen.cs.

7 {
8 Thing thing = new Thing();
9 CardRow s = EClass.sources.cards.map.TryGetValue(id);
10 if (s == null)
11 {
12 Debug.LogError("exception: Item not found:" + id);
13 id = "869";
14 s = EClass.sources.cards.map.TryGetValue(id);
15 }
16 if (s.isOrigin)
17 {
18 id = SpawnListThing.Get("origin_" + id, (SourceThing.Row a) => a.origin == s).Select(lv)?.id ?? EClass.sources.cards.rows.Where((CardRow a) => a.origin == s).First().id;
19 }
20 if (lv < 1)
21 {
22 lv = 1;
23 }
24 thing.Create(id, idMat, lv);
25 if (thing.trait is TraitAmmo)
26 {
27 thing.SetNum(EClass.rnd(20) + 10);
28 }
29 return thing;
30 }
CardRow origin
Definition: CardRow.cs:49
string id
Definition: CardRow.cs:7
bool isOrigin
Definition: CardRow.cs:52
Thing SetNum(int a)
Definition: Card.cs:3242
Trait trait
Definition: Card.cs:49
void Create(string _id, int _idMat=-1, int genLv=-1)
Definition: Card.cs:2574
Definition: EClass.cs:5
static int rnd(int a)
Definition: EClass.cs:50
static SourceManager sources
Definition: EClass.cs:42
List< CardRow > rows
Definition: SourceCard.cs:6
Dictionary< string, CardRow > map
Definition: SourceCard.cs:8
SourceCard cards
static SpawnList Get(string id, Func< SourceThing.Row, bool > func)
CardRow Select(int lv=-1, int levelRange=-1)
Definition: SpawnList.cs:139
Definition: Thing.cs:8

References SourceManager.cards, Card.Create(), Debug, SpawnListThing.Get(), CardRow.id, CardRow.isOrigin, SourceCard.map, CardRow.origin, EClass.rnd(), SourceCard.rows, SpawnList.Select(), Card.SetNum(), EClass.sources, and Card.trait.

Referenced by Create(), CreateFromCategory(), CreateFromFilter(), CreateFromTag(), and TestCreate().

◆ Create() [1/2]

static Thing ThingGen.Create ( string  id,
int  idMat = -1,
int  lv = -1 
)
inlinestatic

Definition at line 53 of file ThingGen.cs.

54 {
55 return _Create(id, idMat, lv);
56 }
static Thing _Create(string id, int idMat=-1, int lv=-1)
Definition: ThingGen.cs:6

References _Create().

Referenced by Game._Create(), InvOwnerRecycle._OnProcess(), TraitGodStatue._OnUse(), TraitShrine._OnUse(), Card.Add(), ThingContainer.AddCurrency(), Card.AddThing(), Zone.AddThing(), GameDate.AdvanceDay(), GameDate.AdvanceYear(), RecipeCard.Build(), DropdownGrid.BuildIngredients(), Map.Burn(), AI_Shopping.Buy(), Zone.ClaimZone(), DramaOutcome.convert_Jure(), TraitCrafter.Craft(), RecipeCard.Craft(), Create(), CreateBill(), CreateBlock(), SourceMaterial.Row.CreateByProduct(), CreateCardboardBox(), CreateCurrency(), InvOwner.CreateDefaultContainer(), InvOwnerChangeMaterial.CreateDefaultContainer(), Player.CreateEquip(), CreateFloor(), CreateLetter(), CreateMap(), RecipeCard.CreateMold(), CreateObj(), CreateParcel(), CreatePerfume(), CreatePlan(), CreatePotion(), CreateRawMaterial(), CreateRecipe(), CreateScroll(), CreateSpellbook(), Trait.CreateStock(), CreateTreasure(), CreateTreasureContent(), FactionBranch.DailyOutcome(), QuestDeliver.Deliver(), Card.Die(), Chara.DoHostileAction(), Map.DropBlockComponent(), Recipe.DropIngredients(), Quest.DropReward(), Card.Duplicate(), Card.EjectSockets(), Chara.EQ_ID(), Chara.EQ_Item(), ZonePreEnterBoutWin.Execute(), ZonePreEnterDigStairs.Execute(), DramaOutcome.fiama_gold(), DramaOutcome.fiama_starter_gift(), AI_Fuck.Finish(), CoreDebug.Fix_LostCore(), CoreDebug.Fix_LoytelDebt(), Zone.Generate(), FactionBranch.GenerateGarbage(), DNA.GenerateGene(), Zone_SnowGrave.GenerateGrave(), DramaOutcome.get_scratch(), FactionBranch.GetDailyIncome(), AI_Shear.GetFur(), FortuneRollData.GetPrize(), MiniGame.GetSlotReward(), DramaOutcome.give_sketch_reward(), QuestDebt.GiveBill(), QuestDebt.GiveReward(), TaskHarvest.HarvestThing(), DramaOutcome.ListFelmeraBarter(), CraftUtil.MakeDish(), Chara.MakeEgg(), AI_Fish.Makefish(), Chara.MakeGrave(), Chara.MakeMilk(), TraitSeed.MakeRandomSeed(), AI_OpenGambleChest.MakeReward(), TraitSeed.MakeSeed(), Map.MineBlock(), Map.MineObj(), CraftUtil.MixIngredients(), Chara.MutateRandom(), DramaOutcome.nerun_gift(), DramaOutcome.nerun_gift2(), DramaOutcome.nerun_gift3(), Faction.OnAdvanceMonth(), Trait.OnBarter(), QuestVernis.OnChangePhase(), TraitBrewery.OnChildDecay(), ContentCodex.OnClickGetCard(), FactionBranch.OnCreate(), TaskChopWood.OnCreateProgress(), TaskHarvest.OnCreateProgress(), QuestCraft.OnDropReward(), QuestDefense.OnDropReward(), QuestRandom.OnDropReward(), ZoneEventSiege.OnFirstTick(), Zone_TestRoom.OnGenerateMap(), MapGenDungen.OnGenerateTerrain(), GrowSystem.OnMineObj(), GrowSystemFlower.OnMineObj(), GrowSystemHerb.OnMineObj(), GrowSystemWeed.OnMineObj(), GrowSystemWheat.OnMineObj(), QuestCraft.OnProgressComplete(), TaskDig.OnProgressComplete(), TaskMine.OnProgressComplete(), FactionBranch.OnSimulateDay(), QuestDebt.OnStart(), QuestDeliver.OnStart(), QuestFiamaLock.OnStart(), TraitGiftJure.OnUse(), TraitGiftNewYear.OnUse(), TraitGiftPack.OnUse(), TraitPlamoBox.OnUse(), TraitStairsLocked.OnUse(), TraitPotionEmpty.OnUse(), ZoneEventDefenseGame.OnVisit(), DramaManager.ParseLine(), InvOwnerDeliver.PayBill(), ActDreamBug.Perform(), Chara.PickOrDrop(), Zone_Dungeon.PlaceRail(), TraitGacha.PlayGacha(), GrowSystem.PopHarvest(), GenRoom.Populate(), TraitBaseContainer.Prespawn(), TraitContainerCurrency.Prespawn(), TraitToolBelt.Prespawn(), FoodEffect.Proc(), ActEffect.Proc(), Religion.Punish(), Religion.PunishTakeOver(), TraitBaseContainer.PutChara(), DramaOutcome.PutOutFire(), DramaOutcome.QuestDefense_1(), DramaOutcome.QuestSharedContainer_Drop1(), CoreDebug.QuickStart(), FactionBranch.ReceivePackages(), Religion.Reforge(), Chara.RestockEquip(), Chara.RestockInventory(), SerializedCards.Restore(), AI_Craft_Snowman.Run(), AI_Idle.Run(), AI_OpenGambleChest.Run(), AI_PlayMusic.Run(), AI_Steal.Run(), TaskCullLife.Run(), CoreDebug.SetStartStockpile(), GameDate.ShipGoods(), GameDate.ShipLetter(), GameDate.ShipRandomPackages(), Chara.ShowDialog(), CoreDebug.Spawn(), Zone.SpawnAltar(), Card.SpawnLoot(), Zone.SpawnLostItems(), AI_PlayMusic.ThrowReward(), BiomeProfile.ClusterThing.TryCreate(), TraitSwitch.TryDisarmTrap(), Zone.TryGenerateShrine(), Recipe.TryGetFirstTimeBonus(), GrowSystem.TryPick(), Chara.TryPoisonPotion(), Map.TryShatter(), DramaOutcome.Tutorial1(), TraitFoodEgg.Update(), ActionMode.UpdateInput(), CoreDebug.UpdateInput(), Chara.Vomit(), and ActEffect.Wish().

◆ Create() [2/2]

static Thing ThingGen.Create ( string  id,
string  idMat 
)
inlinestatic

Definition at line 58 of file ThingGen.cs.

59 {
60 return Create(id, idMat.IsEmpty() ? (-1) : EClass.sources.materials.alias[idMat].id);
61 }
SourceMaterial materials
static Thing Create(string id, int idMat=-1, int lv=-1)
Definition: ThingGen.cs:53

References Create(), SourceManager.materials, and EClass.sources.

◆ CreateBill()

static Thing ThingGen.CreateBill ( int  pay,
bool  tax 
)
inlinestatic

Definition at line 85 of file ThingGen.cs.

86 {
87 Thing thing = Create(tax ? "bill_tax" : "bill");
88 thing.c_bill = pay;
89 if (tax)
90 {
91 EClass.player.stats.taxBills += thing.c_bill;
93 }
94 else
95 {
96 EClass.player.unpaidBill += thing.c_bill;
97 }
98 return thing;
99 }
int c_bill
Definition: Card.cs:1217
static Player player
Definition: EClass.cs:12
int taxBills
Definition: Player.cs:715

References Card.c_bill, Create(), EClass.player, and Player.taxBills.

Referenced by Faction.OnAdvanceMonth(), and GameDate.ShipPackages().

◆ CreateBlock()

static Thing ThingGen.CreateBlock ( int  id,
int  idMat 
)
inlinestatic

Definition at line 101 of file ThingGen.cs.

102 {
103 Thing thing = Create(EClass.sources.blocks.rows[id].idThing, idMat);
104 thing.refVal = id;
105 return thing;
106 }
SourceBlock blocks

References SourceManager.blocks, Create(), and EClass.sources.

Referenced by Recipe.Craft(), Map.DropBlockComponent(), and CoreDebug.QuickStart().

◆ CreateCardboardBox()

static Thing ThingGen.CreateCardboardBox ( int  uidZone = -1)
inlinestatic

Definition at line 191 of file ThingGen.cs.

192 {
193 Thing thing = Create("cardboard_box", new string[5] { "pine", "wood_birch", "wood_acacia", "oak", "cedar" }.RandomItem());
194 thing.things.DestroyAll();
195 Spatial spatial = ((uidZone == -1) ? null : EClass.game.spatials.map.TryGetValue(uidZone));
196 if (spatial != null)
197 {
198 thing.c_idRefName = "sender_header".lang("sender_post".lang(spatial.Name));
199 }
200 return thing;
201 }
ThingContainer things
Definition: Card.cs:34
static Game game
Definition: EClass.cs:8
SpatialManager spatials
Definition: Game.cs:152
GlobalSpatialList map
virtual string Name
Definition: Spatial.cs:495
void DestroyAll(Func< Thing, bool > funcExclude=null)

References Create(), ThingContainer.DestroyAll(), EClass.game, SpatialManager.map, Spatial.Name, Game.spatials, and Card.things.

Referenced by GameDate.ShipPackages(), and GameDate.ShipRandomPackages().

◆ CreateCurrency()

static Thing ThingGen.CreateCurrency ( int  a,
string  id = "money" 
)
inlinestatic

Definition at line 37 of file ThingGen.cs.

38 {
39 return Create(id).SetNum(a);
40 }

References Create(), and Card.SetNum().

Referenced by Chara.ApplyDeathPenalty(), Player.CreateEquip(), QuestRandom.OnDropReward(), and TraitFarmChest.OnUse().

◆ CreateFloor()

static Thing ThingGen.CreateFloor ( int  id,
int  idMat,
bool  platform = false 
)
inlinestatic

Definition at line 108 of file ThingGen.cs.

109 {
110 _ = EClass.sources.floors.rows[id];
111 Thing thing = Create(platform ? "platform" : "floor", idMat);
112 thing.refVal = id;
113 return thing;
114 }
SourceFloor floors

References Create(), SourceManager.floors, and EClass.sources.

Referenced by Recipe.Craft(), Map.DropBlockComponent(), and CoreDebug.QuickStart().

◆ CreateFromCategory()

◆ CreateFromFilter()

static Thing ThingGen.CreateFromFilter ( string  id,
int  lv = -1 
)
inlinestatic

Definition at line 63 of file ThingGen.cs.

64 {
65 return _Create(SpawnList.Get(id).Select(lv).id, -1, lv);
66 }
static SpawnList Get(string id, string parent=null, CardFilter filter=null)
Definition: SpawnList.cs:18

References _Create(), SpawnList.Get(), CardRow.id, and SpawnList.Select().

Referenced by Trait.CreateStock(), CreateTreasureContent(), QuestDefenseGame.OnInit(), TraitBaseContainer.Prespawn(), SerializedCards.Restore(), AI_Steal.Run(), and Card.SpawnLoot().

◆ CreateFromTag()

static Thing ThingGen.CreateFromTag ( string  idTag,
int  lv = -1 
)
inlinestatic

Definition at line 80 of file ThingGen.cs.

81 {
82 return _Create(SpawnListThing.Get("tag_" + idTag, (SourceThing.Row s) => s.tag.Contains(idTag)).Select(lv).id, -1, lv);
83 }

References _Create(), SpawnListThing.Get(), CardRow.id, and SpawnList.Select().

Referenced by FactionBranch.GenerateGarbage(), and GameDate.ShipRandomPackages().

◆ CreateLetter()

static Thing ThingGen.CreateLetter ( string  idLetter)
inlinestatic

Definition at line 184 of file ThingGen.cs.

185 {
186 Thing thing = Create("letter");
187 thing.SetStr(53, idLetter);
188 return thing;
189 }
void SetStr(int id, string value=null)
Definition: BaseCard.cs:63

References Create(), and BaseCard.SetStr().

Referenced by TraitGiftJure.OnUse().

◆ CreateMap()

static Thing ThingGen.CreateMap ( string  idSource = null,
int  lv = -1 
)
inlinestatic

Definition at line 124 of file ThingGen.cs.

125 {
126 if (idSource.IsEmpty())
127 {
129 }
130 if (lv == -1)
131 {
132 lv = 1 + EClass.rnd(EClass.rnd(50) + 1);
133 }
134 return Create("map");
135 }
new World world
Definition: Game.cs:173
SourceZone.Row GetRandomSiteSource()
Definition: Region.cs:159
Region region
Definition: World.cs:23

References Create(), EClass.game, Region.GetRandomSiteSource(), World.region, EClass.rnd(), and Game.world.

Referenced by Trait.CreateStock().

◆ CreateObj()

static Thing ThingGen.CreateObj ( int  id,
int  idMat 
)
inlinestatic

Definition at line 116 of file ThingGen.cs.

117 {
118 _ = EClass.sources.objs.rows[id];
119 Thing thing = Create("obj", idMat);
120 thing.refVal = id;
121 return thing;
122 }
SourceObj objs

References Create(), SourceManager.objs, and EClass.sources.

Referenced by Recipe.Craft().

◆ CreateParcel()

static Thing ThingGen.CreateParcel ( string  idLang = null,
params Thing[]  things 
)
inlinestatic

Definition at line 42 of file ThingGen.cs.

43 {
44 Thing thing = Create("parcel");
45 foreach (Thing c in things)
46 {
47 thing.AddCard(c);
48 }
49 thing.c_idRefName = idLang.lang();
50 return thing;
51 }
Card AddCard(Card c)
Definition: Card.cs:2887

References Create().

Referenced by GameDate.AdvanceDay(), Chara.MutateRandom(), Faction.OnAdvanceMonth(), and InvOwnerDeliver.PayBill().

◆ CreatePerfume()

static Thing ThingGen.CreatePerfume ( int  ele,
int  num = 1 
)
inlinestatic

Definition at line 177 of file ThingGen.cs.

178 {
179 Thing thing = Create("perfume").SetNum(num);
180 thing.refVal = ele;
181 return thing;
182 }

References Create(), and Card.SetNum().

Referenced by Trait.OnBarter().

◆ CreatePlan()

static Thing ThingGen.CreatePlan ( int  ele)
inlinestatic

Definition at line 137 of file ThingGen.cs.

138 {
139 Thing thing = Create("book_plan");
140 thing.refVal = ele;
141 return thing;
142 }

References Create().

Referenced by Trait.OnBarter().

◆ CreatePotion()

static Thing ThingGen.CreatePotion ( int  ele,
int  num = 1 
)
inlinestatic

Definition at line 170 of file ThingGen.cs.

171 {
172 Thing thing = Create("1163").SetNum(num);
173 thing.refVal = ele;
174 return thing;
175 }

References Create(), and Card.SetNum().

Referenced by Trait.OnBarter(), and QuestVernis.OnChangePhase().

◆ CreateRawMaterial()

static Thing ThingGen.CreateRawMaterial ( SourceMaterial::Row  m)
inlinestatic

Definition at line 68 of file ThingGen.cs.

69 {
70 Thing thing = Create(m.thing);
71 thing.ChangeMaterial(m.id);
72 return thing;
73 }
Card ChangeMaterial(int idNew, bool ignoreFixedMaterial=false)
Definition: Card.cs:2838

References Card.ChangeMaterial(), and Create().

Referenced by SourceMaterial.Row.CreateByProduct(), Map.MineFloor(), and DramaOutcome.QuestCraft_Drop1().

◆ CreateRecipe()

static Thing ThingGen.CreateRecipe ( string  id)
inlinestatic

Definition at line 144 of file ThingGen.cs.

145 {
146 Thing thing = Create("rp_random");
147 thing.SetStr(53, id);
148 return thing;
149 }

References Create(), and BaseCard.SetStr().

Referenced by Trait.OnBarter(), QuestCrafter.OnDropReward(), QuestDialog.OnDropReward(), TraitGiftJure.OnUse(), and DramaOutcome.QuestVernis_DropRecipe().

◆ CreateScroll()

◆ CreateSpellbook() [1/2]

static Thing ThingGen.CreateSpellbook ( int  ele,
int  num = 1 
)
inlinestatic

Definition at line 156 of file ThingGen.cs.

157 {
158 Thing thing = Create("spellbook").SetNum(num);
159 thing.refVal = ele;
160 return thing;
161 }

References Create(), and Card.SetNum().

◆ CreateSpellbook() [2/2]

static Thing ThingGen.CreateSpellbook ( string  alias,
int  num = 1 
)
inlinestatic

Definition at line 151 of file ThingGen.cs.

152 {
153 return CreateSpellbook(EClass.sources.elements.alias[alias].id, num);
154 }
SourceElement elements
static Thing CreateSpellbook(string alias, int num=1)
Definition: ThingGen.cs:151

References CreateSpellbook(), SourceManager.elements, and EClass.sources.

Referenced by Player.CreateEquip(), CreateSpellbook(), Trait.OnBarter(), and Chara.RestockEquip().

◆ CreateTreasure()

static Thing ThingGen.CreateTreasure ( string  id,
int  lv,
TreasureType  type = TreasureType::Map 
)
inlinestatic

Definition at line 203 of file ThingGen.cs.

204 {
205 Thing thing = Create(id, -1, lv);
206 CreateTreasureContent(thing, lv, type, clearContent: true);
207 return thing;
208 }
static void CreateTreasureContent(Thing t, int lv, TreasureType type, bool clearContent)
Definition: ThingGen.cs:210

References Create(), and CreateTreasureContent().

Referenced by FactionBranch.DailyOutcome(), and Chara.TryDropBossLoot().

◆ CreateTreasureContent()

static void ThingGen.CreateTreasureContent ( Thing  t,
int  lv,
TreasureType  type,
bool  clearContent 
)
inlinestatic

Definition at line 210 of file ThingGen.cs.

211 {
212 int miracleChance = lv;
213 int num = EClass.curve(lv, 20, 15);
214 bool flag = true;
215 bool flag2 = true;
216 int guaranteedMythical = ((type == TreasureType.BossQuest) ? 1 : 0);
217 ChangeSeed();
218 t.AddEditorTag(EditorTag.PreciousContainer);
219 if (clearContent)
220 {
221 t.things.DestroyAll();
222 }
223 switch (type)
224 {
225 case TreasureType.Map:
226 miracleChance += 50;
227 t.Add("money", EClass.rndHalf(1000 + num * 100));
228 t.Add("money2", EClass.rndHalf(Mathf.Min(3 + num / 10, 10)));
229 t.Add("medal", EClass.rnd(3));
230 break;
231 case TreasureType.BossNefia:
232 case TreasureType.BossQuest:
233 t.Add("money", EClass.rndHalf(500 + num * 50));
234 t.Add("plat", EClass.rndHalf(Mathf.Min(3 + num / 10, 15)));
235 t.Add("rp_random", 1, lv);
236 if (EClass.rnd(5) == 0)
237 {
238 t.Add("medal", EClass.rnd(3));
239 }
240 else if (EClass.rnd(3) == 0)
241 {
242 t.Add("map_treasure", 1, EClass.rndHalf(lv + 10));
243 }
244 else
245 {
246 t.Add("book_skill", 1, lv);
247 }
248 t.c_lockLv /= 2;
249 break;
250 case TreasureType.RandomChest:
251 flag2 = false;
252 miracleChance /= 2;
253 if (miracleChance > 50)
254 {
255 miracleChance = 50;
256 }
257 if (EClass.rnd(2) == 0)
258 {
259 t.Add("money", EClass.rndHalf(10 + num * 25));
260 }
261 else if (EClass.rnd(2) == 0)
262 {
263 t.Add("money2", 1 + EClass.rnd(Mathf.Min(2 + num / 25, 5)));
264 }
265 else
266 {
267 t.Add("plat", 1 + EClass.rnd(Mathf.Min(2 + num / 25, 5)));
268 }
270 {
271 flag = false;
272 break;
273 }
274 if (EClass.rnd(10) == 0)
275 {
276 t.Add("map_treasure", 1, EClass.rndHalf(lv + 10));
277 }
278 if (EClass.rnd(3) == 0)
279 {
280 t.AddCard(Create("rp_random", -1, lv));
281 }
282 if (t.c_lockLv > 0 && EClass.rnd(3) == 0)
283 {
284 t.Add("medal");
285 }
286 break;
287 }
288 if (type == TreasureType.RandomChest && EClass.rnd(2) == 0)
289 {
290 t.AddCard(CreateFromCategory("junk", lv));
291 }
292 else if (EClass.rnd(3) == 0)
293 {
294 t.Add("rp_random", 1, lv);
295 }
296 else if (type != TreasureType.Map && EClass.rnd(2) == 0)
297 {
298 Thing thing = CreateFromCategory("furniture", lv);
299 if (!thing.IsContainer && (t.c_lockLv == 0 || thing.SelfWeight < 10000))
300 {
301 t.AddCard(thing);
302 }
303 }
304 else
305 {
306 t.AddCard(CreateFromCategory("junk", lv));
307 }
308 if (EClass.rnd(3) == 0)
309 {
310 t.Add("book_ancient", 1, lv);
311 }
312 if (t.c_lockLv > 0)
313 {
314 miracleChance += 20 + (int)Mathf.Sqrt(t.c_lockLv * 5);
315 }
316 if (flag)
317 {
318 SetRarity(100);
319 t.AddCard(CreateFromFilter("eq", lv));
320 if (flag2)
321 {
322 SetRarity(20);
323 t.AddCard(CreateFromFilter("eq", lv));
324 }
325 }
326 Rand.SetSeed();
327 static void ChangeSeed()
328 {
331 }
332 void SetRarity(int mtp)
333 {
334 ChangeSeed();
335 Rarity rarity = ((miracleChance * mtp / 100 < EClass.rnd(100)) ? Rarity.Superior : ((EClass.rnd(20) == 0) ? Rarity.Mythical : Rarity.Legendary));
336 if (guaranteedMythical > 0)
337 {
338 guaranteedMythical--;
339 rarity = Rarity.Mythical;
340 }
342 {
343 rarity = rarity
344 });
345 }
346 }
EditorTag
Definition: EditorTag.cs:2
Rarity
Definition: Rarity.cs:2
TreasureType
Definition: TreasureType.cs:2
static void Set(CardBlueprint _bp)
int c_lockLv
Definition: Card.cs:924
void AddEditorTag(EditorTag tag)
Definition: Card.cs:2465
Thing Add(string id, int num=1, int lv=1)
Definition: Card.cs:2878
bool IsContainer
Definition: Card.cs:1965
static int curve(int a, int start, int step, int rate=75)
Definition: EClass.cs:55
static Zone _zone
Definition: EClass.cs:20
static int rndHalf(int a)
Definition: EClass.cs:74
int seed
Definition: Game.cs:197
int seedChest
Definition: Player.cs:751
Definition: Rand.cs:4
static void SetSeed(int a=-1)
Definition: Rand.cs:37
static Thing CreateFromFilter(string id, int lv=-1)
Definition: ThingGen.cs:63
static Thing CreateFromCategory(string idCat, int lv=-1)
Definition: ThingGen.cs:75
override int SelfWeight
Definition: Thing.cs:62

References EClass._zone, Card.Add(), Card.AddCard(), Card.AddEditorTag(), Card.c_lockLv, Create(), CreateFromCategory(), CreateFromFilter(), EClass.curve(), ThingContainer.DestroyAll(), EClass.game, Card.IsContainer, EClass.player, EClass.rnd(), EClass.rndHalf(), Game.seed, Player.seedChest, Thing.SelfWeight, CardBlueprint.Set(), Rand.SetSeed(), and Card.things.

Referenced by CreateTreasure(), Trait.OnBarter(), and TraitChest.Prespawn().

◆ TestCreate()

static Thing ThingGen.TestCreate ( )
inlinestatic

Definition at line 32 of file ThingGen.cs.

33 {
34 return _Create(SpawnList.Get("thing").Select().id);
35 }

References _Create(), SpawnList.Get(), CardRow.id, and SpawnList.Select().

Referenced by CoreDebug.UpdateInput().

◆ TryLickChest()

static void ThingGen.TryLickChest ( Thing  chest)
inlinestatic

Definition at line 348 of file ThingGen.cs.

349 {
350 foreach (Chara chara in EClass._map.charas)
351 {
352 if (!chara.HasElement(1412) || chara.Dist(chest) >= 5)
353 {
354 continue;
355 }
356 chara.Say("lick", chara, chest);
357 chest.PlaySound("offering");
358 chest.PlayEffect("mutation");
359 {
360 foreach (Thing thing in chest.things)
361 {
362 thing.TryLickEnchant(chara, msg: false);
363 }
364 break;
365 }
366 }
367 }
bool HasElement(int ele, int req=1)
Definition: Card.cs:5214
SoundSource PlaySound(string id, float v=1f, bool spatial=true)
Definition: Card.cs:5404
Effect PlayEffect(string id, bool useRenderPos=true, float range=0f, Vector3 fix=default(Vector3))
Definition: Card.cs:5438
int Dist(Card c)
Definition: Card.cs:6777
void Say(string lang, string ref1=null, string ref2=null)
Definition: Card.cs:6046
Definition: Chara.cs:10
static Map _map
Definition: EClass.cs:18
List< Chara > charas
Definition: Map.cs:81
void TryLickEnchant(Chara c, bool msg=true, Chara tg=null, BodySlot slot=null)
Definition: Thing.cs:1892

References EClass._map, Map.charas, Card.Dist(), Card.HasElement(), Card.Say(), Card.things, and Thing.TryLickEnchant().

Referenced by Chara.TryDropBossLoot().


The documentation for this class was generated from the following file: