15 public override string ToString()
17 string[] array =
new string[5];
21 Point point = this.pos;
22 array[num] = ((point !=
null) ? point.ToString() :
null);
26 array[num2] = ((cardParent !=
null) ? cardParent.ToString() :
null);
27 return string.Concat(array);
31 public bool CanReserve(
AIAct act)
33 return this.reservedAct ==
null || this.reservedAct == act || !this.reservedAct.IsRunning;
37 public bool TryReserve(
AIAct act)
39 if (this.CanReserve(act))
41 this.reservedAct = act;
49 public Card parentCard
53 return this.parent as
Card;
59 public Thing parentThing
63 return this.parent as
Thing;
73 if (this._colorInt == 0)
77 return this._colorInt;
87 return this.invY == 1;
102 this._ints[1] = value;
109 public int idMaterial
113 return this._ints[4];
117 this._ints[4] = value;
128 return this._ints[5];
132 this._ints[5] = value;
143 return this._ints[6];
147 this._ints[6] = value;
158 return this._ints[7];
162 this._ints[7] = value;
173 return this._ints[9];
177 this._ints[9] = value;
188 return this._ints[11];
192 this._ints[11] = value;
203 return this._ints[12];
207 this._ints[12] = value;
218 return this._ints[13];
222 this._ints[13] = value;
233 return this._ints[14];
237 this._ints[14] = value;
248 return 0.001f * (float)this._ints[15];
252 this._ints[15] = (int)(value * 1000f);
263 return 0.001f * (float)this._ints[16];
267 this._ints[16] = (int)(value * 1000f);
274 public BlessedState blessedState
278 return this._ints[17].ToEnum<BlessedState>();
282 this._ints[17] = (int)value;
289 public PlaceState _placeState
293 return this._ints[18].ToEnum<PlaceState>();
297 this._ints[18] = (int)value;
308 return this._ints[19];
312 this._ints[19] = value;
323 return (this._ints[19] / 100).ToEnum<Rarity>();
327 this._ints[19] = (int)(value * (Rarity)100);
338 return this._ints[20];
342 this._ints[20] = value;
353 return this._ints[21];
357 this._ints[21] = value;
368 return this._ints[22];
372 this._ints[22] = value;
383 return this._ints[23];
387 this._ints[23] = value;
398 return this._ints[24];
402 this._ints[24] = value;
413 return this._ints[25];
417 this._ints[25] = value;
428 return this._ints[26];
432 this._ints[26] = value;
439 public int qualityTier
443 return this._ints[27];
447 this._ints[27] = value;
454 public bool isCensored
458 return this._bits1[1];
462 this._bits1[1] = value;
469 public bool isDeconstructing
473 return this._bits1[2];
477 this._bits1[2] = value;
488 return this._bits1[3];
492 this._bits1[3] = value;
499 public bool isModified
503 return this._bits1[4];
507 this._bits1[4] = value;
518 return this._bits1[5];
522 this._bits1[5] = value;
529 public bool isPlayerCreation
533 return this._bits1[6];
537 this._bits1[6] = value;
544 public bool ignoreAutoPick
548 return this._bits1[7];
552 this._bits1[7] = value;
563 return this._bits1[8];
567 this._bits1[8] = value;
578 return this._bits1[9];
582 this._bits1[9] = value;
593 return this._bits1[10];
597 this._bits1[10] = value;
604 public bool isNPCProperty
608 return this._bits1[11];
612 this._bits1[11] = value;
619 public bool isRestrained
623 return this._bits1[12];
627 this._bits1[12] = value;
634 public bool isRoofItem
638 return this._bits1[13];
642 this._bits1[13] = value;
653 return this._bits1[14];
657 this._bits1[14] = value;
664 public bool disableAutoToggle
668 return this._bits1[15];
672 this._bits1[15] = value;
679 public bool isImported
683 return this._bits1[16];
687 this._bits1[16] = value;
694 public bool autoRefuel
698 return this._bits1[17];
702 this._bits1[17] = value;
709 public bool ignoreStackHeight
713 return this._bits1[18];
717 this._bits1[18] = value;
724 public bool isFloating
728 return this._bits1[19];
732 this._bits1[19] = value;
739 public bool isWeightChanged
743 return this._bits1[20];
747 this._bits1[20] = value;
754 public bool isFireproof
758 return this._bits1[21];
762 this._bits1[21] = value;
769 public bool isAcidproof
773 return this._bits1[22];
777 this._bits1[22] = value;
784 public bool isReplica
788 return this._bits1[23];
792 this._bits1[23] = value;
803 return this._bits1[24];
807 this._bits1[24] = value;
814 public bool isElemental
818 return this._bits1[25];
822 this._bits1[25] = value;
833 return this._bits1[26];
837 this._bits1[26] = value;
844 public bool isSubsetCard
848 return this._bits1[27];
852 this._bits1[27] = value;
863 return this._bits1[28];
867 this._bits1[28] = value;
878 return this._bits1[29];
882 this._bits1[29] = value;
893 return this._bits1[30];
897 this._bits1[30] = value;
904 public bool isCrafted
908 return this._bits1[31];
912 this._bits1[31] = value;
919 public bool isLostProperty
923 return this._bits2[0];
927 this._bits2[0] = value;
938 return this._bits2[1];
942 this._bits2[1] = value;
953 return this._bits2[2];
957 this._bits2[2] = value;
964 public bool isLeashed
968 return this._bits2[3];
972 this._bits2[3] = value;
983 return this._bits2[4];
987 this._bits2[4] = value;
998 return this._bits2[5];
1002 this._bits2[5] = value;
1013 return this._bits2[6];
1017 this._bits2[6] = value;
1024 public bool isRestocking
1028 return this._bits2[7];
1032 this._bits2[7] = value;
1038 public bool isBackerContent
1042 return this.c_idBacker != 0;
1052 if (!this.isBackerContent)
1056 return EClass.sources.backers.map.TryGetValue(this.c_idBacker,
null);
1063 this.isModified =
true;
1069 public BedType c_bedType
1073 return base.GetInt(9,
null).ToEnum<BedType>();
1077 base.SetInt(9, (
int)value);
1084 public int c_equippedSlot
1088 return base.GetInt(6,
null);
1092 base.SetInt(6, value);
1103 return base.GetInt(50,
null);
1107 base.SetInt(50, value);
1114 public Hostility c_originalHostility
1118 return base.GetInt(12,
null).ToEnum<Hostility>();
1122 base.SetInt(12, (
int)value);
1129 public MinionType c_minionType
1133 return base.GetInt(61,
null).ToEnum<MinionType>();
1137 base.SetInt(61, (
int)value);
1148 return base.GetInt(13,
null);
1152 base.SetInt(13, value);
1159 public bool c_isImportant
1163 return base.GetInt(109,
null) != 0;
1167 base.SetInt(109, value ? 1 : 0);
1174 public bool c_lockedHard
1178 return base.GetInt(63,
null) != 0;
1182 base.SetInt(63, value ? 1 : 0);
1189 public bool c_revealLock
1193 return base.GetInt(64,
null) != 0;
1197 base.SetInt(64, value ? 1 : 0);
1204 public bool c_isTrained
1208 return base.GetInt(120,
null) != 0;
1212 base.SetInt(120, value ? 1 : 0);
1219 public bool c_isPrayed
1223 return base.GetInt(121,
null) != 0;
1227 base.SetInt(121, value ? 1 : 0);
1234 public int c_lightColor
1238 return base.GetInt(5,
null);
1243 base.SetInt(5, value);
1249 public Color LightColor
1253 return new Color((
float)(this.c_lightColor / 1024 * 8) / 256f, (
float)(this.c_lightColor % 1024 / 32 * 8) / 256f, (
float)(this.c_lightColor % 32 * 8) / 256f, 1f);
1260 public int c_uidZone
1264 return base.GetInt(10,
null);
1269 base.SetInt(10, value);
1276 public int c_uidRefCard
1280 return base.GetInt(11,
null);
1285 base.SetInt(11, value);
1292 public int c_priceFix
1296 return base.GetInt(21,
null);
1300 base.SetInt(21, value);
1307 public int c_priceAdd
1311 return base.GetInt(29,
null);
1315 base.SetInt(29, value);
1326 return base.GetInt(3,
null);
1330 base.SetInt(3, value);
1337 public VisitorState visitorState
1341 return base.GetInt(4,
null).ToEnum<VisitorState>();
1345 base.SetInt(4, (
int)value);
1352 public RescueState c_rescueState
1356 return base.GetInt(53,
null).ToEnum<RescueState>();
1360 base.SetInt(53, (
int)value);
1367 public BossType c_bossType
1371 return base.GetInt(65,
null).ToEnum<BossType>();
1375 base.SetInt(65, (
int)value);
1382 public int c_dateStockExpire
1386 return base.GetInt(22,
null);
1390 base.SetInt(22, value);
1397 public int c_IDTState
1401 return base.GetInt(2,
null);
1405 base.SetInt(2, value);
1412 public int c_charges
1416 return base.GetInt(7,
null);
1420 base.SetInt(7, value);
1431 return base.GetInt(23,
null);
1435 base.SetInt(23, value);
1446 return base.GetInt(28,
null);
1450 base.SetInt(28, value);
1461 return base.GetInt(33,
null);
1465 base.SetInt(33, value);
1472 public int c_allowance
1476 return base.GetInt(114,
null);
1480 base.SetInt(114, value);
1491 return base.GetInt(62,
null);
1495 base.SetInt(62, value);
1502 public int c_containerSize
1506 return base.GetInt(8,
null);
1510 base.SetInt(8, value);
1521 return base.GetInt(1,
null);
1525 base.SetInt(1, value);
1532 public int c_diceDim
1536 return base.GetInt(14,
null);
1540 base.SetInt(14, value);
1547 public int c_indexContainerIcon
1551 return base.GetInt(15,
null);
1555 base.SetInt(15, value);
1562 public int c_idMainElement
1566 return base.GetInt(16,
null);
1570 base.SetInt(16, value);
1577 public int c_summonDuration
1581 return base.GetInt(17,
null);
1585 base.SetInt(17, value);
1592 public int c_idBacker
1596 return base.GetInt(52,
null);
1600 base.SetInt(52, value);
1607 public int c_uidMaster
1611 return base.GetInt(54,
null);
1615 base.SetInt(54, value);
1626 return base.GetInt(27,
null);
1630 base.SetInt(27, value);
1637 public int c_daysWithGod
1641 return base.GetInt(57,
null);
1645 base.SetInt(57, value);
1652 public string c_idPortrait
1656 return base.GetStr(9,
null);
1660 base.SetStr(9, value);
1667 public string c_idRace
1671 return base.GetStr(3,
null);
1675 base.SetStr(3, value);
1682 public string c_idJob
1686 return base.GetStr(4,
null);
1690 base.SetStr(4, value);
1697 public string c_idTone
1701 return base.GetStr(22,
null);
1705 base.SetStr(22, value);
1712 public string c_color
1716 return base.GetStr(8,
null);
1720 base.SetStr(8, value);
1727 public string c_idTalk
1731 return base.GetStr(21,
null);
1735 base.SetStr(21, value);
1742 public string c_idDeity
1746 return base.GetStr(26,
null);
1750 base.SetStr(26, value);
1757 public string c_altName
1761 return base.GetStr(1,
null);
1765 base.SetStr(1, value);
1772 public string c_altName2
1776 return base.GetStr(2,
null);
1780 base.SetStr(2, value);
1787 public string c_refText
1791 return base.GetStr(10,
null);
1795 base.SetStr(10, value);
1802 public string c_idRefName
1806 return base.GetStr(7,
null);
1810 base.SetStr(7, value);
1817 public string c_idRidePCC
1821 return base.GetStr(55,
null);
1825 base.SetStr(55, value);
1832 public string c_idAbility
1836 return base.GetStr(50,
null);
1840 base.SetStr(50, value);
1847 public string c_context
1851 return base.GetStr(20,
null);
1855 base.SetStr(20, value);
1862 public string c_idEditor
1866 return base.GetStr(27,
null);
1870 base.SetStr(27, value);
1877 public string c_editorTags
1881 return base.GetStr(28,
null);
1885 base.SetStr(28, value);
1892 public string c_editorTraitVal
1896 return base.GetStr(25,
null);
1900 base.SetStr(25, value);
1907 public string c_idTrait
1911 return base.GetStr(29,
null);
1915 base.SetStr(29, value);
1922 public string c_idRefCard
1926 return base.GetStr(5,
null);
1930 base.SetStr(5, value);
1937 public string c_idRefCard2
1941 return base.GetStr(6,
null);
1945 base.SetStr(6, value);
1952 public string c_note
1956 return base.GetStr(51,
null);
1960 base.SetStr(51, value);
1975 base.SetObj(6, value);
1982 public Thing ammoData
1986 return base.GetObj<
Thing>(9);
1990 base.SetObj(9, value);
1997 public Thing c_copyContainer
2001 return base.GetObj<
Thing>(10);
2005 base.SetObj(10, value);
2012 public Window.SaveData c_windowSaveData
2016 return base.GetObj<Window.SaveData>(2);
2020 base.SetObj(2, value);
2035 base.SetObj(11, value);
2050 base.SetObj(15, value);
2070 base.SetObj(12, value);
2081 return base.GetObj<
DNA>(14);
2085 base.SetObj(14, value);
2100 base.SetObj(13, value);
2105 public Window.SaveData GetWindowSaveData()
2109 return Window.dictData.TryGetValue(
"LayerInventoryFloatMain0",
null);
2113 return Window.dictData.TryGetValue(
"ChestMerchant",
null);
2115 return this.c_windowSaveData;
2119 public bool IsExcludeFromCraft()
2121 if (this.IsUnique || this.c_isImportant)
2136 Window.SaveData windowSaveData = card.GetWindowSaveData();
2137 if (windowSaveData !=
null)
2139 return windowSaveData.excludeCraft;
2148 public byte[] c_textureData
2152 return base.GetObj<
byte[]>(4);
2156 base.SetObj(4, value);
2166 return EClass.sources.materials.rows[this.c_dyeMat];
2206 if (!this.c_idRefCard.IsEmpty())
2208 return EClass.sources.cards.map[this.c_idRefCard];
2220 if (!this.c_idRefCard2.IsEmpty())
2222 return EClass.sources.cards.map[this.c_idRefCard2];
2230 public int ExpToNext
2234 return (50 + this.LV * 30) * (100 - this.Evalue(403)) / 100;
2240 public int DefaultLV
2244 return this.sourceCard.LV;
2250 public int ChildrenWeight
2254 if (this.dirtyWeight)
2256 this._childrenWeight = 0;
2259 foreach (
Thing thing
in this.things)
2261 this._childrenWeight += thing.ChildrenAndSelfWeight;
2263 this.dirtyWeight =
false;
2267 card.SetDirtyWeight();
2269 if (this.isChara && this.IsPCFaction)
2271 this.
Chara.CalcBurden();
2273 if (this._childrenWeight < 0 || this._childrenWeight >= 10000000)
2275 this._childrenWeight = 9999999;
2279 return this._childrenWeight * Mathf.Max(100 - this.Evalue(404), 0) / 100;
2284 public void SetDirtyWeight()
2286 if (
EClass.core.IsGameStarted &&
this.IsPC)
2288 EClass.player.wasDirtyWeight =
true;
2290 this.dirtyWeight =
true;
2296 card.SetDirtyWeight();
2300 public void ChangeWeight(
int a)
2303 this.isWeightChanged =
true;
2304 this.SetDirtyWeight();
2309 public int ChildrenAndSelfWeight
2313 return this.ChildrenWeight + this.SelfWeight * this.Num;
2319 public int ChildrenAndSelfWeightSingle
2323 return this.ChildrenWeight + this.SelfWeight;
2329 public virtual int SelfWeight
2339 public virtual int WeightLimit
2354 if ((result = this._category) ==
null)
2356 result = (this._category =
EClass.sources.categories.map[this.sourceCard.category]);
2369 if ((result = this._material) ==
null)
2371 result = (this._material =
EClass.sources.materials.map[this.idMaterial]);
2379 public virtual string AliasMaterialOnCreate
2383 return this.DefaultMaterial.alias;
2388 public int Evalue(
int ele)
2390 return this.elements.Value(ele);
2394 public int Evalue(
string alias)
2396 return this.elements.Value(
EClass.sources.elements.alias[alias].id);
2400 public bool HasTag(CTAG tag)
2402 return this.sourceCard.tag.Contains(tag.ToString());
2406 public bool HasEditorTag(EditorTag tag)
2408 string c_editorTags = this.c_editorTags;
2409 return c_editorTags !=
null && c_editorTags.Contains(tag.ToString());
2413 public void AddEditorTag(EditorTag tag)
2415 this.c_editorTags = (this.c_editorTags.IsEmpty() ? tag.ToString() : (
this.c_editorTags +
"," + tag.ToString()));
2419 public void RemoveEditorTag(EditorTag tag)
2421 this.c_editorTags = (this.c_editorTags.IsEmpty() ?
null : this.c_editorTags.Replace(tag.ToString(),
"").Replace(
",,",
","));
2430 return this.pos.cell;
2464 public virtual bool isThing
2474 public virtual bool isChara
2484 public bool ExistsOnMap
2488 return this.parent ==
EClass._zone;
2494 public virtual bool isSynced
2498 return this.renderer.isSynced;
2504 public bool IsContainer
2508 return this.trait.IsContainer;
2514 public bool IsUnique
2518 return this.rarity == Rarity.Artifact;
2524 public bool IsPowerful
2528 return (this.rarity >= Rarity.Legendary ||
this.trait is
TraitAdventurer) && !this.IsPCFaction;
2534 public bool IsImportant
2538 return this.sourceCard.HasTag(CTAG.important);
2548 return this.sourceCard.pref;
2554 public virtual bool IsDeadOrSleeping
2564 public virtual bool IsDisabled
2574 public virtual bool IsMoving
2584 public virtual bool flipX
2588 return this.Tiles.Length == 1 && this.dir % 2 == 1;
2594 public virtual bool IsAliveInCurrentZone
2598 return this.ExistsOnMap;
2604 public virtual string actorPrefab
2608 return "ThingActor";
2614 public virtual CardRow sourceCard
2624 public virtual CardRow sourceRenderCard
2628 return this.sourceCard;
2638 return this.sourceCard.tileType;
2648 return this.GetName(NameStyle.Full, -1);
2654 public string NameSimple
2658 return this.GetName(NameStyle.Simple, -1);
2663 public virtual string GetName(NameStyle style,
int num = -1)
2669 public virtual string GetExtraName()
2675 public virtual string GetDetail()
2677 return this.sourceCard.GetText(
"detail",
true);
2682 public virtual bool IsPC
2696 return base.GetInt(56,
null) != 0;
2702 public virtual bool IsPCC
2712 public virtual bool IsPCParty
2722 public virtual bool IsMinion
2732 public virtual bool IsPCPartyMinion
2742 public virtual bool IsPCFactionMinion
2752 public virtual bool IsMultisize
2756 return this.sourceCard.multisize && this.IsInstalled;
2762 public bool IsToolbelt
2766 return this.category.slot == 44;
2772 public bool IsLightsource
2776 return this.category.slot == 45;
2782 public bool IsEquipment
2786 return this.category.slot != 0;
2796 return this.category.IsChildOf(
"food");
2802 public bool ShowFoodEnc
2806 return this.IsFood || this.category.IsChildOf(
"seed") || this.id ==
"pasture" || this.category.IsChildOf(
"drug");
2812 public bool IsWeapon
2816 return this.IsMeleeWeapon || this.IsRangedWeapon;
2822 public bool IsEquipmentOrRanged
2826 return this.category.slot != 0 || this.IsRangedWeapon;
2832 public bool IsMeleeWeapon
2836 return this.category.IsChildOf(
"melee");
2842 public bool IsRangedWeapon
2852 public bool IsThrownWeapon
2856 return this.sourceCard.HasTag(CTAG.throwWeapon);
2876 return this ==
EClass.player.Agent;
2882 public bool IsFurniture
2886 return this.category.IsChildOf(
"furniture");
2892 public bool IsBlessed
2896 return this.blessedState >= BlessedState.Blessed;
2902 public bool IsCursed
2906 return this.blessedState <= BlessedState.Cursed;
2912 public bool IsRestrainedResident
2916 return this.isRestrained && this.IsPCFaction;
2922 public virtual bool IsPCFaction
2932 public bool IsPCFactionOrMinion
2936 return this.IsPCFaction || this.IsPCFactionMinion;
2942 public virtual bool IsGlobal
2952 public virtual int MaxDecay
2962 public bool IsDecayed
2966 return this.decay > this.MaxDecay;
2972 public bool IsRotting
2976 return this.decay >= this.MaxDecay / 4 * 3;
2986 return this.decay < this.MaxDecay / 4;
2992 public virtual int MaxHP
3002 public virtual int Power
3006 return Mathf.Max(20,
EClass.curve(
this.GetTotalQuality(
true) * 10, 400, 100, 75));
3020 return EClass.player.fame / 100 + 1;
3026 public virtual int[] Tiles
3030 return this.sourceCard._tiles;
3036 public virtual int PrefIndex
3040 if (this.Tiles.Length < 3)
3042 return this.dir % 2;
3050 public bool IsVariation
3054 return this.sourceCard.origin !=
null;
3060 public virtual int DV
3064 return this.elements.Value(64);
3070 public virtual int PV
3074 return this.elements.Value(65);
3084 return this.elements.Value(66);
3094 return this.elements.Value(67);
3104 return this.elements.Value(70);
3114 return this.elements.Value(72);
3124 return this.elements.Value(71);
3134 return this.elements.Value(73);
3144 return this.elements.Value(74);
3154 return this.elements.Value(75);
3164 return this.elements.Value(76);
3174 return this.elements.Value(77);
3184 return this.elements.Value(80);
3194 return this.elements.Value(78);
3199 public int GetBestAttribute()
3202 foreach (
Element element
in from a
in this.elements.dict.Values
3203 where
Element.List_MainAttributesMajor.Contains(a.id)
3206 int num2 = element.Value;
3207 if (this.isChara && this.
Chara.tempElements !=
null)
3209 num2 -= this.
Chara.tempElements.Value(element.id);
3220 public void ModExp(
string alias,
int a)
3222 this.ModExp(
EClass.sources.elements.alias[alias].id, a);
3226 public void ModExp(
int ele,
int a)
3232 this.elements.ModExp(ele, a,
false);
3241 if (this.dir % 2 != 0)
3243 return this.sourceCard.H;
3245 return this.sourceCard.W;
3255 if (this.dir % 2 != 0)
3257 return this.sourceCard.W;
3259 return this.sourceCard.H;
3265 public bool IsIdentified
3269 return this.c_IDTState == 0;
3275 public string TextRarity
3279 return Lang.GetList(
"quality")[Mathf.Clamp((
int)(this.rarity + 1), 0, 5)];
3285 public bool IsInstalled
3289 return this.placeState == PlaceState.installed;
3299 return this.bio !=
null && this.bio.gender == 2;
3305 public bool IsNegativeGift
3309 return this.HasTag(CTAG.neg) || this.blessedState <= BlessedState.Cursed;
3314 public bool IsChildOf(
Card c)
3316 return this.GetRootCard() == c;
3321 public bool HasContainerSize
3325 return this.c_containerSize != 0;
3339 return EClass.player.currentHotItem.Thing;
3349 return this.sourceCard.DefaultMaterial;
3355 public virtual bool HasHost
3365 private void _OnSerializing(StreamingContext context)
3367 this._x = this.pos.x;
3368 this._z = this.pos.z;
3369 this._ints[0] = this._bits1.ToInt();
3370 this._ints[2] = this._bits2.ToInt();
3371 this._placeState = this.placeState;
3372 this.OnSerializing();
3376 protected virtual void OnSerializing()
3382 private void _OnDeserialized(StreamingContext context)
3384 this._bits1.SetInt(this._ints[0]);
3385 this._bits2.SetInt(this._ints[2]);
3386 this.placeState = this._placeState;
3387 this.pos.Set(this._x, this._z);
3389 this.things.SetOwner(
this);
3390 this.elements.SetOwner(
this,
false);
3391 this.ApplyMaterialElements(
false);
3392 this.OnDeserialized();
3394 this._CreateRenderer();
3395 foreach (
Thing thing
in this.things)
3397 thing.parent =
this;
3399 if (this.isThing && this.Num <= 0)
3401 this.isDestroyed =
true;
3406 protected virtual void OnDeserialized()
3411 public string ReferenceId()
3413 return "c" + this.uid.ToString();
3417 public void Create(
string _id,
int _idMat = -1,
int genLv = -1)
3422 CardBlueprint.current =
null;
3430 this.autoRefuel =
true;
3431 EClass.game.cards.AssignUID(
this);
3434 this.OnBeforeCreate();
3435 if (this.sourceCard.quality != 0)
3437 this.rarity = this.sourceCard.quality.ToEnum<Rarity>();
3439 else if (this.bp.rarity != Rarity.Random)
3441 this.rarity = this.bp.rarity;
3443 else if (this.category.slot != 0 &&
this.category.slot != 45 &&
this.category.slot != 44)
3447 this.rarity = Rarity.Crude;
3449 else if (
EClass.rnd(10) == 0)
3451 this.rarity = Rarity.Superior;
3453 else if (
EClass.rnd(80) == 0)
3455 this.rarity = Rarity.Legendary;
3457 else if (
EClass.rnd(250) == 0)
3459 this.rarity = Rarity.Mythical;
3462 if (this.rarity != Rarity.Normal &&
this.category.tag.Contains(
"fixedRarity"))
3464 this.rarity = Rarity.Normal;
3466 this.LV = this.DefaultLV;
3467 if (this.bp.lv != -999)
3469 this.LV = this.bp.lv;
3471 if (this.sourceCard.fixedMaterial)
3473 this._material =
EClass.sources.materials.alias[this.AliasMaterialOnCreate];
3477 bool flag = (this.bp !=
null && this.bp.fixedMat) || this.sourceCard.quality == 4 ||
this.sourceCard.tierGroup.IsEmpty();
3480 this._material =
EClass.sources.materials.rows[_idMat];
3484 if (this.sourceCard.tierGroup ==
"wood")
3488 this._material =
MATERIAL.GetRandomMaterial(genLv, this.sourceCard.tierGroup,
this.bp.tryLevelMatTier);
3492 this._material =
EClass.sources.materials.alias[this.AliasMaterialOnCreate];
3495 this.idMaterial = this._material.id;
3496 this.things.SetOwner(
this);
3497 this.elements.SetOwner(
this,
true);
3499 if (!this.bp.fixedQuality &&
this.trait.LevelAsQuality && (!
EClass._zone.IsPCFaction ||
EClass.Branch.lv != 1) &&
EClass.debug.testThingQuality &&
EClass.rnd(2) == 0)
3501 this.qualityTier = Mathf.Clamp(
EClass.rnd(5) + 1, 1, 3);
3502 this.LV = this.LV + this.qualityTier * 10 + (this.LV - 1) * (125 + this.qualityTier * 25) / 100;
3504 this.ApplyMaterial(
false);
3505 this.OnCreate(genLv);
3506 this._CreateRenderer();
3507 this.trait.OnCreate(genLv);
3508 this.hp = this.MaxHP;
3509 if (this.HasTag(CTAG.hidden))
3511 this.SetHidden(
true);
3513 this.isFloating = this.Pref.Float;
3517 public virtual void OnBeforeCreate()
3522 public virtual void OnCreate(
int genLv)
3527 public virtual void SetSource()
3532 public virtual void ApplyEditorTags(EditorTag tag)
3534 if (tag <= EditorTag.IsOn)
3536 if (tag == EditorTag.Empty)
3538 this.RemoveThings();
3541 if (tag == EditorTag.Hidden)
3543 this.SetHidden(
true);
3546 if (tag != EditorTag.IsOn)
3555 if (tag == EditorTag.IsOff)
3560 if (tag == EditorTag.NoSnow)
3565 if (tag != EditorTag.Boss)
3569 EClass._zone.Boss = this.
Chara;
3575 public void ApplyTrait()
3577 string c_idTrait = this.c_idTrait;
3578 if (c_idTrait.IsEmpty())
3580 if (this.sourceCard.trait.IsEmpty())
3586 this.trait = ClassCache.Create<
Trait>(
"Trait" + this.sourceCard.trait[0],
"Elin");
3591 this.trait = ClassCache.Create<
Trait>(c_idTrait,
"Elin");
3593 this.trait.SetOwner(
this);
3597 public Card SetLv(
int a)
3604 Rand.SetSeed(this.uid);
3606 elementContainer.ApplyElementMap(this.uid, SourceValueType.Chara,
this.Chara.job.elementMap,
this.LV,
false,
false);
3607 elementContainer.ApplyElementMap(this.uid, SourceValueType.Chara,
this.Chara.race.elementMap,
this.LV,
false,
false);
3608 elementContainer.ApplyElementMap(this.uid, SourceValueType.Chara,
this.Chara.source.elementMap, 1,
false,
true);
3609 foreach (
Element element
in this.elements.dict.Values)
3611 int num = elementContainer.Value(element.id);
3614 int num2 = num - element.ValueWithoutLink;
3617 this.elements.ModBase(element.id, num2);
3622 this.hp = this.MaxHP;
3623 this.Chara.mana.value = this.
Chara.mana.max;
3624 this.
Chara.CalculateMaxStamina();
3625 this.SetDirtyWeight();
3630 public void AddExp(
int a)
3637 while (this.exp >= this.ExpToNext)
3639 this.exp -= this.ExpToNext;
3645 public void LevelUp()
3649 if (
EClass.core.version.demo &&
EClass.player.totalFeat >= 5)
3651 Msg.Say(
"demoLimit");
3654 EClass.player.totalFeat++;
3657 int num = this.feat;
3658 this.feat = num + 1;
3661 this.Say(
"dingExp",
this,
null,
null);
3662 this.PlaySound(
"jingle_lvup", 1f,
true);
3663 this.PlayEffect(
"aura_heaven",
true, 0f,
default(Vector3));
3664 if (this.HasElement(1415, 1) && this.Evalue(1415) < 9 && this.LV >= this.Evalue(1415) * 5 + 10)
3666 this.
Chara.SetFeat(1415, this.Evalue(1415) + 1,
true);
3670 if (this.
Chara.race.id ==
"mutant")
3672 int num2 = Mathf.Min(1 + this.LV / 5, 22);
3673 for (
int i = 0; i < num2; i++)
3675 if (this.Evalue(1644) < i + 1)
3677 this.
Chara.SetFeat(1644, i + 1,
false);
3681 this.
Chara.TryUpgrade(
true);
3686 public virtual void ApplyMaterialElements(
bool remove)
3691 public virtual void ApplyMaterial(
bool remove =
false)
3697 public Card ChangeMaterial(
int idNew)
3699 return this.ChangeMaterial(
EClass.sources.materials.map[idNew]);
3703 public Card ChangeMaterial(
string idNew)
3705 return this.ChangeMaterial(
EClass.sources.materials.alias[idNew]);
3711 if (this.sourceCard.fixedMaterial)
3715 this.ApplyMaterial(
true);
3716 this._material = row;
3717 this.idMaterial = row.id;
3719 this.dirtyWeight =
true;
3720 Card rootCard = this.GetRootCard();
3721 if (rootCard !=
null && rootCard.IsPC)
3723 this.GetRootCard().SetDirtyWeight();
3729 this.ApplyMaterial(
false);
3734 public void SetReplica(
bool on)
3736 this.isReplica =
true;
3737 this.ChangeMaterial(
"granite");
3741 public Thing Add(
string id,
int num = 1,
int lv = 1)
3747 return this.AddCard(
ThingGen.Create(
id, -1, lv).SetNum(num)) as
Thing;
3753 return this.AddThing(c as
Thing,
true, -1, -1);
3757 public void RemoveCard(
Card c)
3759 this.RemoveThing(c as
Thing);
3763 public void NotifyAddThing(
Thing t,
int num)
3768 public Thing AddThing(
string id,
int lv = -1)
3770 return this.AddThing(
ThingGen.Create(
id, -1, (lv == -1) ?
this.LV : lv),
true, -1, -1);
3774 public Thing AddThing(
Thing t,
bool tryStack =
true,
int destInvX = -1,
int destInvY = -1)
3776 if (t.Num == 0 || t.isDestroyed)
3778 Debug.LogWarning(
string.Concat(
new string[]
3780 "tried to add destroyed thing:",
3783 t.isDestroyed.ToString(),
3785 (t !=
null) ? t.ToString() :
null,
3787 (
this !=
null) ? this.ToString() :
null
3791 if (t.parent ==
this)
3793 Debug.LogWarning(
"already child:" + ((t !=
null) ? t.ToString() :
null));
3796 if (this.things.Contains(t))
3798 Debug.Log(
"already in the list" + ((t !=
null) ? t.ToString() :
null));
3803 bool flag = this.IsPC && t.GetRootCard() ==
EClass.pc;
3804 if (t.parent !=
null)
3806 t.parent.RemoveCard(t);
3808 if (t.trait.ToggleType == ToggleType.Fire && destInvY == 0)
3810 t.trait.Toggle(
false,
false);
3813 t.ignoreAutoPick =
false;
3819 t.RemoveEditorTag(EditorTag.PreciousContainer);
3826 Thing thing = tryStack ? this.things.TryStack(t, destInvX, destInvY) : t;
3830 this.things.OnAdd(t);
3832 if (thing == t && this.IsPC &&
EClass.core.IsGameStarted &&
EClass._map !=
null &&
this.parent ==
EClass.game.activeZone &&
this.pos.IsValid && !flag)
3834 this.NotifyAddThing(t, t.Num);
3836 if (t == thing && this.isThing && this.parent ==
EClass._zone &&
this.placeState != PlaceState.roaming)
3838 EClass._map.Stocked.Add(t);
3840 this.SetDirtyWeight();
3841 if (this.ShouldTrySetDirtyInventory())
3843 EClass.pc.SetDirtyWeight();
3848 if (!this.IsContainer)
3852 Card rootCard = this.GetRootCard();
3853 if (rootCard ==
null || !rootCard.IsPC)
3858 Card.<>c__DisplayClass684_0 CS$<>8__locals1 =
new Card.<>c__DisplayClass684_0();
3859 t.isNPCProperty =
false;
3861 CS$<>8__locals1.count = 0;
3862 CS$<>8__locals1.ings =
EClass.player.recipes.knownIngredients;
3863 CS$<>8__locals1.<AddThing>g__TryAdd|0(t);
3864 if (t.CanSearchContents)
3866 t.things.Foreach(delegate(
Thing _t)
3868 base.<AddThing>g__TryAdd|0(_t);
3871 if (CS$<>8__locals1.count > 0 &&
EClass.core.IsGameStarted)
3873 Msg.Say((CS$<>8__locals1.count == 1) ?
"newIng" :
"newIngs", CS$<>8__locals1.count.ToString() ??
"",
null,
null,
null);
3879 public void RemoveThings()
3881 for (
int i = this.things.Count - 1; i >= 0; i--)
3883 this.RemoveThing(this.things[i]);
3888 public void RemoveThing(
Thing thing)
3891 if (((chara !=
null) ? chara.held :
null) == thing)
3893 (this.GetRootCard() as
Chara).held =
null;
3894 this.RecalculateFOV();
3896 this.dirtyWeight =
true;
3897 if (thing.c_equippedSlot != 0 &&
this.isChara)
3899 this.Chara.body.Unequip(thing,
true);
3901 this.things.Remove(thing);
3902 this.things.OnRemove(thing);
3903 if (this.isSale && this.things.Count == 0 &&
this.IsContainer)
3905 this.isSale =
false;
3906 EClass._map.props.sales.Remove(
this);
3908 if (thing.invY == 1)
3910 WidgetCurrentTool.dirty =
true;
3914 if (thing.props !=
null)
3916 thing.props.Remove(thing);
3918 this.SetDirtyWeight();
3919 if (this.ShouldTrySetDirtyInventory())
3922 WidgetHotbar.dirtyCurrentItem =
true;
3923 thing.parent =
null;
3924 if (thing.trait.IsContainer)
3928 if (layerInventory.invs[0].owner.Container.GetRootCard() !=
EClass.pc && layerInventory.floatInv)
3930 EClass.ui.layerFloat.RemoveLayer(layerInventory);
3935 thing.parent =
null;
3939 public bool ShouldTrySetDirtyInventory()
3941 return EClass.player.chara !=
null && (this.IsPC || this.GetRootCard() == EClass.pc || EClass.ui.layers.Count > 0);
3945 public virtual bool CanStackTo(
Thing to)
3951 public bool TryStackTo(
Thing to)
3953 if (!this.CanStackTo(to))
3957 to.ModNum(this.Num,
true);
3958 to.decay = (to.decay * to.Num + this.decay * this.Num) / (to.Num +
this.Num);
3959 if (this.c_isImportant)
3961 to.c_isImportant =
true;
3963 if (
EClass.core.config.game.markStack && to.GetRootCard() ==
EClass.pc)
3974 if (this.parent ==
null)
3978 return this.parent.GetRoot();
3982 public Card GetRootCard()
3989 return card.GetRootCard();
3993 public bool IsStackable(
Thing tg)
3995 return !(this.id != tg.id) && this.material == tg.material;
3999 public Thing Duplicate(
int num)
4002 thing.ChangeMaterial(this.idMaterial);
4003 thing._bits1 = this._bits1;
4004 thing._bits2 = this._bits2;
4005 thing.dir = this.dir;
4006 thing.refVal = this.refVal;
4007 thing.altitude = this.altitude;
4008 thing.idSkin = this.idSkin;
4009 thing.blessedState = this.blessedState;
4010 thing.rarityLv = this.rarityLv;
4011 thing.qualityTier = this.qualityTier;
4013 thing.exp = this.exp;
4014 thing.encLV = this.encLV;
4015 thing.decay = this.decay;
4016 thing.mapInt.Clear();
4017 thing.mapStr.Clear();
4018 foreach (KeyValuePair<int, int> keyValuePair
in this.mapInt)
4020 thing.mapInt[keyValuePair.Key] = keyValuePair.Value;
4022 foreach (KeyValuePair<int, string> keyValuePair2
in this.mapStr)
4024 thing.mapStr[keyValuePair2.Key] = keyValuePair2.Value;
4026 this.elements.CopyTo(thing.elements);
4028 if (thing.IsRangedWeapon)
4030 thing.sockets = IO.DeepCopy<List<int>>(this.sockets);
4036 public Thing Split(
int a)
4042 Thing result = this.Duplicate(a);
4043 this.ModNum(-a,
false);
4048 public Thing SetNum(
int a)
4056 return this as
Thing;
4058 this.ModNum(a - this.Num,
true);
4059 return this as
Thing;
4063 public Thing SetNoSell()
4066 return this as
Thing;
4070 public void ModNum(
int a,
bool notify =
true)
4072 if (this.Num + a < 0)
4077 if (this.props !=
null)
4079 this.props.OnNumChange(
this, a);
4081 if (this.parent !=
null)
4083 this.parent.OnChildNumChange(
this);
4085 if (a > 0 &&
EClass.core.IsGameStarted &&
this.GetRootCard() ==
EClass.pc && notify)
4087 this.NotifyAddThing(this.
Thing, a);
4089 this.SetDirtyWeight();
4097 public void AddSocket()
4099 if (this.sockets ==
null)
4101 this.sockets =
new List<int>();
4103 this.sockets.Add(0);
4107 public void ApplySocket(
Thing t)
4110 if (traitMod ==
null || this.sockets ==
null)
4114 this.ApplySocket(traitMod.source.id, traitMod.owner.encLV, traitMod.owner);
4118 public void ApplySocket(
int id,
int lv,
Card mod =
null)
4121 while (i < this.sockets.Count)
4123 if (this.sockets[i] == 0)
4129 this.sockets[i] =
id * 100 + lv;
4130 this.elements.ModBase(
id, lv);
4146 public void EjectSockets()
4148 for (
int i = 0; i < this.sockets.Count; i++)
4150 int num = this.sockets[i];
4153 Thing thing =
ThingGen.Create(this.isCopy ?
"ash3" :
"mod_ranged", -1, -1);
4154 int refVal = num / 100;
4155 int encLV = num % 100;
4158 thing.refVal = refVal;
4159 thing.encLV = encLV;
4161 EClass._map.TrySmoothPick(this.pos.IsBlocked ?
EClass.pc.pos :
this.pos, thing,
EClass.pc);
4162 this.elements.ModBase(thing.refVal, -thing.encLV);
4163 this.sockets[i] = 0;
4169 public void OnChildNumChange(
Card c)
4171 if (this.ShouldTrySetDirtyInventory() && c.isThing)
4179 public Card Install()
4181 this.SetPlaceState(PlaceState.installed,
false);
4186 public void SetPlaceState(PlaceState newState,
bool byPlayer =
false)
4188 if (this.placeState == newState)
4192 if (this.parent !=
EClass._zone)
4194 Debug.Log(
"tried to change placestate of non-root card:" + ((
this !=
null) ? this.ToString() :
null));
4197 PlaceState placeState = this.placeState;
4198 Area area = this.pos.area;
4199 if (placeState == PlaceState.installed)
4203 area.OnUninstallCard(
this);
4205 if (!this.isRoofItem)
4208 this.freePos =
false;
4209 this.fx = (this.fy = 0f);
4211 this.trait.Uninstall();
4213 if (placeState == PlaceState.installed || newState == PlaceState.installed)
4215 this.ForeachPoint(delegate(
Point p,
bool main)
4217 p.cell.RemoveCard(
this);
4219 this.placeState = newState;
4220 this.ForeachPoint(delegate(
Point p,
bool main)
4222 p.cell.AddCard(
this);
4227 this.placeState = newState;
4229 if (newState == PlaceState.none)
4231 this.placeState = PlaceState.roaming;
4232 if (this.props !=
null)
4234 this.props.Remove(
this);
4239 EClass._map.props.OnCardAddedToZone(
this);
4240 if (this.placeState == PlaceState.installed)
4244 this.pos.detail.MoveThingToTop(this.
Thing);
4248 area.OnInstallCard(
this);
4250 this.isRoofItem =
false;
4251 this.trait.Install(byPlayer);
4254 if (this.trait.ShouldRefreshTile)
4256 this.pos.RefreshNeighborTiles();
4258 if (this.trait.ShouldTryRefreshRoom && (placeState == PlaceState.installed ||
this.placeState == PlaceState.installed))
4260 EClass._map.OnSetBlockOrDoor(this.pos.x,
this.pos.z);
4262 this.trait.OnChangePlaceState(newState);
4263 if (
EClass._zone.IsPCFaction)
4265 EClass.Branch.resources.SetDirty();
4275 return this.Evalue(2);
4281 public int QualityLv
4285 return this.Quality / 10;
4290 public int GetTotalQuality(
bool applyBonus =
true)
4292 int num = 5 + this.LV + this.material.quality;
4295 num = num * (100 + this.Quality) / 100;
4301 public void ModEncLv(
int a)
4303 this.ApplyMaterialElements(
true);
4305 this.ApplyMaterialElements(
false);
4306 if (this.IsEquipmentOrRanged || this.IsAmmo)
4308 if (this.IsWeapon || this.IsAmmo)
4310 this.elements.ModBase(67, a);
4313 this.elements.ModBase(65, a * 2);
4318 public void SetEncLv(
int a)
4320 this.ModEncLv(a - this.encLV);
4324 public virtual void SetBlessedState(BlessedState s)
4327 if (s == BlessedState.Blessed &&
this.blessedState < BlessedState.Blessed)
4331 if (s < BlessedState.Blessed &&
this.blessedState == BlessedState.Blessed)
4335 if (num != 0 && (this.IsEquipmentOrRanged || this.IsAmmo))
4337 if (this.IsWeapon || this.IsAmmo)
4339 this.elements.ModBase(67, num);
4343 this.elements.ModBase(65, num * 2);
4346 this.blessedState = s;
4350 public virtual void ChangeRarity(Rarity q)
4356 public bool TryPay(
int a,
string id =
"money")
4358 if (this.GetCurrency(
id) < a)
4363 Msg.Say((
id ==
"ration") ?
"notEnoughFood" :
"notEnoughMoney");
4367 if (this.IsPC && !(
id ==
"ration"))
4371 this.ModCurrency(-a,
id);
4376 public void SetCharge(
int a)
4383 public void ModCharge(
int a,
bool destroy =
false)
4385 this.c_charges += a;
4387 if (this.c_charges <= 0 && destroy)
4389 this.Say(
"spellbookCrumble",
this,
null,
null);
4390 this.ModNum(-1,
true);
4395 public void ModCurrency(
int a,
string id =
"money")
4401 if (
id ==
"influence")
4403 EClass._zone.ModInfluence(a);
4407 this.things.AddCurrency(
this,
id, a, mat);
4411 public int GetCurrency(
string id =
"money")
4413 if (
id ==
"influence")
4415 return EClass._zone.influence;
4419 this.things.GetCurrency(
id, ref result, mat);
4424 public virtual void HealHPHost(
int a, HealSource origin = HealSource.None)
4428 if (this.
Chara.parasite !=
null)
4430 this.
Chara.parasite.HealHP(a, HealSource.None);
4432 if (this.
Chara.ride !=
null)
4434 this.
Chara.ride.HealHP(a, HealSource.None);
4437 this.HealHP(a, origin);
4441 public virtual void HealHP(
int a, HealSource origin = HealSource.None)
4444 if (this.hp > this.MaxHP)
4446 this.hp = this.MaxHP;
4448 if (origin == HealSource.Magic)
4450 this.PlaySound(
"heal", 1f,
true);
4451 this.PlayEffect(
"heal",
true, 0f,
default(Vector3));
4454 if (origin != HealSource.HOT)
4458 this.PlaySound(
"heal_tick", 1f,
true);
4459 this.PlayEffect(
"heal_tick",
true, 0f,
default(Vector3));
4463 public virtual int GetArmorSkill()
4469 public virtual int ApplyProtection(
int dmg,
int mod = 100)
4471 int armorSkill = this.GetArmorSkill();
4472 Element orCreateElement = this.elements.GetOrCreateElement(armorSkill);
4473 int num = this.PV + orCreateElement.Value + this.DEX / 10;
4480 num2 = num3 / 10 + 1;
4481 sides = num3 / num2 + 1;
4483 dmg = dmg * 100 / (100 + num);
4485 int num4 =
Dice.Roll(num2, sides, bonus,
this);
4486 dmg -= num4 * mod / 100;
4495 public void DamageHP(
int dmg, AttackSource attackSource = AttackSource.None,
Card origin =
null)
4497 this.DamageHP(dmg, 0, 0, attackSource, origin,
true);
4501 public void DamageHP(
int dmg,
int ele,
int eleP = 100, AttackSource attackSource = AttackSource.None,
Card origin =
null,
bool showEffect =
true)
4503 Card.<>c__DisplayClass724_0 CS$<>8__locals1 =
new Card.<>c__DisplayClass724_0();
4504 CS$<>8__locals1.<>4__this =
this;
4505 CS$<>8__locals1.dmg = dmg;
4506 CS$<>8__locals1.origin = origin;
4513 CS$<>8__locals1.e =
Element.Void;
4517 CS$<>8__locals1.e =
Element.Create(ele, 0);
4518 if (attackSource != AttackSource.Condition && showEffect)
4522 CS$<>8__locals1.<>4__this.PlayEffect(CS$<>8__locals1.e.id,
true, 0.25f);
4523 EClass.Sound.Play(
"atk_" + CS$<>8__locals1.e.source.alias);
4526 if (!CS$<>8__locals1.e.source.aliasRef.IsEmpty())
4528 CS$<>8__locals1.dmg =
Element.GetResistDamage(CS$<>8__locals1.dmg,
this.Evalue(CS$<>8__locals1.e.source.aliasRef));
4529 CS$<>8__locals1.dmg = CS$<>8__locals1.dmg * 100 / (100 + Mathf.Clamp(this.Evalue(961) * 5, -50, 200));
4531 int dmg2 = CS$<>8__locals1.e.id;
4537 if (chara !=
null && chara.isWet)
4539 CS$<>8__locals1.dmg = CS$<>8__locals1.dmg * 150 / 100;
4546 if (chara2 !=
null && chara2.isWet)
4548 CS$<>8__locals1.dmg /= 3;
4552 if (attackSource != AttackSource.Finish)
4554 if (!this.IsPCFaction && this.LV > 50)
4556 CS$<>8__locals1.dmg = CS$<>8__locals1.dmg * (100 - (int)Mathf.Min(80f, Mathf.Sqrt((
float)(
this.LV - 50)) * 2.5f)) / 100;
4558 CS$<>8__locals1.dmg = CS$<>8__locals1.dmg * Mathf.Max(0, 100 - this.Evalue((CS$<>8__locals1.e ==
Element.Void) ? 55 : 56)) / 100;
4559 if (CS$<>8__locals1.origin !=
null && CS$<>8__locals1.origin.IsPC &&
EClass.player.codex.Has(
this.id))
4561 CS$<>8__locals1.dmg = CS$<>8__locals1.dmg * (100 + Mathf.Min(10,
EClass.player.codex.GetOrCreate(
this.id).weakspot)) / 100;
4563 if (this.isChara && this.
Chara.body.GetAttackStyle() == AttackStyle.Shield &&
this.elements.ValueWithoutLink(123) >= 5 && CS$<>8__locals1.e ==
Element.Void)
4565 CS$<>8__locals1.dmg = CS$<>8__locals1.dmg * 90 / 100;
4567 if (this.Evalue(971) > 0)
4569 CS$<>8__locals1.dmg = CS$<>8__locals1.dmg * 100 / Mathf.Clamp(100 + this.Evalue(971), 25, 1000);
4571 if (this.HasElement(1305, 1))
4573 CS$<>8__locals1.dmg = CS$<>8__locals1.dmg * 90 / 100;
4575 if (
EClass.pc.HasElement(1207, 1) &&
this.isChara)
4581 if (condition.Type == ConditionType.Buff)
4585 else if (condition.Type == ConditionType.Debuff)
4592 CS$<>8__locals1.dmg = CS$<>8__locals1.dmg * 100 / Mathf.Max(100 + num * 5, 120);
4596 CS$<>8__locals1.dmg = CS$<>8__locals1.dmg * Mathf.Max(100 + num2 * 5, 120) / 100;
4601 CS$<>8__locals1.dmg = CS$<>8__locals1.dmg -
EClass.pc.Evalue(13) - 1;
4603 else if (CS$<>8__locals1.origin !=
null && CS$<>8__locals1.origin.IsPCParty &&
EClass.pc.ai is
GoalAutoCombat)
4605 CS$<>8__locals1.dmg = CS$<>8__locals1.dmg * 100 / Mathf.Max(110 -
EClass.pc.Evalue(13), 105);
4607 if (this.HasElement(1218, 1))
4609 CS$<>8__locals1.dmg = CS$<>8__locals1.dmg * (1000 - this.Evalue(1218)) / 1000;
4610 if (CS$<>8__locals1.dmg <= 0 &&
EClass.rnd(4) == 0)
4612 int dmg2 = CS$<>8__locals1.dmg;
4613 CS$<>8__locals1.dmg = dmg2 + 1;
4616 if (CS$<>8__locals1.dmg >=
this.MaxHP / 10 &&
this.Evalue(68) > 0)
4618 int num3 = this.MaxHP / 10;
4619 int num4 = CS$<>8__locals1.dmg - num3;
4620 num4 = num4 * 100 / (200 + this.Evalue(68) * 10);
4621 CS$<>8__locals1.dmg = num3 + num4;
4624 if (CS$<>8__locals1.origin !=
null && CS$<>8__locals1.origin.IsPC &&
EClass.pc.Evalue(654) > 0)
4626 CS$<>8__locals1.dmg = 0;
4628 if (CS$<>8__locals1.dmg < 0)
4630 CS$<>8__locals1.dmg = 0;
4632 int num5 = Mathf.Clamp(CS$<>8__locals1.dmg * 6 /
this.MaxHP, 0, 4) + ((CS$<>8__locals1.dmg > 0) ? 1 : 0);
4633 if (this.Evalue(1421) > 0)
4635 int num6 = CS$<>8__locals1.dmg;
4638 num6 = CS$<>8__locals1.dmg - this.hp;
4639 this.hp -= CS$<>8__locals1.dmg;
4640 if (this.hp < 0 && this.Chara.mana.value >= 0)
4647 if (this.Evalue(1421) >= 2)
4651 CS$<>8__locals1.dmg = num6;
4652 if (this.
Chara.mana.value > 0)
4654 num6 -= this.
Chara.mana.value;
4655 this.Chara.mana.value -= CS$<>8__locals1.dmg;
4657 if (this.
Chara.mana.value <= 0)
4665 this.hp -= CS$<>8__locals1.dmg;
4667 if (this.isSynced && CS$<>8__locals1.dmg != 0)
4669 float ratio = (float)CS$<>8__locals1.dmg / (
float)this.MaxHP;
4673 c.PlayEffect(
"blood",
true, 0f,
default(Vector3)).SetParticleColor(
EClass.Colors.matColors[CS$<>8__locals1.<>4__this.material.alias].main).Emit(20 + (
int)(30f * ratio));
4674 if (
EClass.core.config.test.showNumbers || CS$<>8__locals1.<>4__this.isThing)
4676 Popper popper =
EClass.scene.popper.Pop(CS$<>8__locals1.<>4__this.renderer.PositionCenter(),
"DamageNum");
4677 Color color = c.IsPC ? EClass.Colors.textColors.damagePC : (c.IsPCFaction ? EClass.Colors.textColors.damagePCParty :
EClass.Colors.textColors.damage);
4678 if (CS$<>8__locals1.e !=
Element.Void)
4680 color =
EClass.Colors.elementColors.TryGetValue(CS$<>8__locals1.e.source.alias,
default(Color));
4681 float num13 = (color.r + color.g + color.b) / 3f;
4682 num13 = ((num13 > 0.5f) ? 0f : (0.6f - num13));
4683 color =
new Color(color.r + num13, color.g + num13, color.b + num13, 1f);
4685 popper.SetText(CS$<>8__locals1.dmg.ToString() ??
"", color);
4692 if (this.isRestrained && this.IsPCFaction &&
EClass._zone.IsPCFaction && (!
this.IsPC || (
this.Chara.ai is
AI_Torture &&
this.Chara.ai.IsRunning)))
4694 CS$<>8__locals1.<DamageHP>g__EvadeDeath|1();
4695 if (this.
Chara.stamina.value > 0 && (
EClass.rnd(2) == 0 || !
this.IsPC))
4697 this.
Chara.stamina.Mod(-1);
4700 else if (this.IsInstalled && this.pos.HasBlock &&
this.trait.IsDoor)
4702 CS$<>8__locals1.<DamageHP>g__EvadeDeath|1();
4704 else if (!this.trait.CanBeDestroyed)
4706 CS$<>8__locals1.<DamageHP>g__EvadeDeath|1();
4708 else if (this.HasEditorTag(EditorTag.Invulnerable) || (
this.HasEditorTag(EditorTag.InvulnerableToMobs) && (CS$<>8__locals1.origin ==
null || !CS$<>8__locals1.origin.IsPCParty)))
4710 CS$<>8__locals1.<DamageHP>g__EvadeDeath|1();
4712 else if (this.isChara)
4716 CS$<>8__locals1.<DamageHP>g__EvadeDeath|1();
4718 else if (this.IsPC &&
EClass.debug.godMode)
4720 CS$<>8__locals1.<DamageHP>g__EvadeDeath|1();
4722 else if (this.
Chara.host !=
null)
4724 CS$<>8__locals1.<DamageHP>g__EvadeDeath|1();
4726 else if (zoneInstanceBout !=
null &&
LayerDrama.Instance)
4728 CS$<>8__locals1.<DamageHP>g__EvadeDeath|1();
4732 CS$<>8__locals1.<DamageHP>g__EvadeDeath|1();
4736 if (attackSource != AttackSource.Finish &&
this.IsPCParty &&
this.Chara.host ==
null &&
EClass.pc.ai is
GoalAutoCombat)
4740 Msg.Say(this.IsPC ?
"abort_damage" :
"abort_damgeAlly");
4741 EClass.player.invlunerable =
true;
4742 EClass.player.TryAbortAutoCombat();
4745 if (
EClass.player.invlunerable)
4747 CS$<>8__locals1.<DamageHP>g__EvadeDeath|1();
4751 if (this.IsPC && this.Evalue(1220) > 0 && this.
Chara.stamina.value >=
this.Chara.stamina.max / 2)
4753 this.
Chara.stamina.Mod(-this.
Chara.stamina.max / 2);
4755 CS$<>8__locals1.<DamageHP>g__EvadeDeath|1();
4761 if (this.trait.CanBeAttacked)
4763 this.renderer.PlayAnime(AnimeID.HitObj,
default(Vector3),
false);
4764 this.hp = this.MaxHP;
4768 if ((attackSource == AttackSource.Melee || attackSource == AttackSource.Range) && CS$<>8__locals1.origin !=
null && (CS$<>8__locals1.origin.isSynced ||
this.IsPC))
4771 if (this.IsPC && Lang.setting.combatTextStyle == 0)
4773 if (CS$<>8__locals1.e !=
Element.Void && CS$<>8__locals1.e !=
null)
4775 text =
"dead_" + CS$<>8__locals1.e.source.alias;
4777 if (text ==
"" || !LangGame.Has(text))
4779 text =
"dead_attack";
4781 EClass.pc.Say(text,
this,
"",
null);
4785 if (CS$<>8__locals1.e !=
Element.Void && CS$<>8__locals1.e !=
null)
4787 text =
"kill_" + CS$<>8__locals1.e.source.alias;
4789 if (text ==
"" || !LangGame.Has(text))
4791 text =
"kill_attack";
4793 (this.IsPC ? EClass.pc : CS$<>8__locals1.origin).Say(text, CS$<>8__locals1.origin,
this,
null,
null);
4798 if (this.HasElement(1410, 1) && !this.
Chara.HasCooldown(1410))
4800 this.
Chara.AddCooldown(1410, 0);
4801 this.Say(
"reboot",
this,
null,
null);
4802 this.PlaySound(
"reboot", 1f,
true);
4803 this.
Chara.Cure(CureType.Boss, 100, BlessedState.Normal);
4804 this.hp = this.MaxHP / 3;
4810 if (this.
Chara.IsFriendOrAbove(chara3) && chara3.HasElement(1408, 1) && chara3.faith ==
EClass.game.religions.Healing &&
EClass.world.date.GetRawDay() != chara3.GetInt(58,
null) && (!chara3.IsPCFaction ||
this.IsPCFaction))
4812 Msg.alwaysVisible =
true;
4813 Msg.Say(
"layhand", chara3,
this,
null,
null);
4814 Msg.Say(
"pray_heal",
this,
null,
null,
null);
4815 this.hp = this.MaxHP;
4817 this.PlayEffect(
"revive",
true, 0f,
default(Vector3));
4818 this.PlaySound(
"revive", 1f,
true);
4819 chara3.SetInt(58,
EClass.world.date.GetRawDay());
4824 if (zoneInstanceBout !=
null)
4826 Chara chara4 =
EClass._map.FindChara(zoneInstanceBout.uidTarget);
4832 chara4.ShowDialog(
"_chara",
"bout_lose",
"");
4838 chara4.ModAffinity(
EClass.pc, 10,
true);
4839 chara4.ShowDialog(
"_chara",
"bout_win",
"");
4844 if (!this.isDestroyed)
4846 this.Die(CS$<>8__locals1.e, CS$<>8__locals1.origin, attackSource);
4848 if (CS$<>8__locals1.origin !=
null && CS$<>8__locals1.origin.isChara)
4850 if (CS$<>8__locals1.origin.IsPCFactionOrMinion &&
this.isChara && !
this.isCopy)
4852 EClass.player.stats.kills++;
4853 EClass.game.quests.list.ForeachReverse(delegate(
Quest q)
4855 q.OnKillChara(CS$<>8__locals1.<>4__this.Chara);
4857 EClass.player.codex.AddKill(this.
id);
4858 if (this.rarity >= Rarity.Legendary &&
this.Chara.OriginalHostility == Hostility.Enemy)
4860 Guild.Fighter.AddContribution(5 + this.LV / 5);
4861 if (
Guild.Fighter.relation.rank >= 4 &&
this.uid % 2 == 0)
4863 int a =
EClass.rndHalf(200 + this.LV * 20);
4864 Msg.Say(
"bounty", this.
Chara, a.ToString() ??
"",
null,
null);
4865 EClass.pc.ModCurrency(a,
"money");
4870 if (CS$<>8__locals1.origin.IsPCParty &&
EClass.pc.Evalue(1355) > 0)
4873 if (conStrife !=
null)
4875 conStrife.AddKill();
4878 if (CS$<>8__locals1.origin.GetInt(106,
null) == 0)
4880 CS$<>8__locals1.origin.Chara.TalkTopic(
"kill");
4885 else if ((attackSource == AttackSource.Melee || attackSource == AttackSource.Range) && CS$<>8__locals1.origin !=
null)
4887 (this.IsPC ? EClass.pc : CS$<>8__locals1.origin).Say(
"dmgMelee" + num5.ToString() + (
this.IsPC ?
"pc" :
""), CS$<>8__locals1.origin,
this,
null,
null);
4889 else if (this.isChara)
4891 int num7 = (attackSource == AttackSource.Condition || attackSource == AttackSource.WeaponEnchant) ? 2 : 1;
4894 if (CS$<>8__locals1.e !=
Element.Void)
4896 this.Say(
"dmg_" + CS$<>8__locals1.e.source.alias,
this,
null,
null);
4898 if (CS$<>8__locals1.e ==
Element.Void || num5 >= 2)
4900 this.Say(
"dmg" + num5.ToString(),
this,
null,
null);
4904 if (this.isChara && CS$<>8__locals1.origin !=
null && CS$<>8__locals1.origin.IsAliveInCurrentZone && CS$<>8__locals1.origin.isChara)
4906 if (CS$<>8__locals1.e.id == 916)
4908 CS$<>8__locals1.origin.HealHP(Mathf.Clamp(
EClass.rnd(CS$<>8__locals1.dmg * (50 + eleP) / 500 + 5), 1, CS$<>8__locals1.origin.MaxHP / 5 +
EClass.rnd(10)), HealSource.None);
4910 if ((attackSource == AttackSource.Melee || attackSource == AttackSource.Range) && CS$<>8__locals1.origin.Dist(
this) <= 1)
4912 if (attackSource == AttackSource.Melee &&
this.HasElement(1221, 1))
4914 int ele2 = (this.Chara.MainElement ==
Element.Void) ? 924 : this.
Chara.MainElement.id;
4915 this.Say(
"reflect_thorne",
this, CS$<>8__locals1.origin,
null,
null);
4916 CS$<>8__locals1.origin.DamageHP(Mathf.Clamp(CS$<>8__locals1.dmg / 20, 1,
this.MaxHP / 20), ele2,
this.Power, AttackSource.Condition,
null,
true);
4918 if (this.HasElement(1223, 1))
4920 int ele3 = (this.Chara.MainElement ==
Element.Void) ? 923 : this.
Chara.MainElement.id;
4921 this.Say(
"reflect_acid",
this, CS$<>8__locals1.origin,
null,
null);
4922 CS$<>8__locals1.origin.DamageHP(Mathf.Clamp(CS$<>8__locals1.dmg / 20, 1,
this.MaxHP / 20), ele3,
this.Power * 2, AttackSource.Condition,
null,
true);
4925 if (CS$<>8__locals1.origin.HasElement(662, 1) && attackSource == AttackSource.Melee && CS$<>8__locals1.origin.isChara &&
this.Chara.IsHostile(CS$<>8__locals1.origin as
Chara))
4927 int num8 =
EClass.rnd(3 + Mathf.Clamp(CS$<>8__locals1.dmg / 100, 0, CS$<>8__locals1.origin.Evalue(662) / 10));
4928 CS$<>8__locals1.origin.Chara.stamina.Mod(num8);
4929 if (this.IsAliveInCurrentZone)
4931 this.Chara.stamina.Mod(-num8);
4934 if (CS$<>8__locals1.origin.HasElement(1350, 1) && attackSource == AttackSource.Melee)
4936 int num9 =
EClass.rndHalf(2 + Mathf.Clamp(CS$<>8__locals1.dmg / 10, 0, CS$<>8__locals1.origin.Chara.GetPietyValue() + 10));
4937 CS$<>8__locals1.origin.Chara.mana.Mod(num9);
4938 if (this.IsAliveInCurrentZone)
4940 this.Chara.mana.Mod(-num9);
4943 if (CS$<>8__locals1.origin.HasElement(661, 1) && attackSource == AttackSource.Melee)
4945 int num10 =
EClass.rnd(2 + Mathf.Clamp(CS$<>8__locals1.dmg / 10, 0, CS$<>8__locals1.origin.Evalue(661) + 10));
4946 CS$<>8__locals1.origin.Chara.mana.Mod(num10);
4947 if (this.IsAliveInCurrentZone)
4949 this.Chara.mana.Mod(-num10);
4961 if (CS$<>8__locals1.dmg > 0)
4963 int a2 = 100 * (CS$<>8__locals1.dmg * 100 / this.MaxHP) / 100;
4964 a2 = Mathf.Min(a2, this.
Chara.isRestrained ? 15 : 200);
4965 this.elements.ModExp(this.GetArmorSkill(), a2,
false);
4966 if (this.
Chara.body.GetAttackStyle() == AttackStyle.Shield)
4968 this.elements.ModExp(123, a2,
false);
4971 int num11 = (
EClass.rnd(2) == 0) ? 1 : 0;
4972 if (attackSource == AttackSource.Condition)
4974 num11 = 1 +
EClass.rnd(2);
4978 bool flag = this.
Chara.HasCondition<
ConPoison>() || ((CS$<>8__locals1.e.id == 915 || CS$<>8__locals1.e.id == 923) &&
this.ResistLv(
this.Evalue(955)) < 4);
4979 this.AddBlood(num11, flag ? 6 : -1);
4982 switch (CS$<>8__locals1.e.id)
4985 if (CS$<>8__locals1.<DamageHP>g__Chance|3(30 + eleP / 5, 100))
4991 if (this.
Chara.isWet)
4993 if (CS$<>8__locals1.<DamageHP>g__Chance|3(30 + eleP / 10, 100))
4998 else if (CS$<>8__locals1.<DamageHP>g__Chance|3(50 + eleP / 10, 100))
5004 if (CS$<>8__locals1.<DamageHP>g__Chance|3(75 + eleP / 20, 100) &&
EClass.rnd(3) == 0)
5010 if (CS$<>8__locals1.<DamageHP>g__Chance|3(30 + eleP / 5, 100))
5019 if (CS$<>8__locals1.<DamageHP>g__Chance|3(30 + eleP / 5, 100))
5024 else if (CS$<>8__locals1.<DamageHP>g__Chance|3(30 + eleP / 5, 100))
5028 if (CS$<>8__locals1.<DamageHP>g__Chance|3(50, 100))
5034 if (CS$<>8__locals1.<DamageHP>g__Chance|3(30 + eleP / 5, 100))
5040 if (CS$<>8__locals1.<DamageHP>g__Chance|3(50 + eleP / 10, 100))
5047 if (CS$<>8__locals1.<DamageHP>g__Chance|3(30 + eleP / 5, 100))
5054 if (CS$<>8__locals1.<DamageHP>g__Chance|3(5 + eleP / 25, 40))
5058 if (CS$<>8__locals1.<DamageHP>g__Chance|3(5 + eleP / 25, 40))
5062 if (CS$<>8__locals1.<DamageHP>g__Chance|3(5 + eleP / 25, 40))
5066 if (CS$<>8__locals1.<DamageHP>g__Chance|3(5 + eleP / 25, 40))
5070 if (CS$<>8__locals1.<DamageHP>g__Chance|3(5 + eleP / 25, 40))
5074 if (CS$<>8__locals1.<DamageHP>g__Chance|3(5 + eleP / 25, 40))
5078 if (CS$<>8__locals1.<DamageHP>g__Chance|3(30 + eleP / 10, 100))
5084 this.
Chara.ModCorruption(
EClass.rnd(eleP / 50 + 10));
5087 if (CS$<>8__locals1.<DamageHP>g__Chance|3(50 + eleP / 10, 100) &&
EClass.rnd(4) == 0)
5089 ActEffect.Proc(EffectId.Acid,
this.Chara,
null, 100,
default(
ActRef));
5093 if (CS$<>8__locals1.<DamageHP>g__Chance|3(50 + eleP / 10, 100))
5101 if (CS$<>8__locals1.<DamageHP>g__Chance|3(30 + eleP / 5, 100))
5106 else if (
EClass.rnd(2) == 0)
5113 else if (
EClass.rnd(2) == 0)
5119 if (CS$<>8__locals1.origin !=
null && CS$<>8__locals1.origin.HasElement(1411, 1) && !
this.Chara.HasCondition<
ConGravity>())
5121 Condition.ignoreEffect =
true;
5123 Condition.ignoreEffect =
false;
5125 if (this.
Chara.conSleep !=
null && flag2)
5127 this.
Chara.conSleep.Kill(
false);
5129 if (this.
Chara.host !=
null &&
this.hp == 0 && !
this.Chara.HasCondition<
ConFaint>())
5135 float num12 = (float)this.hp / (
float)this.MaxHP;
5136 if (this.Evalue(1421) > 0)
5138 num12 = (float)this.
Chara.mana.value / (
float)this.
Chara.mana.max;
5142 this.PlaySound(
"heartbeat", 1f - num12 * 2f,
true);
5145 if (!this.IsPC && this.hp < this.MaxHP / 5 && this.Evalue(423) <= 0 && CS$<>8__locals1.dmg * 100 /
this.MaxHP + 10 >
EClass.rnd(
this.IsPowerful ? 400 : 150) && !
this.HasCondition<
ConFear>())
5149 if (this.
Chara.ai.Current.CancelWhenDamaged && attackSource != AttackSource.Hunger && attackSource != AttackSource.Fatigue)
5151 this.
Chara.ai.Current.TryCancel(CS$<>8__locals1.origin);
5156 if (CS$<>8__locals1.e.source.aliasRef == condition2.sourceElement.aliasRef)
5158 condition2.Mod(-1,
false);
5161 if (this.
Chara.HasElement(1222, 1) && (CS$<>8__locals1.dmg >=
this.MaxHP / 10 ||
EClass.rnd(20) == 0))
5165 if (this.hp < this.MaxHP / 3 && this.HasElement(1409, 1) && !this.
Chara.HasCooldown(1409))
5167 this.
Chara.AddCooldown(1409, 0);
5169 this.
Chara.Cure(CureType.Boss, 100, BlessedState.Normal);
5170 this.
Chara.HealHP(this.MaxHP / 2, HealSource.None);
5172 if (CS$<>8__locals1.origin !=
null && CS$<>8__locals1.origin.isChara)
5176 this.
Chara.TrySetEnemy(CS$<>8__locals1.origin.Chara);
5178 if (CS$<>8__locals1.origin.Evalue(428) > 0 && !
this.IsPCFactionOrMinion &&
EClass.rnd(CS$<>8__locals1.dmg) >=
EClass.rnd(
this.MaxHP / 10) +
this.MaxHP / 100 + 1)
5180 CS$<>8__locals1.origin.Chara.TryNeckHunt(this.
Chara, CS$<>8__locals1.origin.Evalue(428) * 20,
true);
5186 public virtual void Die(
Element e =
null,
Card origin =
null, AttackSource attackSource = AttackSource.None)
5188 Card rootCard = this.GetRootCard();
5189 Point _pos = ((rootCard !=
null) ? rootCard.pos :
null) ?? this.pos;
5190 if (_pos !=
null && !_pos.IsValid)
5194 if (this.trait.EffectDead == EffectDead.Default && _pos !=
null)
5196 _pos.PlaySound(this.material.GetSoundDead(
this.sourceCard),
true, 1f,
true);
5197 _pos.PlayEffect(
"mine").SetParticleColor(this.material.GetColor()).Emit(10 +
EClass.rnd(10));
5198 this.material.AddBlood(_pos, 6);
5201 string text = (rootCard !=
this) ?
"destroyed_inv_" :
"destroyed_ground_";
5202 if (e !=
null && LangGame.Has(text + e.source.alias))
5204 text += e.source.alias;
5206 if (attackSource != AttackSource.Throw)
5208 Msg.Say(text,
this, rootCard,
null,
null);
5211 else if (attackSource != AttackSource.Throw)
5213 Msg.Say(
"destroyed",
this,
null,
null,
null);
5218 this.things.ForeachReverse(delegate(
Thing t)
5224 EClass._zone.AddCard(t, _pos);
5228 if (e !=
null && _pos !=
null && e.id == 21)
5232 if (this.trait.ThrowType == ThrowType.Explosive)
5234 this.Explode(this.pos, origin);
5239 public void Explode(
Point p,
Card origin)
5241 ActEffect.ProcAt(EffectId.Explosive, 100,
this.blessedState,
this,
null, p,
true,
new ActRef
5243 origin = ((origin != null) ? origin.Chara : null),
5244 refThing = this.Thing,
5245 aliasEle =
"eleImpact"
5250 public void Deconstruct()
5252 this.PlaySound(this.material.GetSoundDead(
this.sourceCard), 1f,
true);
5257 public void Destroy()
5259 if (this.isDestroyed)
5261 Debug.Log(this.Name +
" is already destroyed.");
5266 if (this.IsPCFaction && !this.
Chara.isSummon)
5271 this.
Chara.DropHeld(
null);
5272 this.Chara.isDead =
true;
5279 EClass.game.cards.globalCharas.Remove(this.
Chara);
5282 if (this.renderer.hasActor)
5284 this.renderer.KillActor();
5286 if (this.parent !=
null)
5288 this.parent.RemoveCard(
this);
5290 for (
int i = this.things.Count - 1; i >= 0; i--)
5292 this.things[i].Destroy();
5294 this.isDestroyed =
true;
5298 public void SpawnLoot(
Card origin)
5300 if (!this.isChara || this.IsPCFactionMinion || (this.isCopy &&
EClass.rnd(10) != 0))
5304 bool isUserZone =
EClass._zone.IsUserZone;
5306 List<Card> list =
new List<Card>();
5308 if (!this.IsPCFaction && !isUserZone && this.sourceCard.idActor.IsEmpty())
5311 if (this.rarity >= Rarity.Legendary)
5313 i = ((!
EClass.player.codex.DroppedCard(this.
id)) ? 1 : 10);
5314 EClass.player.codex.MarkCardDrop(this.
id);
5320 if (this.<SpawnLoot>g__chance|729_0(i))
5323 thing.MakeFigureFrom(this.
id);
5326 if (this.<SpawnLoot>g__chance|729_0(i))
5329 thing2.MakeFigureFrom(this.
id);
5333 bool flag2 = this.
Chara.race.corpse[1].ToInt() >
EClass.rnd(1500) || (this.Chara.IsPowerful && !this.IsPCFaction) ||
EClass.debug.godFood;
5334 if (this.
Chara.race.IsAnimal &&
EClass.rnd(
EClass._zone.IsPCFaction ? 3 : 5) == 0)
5338 if (origin !=
null && origin.HasElement(290, 1))
5340 if (!flag2 && this.
Chara.race.corpse[1].ToInt() >
EClass.rnd(150000 / (100 + (
int)Mathf.Sqrt((
float)origin.Evalue(290)) * 5)))
5343 origin.elements.ModExp(290, 100,
false);
5347 origin.elements.ModExp(290, 5,
false);
5350 if (flag2 && !isUserZone)
5352 string a = this.
Chara.race.corpse[0];
5353 if (a ==
"_meat" &&
EClass.rnd(10) == 0)
5358 if (thing3.source._origin ==
"meat")
5360 thing3.MakeFoodFrom(
this);
5364 thing3.ChangeMaterial(this.
Chara.race.material);
5368 if (!this.IsPCFaction && this.<SpawnLoot>g__chance|729_0(200))
5370 list.Add(this.
Chara.MakeGene(
null));
5372 if (!this.IsPCFaction && !isUserZone)
5374 foreach (
string text
in this.sourceCard.loot.Concat(
this.Chara.race.loot).ToList<
string>())
5376 string[] array = text.Split(
'/', StringSplitOptions.None);
5377 int num = array[1].ToInt();
5378 if (num >= 1000 || num >
EClass.rnd(1000) ||
EClass.debug.godMode)
5380 list.Add(
ThingGen.Create(array[0], -1, -1).SetNum((num >= 1000) ? (num / 1000 + ((
EClass.rnd(1000) > num % 1000) ? 1 : 0)) : 1));
5385 if (this.<SpawnLoot>g__chance|729_0(20))
5387 list.Add(
ThingGen.Create(
"microchip", -1, -1));
5389 if (this.<SpawnLoot>g__chance|729_0(15))
5391 list.Add(
ThingGen.Create(
"battery", -1, -1));
5398 if (this.<SpawnLoot>g__chance|729_0(15))
5400 list.Add(
ThingGen.Create(
"fang", -1, -1));
5402 if (this.<SpawnLoot>g__chance|729_0(10))
5404 list.Add(
ThingGen.Create(
"skin", -1, -1));
5407 if (this.<SpawnLoot>g__chance|729_0(20))
5409 list.Add(
ThingGen.Create(
"offal", -1, -1));
5411 if (this.<SpawnLoot>g__chance|729_0(20))
5413 list.Add(
ThingGen.Create(
"heart", -1, -1));
5416 if (!this.isBackerContent && !flag)
5419 List<Thing> list2 =
new List<Thing>();
5420 foreach (
Thing thing4
in this.things)
5424 if (thing4.isGifted || thing4.rarity >= Rarity.Artifact)
5428 else if (thing4.IsEquipmentOrRanged)
5430 if (thing4.rarity >= Rarity.Legendary)
5434 else if (
EClass.rnd(200) == 0)
5439 else if (
EClass.rnd(5) == 0)
5445 if (num2 > 0 && list2.Count > 0)
5447 list2.Shuffle<
Thing>();
5449 while (num3 < list2.Count && num3 < num2)
5451 list.Add(list2[num3]);
5456 if (!this.isBackerContent && this.
id !=
"big_sister")
5458 foreach (
Thing thing5
in this.things)
5462 if (thing5.isGifted || thing5.rarity >= Rarity.Legendary || thing5.trait.DropChance >
EClass.rndf(1f))
5466 else if (thing5.IsEquipmentOrRanged)
5468 if (
EClass.rnd(200) == 0)
5473 else if (
EClass.rnd(5) == 0)
5481 foreach (
Thing thing6
in this.things)
5483 if (thing6.GetInt(116,
null) != 0)
5488 Point nearestPoint = this.GetRootCard().pos;
5489 if (nearestPoint.IsBlocked)
5491 nearestPoint = nearestPoint.GetNearestPoint(
false,
true,
true,
false);
5493 foreach (
Card card
in list)
5495 card.isHidden =
false;
5496 card.SetInt(116, 0);
5497 EClass._zone.AddCard(card, nearestPoint);
5498 if (card.IsEquipmentOrRanged && card.rarity >= Rarity.Superior && !card.IsCursed)
5502 if (chara.HasElement(1412, 1) && chara.Dist(nearestPoint) < 3)
5504 card.Thing.TryLickEnchant(chara,
true,
null,
null);
5513 public Thing TryMakeRandomItem(
int lv = -1)
5517 lv =
EClass._zone.DangerLv;
5519 string text = this.id;
5520 uint num = <PrivateImplementationDetails>.ComputeStringHash(text);
5521 if (num <= 2291038882U)
5523 if (num <= 1062293841U)
5525 if (num != 51003139U)
5527 if (num != 1062293841U)
5531 if (!(text ==
"log"))
5535 this.ChangeMaterial((from m in
EClass.sources.materials.rows
5536 where m.category ==
"wood"
5540 else if (!(text ==
"egg_fertilized"))
5545 else if (num != 1555468929U)
5547 if (num != 2291038882U)
5551 if (!(text ==
"milk"))
5556 else if (!(text ==
"_meat"))
5561 else if (num <= 3595465691U)
5563 if (num != 2585652531U)
5565 if (num != 3595465691U)
5569 if (!(text ==
"ore_gem"))
5573 this.ChangeMaterial(
MATERIAL.GetRandomMaterialFromCategory(lv,
"gem",
this.material));
5578 if (!(text ==
"ore"))
5582 this.ChangeMaterial(
MATERIAL.GetRandomMaterialFromCategory(lv,
"ore",
this.material));
5586 else if (num != 3786258943U)
5588 if (num != 3871660930U)
5592 if (!(text ==
"meat_marble"))
5597 else if (!(text ==
"_egg"))
5601 string text2 =
"c_wilds";
5602 if (this.
id ==
"_meat" || this.
id ==
"meat_marble")
5610 if (!(cardRow.model.Chara.race.corpse[0] !=
"_meat") || !(
this.id !=
"milk") || !(
this.id !=
"_egg") || !(
this.id !=
"egg_fertilized"))
5612 if (!(this.
id ==
"milk"))
5614 this.MakeFoodFrom(cardRow.model);
5617 if (this.c_idRefCard.IsEmpty())
5619 this.MakeRefFrom(cardRow.model,
null);
5630 return this as
Thing;
5634 public Card MakeFoodFrom(
string _id)
5636 return this.MakeFoodFrom(
EClass.sources.cards.map[_id].model);
5642 this.MakeRefFrom(c,
null);
5643 this.ChangeMaterial(c.material);
5645 int num = race.food[0].ToInt();
5646 bool flag = this.id ==
"meat_marble";
5648 bool flag2 = this.category.IsChildOf(
"meat");
5649 bool flag3 = this.category.IsChildOf(
"egg");
5656 this.elements.SetBase(70, race.STR * race.STR / 5 * num / 100 - 10 + num / 10, 0);
5659 this.elements.SetBase(440, race.END * race.END / 5 * num / 100 - 10 + num / 10, 0);
5661 this.elements.SetBase(71, (
int)Mathf.Clamp((
float)(num / 10) + Mathf.Sqrt((
float)race.height) - 10f, 1f, 60f), 0);
5665 this.elements.SetBase(444, race.LER * race.LER / 5 * num / 100 - 10 + num / 10, 0);
5672 foreach (
Element element
in c.elements.dict.Values)
5674 if ((!flag3 || element.id != 1229) && (element.source.category ==
"food" || element.source.tag.Contains(
"foodEnc") || element.IsTrait))
5676 this.elements.SetBase(element.id, element.Value, 0);
5679 List<Tuple<int, int>> list =
new List<Tuple<int, int>>();
5680 foreach (KeyValuePair<int, int> keyValuePair
in race.elementMap)
5682 if (
EClass.sources.elements.map[keyValuePair.Key].tag.Contains(
"primary"))
5684 list.Add(
new Tuple<int, int>(keyValuePair.Key, keyValuePair.Value));
5687 list.Sort((Tuple<int, int> a, Tuple<int, int> b) => b.Item2 - a.Item2);
5689 while (num3 < num2 && num3 < list.Count)
5691 Tuple<int, int> tuple = list[num3];
5692 this.elements.SetBase(tuple.Item1, tuple.Item2 * tuple.Item2 / 4, 0);
5697 this.elements.ModBase(73, -20);
5699 this.isWeightChanged =
true;
5700 this.c_weight = race.height * 4 + 100;
5701 this.SetBlessedState(BlessedState.Normal);
5702 int num4 = c.LV - c.sourceCard.LV;
5707 num4 =
EClass.curve(num4, 10, 10, 80);
5708 if (c.rarity >= Rarity.Legendary || c.IsUnique)
5714 this.elements.ModBase(2, num4);
5720 public void MakeFoodRef(
Card c1,
Card c2 =
null)
5724 if (
Card.<MakeFoodRef>g__IsIgnoreName|733_0(card))
5728 if (
Card.<MakeFoodRef>g__IsIgnoreName|733_0(card2))
5732 if (card ==
null && card2 !=
null)
5739 this.MakeRefFrom(card, card2);
5740 if (card.c_idRefCard !=
null)
5742 this.c_idRefCard = card.c_idRefCard;
5743 this.c_altName = this.TryGetFoodName(card);
5745 if (card2 !=
null && card2.c_idRefCard !=
null)
5747 this.c_idRefCard2 = card2.c_idRefCard;
5748 this.c_altName2 = this.TryGetFoodName(card2);
5754 public string TryGetFoodName(
Card c)
5756 if (c.c_idRefCard.IsEmpty())
5761 if (row ==
null || !row.isChara)
5765 if (!row.aka.IsEmpty())
5767 if (row.name ==
"*r" && row.aka ==
"*r")
5769 return "corpseGeneral".lang();
5771 if (row.name ==
"*r")
5773 return row.GetText(
"aka",
false);
5776 return row.GetName();
5780 public string GetFoodName(
string s)
5782 return s.Replace(
"_corpseFrom".lang(),
"_corpseTo".lang());
5786 public void MakeFigureFrom(
string id)
5788 this.MakeRefFrom(
id);
5792 public void MakeRefFrom(
string id)
5794 this.c_idRefCard = id;
5798 public void MakeRefFrom(
Card c1,
Card c2 =
null)
5800 this.c_idRefCard = c1.id;
5801 this.c_altName = (c1.IsPC ? c1.c_altName : c1.GetName(NameStyle.Ref, c1.isChara ? 0 : 1));
5804 this.c_idRefCard2 = c2.id;
5805 this.c_altName2 = (c2.IsPC ? c2.c_altName : c2.GetName(NameStyle.Ref, c2.isChara ? 0 : 1));
5810 public void SetHidden(
bool hide =
true)
5812 this.isHidden = hide;
5813 this.pos.cell.Refresh();
5817 public virtual Card.MoveResult _Move(
Point p,
Card.MoveType type =
Card.MoveType.Walk)
5819 EClass._map.MoveCard(p,
this);
5822 this.
Chara.SyncRide();
5824 return Card.MoveResult.Success;
5828 public unsafe
void MoveImmediate(
Point p,
bool focus =
true,
bool cancelAI =
true)
5834 EClass._map.MoveCard(p,
this);
5835 if (!this.IsPC || focus)
5837 this.renderer.SetFirst(
true, *p.PositionCenter());
5843 this.
Chara.ai.Cancel();
5845 this.
Chara.SyncRide();
5847 if (this.IsPC && focus)
5850 EClass.screen.RefreshPosition();
5855 public unsafe
void Teleport(
Point point,
bool silent =
false,
bool force =
false)
5857 if (
EClass._zone.IsRegion)
5859 this.SayNothingHappans();
5862 this.PlayEffect(
"teleport",
true, 0f,
default(Vector3));
5863 if (!force && (this.elements.Has(400) || (
this.isChara &&
this.Chara.HasCondition<
ConGravity>())))
5865 this.Say(
"antiTeleport",
this,
null,
null);
5866 this.PlaySound(
"gravity", 1f,
true);
5871 this.PlaySound(
"teleport", 1f,
true);
5872 this.Say(
"teleported",
this,
null,
null);
5874 this._Move(point,
Card.MoveType.Walk);
5875 this.renderer.SetFirst(
true, *this.pos.PositionCenter());
5878 this.
Chara.ai.Cancel();
5881 if (chara.enemy ==
this)
5883 chara.SetEnemy(
null);
5891 EClass.screen.RefreshPosition();
5892 EClass.player.haltMove =
true;
5894 this.PlayEffect(
"teleport",
false, 0f,
default(Vector3));
5898 public virtual void OnLand()
5900 if (this.
Cell.IsTopWaterAndNoSnow)
5902 this.PlayEffect(
"ripple",
true, 0f,
default(Vector3));
5903 this.PlaySound(
"Footstep/water", 1f,
true);
5908 public int ResistLvFrom(
int ele)
5910 return this.ResistLv(
EClass.sources.elements.alias[
EClass.sources.elements.map[ele].aliasRef].id);
5914 public int ResistLv(
int res)
5916 return Element.GetResistLv(this.Evalue(res));
5920 public bool HasElement(
int ele,
int req = 1)
5922 return this.elements.Value(ele) >= req;
5926 public bool HasElement(
string id,
int req = 1)
5928 return this.HasElement(
EClass.sources.elements.alias[
id].id, req);
5935 this.renderer.SetOwner(
this);
5936 return this.renderer;
5940 public void AddBlood(
int a = 1,
int id = -1)
5942 if (
EClass._zone.IsRegion)
5946 for (
int i = 0; i < a; i++)
5948 EClass._map.AddDecal(this.pos.x + ((
EClass.rnd(2) == 0) ? 0 : (
EClass.rnd(3) - 1)),
this.pos.z + ((
EClass.rnd(2) == 0) ? 0 : (
EClass.rnd(3) - 1)), (
id == -1) ? (
this.isChara ?
this.Chara.race.blood :
this.material.decal) :
id, 1,
true);
5950 this.PlaySound(
"blood", 1f,
true);
5957 shared.color = 11010048f;
5958 shared.liquidLv = 0;
5960 this.SetRenderParam(shared);
5970 public void DyeRandom()
5976 public void Dye(
string idMat)
5978 this.Dye(
EClass.sources.materials.alias[idMat]);
5985 this.c_dyeMat = mat.id;
5990 public void RefreshColor()
5996 this._colorInt =
BaseTileMap.GetColorInt(ref this.DyeMat.matColor,
this.sourceRenderCard.colorMod);
5999 if (this.isElemental)
6001 this._colorInt =
BaseTileMap.GetColorInt(ref
EClass.setting.elements[
this.Chara.MainElement.source.alias].colorSprite,
this.sourceRenderCard.colorMod);
6004 this._colorInt = 104025;
6011 this._colorInt =
BaseTileMap.GetColorInt(ref this.DyeMat.matColor,
this.sourceRenderCard.colorMod);
6014 if (this.sourceRenderCard.useRandomColor)
6016 this._colorInt =
BaseTileMap.GetColorInt(this.GetRandomColor(), this.sourceRenderCard.colorMod);
6019 if (this.sourceRenderCard.useAltColor)
6021 this._colorInt =
BaseTileMap.GetColorInt(ref this.material.altColor,
this.sourceRenderCard.colorMod);
6024 this._colorInt =
BaseTileMap.GetColorInt(ref this.material.matColor,
this.sourceRenderCard.colorMod);
6030 public ref Color GetRandomColor()
6032 Rand.UseSeed(
EClass.game.seed +
this.sourceCard._index +
this.refVal, delegate
6034 Card._randColor = EClass.sources.materials.rows.RandomItem<SourceMaterial.Row>().matColor;
6036 return ref
Card._randColor;
6040 public virtual Sprite GetSprite(
int dir = 0)
6045 return ((act !=
null) ? act.GetSprite() :
null) ??
EClass.core.refs.icons.defaultAbility;
6047 return this.sourceCard.GetSprite(dir, this.idSkin, this.IsInstalled && this.pos.cell.IsSnowTile);
6051 public virtual Sprite GetImageSprite()
6057 public void SetImage(Image image,
int dir,
int idSkin = 0)
6059 this.sourceRenderCard.SetImage(image, this.GetSprite(dir), this.colorInt,
true, dir, idSkin);
6063 public virtual void SetImage(Image image)
6070 this.sourceRenderCard.SetImage(image, this.GetSprite(0), this.colorInt,
true, 0, 0);
6074 public void ShowEmo(Emo _emo = Emo.none,
float duration = 0f,
bool skipSame =
true)
6076 if (this.isChara && this.
Chara.host !=
null)
6080 if (_emo == this.lastEmo && skipSame)
6084 if (_emo != Emo.none)
6086 this.renderer.ShowEmo(_emo, duration);
6088 this.lastEmo = _emo;
6093 public Point ThisOrParentPos
6097 if (!(this.parent is
Card))
6101 return (this.parent as
Card).pos;
6106 public void PlaySoundHold(
bool spatial =
true)
6108 this.PlaySound(this.material.GetSoundDrop(
this.sourceCard), 1f, spatial);
6112 public void PlaySoundDrop(
bool spatial =
true)
6114 this.PlaySound(this.material.GetSoundDrop(
this.sourceCard), 1f, spatial);
6118 public SoundSource PlaySound(
string id,
float v = 1f,
bool spatial =
true)
6124 if (this.Dist(
EClass.pc) <
EClass.player.lightRadius + 1 || !spatial)
6126 return this.ThisOrParentPos.PlaySound(
id, this.isSynced || !spatial, v, spatial);
6132 public void KillAnime()
6134 this.renderer.KillAnime();
6138 public void PlayAnime(AnimeID
id,
bool force =
false)
6140 this.renderer.PlayAnime(
id, force);
6144 public void PlayAnime(AnimeID
id,
Point dest,
bool force =
false)
6146 this.renderer.PlayAnime(
id, dest);
6150 public void PlayAnimeLoot()
6152 this.renderer.PlayAnime(AnimeID.Loot,
default(Vector3),
false);
6156 public unsafe
Effect PlayEffect(
string id,
bool useRenderPos =
true,
float range = 0f, Vector3 fix =
default(Vector3))
6162 return Effect.Get(
id)._Play(this.pos, fix + ((this.isSynced && useRenderPos) ? this.renderer.position : (*
this.pos.Position())) +
new Vector3(Rand.Range(-range, range), Rand.Range(-range, range), 0f), 0f,
null,
null);
6166 public unsafe
void PlayEffect(
int ele,
bool useRenderPos =
true,
float range = 0f)
6174 effect._Play(this.pos, ((this.isSynced && useRenderPos) ? this.renderer.position : (*
this.pos.Position())) +
new Vector3(Rand.Range(-range, range), Rand.Range(-range, range), 0f), 0f,
null,
null);
6178 public virtual void SetDir(
int d)
6181 this.renderer.RefreshSprite();
6185 public void SetRandomDir()
6187 this.SetDir(
EClass.rnd(4));
6191 public virtual void LookAt(
Card c)
6196 public virtual void LookAt(
Point p)
6201 public virtual void Rotate(
bool reverse =
false)
6204 if (this.sourceCard.tiles.Length > 4)
6206 num = this.sourceCard.tiles.Length;
6226 if (this.dir == num)
6230 this.SetDir(this.dir);
6231 this.renderer.RefreshSprite();
6235 public void ChangeAltitude(
int a)
6238 if (this.altitude < 0)
6242 if (this.altitude > this.
TileType.MaxAltitude)
6244 this.altitude = this.
TileType.MaxAltitude;
6255 public unsafe
void SetFreePos(
Point point)
6257 this.freePos = (EClass.game.config.FreePos && this.isThing && this.TileType.FreeStyle && !this.sourceCard.multisize && !
EClass.scene.actionMode.IsRoofEditMode(
this));
6260 Vector3 vector = *point.Position();
6261 Vector3 thingPosition =
EClass.screen.tileMap.GetThingPosition(
this, point);
6262 this.fx = EInput.mposWorld.x +
EClass.setting.render.freePosFix.x;
6263 this.fy = EInput.mposWorld.y +
EClass.setting.render.freePosFix.y;
6264 if (
EClass.game.config.snapFreePos)
6266 this.fx -= this.fx % 0.2f;
6267 this.fy -= this.fy % 0.1f;
6269 this.fx = this.fx - vector.x + thingPosition.x;
6270 this.fy = this.fy - vector.y + thingPosition.y;
6273 this.fx = (this.fy = 0f);
6277 public unsafe
void RenderMarker(
Point point,
bool active, HitResult result,
bool main,
int dir,
bool useCurrentPosition =
false)
6283 Vector3 vector = *point.Position();
6284 bool skipRender = point.cell.skipRender;
6285 if (result != HitResult.Default &&
EClass.screen.guide.isActive && !skipRender)
6287 EClass.screen.guide.passGuideBlock.Add(ref vector, (
float)((point.HasObj || point.HasChara) ? 5 : 0), 0f);
6294 if (
EClass.scene.actionMode.IsRoofEditMode(
this))
6296 renderParam.x = vector.x;
6297 renderParam.y = vector.y;
6298 renderParam.z = vector.z;
6299 EClass.screen.tileMap.SetRoofHeight(renderParam, point.cell, point.x, point.z, 0, 0, -1,
false);
6300 vector.x = renderParam.x;
6301 vector.y = renderParam.y;
6302 vector.z = renderParam.z;
6304 if (this.
TileType.UseMountHeight && !
EClass.scene.actionMode.IsRoofEditMode(
this))
6306 this.
TileType.GetMountHeight(ref vector, point, this.dir,
this);
6308 vector.z +=
EClass.setting.render.thingZ;
6311 Vector3 thingPosition =
EClass.screen.tileMap.GetThingPosition(
this, point);
6314 vector.x += this.fx;
6315 vector.y += this.fy;
6316 vector.z += thingPosition.z;
6320 vector += thingPosition;
6323 if (useCurrentPosition)
6325 vector = this.renderer.position;
6332 renderParam.matColor = (float)(active ?
EClass.Colors.blockColors.Active :
EClass.Colors.blockColors.Inactive);
6333 point.ApplyAnime(ref vector);
6334 if (this.renderer.hasActor)
6336 this.renderer.actor.RefreshSprite();
6338 this.renderer.Draw(renderParam, ref vector,
false);
6342 public void RecalculateFOV()
6344 if (this.fov !=
null)
6350 EClass.player.lightRadius = 1;
6353 this.CalculateFOV();
6357 public bool HasLight()
6359 return this.GetLightRadius() > 0;
6364 public LightData LightData
6368 if (this._LightData ==
null)
6370 return this._LightData = ((!this.sourceCard.lightData.IsEmpty()) ?
EClass.Colors.lightColors[
this.sourceCard.lightData] :
null);
6372 return this._LightData;
6377 public float GetLightPower()
6379 float num = this.isChara ?
EClass.scene.profile.light.fovCurveChara.Evaluate(
EClass.scene.timeRatio) :
EClass.scene.profile.global.fovPower;
6380 if (this.LightData !=
null)
6382 return 0.01f * this.LightData.color.a * 256f * 1.12f;
6384 if (this.IsPCFaction && !this.IsPC)
6392 public int GetSightRadius()
6396 return this.GetLightRadius();
6398 return (
EClass._map.IsIndoor ? 4 : 5) + (this.IsPCFaction ? 1 : 0);
6402 public int GetLightRadius()
6406 int num = (this.LightData !=
null) ? this.LightData.radius : 0;
6410 if (this.
Chara.isBlind)
6414 num = ((EClass._map.IsIndoor ||
EClass.world.date.IsNight) ? 2 : ((EClass.world.date.periodOfDay == PeriodOfDay.Day) ? 6 : 5));
6419 if (!
EClass.core.config.graphic.drawAllyLight)
6423 if (this.LightData ==
null && !
EClass._map.IsIndoor && !
EClass.world.date.IsNight)
6428 if (this.IsPCFaction)
6430 Thing equippedThing = this.
Chara.body.GetEquippedThing(45);
6431 if (equippedThing !=
null)
6435 if (this.
Chara.held !=
null &&
this.IsPC)
6437 int lightRadius = this.
Chara.held.GetLightRadius();
6438 if (lightRadius > 0)
6440 if (lightRadius > num2)
6442 num2 = this.
Chara.held.GetLightRadius() - 1;
6457 if (!this.IsInstalled &&
EClass.pc.held !=
this)
6465 if (this.LightData ==
null || !this.trait.IsLightOn)
6469 return this.LightData.radius;
6473 public void CalculateFOV()
6475 int lightRadius = this.GetLightRadius();
6476 if (lightRadius == 0 || !this.IsAliveInCurrentZone || !
EClass._zone.isStarted)
6480 float num = this.GetLightPower();
6483 if (this.
Chara.held !=
null &&
this.Chara.held.GetLightRadius() > 0)
6485 num += this.
Chara.held.GetLightPower();
6487 if (lightRadius <= 2)
6493 condition.OnCalculateFov(this.fov, ref lightRadius, ref num);
6495 if (num >
EClass.scene.profile.global.playerLightPowerLimit)
6497 num =
EClass.scene.profile.global.playerLightPowerLimit;
6499 num *=
EClass.scene.profile.light.playerLightMod;
6500 EClass.player.lightRadius = lightRadius;
6501 EClass.player.lightPower = num;
6503 if (this.fov ==
null)
6505 this.fov = this.CreateFov();
6507 this.fov.Perform(this.pos.x,
this.pos.z, lightRadius, num * 2f);
6511 public void SetRandomLightColors()
6513 this.c_lightColor = (int)((
byte)(
EClass.rnd(8) + 1)) * 1024 + (int)((
byte)(
EClass.rnd(8) + 1) * 32) + (int)((
byte)(
EClass.rnd(8) + 1));
6517 public Fov CreateFov()
6520 int num = this.trait.UseLightColor ? this.c_lightColor : 0;
6523 fov.r = (byte)(num / 1024);
6524 fov.g = (byte)(num % 1024 / 32);
6525 fov.b = (byte)(num % 32);
6527 else if (this.LightData !=
null)
6529 fov.r = (byte)(this.LightData.color.r * 16f);
6530 fov.g = (byte)(this.LightData.color.g * 16f);
6531 fov.b = (byte)(this.LightData.color.b * 16f);
6533 else if (this.isChara)
6545 if (this.isChara && this.
Chara.held !=
null &&
this.Chara.held.GetLightRadius() > 0)
6547 Fov fov2 = this.
Chara.held.CreateFov();
6560 condition.OnCreateFov(fov);
6563 fov.limitGradient = (this.IsPCParty &&
EClass.scene.profile.global.limitGradient);
6568 public void ClearFOV()
6570 if (this.fov ==
null || this.fov.lastPoints.Count == 0)
6574 this.fov.Perform(this.pos.x,
this.pos.z, 0, 1f);
6578 public virtual void OnSimulateHour(
VirtualDate date)
6580 this.trait.OnSimulateHour(date);
6581 if (date.IsRealTime)
6583 this.DecayNatural(1);
6588 public void DecayNatural(
int hour = 1)
6590 if (this.isNPCProperty)
6594 this.things.ForeachReverse(delegate(
Thing t)
6596 t.DecayNatural(hour);
6598 if (this.parent is
Card && (this.parent as
Card).trait.CanChildDecay(
this))
6600 this.Decay(10 * hour);
6603 if (this.isChara || this.trait.Decay == 0)
6607 this.Decay(this.trait.Decay * hour);
6611 public void Decay(
int a = 10)
6615 int num2 = this.MaxDecay / 4 * 3;
6620 num = card.trait.DecaySpeedChild;
6622 num = num * this.trait.DecaySpeed / 100;
6623 int num3 = this.Evalue(405);
6626 num = num * (100 - num3 * 2) / 100;
6638 if (!this.IsDecayed && this.decay + a > this.MaxDecay)
6640 if (card !=
null && !card.trait.OnChildDecay(
this))
6644 if (
EClass.pc.HasElement(1325, 1) &&
this.GetRootCard() is
Chara &&
this.category.IsChildOf(
"food"))
6646 Thing thing =
TraitSeed.MakeRandomSeed(
true).SetNum(Mathf.Min(
this.Num, 3));
6647 card.AddCard(thing);
6648 if (!this.<Decay>g__IsParentLocked|800_0())
6650 this.GetRootCard().Say(
"seed_rot", this.GetRootCard(),
this, thing.Name,
null);
6655 if (this.parent ==
EClass._zone)
6657 this.Say(
"rot",
this,
null,
null);
6659 else if (this.GetRootCard() ==
EClass.pc)
6661 if (!this.<Decay>g__IsParentLocked|800_0())
6669 this.elements.SetBase(73, -10, 0);
6672 else if (this.decay < num2 && this.decay + a >= num2 && this.GetRootCard() ==
EClass.pc)
6674 if (!this.<Decay>g__IsParentLocked|800_0())
6676 EClass.pc.Say(
"rottingInv",
this,
EClass.pc,
null,
null);
6684 public void Talk(
string idTopic,
string ref1 =
null,
string ref2 =
null,
bool forceSync =
false)
6686 if (this.IsPC && !
EClass.player.forceTalk && idTopic !=
"goodBoy" && idTopic !=
"insane")
6688 EClass.player.forceTalk =
false;
6692 EClass.player.forceTalk =
false;
6693 if (!this.isSynced && !forceSync)
6698 GameLang.refDrama1 = ref1;
6699 GameLang.refDrama2 = ref2;
6700 string talkText = this.GetTalkText(idTopic,
true,
true);
6701 if (this.
id ==
"adv_gaki")
6705 this.TalkRaw(talkText, ref1, ref2, forceSync);
6709 public void TalkRaw(
string text,
string ref1 =
null,
string ref2 =
null,
bool forceSync =
false)
6711 if ((!this.isSynced && !forceSync) || text.IsEmpty())
6718 text = text.Replace(
"#1", ref1);
6722 text = text.Replace(
"#2", ref2);
6724 this.HostRenderer.Say(this.ApplyNewLine(text),
default(Color), 0f);
6725 bool flag = text.StartsWith(
"*");
6726 Msg.SetColor(text.StartsWith(
"(") ?
Msg.colors.Thinking : (flag ?
Msg.colors.Ono :
Msg.colors.Talk));
6729 text = text.Bracket(0);
6731 Msg.Say(text.Replace(
"&",
""));
6735 public string ApplyNewLine(
string text)
6737 if (text.Contains(
"&"))
6739 string str =
"_comma".lang();
6740 text = text.Replace(str +
" &", Environment.NewLine ??
"");
6741 text = text.Replace(str +
"&", Environment.NewLine ??
"");
6742 text = text.Replace(
"&", Environment.NewLine ??
"");
6753 if (!this.isChara || this.
Chara.host ==
null)
6755 return this.renderer;
6757 return this.
Chara.host.renderer;
6762 public void SayRaw(
string text,
string ref1 =
null,
string ref2 =
null)
6774 text = text.Replace(
"#1", ref1);
6778 text = text.Replace(
"#2", ref2);
6780 this.HostRenderer.Say(text,
default(Color), 0f);
6785 public bool ShouldShowMsg
6789 return (this.IsPC || this.parent ==
EClass.pc ||
this.isSynced) && (!this.isChara || !this.
Chara.isDead);
6794 public void SayNothingHappans()
6796 this.Say(
"nothingHappens",
null,
null);
6800 public void Say(
string lang,
string ref1 =
null,
string ref2 =
null)
6802 if (this.ShouldShowMsg)
6804 Msg.Say(this.IsPC ? Lang.Game.TryGetId(lang +
"_pc", lang) : lang, ref1, ref2,
null,
null);
6810 public void Say(
string lang,
Card c1,
Card c2,
string ref1 =
null,
string ref2 =
null)
6812 if (this.ShouldShowMsg)
6814 Msg.Say(this.IsPC ? Lang.Game.TryGetId(lang +
"_pc", lang) : lang, c1, c2, ref1, ref2);
6820 public void Say(
string lang,
Card c1,
string ref1 =
null,
string ref2 =
null)
6822 if (this.ShouldShowMsg)
6824 Msg.Say(this.IsPC ? Lang.Game.TryGetId(lang +
"_pc", lang) : lang, c1, ref1, ref2,
null);
6830 public string GetTalkText(
string idTopic,
bool stripPun =
false,
bool useDefault =
true)
6832 bool flag = this.isChara && this.
Chara.IsHuman;
6833 string text = MOD.listTalk.GetTalk(this.c_idTalk.IsEmpty(
this.id), idTopic, useDefault, flag);
6834 if (!text.IsEmpty())
6836 text = text.Split(
'|', StringSplitOptions.None).RandomItem<
string>();
6837 if (!flag || (this.IsDeadOrSleeping && this.IsAliveInCurrentZone))
6839 if (!text.StartsWith(
"(") && !text.StartsWith(
"*"))
6841 text =
"(" + text +
")";
6843 text = text.Replace(
"。)",
")");
6846 return this.ApplyTone(text, stripPun);
6850 public string ApplyTone(
string text,
bool stripPun =
false)
6854 string c_idTone = this.c_idTone;
6856 return Card.ApplyTone(chara, ref text, c_idTone, (biography !=
null) ? biography.gender : 0, stripPun);
6860 public static string ApplyTone(
Chara c, ref
string text,
string _tones,
int gender,
bool stripPun =
false)
6866 string[] array = _tones.IsEmpty(
"").Split(
'|', StringSplitOptions.None);
6867 string key = array[0];
6868 MOD.tones.Initialize();
6870 if (!Lang.setting.useTone || MOD.tones.list.Count == 0)
6872 text2 = text.Replace(
"{",
"").Replace(
"}",
"");
6876 if (array[0].IsEmpty())
6880 if (MOD.tones.all.ContainsKey(key))
6882 StringBuilder stringBuilder = MOD.tones.ApplyTone(key, ref text, gender);
6883 if (Lang.isJP && c !=
null && c.trait.EnableTone)
6885 if (array.Length >= 2)
6887 stringBuilder.Replace(
"_toneI".lang(), array[1]);
6889 if (array.Length >= 3)
6891 stringBuilder.Replace(
"_toneYou".lang(), array[2]);
6894 text2 = stringBuilder.ToString();
6898 text2 = text.Replace(
"{",
"").Replace(
"}",
"");
6901 if (!stripPun || !Lang.setting.stripPuns)
6905 return text2.StripLastPun();
6909 public void SetRandomTalk()
6911 MOD.listTalk.Initialize();
6912 if (!MOD.listTalk.list[0].ContainsKey(
this.id))
6914 this.c_idTalk = MOD.listTalk.GetRandomID(
"human");
6919 public void SetRandomTone()
6921 MOD.tones.Initialize();
6922 List<Dictionary<string, string>> list = MOD.tones.list;
6923 if (list.Count == 0)
6927 string text = list.RandomItem<Dictionary<string, string>>()[
"id"];
6928 for (
int i = 0; i < 10; i++)
6930 Dictionary<string, string> dictionary = list.RandomItem<Dictionary<string, string>>();
6931 if (
EClass.rnd(100) <= dictionary[
"chance"].ToInt())
6933 text = dictionary[
"id"];
6937 ToneDataList tones = MOD.tones;
6938 string text2 = text;
6940 this.c_idTone = tones.GetToneID(text2, (biography !=
null) ? biography.gender : 0);
6944 public void TryStack(
Thing t)
6951 if (dest.stack !=
null)
6955 this.Say(
"stack_thing", t, dest.stack,
null,
null);
6957 t.TryStackTo(dest.stack);
6962 public void ApplyBacker(
int bid)
6964 this.ChangeRarity(Rarity.Normal);
6970 this.c_idBacker = row.id;
6973 this.
Chara.bio.SetGender(row.gender);
6974 this.Chara.hostility = (this.Chara.c_originalHostility = Hostility.Neutral);
6978 this.
Chara.bio.SetGender(row.gender);
6980 this.Chara.idFaith = row.deity.ToLower();
6982 if (row.type == 4 || row.type == 5 || row.type == 7)
6984 this.idSkin = ((row.skin == 0) ?
EClass.rnd(this.sourceCard._tiles.Length) : row.skin);
6985 if (this.
id ==
"putty_snow")
6992 this.
Chara.EQ_ID(
"amulet_moonnight", -1, Rarity.Random);
6997 public void RemoveBacker()
6999 if (this.c_idBacker == 164)
7001 Thing thing = this.
Chara.things.Find(
"amulet_moonnight", -1, -1);
7007 this.c_idBacker = 0;
7011 public void SetPaintData()
7014 EClass.core.WaitForEndOfFrame(delegate
7016 this.ClearPaintSprite();
7017 this.c_textureData = this.GetPaintData();
7018 EClass.core.WaitForEndOfFrame(delegate
7026 public byte[] GetPaintData()
7028 Sprite sprite = this.GetSprite(0);
7029 Texture2D texture2D = ScreenCapture.CaptureScreenshotAsTexture();
7030 int num = sprite.texture.width * 2;
7031 int num2 = sprite.texture.height * 2;
7032 int x = (int)Mathf.Clamp(Input.mousePosition.x - (
float)(num / 2), 1f, (
float)(texture2D.width - num - 1));
7033 int y = (int)Mathf.Clamp(Input.mousePosition.y - (
float)(num2 / 2), 1f, (
float)(texture2D.height - num2 - 1));
7034 Color[] pixels = texture2D.GetPixels(x, y, num, num2);
7035 Texture2D texture2D2 =
new Texture2D(num, num2, TextureFormat.ARGB32,
false);
7036 texture2D2.SetPixels(pixels);
7038 byte[] result = texture2D2.EncodeToJPG();
7039 UnityEngine.Object.Destroy(texture2D);
7040 UnityEngine.Object.Destroy(texture2D2);
7045 public void ClearPaintSprite()
7047 if (this._paintSprite)
7049 UnityEngine.Object.Destroy(this._paintSprite.texture);
7050 UnityEngine.Object.Destroy(this._paintSprite);
7051 this._paintSprite =
null;
7056 public Sprite GetPaintSprite()
7058 if (!this._paintSprite)
7060 byte[] c_textureData = this.c_textureData;
7061 Texture2D texture2D =
new Texture2D(1, 1);
7062 texture2D.LoadImage(c_textureData);
7063 this._paintSprite = Sprite.Create(texture2D,
new Rect(0f, 0f, (
float)texture2D.width, (
float)texture2D.height),
new Vector2(0.5f, 0.5f), 200f);
7064 EClass.game.loadedTextures.Add(texture2D);
7066 if (traitCanvas !=
null)
7068 texture2D.filterMode = (traitCanvas.PointFilter ? FilterMode.Point : FilterMode.Bilinear);
7071 return this._paintSprite;
7075 public void TryUnrestrain(
bool force =
false,
Chara c =
null)
7077 if (this.GetRestrainer() ==
null || force)
7079 this.isRestrained =
false;
7080 this.Say(
"unrestrained",
this,
null,
null);
7083 this.Talk(
"thanks",
null,
null,
false);
7085 this.MoveImmediate(this.pos.GetNearestPoint(
false,
true,
true,
false),
true,
true);
7086 this.renderer.SetFirst(
true);
7089 if (this.c_rescueState == RescueState.WaitingForRescue)
7091 this.c_rescueState = RescueState.Rescued;
7094 EClass.player.ModKarma(2);
7097 foreach (
Chara tg
in c.pos.ListCharasInRadius(c, 5, (
Chara _c) => _c.id ==
"fanatic" && _c.faith !=
this.Chara.faith))
7099 c.DoHostileAction(tg,
true);
7108 foreach (
Card card
in this.pos.ListCards(
false))
7110 if (card.trait is
TraitShackle && card.c_uidRefCard ==
this.uid)
7119 public virtual void Tick()
7131 num = row.value * mat.value / 100;
7140 public Thing SetPriceFix(
int a)
7142 this.c_priceFix = a;
7147 public int GetEquipValue()
7149 return this.GetValue(
false);
7153 public void SetSale(
bool sale)
7155 if (this.isSale == sale)
7162 EClass._map.props.sales.Add(
this);
7165 EClass._map.props.sales.Remove(
this);
7169 public int GetValue(
bool sell =
false)
7171 int value = this.trait.GetValue();
7176 float num = (float)value;
7177 num = num * (float)Mathf.Max(100 +
this.rarityLv + Mathf.Min(
this.QualityLv * 10, 200), 80) / 100f;
7178 if (this.IsFood && !this.material.tag.Contains(
"food"))
7183 if (this.IsEquipmentOrRanged || this.trait is
TraitMod)
7201 if (this.IsEquipmentOrRanged && this.rarity >= Rarity.Legendary)
7203 num = Mathf.Max(num, 1800f + num / 5f);
7205 num = num * (100f + num2 * (float)(this.material.value - 100)) / 100f;
7206 if (this.IsEquipmentOrRanged)
7209 foreach (
Element element
in this.elements.dict.Values)
7211 num3 += element.source.value;
7213 num = num * (float)(100 + (sell ? ((
int)MathF.Sqrt((
float)num3) * 10) : num3)) / 100f;
7214 if (this.rarity >= Rarity.Legendary)
7216 num = Mathf.Max(num, 3600f + num / 5f);
7224 if (this.encLV != 0)
7226 if (this.category.tag.Contains(
"enc"))
7228 num *= 0.7f + (float)(this.encLV - 1) * 0.2f;
7230 else if (this.IsFood)
7232 if (this.
id ==
"honey")
7234 num += (float)(this.encLV * 10);
7238 num = num * Mathf.Min(1f + 0.1f * (
float)this.encLV, 2f) + (float)(this.encLV * 100);
7243 num *= 1f + (float)this.encLV * 0.01f;
7250 public virtual int GetPrice(CurrencyType currency = CurrencyType.Money,
bool sell =
false, PriceType priceType = PriceType.Default,
Chara c =
null)
7254 if (this.
id ==
"littleball")
7258 if (currency != CurrencyType.Medal)
7260 if (currency == CurrencyType.Plat &&
this.id ==
"lucky_coin")
7267 string text = this.id;
7268 uint num = <PrivateImplementationDetails>.ComputeStringHash(text);
7269 if (num <= 2142614709U)
7271 if (num <= 696483963U)
7273 if (num != 319581401U)
7275 if (num != 371758720U)
7277 if (num == 696483963U)
7279 if (text ==
"diary_catsister")
7285 else if (text ==
"wrench_extend_v")
7290 else if (text ==
"diary_lady")
7295 else if (num <= 1237752336U)
7297 if (num != 875087290U)
7299 if (num == 1237752336U)
7301 if (text ==
"water")
7307 else if (text ==
"wrench_extend_h")
7312 else if (num != 1783752896U)
7314 if (num == 2142614709U)
7316 if (text ==
"diary_sister")
7322 else if (text ==
"wrench_bed")
7327 else if (num <= 2853982554U)
7329 if (num != 2149577330U)
7331 if (num != 2315782384U)
7333 if (num == 2853982554U)
7335 if (text ==
"wrench_storage")
7341 else if (text ==
"monsterball")
7346 else if (text ==
"1165")
7351 else if (num <= 2987720544U)
7353 if (num != 2893910830U)
7355 if (num == 2987720544U)
7357 if (text ==
"wrench_fridge")
7363 else if (text ==
"bill_tax")
7368 else if (num != 3142504220U)
7370 if (num == 3660019884U)
7372 if (text ==
"container_magic")
7378 else if (text ==
"bill")
7384 if (sell && this.noSell)
7388 if (!sell && this.
id ==
"casino_coin")
7392 int value = this.GetValue(sell);
7401 float p = (float)value;
7402 Trait trait = this.trait;
7406 if (traitContainer !=
null)
7408 p *= 1f + 1f * (float)(this.things.width - traitContainer.Width) + 1f * (float)(this.things.height - traitContainer.Height);
7413 p *= 1f + 0.5f * (float)this.c_containerSize;
7415 p += (float)this.c_priceAdd;
7416 if (this.c_priceFix != 0)
7418 p = (float)((
int)(p * (
float)Mathf.Clamp(100 +
this.c_priceFix, 0, 1000000) / 100f));
7426 if (sell && priceType == PriceType.PlayerShop &&
EClass.Branch !=
null &&
EClass.Branch.policies.IsActive(2824, -1))
7428 p = p * 100f / Mathf.Max(110f, 170f - Mathf.Sqrt((
float)(
EClass.Branch.Evalue(2824) * 5)));
7430 else if (sell &&
Guild.Thief.IsMember)
7432 p = (float)
Guild.Thief.SellStolenPrice((
int)p);
7439 if (!sell && this.category.id ==
"spellbook")
7441 p = (float)
Guild.Mage.BuySpellbookPrice((
int)p);
7443 int num2 = (priceType == PriceType.CopyShop) ? 5 : 1;
7444 float num3 = 1f + Mathf.Min(0.01f * (
float)this.Evalue(752), 1f) + Mathf.Min(0.01f * (
float)this.Evalue(751), 1f) * (float)num2;
7450 if (currency == CurrencyType.Money && (
this.category.IsChildOf(
"meal") ||
this.category.IsChildOf(
"preserved")))
7454 if (priceType - PriceType.Shipping <= 1 && (
this.category.IsChildOf(
"vegi") ||
this.category.IsChildOf(
"fruit")))
7456 p *= ((EClass.pc.faith ==
EClass.game.religions.Harvest) ? 3f : 2f);
7459 if (this.
id ==
"rod_wish")
7461 p *= (sell ? 0.01f : 50f);
7465 case CurrencyType.Medal:
7468 case CurrencyType.Ecopo:
7481 case CurrencyType.Money2:
7484 case CurrencyType.Influence:
7487 case CurrencyType.Casino_coin:
7491 if (this.IsIdentified || (this.trait is
TraitErohon && !sell))
7493 if (this.blessedState == BlessedState.Blessed)
7497 else if (this.blessedState == BlessedState.Cursed)
7501 else if (this.blessedState == BlessedState.Doomed)
7505 if (this.trait.HasCharges)
7507 p = p * 0.05f + p * (0.5f + Mathf.Clamp(0.1f * (
float)this.c_charges, 0f, 1.5f));
7516 Rand.UseSeed(this.uid, delegate
7518 p = (float)(sell ? (1 +
EClass.rnd(15)) : (50 +
EClass.rnd(500)));
7523 p *= 1f + 0.2f * (float)c.Evalue(1406);
7526 float num4 = Math.Clamp(Mathf.Sqrt((
float)(c.Evalue(291) + ((!sell &&
EClass._zone.IsPCFaction) ? (
EClass.Branch.Evalue(2800) * 2) : 0))), 0f, 25f);
7527 if (priceType != PriceType.Shipping)
7529 if (priceType == PriceType.PlayerShop)
7534 if (
EClass.Branch !=
null)
7536 if (
EClass.Branch.policies.IsActive(2817, -1))
7538 num5 += 0.1f + 0.01f * Mathf.Sqrt((
float)
EClass.Branch.Evalue(2817));
7540 if (
EClass.Branch.policies.IsActive(2816, -1))
7542 num5 += 0.2f + 0.02f * Mathf.Sqrt((
float)
EClass.Branch.Evalue(2816));
7546 if (
EClass.Branch.policies.IsActive(2828, -1))
7548 num5 += 0.1f + 0.01f * Mathf.Sqrt((
float)
EClass.Branch.Evalue(2828));
7551 else if (this.category.IsChildOf(
"food") ||
this.category.IsChildOf(
"drink"))
7553 if (
EClass.Branch.policies.IsActive(2818, -1))
7555 num5 += 0.05f + 0.005f * Mathf.Sqrt((
float)
EClass.Branch.Evalue(2818));
7558 else if (this.category.IsChildOf(
"furniture"))
7560 if (
EClass.Branch.policies.IsActive(2819, -1))
7562 num5 += 0.05f + 0.005f * Mathf.Sqrt((
float)
EClass.Branch.Evalue(2819));
7565 else if (
EClass.Branch.policies.IsActive(2820, -1))
7567 num5 += 0.05f + 0.005f * Mathf.Sqrt((
float)
EClass.Branch.Evalue(2820));
7578 if (currency > CurrencyType.Money)
7582 p *= (sell ? (1f + num4 * 0.02f) : (1f - num4 * 0.02f));
7585 p = (float)
EClass.curve((
int)p, 10000, 10000, 80);
7589 p = (float)(sell ? 0 : 1);
7593 if (currency == CurrencyType.Casino_coin)
7597 p = (float)(Mathf.CeilToInt(p / 100000f) * 100000);
7599 else if (p > 10000f)
7601 p = (float)(Mathf.CeilToInt(p / 10000f) * 10000);
7605 p = (float)(Mathf.CeilToInt(p / 1000f) * 1000);
7609 p = (float)(Mathf.CeilToInt(p / 100f) * 100);
7613 p = (float)(Mathf.CeilToInt(p / 10f) * 10);
7618 p *= Mathf.Pow(2f, (
float)
EClass.player.flags.landDeedBought);
7625 public virtual string GetHoverText()
7627 return this.Name + this.GetExtraName();
7631 public virtual string GetHoverText2()
7637 public int Dist(
Card c)
7639 if (!this.IsMultisize && !c.IsMultisize)
7641 return this.pos.Distance(c.pos);
7643 if (this.IsMultisize)
7646 this.ForeachPoint(delegate(
Point p,
bool main)
7648 int num =
Card.<Dist>g__DistMulti|837_0(p, c);
7656 return Card.<Dist>g__DistMulti|837_0(this.pos, c);
7660 public int Dist(
Point p)
7662 return this.pos.Distance(p);
7666 public bool IsInMutterDistance(
int d = 10)
7668 return this.pos.Distance(
EClass.pc.pos) < d;
7672 public void SetCensored(
bool enable)
7674 this.isCensored = enable;
7675 if (
EClass.core.config.other.noCensor)
7677 this.isCensored =
false;
7679 this.renderer.SetCensored(this.isCensored);
7683 public void SetDeconstruct(
bool deconstruct)
7685 if (this.isDeconstructing == deconstruct)
7691 EClass._map.props.deconstructing.Add(
this);
7695 EClass._map.props.deconstructing.Remove(
this);
7697 this.isDeconstructing = deconstruct;
7701 public virtual void SetSortVal(UIList.SortMode m, CurrencyType currency = CurrencyType.Money)
7705 case UIList.SortMode.ByNumber:
7706 this.sortVal = -this.Num * 1000;
7708 case UIList.SortMode.ByValue:
7709 this.sortVal = -this.GetPrice(currency,
false, PriceType.Default,
null) * 1000;
7711 case UIList.SortMode.ByCategory:
7712 this.sortVal = this.category.sortVal * 1000;
7714 case UIList.SortMode.ByEquip:
7715 this.sortVal = ((this.c_equippedSlot != 0) ? 0 : (this.category.sortVal * 1000));
7717 case UIList.SortMode.ByWeight:
7718 this.sortVal = -this.ChildrenAndSelfWeight * 1000;
7720 case UIList.SortMode.ByPrice:
7721 this.sortVal = -this.GetPrice(currency,
false, PriceType.Default,
null) * 1000;
7723 case UIList.SortMode.ByWeightSingle:
7724 this.sortVal = -this.ChildrenAndSelfWeightSingle * 1000;
7727 this.sortVal = this.sourceCard._index * 1000;
7731 public virtual int SecondaryCompare(UIList.SortMode m,
Card c)
7736 num = this.
id.CompareTo(c.id);
7740 num = this.trait.CompareTo(c);
7744 num = this.GetName(NameStyle.Full, 1).CompareTo(c.GetName(NameStyle.Full, 1));
7748 num = this.refVal - c.refVal;
7752 num = this.c_charges - c.c_charges;
7756 num = this.encLV - c.encLV;
7760 num = this.uid - c.uid;
7766 public void ForeachFOV(Func<Point, bool> func)
7768 if (this.fov ==
null)
7772 foreach (KeyValuePair<int, byte> keyValuePair
in this.fov.lastPoints)
7774 Point arg =
new Point().Set(keyValuePair.Key);
7783 public void ForeachPoint(Action<Point, bool> action)
7785 if (this.IsMultisize)
7787 this.pos.ForeachMultiSize(this.W, this.H, action);
7790 action(this.pos,
true);
7794 public void OnInspect()
7800 public bool CanInspect
7804 return !this.isDestroyed && this.ExistsOnMap;
7810 public string InspectName
7820 public Point InspectPoint
7830 public Vector3 InspectPosition
7834 return this.renderer.position;
7839 public virtual void WriteNote(UINote n, Action<UINote> onWriteNote =
null,
IInspect.NoteMode mode =
IInspect.NoteMode.Default,
Recipe recipe =
null)
7844 public void Inspect()
7846 SE.Play(
"pop_paper");
7850 layerChara.windows[0].SetRect(
EClass.core.refs.rects.center,
false);
7851 layerChara.SetChara(this.
Chara);
7858 public virtual bool HasCondition<T>() where T :
Condition
7864 public bool HaveFur()
7871 return a ==
"putty_snow" || a ==
"putty_snow_gold" || !this.
Chara.race.fur.IsEmpty();
7875 public bool CanBeSheared()
7877 return !EClass._zone.IsUserZone && this.HaveFur() && this.c_fur >= 0;
7882 private bool <SpawnLoot>g__chance|729_0(
int i)
7884 i = i * 100 / (100 +
EClass.player.codex.GetOrCreate(this.
id).BonusDropLv * 10);
7889 return EClass.rnd(i) == 0;
7894 internal static bool <MakeFoodRef>g__IsIgnoreName|733_0(
Card c)
7901 return a ==
"dough_cake" || a ==
"dough_bread" || a ==
"noodle" || a ==
"flour" || a ==
"rice";
7906 private bool <Decay>g__IsParentLocked|800_0()
7908 return this.parent is
Thing && (this.parent as
Thing).c_lockLv > 0;
7913 internal static int <Dist>g__DistMulti|837_0(
Point p1,
Card c)
7917 return p1.Distance(c.pos);
7920 c.ForeachPoint(delegate(
Point p,
bool main)
7922 int num = p1.Distance(p);
7932 [JsonProperty(PropertyName =
"A")]
7933 public int[] _ints =
new int[30];
7936 [JsonProperty(PropertyName =
"B")]
7937 public string id =
"";
7940 [JsonProperty(PropertyName =
"C")]
7944 [JsonProperty(PropertyName =
"D")]
7948 [JsonProperty(PropertyName =
"E")]
7952 [JsonProperty(PropertyName =
"SC")]
7953 public List<int> sockets;
7956 public AIAct reservedAct;
7980 public int _colorInt;
7983 public float roundTimer;
7986 public float angle = 180f;
7989 public bool isDestroyed;
7995 public BitArray32 _bits1;
7998 public BitArray32 _bits2;
8001 public PlaceState placeState;
8004 public bool dirtyWeight =
true;
8007 private int _childrenWeight;
8016 private static Color _randColor;
8022 private LightData _LightData;
8025 private Sprite _paintSprite;
8031 public enum MoveResult
8042 public enum MoveType