19 return this._alias.IsEmpty(this.source.GetText(
"aka",
true) ??
"");
34 this._strs[0] = value;
49 this._strs[1] = value;
56 public string idFaction
64 this._strs[2] = value;
71 public Zone currentZone
75 return RefZone.Get(this._cints[1]);
79 this._cints[1] =
RefZone.Set(value);
90 return RefZone.Get(this._cints[2]);
94 this._cints[2] =
RefZone.Set(value);
101 public GoalListType goalListType
105 return this._cints[3].ToEnum<GoalListType>();
109 this._cints[3] = (int)value;
116 public Hostility hostility
120 return this._cints[4].ToEnum<Hostility>();
124 this._cints[4] = (int)value;
135 return this._cints[5];
139 this._cints[5] = value;
160 return this._cints[6];
164 this._cints[6] = value;
171 public int daysStarved
175 return this._cints[7];
179 this._cints[7] = value;
186 public int _idTimeTable
190 return this._cints[9];
194 this._cints[9] = value;
205 return this._cints[10];
209 this._cints[10] = value;
216 public int _maxStamina
220 return this._cints[20];
224 this._cints[20] = value;
231 public int corruption
235 return this._cints[21];
239 this._cints[21] = value;
250 return this._cbits1[0];
254 this._cbits1[0] = value;
261 public bool isAlawysVisible
265 return this._cbits1[1];
269 this._cbits1[1] = value;
280 return this._cbits1[3];
284 this._cbits1[3] = value;
295 if ((result = this._ability) ==
null)
311 if ((result = this._faction) ==
null)
313 result = (this._faction =
EClass.game.factions.dictAll.TryGetValue(this.idFaction,
null));
319 this.idFaction = ((value !=
null) ? value.uid :
null);
330 return EClass.game.religions.dictAll.TryGetValue(this.idFaith,
null) ??
EClass.game.religions.dictAll[
"eyth"];
334 this.idFaith = ((value !=
null) ? value.id :
null);
340 public override CardRow sourceCard
350 public override CardRow sourceRenderCard
354 if (this.pccData !=
null && !(this.source.renderData is
RenderDataPcc))
369 if ((result = this._race) ==
null)
371 result = (this._race =
EClass.sources.races.map[base.c_idRace.IsEmpty(this.source.race)]);
384 if ((result = this._job) ==
null)
386 result = (this._job =
EClass.sources.jobs.map[base.c_idJob.IsEmpty(this.source.job)]);
394 public string idTimeTable
398 return Chara.IDTimeTable[this._idTimeTable];
404 public Hostility OriginalHostility
408 if (
EClass.pc !=
null &&
this.IsPCFaction)
410 return Hostility.Ally;
412 if (base.c_originalHostility != (Hostility)0)
414 return base.c_originalHostility;
416 if (!this.source.hostility.IsEmpty())
418 return this.source.hostility.ToEnum(
true);
420 return Hostility.Enemy;
426 public string IDPCCBodySet
430 if (this.source.idActor.Length <= 1)
434 return this.source.idActor[1];
454 public override string ToString()
456 string[] array =
new string[9];
457 array[0] = base.Name;
460 AIAct aiact = this.ai;
461 array[num] = ((aiact !=
null) ? aiact.ToString() :
null);
464 Point pos = this.pos;
465 array[num2] = ((pos !=
null) ? pos.ToString() :
null);
467 array[6] = base.ExistsOnMap.ToString();
469 array[8] = this.isDead.ToString();
470 return string.Concat(array);
475 public string NameBraced
479 return this.GetName(NameStyle.Full, -1);
485 public string NameTitled
489 return ((
EClass.game.idDifficulty == 0) ?
"" : ((
EClass.game.idDifficulty == 1) ?
"☆" :
"★")) + this.NameBraced;
495 public override string actorPrefab
501 return "CharaActorPCC";
509 public override int PrefIndex
513 if (this.sourceCard._tiles.Length == 0 &&
this.renderer.replacer ==
null)
517 if (base.dir != 1 && base.dir != 2)
527 public override bool flipX
531 return base.dir == 1 || base.dir == 2;
537 public override string AliasMaterialOnCreate
541 return this.race.material;
547 public override bool IsAliveInCurrentZone
551 return !this.isDead && base.ExistsOnMap;
557 public override bool IsDeadOrSleeping
561 return this.isDead || this.conSleep !=
null || this.conSuspend !=
null || this.isFainted;
567 public override bool IsDisabled
571 return this.isDead || this.conSleep !=
null || this.isFainted || this.isParalyzed;
576 public bool IsCriticallyWounded(
bool includeRide =
false)
578 if (this.host !=
null && !includeRide)
582 if (base.Evalue(1421) <= 0)
584 return base.hp < this.MaxHP / 5;
586 return base.hp + this.mana.value < (this.MaxHP + this.mana.max) / 5;
591 public override bool IsMoving
595 return this.idleTimer > 0f;
601 public override bool IsGlobal
605 return this.global !=
null;
611 public override bool IsPC
615 return this ==
EClass.player.chara;
621 public override bool IsPCParty
625 return this.party !=
null && this.party.leader ==
EClass.pc;
631 public override bool IsMinion
635 return this.master !=
null || base.c_uidMaster != 0;
641 public override bool IsPCPartyMinion
645 return this.master !=
null && (this.master.IsPCParty || this.master.IsPCPartyMinion);
651 public override bool IsPCFactionMinion
655 return this.master !=
null && (this.master.IsPCFaction || this.master.IsPCFactionMinion);
661 public override bool IsPCFaction
665 return EClass.pc !=
null && this.faction ==
EClass.pc.faction;
671 public override bool IsPCC
675 return this.pccData !=
null;
681 public override bool isThing
691 public override bool isChara
701 public override bool HasHost
705 return this.host !=
null;
711 public override bool isSynced
715 return this.renderer.isSynced || (this.host !=
null && this.host.renderer.isSynced);
721 public override bool IsMultisize
725 return this.sourceCard.multisize;
731 public override int MaxHP
735 return Mathf.Max(1, ((base.END * 2 + base.STR + base.WIL / 2) * Mathf.Min(base.LV, 25) / 25 + base.END + 10) * base.Evalue(60) / 100 * (
int)((
this.IsPCFaction ? ((Rarity)100) : ((Rarity)100 + (
int)(base.rarity * (Rarity)300))) + (
this.IsPC ? (
EClass.player.lastEmptyAlly * base.Evalue(1646)) : 0)) / 100);
741 public override int WeightLimit
745 return (base.STR * 500 + base.END * 250 + base.Evalue(207) * 2000) * (base.HasElement(1411, 1) ? 5 : 1) + 45000;
751 public override int SelfWeight
755 return this.bio.weight * 1000;
765 return (
int)(Mathf.Max((
int)Mathf.Sqrt((
float)base.CHA), 1) + base.Evalue(1647) + ((!base.IsPCFactionOrMinion) ? (base.rarity * (Rarity)5) : Rarity.Normal));
775 if (base.c_idMainElement == 0)
779 return this.elements.GetElement(base.c_idMainElement);
785 public override int DV
789 if (this.IsPCFaction)
791 return this.elements.Value(64) / (this.HasCondition<ConWeakness>() ? 2 : 1);
796 num = 50 + (num - 50) / 10;
798 return (num + this.elements.Value(64) * (100 + num +
this.race.DV * 5) / 100) / (this.HasCondition<ConWeakness>() ? 2 : 1);
804 public override int PV
808 if (this.IsPCFaction)
810 return this.elements.Value(65) / (this.HasCondition<ConWeakness>() ? 2 : 1);
815 num = 50 + (num - 50) / 10;
817 return (num + this.elements.Value(65) * (100 + num +
this.race.PV * 5) / 100) / (this.HasCondition<ConWeakness>() ? 2 : 1);
823 public bool CanOpenDoor
827 return base.INT >= 5 || (this.IsPCFaction && this.memberType == FactionMemberType.Default);
832 public bool HasHigherGround(
Card c)
838 float num = this.renderer.position.y - this.pos.Position(0).y + (this.isLevitating ? 0.4f : 0f);
839 float num2 = c.renderer.position.y - c.pos.Position(0).y + ((c.isChara && c.Chara.isLevitating) ? 0.4f : 0f);
840 return num > num2 + 0.1f;
844 public bool CanSeeSimple(
Point p)
846 return p.IsValid && !p.IsHidden && (!this.IsPC || (this.fov !=
null && this.fov.lastPoints.ContainsKey(p.index)));
850 public bool CanSee(
Card c)
862 if (this.hasTelepathy && c.Chara.race.visibleWithTelepathy)
866 if (c.isHidden && c !=
this && !
this.canSeeInvisible)
871 return !this.IsPC || (this.fov !=
null && this.fov.lastPoints.ContainsKey(c.pos.index));
875 public bool CanSeeLos(
Card c,
int dist = -1,
bool includeTelepathy =
false)
877 return (c.isChara && includeTelepathy &&
this.hasTelepathy && c.Chara.race.visibleWithTelepathy) || ((!c.isHidden || this.canSeeInvisible) && this.CanSeeLos(c.pos, dist));
881 public bool CanSeeLos(
Point p,
int dist = -1)
885 dist = this.pos.Distance(p);
887 if (dist > base.GetSightRadius())
893 return this.fov !=
null && this.fov.lastPoints.ContainsKey(p.index);
895 return Los.IsVisible(this.pos, p,
null);
905 if ((result = this._tactics) ==
null)
907 result = (this._tactics =
new Tactics(
this));
915 public TimeTable.Span CurrentSpan
925 public bool IsInActiveZone
929 return this.currentZone ==
EClass.game.activeZone;
935 public bool IsLocalChara
939 return !this.IsGlobal && !base.isSubsetCard && this.homeZone ==
EClass._zone;
949 return !this.IsDeadOrSleeping && this.ai.Current.IsIdle;
955 public bool IsInCombat
969 return this.tactics.DestDist;
975 public bool HasNoGoal
979 return this.ai.IsNoGoal;
985 public bool CanWitness
989 return this.race.IsHuman || this.race.IsFairy || this.race.IsGod || this.race.id ==
"mutant";
999 return this.race.tag.Contains(
"human");
1005 public bool IsHumanSpeak
1009 return this.IsHuman || this.race.tag.Contains(
"humanSpeak");
1019 return EClass.Branch !=
null && EClass.Branch.uidMaid == base.uid;
1025 public bool IsPrisoner
1035 public bool IsAdventurer
1039 return this.global !=
null && this.faction != EClass.pc.faction && this.IsPCC;
1049 return this.faith.id ==
"eyth";
1054 public bool CanSleep()
1056 return EClass._zone.events.GetEvent<
ZoneEventQuest>() ==
null && (
EClass.debug.godMode ||
this.sleepiness.GetPhase() != 0 ||
this.stamina.GetPhase() <= 1);
1061 public bool IsWealthy
1065 return this.source.works.Contains(
"Rich") || this.source.hobbies.Contains(
"Rich");
1075 Zone homeZone = this.homeZone;
1076 if (homeZone ==
null)
1080 return homeZone.branch;
1095 protected override void OnSerializing()
1097 if (this.enemy !=
null)
1099 base.SetInt(55, this.enemy.uid);
1101 this._cints[0] = (int)this._cbits1.Bits;
1102 List<BodySlot> slots = this.body.slots;
1103 this.rawSlots =
new int[slots.Count];
1104 for (
int i = 0; i < slots.Count; i++)
1106 this.rawSlots[i] = slots[i].elementId;
1111 protected override void OnDeserialized()
1113 this.isCreated =
true;
1114 this._cbits1.Bits = (uint)this._cints[0];
1115 this.InitStats(
true);
1116 this.body.SetOwner(
this,
true);
1117 this.elements.ApplyElementMap(base.uid, SourceValueType.Chara,
this.job.elementMap, base.DefaultLV,
false,
false);
1118 this.elements.ApplyElementMap(base.uid, SourceValueType.Chara,
this.race.elementMap, base.DefaultLV,
false,
false);
1119 if (this.global !=
null && this.global.goal !=
null)
1121 this.global.goal.SetOwner(
this);
1125 this.pccData.state = (base.isCensored ? PCCState.Naked : PCCState.Normal);
1127 if (this.tempElements !=
null)
1129 this.tempElements.SetParent(
this);
1132 this.RefreshFaithElement();
1133 this.Refresh(
false);
1134 if (this.source.tag.Contains(
"boss"))
1136 this.bossText =
true;
1138 this.sharedCheckTurn =
EClass.rnd(200);
1142 public override string GetName(NameStyle style,
int num = -1)
1144 if (base.isBackerContent &&
EClass.core.config.backer.Show(base.c_idBacker))
1146 if (this.
id ==
"follower" && !this.IsGlobal)
1148 return "_follower".lang(
EClass.sources.backers.map[base.c_idBacker].Name,
this.faith.Name,
null,
null,
null);
1150 return EClass.sources.backers.map[base.c_idBacker].Name;
1154 string text = base.c_altName ?? this.source.GetName(
this,
false);
1155 text = text.Replace(
"#ele4", this.MainElement.source.GetAltname(2)).Replace(
"#ele3", this.MainElement.source.GetAltname(1)).Replace(
"#ele2", this.MainElement.source.GetAltname(0)).Replace(
"#ele", this.MainElement.source.GetName().ToLower());
1156 if (base.c_bossType == BossType.Evolved)
1158 text =
"_evolved".lang(text.ToTitleCase(
true),
null,
null,
null,
null);
1160 this.trait.SetName(ref text);
1161 if (text.Length > 0 &&
char.IsLower(text[0]))
1163 if (base.rarity >= Rarity.Legendary)
1165 text = text.ToTitleCase(
false);
1169 text = text.AddArticle();
1172 if (style == NameStyle.Simple)
1176 int num2 = (base.rarity == Rarity.Mythical) ? 3 : ((base.rarity >= Rarity.Legendary) ? 2 : ((!this._alias.IsEmpty()) ? 1 : -1));
1181 if (!this.Aka.IsEmpty())
1183 text = ((num2 == 1) ?
"_aka3" : ((num2 == -1) ?
"_aka" :
"_aka2")).lang((num2 == -1) ? this.Aka : this.Aka.ToTitleCase(
true), text.Bracket(num2),
null,
null,
null);
1187 text = text.Bracket(num2);
1189 string str = base.isSale ?
"forSale".lang(Lang._currency(
this.GetPrice(CurrencyType.Money,
true, PriceType.PlayerShop,
null),
"money"),
null,
null,
null,
null) :
"";
1195 public override void ChangeRarity(Rarity r)
1197 if (r == base.rarity)
1202 if (this.renderer !=
null && this.renderer.isSynced)
1204 this.renderer.RefreshExtra();
1206 base.hp = this.MaxHP;
1210 public void SetFaction(
Faction f)
1212 this._faction =
null;
1214 this.hostility = this.faction.GetHostility();
1218 public void SetHomeZone(
Zone zone)
1220 this.homeZone = zone;
1225 public Chara SetGlobal(
Zone _home,
int x,
int z)
1228 this.homeZone = _home;
1229 _home.AddCard(
this, x, z);
1236 this.orgPos =
new Point(x, z);
1241 public Chara SetGlobal()
1245 EClass.game.cards.globalCharas.Add(
this);
1247 base.isSubsetCard =
false;
1249 base.c_uidMaster = 0;
1255 public void RemoveGlobal()
1257 if (!this.IsGlobal || this.trait is
TraitUniqueChara || base.IsUnique ||
EClass.game.cards.listAdv.Contains(
this))
1262 EClass.game.cards.globalCharas.Remove(
this);
1266 public override void OnBeforeCreate()
1268 if (this.source.job ==
"*r")
1270 base.c_idJob = (from j in EClass.sources.jobs.rows
1271 where j.playable < 4
1272 select j).RandomItem<SourceJob.Row>().id;
1274 if (this.bp.idJob !=
null)
1276 base.c_idJob = this.bp.idJob;
1278 if (this.bp.idRace !=
null)
1280 base.c_idRace = this.bp.idRace;
1285 public override void OnCreate(
int genLv)
1287 if (this.source.tag.Contains(
"boss"))
1289 this.bossText =
true;
1291 int num = (this.bp.lv != -999) ? this.bp.lv : base.LV;
1292 if (this.trait.AdvType ==
TraitChara.Adv_Type.Adv ||
this.trait.AdvType ==
TraitChara.Adv_Type.Adv_Fairy)
1294 if (
Chara.ListAdvRace.Count == 0)
1296 Chara.ListAdvRace = (from a in EClass.sources.races.rows
1297 where a.playable <= 1 && a.id !=
"fairy"
1298 select a).ToList<SourceRace.Row>();
1299 Chara.ListAdvJob = (from a in EClass.sources.jobs.rows
1300 where a.playable <= 4
1301 select a).ToList<SourceJob.Row>();
1303 if (this.trait.AdvType ==
TraitChara.Adv_Type.Adv)
1310 num = 10 +
EClass.rnd(40);
1313 this.bio.Generate(
this);
1314 if (this.source.idActor.Length != 0 &&
this.source.idActor[0] ==
"pcc" &&
this.pccData ==
null)
1316 this.pccData = PCCData.Create(this.IDPCCBodySet);
1317 if (this.source.idActor.Length > 2)
1319 this.pccData.SetPart(
"body", this.IDPCCBodySet, this.source.idActor[2],
null);
1323 this.pccData.Randomize(this.IDPCCBodySet,
null,
true);
1326 if (this.source.mainElement.Length != 0)
1328 List<Tuple<string, int, int>> list =
new List<Tuple<string, int, int>>();
1329 string[] mainElement = this.source.mainElement;
1330 for (
int i = 0; i < mainElement.Length; i++)
1332 string[] array = mainElement[i].Split(
'/', StringSplitOptions.None);
1334 int num2 = this.source.LV * row.eleP / 100 + base.LV - this.source.LV;
1335 if (list.Count == 0 || num2 < genLv)
1337 list.Add(
new Tuple<string, int, int>(array[0], (array.Length > 1) ?
int.Parse(array[1]) : 0, num2));
1340 Tuple<string, int, int> tuple = list.RandomItemWeighted((Tuple<string, int, int> a) => (
float)(10000 / (100 + (genLv - a.Item3) * 25)));
1341 if (!this.bp.idEle.IsEmpty())
1343 tuple = (from a in list
1344 where a.Item1 == this.bp.idEle
1345 select a).First<Tuple<string, int, int>>();
1347 this.SetMainElement(tuple.Item1, (tuple.Item2 == 0) ? 10 : tuple.Item2,
true);
1350 if (this.source.name ==
"*r")
1352 base.c_altName = NameGen.getRandomName();
1354 if (this.source.GetText(
"aka",
false) ==
"*r" ||
this.trait.UseRandomAlias)
1356 this._alias = AliasGen.GetRandomAlias();
1358 this.happiness =
EClass.rnd(100);
1359 this.contribution =
EClass.rnd(100);
1360 this.RerollHobby(
true);
1361 this._idTimeTable = ((
EClass.rnd(5) == 0) ? 1 : 0);
1362 this.ApplyRace(
false);
1363 this.ApplyJob(
false);
1364 if (num != this.source.LV)
1368 if (base.LV > 5 &&
this.race.id ==
"mutant")
1370 for (
int j = 0; j < Mathf.Min(1 + base.LV / 5, 22); j++)
1372 this.SetFeat(1644, j + 1,
false);
1375 this.InitStats(
false);
1376 this.body.SetOwner(
this,
false);
1377 this.hostility = this.OriginalHostility;
1378 if (this.race.EQ.Length != 0)
1380 this.TryRestock(
true);
1382 string id = this.id;
1383 uint num3 = <PrivateImplementationDetails>.ComputeStringHash(
id);
1384 if (num3 <= 2331752522U)
1386 if (num3 != 108289031U)
1388 if (num3 != 1020922669U)
1390 if (num3 != 2331752522U)
1394 if (!(
id ==
"snail"))
1403 if (!(
id ==
"dodo"))
1407 base.idSkin =
EClass.rnd(4);
1411 else if (!(
id ==
"cat"))
1416 else if (num3 <= 3253821027U)
1418 if (num3 != 2629043432U)
1420 if (num3 != 3253821027U)
1424 if (!(
id ==
"sister_undead"))
1431 if (!(
id ==
"olderyoungersister"))
1439 else if (num3 != 3352919697U)
1441 if (num3 != 3865623817U)
1452 if (!(
id ==
"putty_snow"))
1458 base.idSkin =
EClass.rnd(4);
1463 base.idSkin =
EClass.rnd(this.sourceCard.tiles.Length);
1464 if (this.
id ==
"sister_undead" &&
EClass.rnd(10) == 0)
1467 if (row2 !=
null && (!
EClass.player.doneBackers.Contains(row2.id) ||
EClass.core.config.test.ignoreBackerDestoryFlag))
1469 base.ApplyBacker(row2.id);
1473 if (this.source.tag.Contains(
"random_color"))
1477 this.SetAI(
new NoGoal());
1478 if (!this.source.faith.IsEmpty())
1480 this.SetFaith(this.source.faith);
1482 else if (
EClass.game.activeZone !=
null &&
EClass.game.activeZone.id ==
"foxtown")
1484 this.SetFaith(
EClass.game.religions.Trickery);
1486 else if (
EClass.game.activeZone !=
null &&
EClass.game.activeZone.id ==
"foxtown_nefu")
1488 this.SetFaith(
EClass.game.religions.MoonShadow);
1492 this.SetFaith(
EClass.game.religions.GetRandomReligion(
true,
EClass.rnd(10) == 0));
1495 this.interest = 100;
1496 this.CalculateMaxStamina();
1497 this.Refresh(
false);
1498 this.stamina.value = this.stamina.max;
1499 this.mana.value = this.mana.max;
1500 this.isCreated =
true;
1504 public void SetFaith(
string id)
1506 this.SetFaith(
EClass.game.religions.dictAll[
id]);
1513 this.RefreshFaithElement();
1517 public void HealAll()
1519 this.Cure(CureType.Death, 100, BlessedState.Normal);
1520 base.hp = this.MaxHP;
1521 this.mana.value = this.mana.max;
1522 this.stamina.value = this.stamina.max;
1523 this.Refresh(
false);
1527 public void Refresh(
bool calledRecursive =
false)
1529 if (this.ride !=
null)
1531 this.ride.Refresh(
true);
1533 this.hasTelepathy =
false;
1535 this.isLevitating = (base.HasElement(401, 1) || (this.ride !=
null && this.ride.isLevitating));
1536 this.canSeeInvisible = base.HasElement(416, 1);
1537 base.isHidden = base.HasElement(415, 1);
1538 foreach (
Condition condition
in this.conditions)
1540 condition.OnRefresh();
1544 base.isHidden =
false;
1546 this.SetDirtySpeed();
1547 if (this.host !=
null && !calledRecursive)
1549 this.host.Refresh(
true);
1554 public Chara Duplicate()
1557 chara.mana.value = this.mana.value;
1558 chara.stamina.value = this.stamina.value;
1559 foreach (KeyValuePair<int, Element> keyValuePair
in this.elements.dict)
1561 Element element = chara.elements.GetElement(keyValuePair.Key);
1562 if (element !=
null)
1564 element.vBase = keyValuePair.Value.ValueWithoutLink - element.vSource;
1567 chara.SetFaith(this.faith);
1568 chara.bio = IO.DeepCopy<
Biography>(this.bio);
1569 chara.hp = Mathf.Max(0, (
int)((
float)chara.MaxHP * ((
float)base.hp / (
float)
this.MaxHP) * 0.99f));
1570 chara.isCopy =
true;
1579 public int GetBurden(
Card t =
null,
int num = -1)
1581 int num2 = (base.ChildrenWeight + ((t !=
null) ? ((num == -1) ? t.ChildrenAndSelfWeight : (t.SelfWeight * num)) : 0)) * 100 / this.WeightLimit;
1586 if (
EClass.debug.ignoreWeight &&
this.IsPC)
1590 int num3 = (num2 < 100) ? 0 : ((num2 - 100) / 10 + 1);
1599 public void CalcBurden()
1601 int num = base.ChildrenWeight * 100 / this.WeightLimit;
1606 if (
EClass.debug.ignoreWeight &&
this.IsPC)
1610 this.burden.Set(num);
1611 this.SetDirtySpeed();
1615 public void Stumble(
int mtp = 100)
1618 base.Say(flag ?
"dmgBurdenStairs" :
"dmgBurdenFallDown",
this,
null,
null);
1619 int num = this.MaxHP;
1620 if (base.Evalue(1421) > 0)
1622 num = this.mana.max;
1624 int num2 = (num * (base.ChildrenWeight * 100 / this.WeightLimit) / (flag ? 100 : 200) + 1) * mtp / 100;
1629 base.DamageHP(num2, flag ? AttackSource.BurdenStairs : AttackSource.BurdenFallDown,
null);
1638 if (this.dirtySpeed)
1640 this.RefreshSpeed();
1647 public void SetDirtySpeed()
1649 this.dirtySpeed =
true;
1650 if (this.host !=
null)
1652 this.host.SetDirtySpeed();
1657 public void RefreshSpeed()
1659 if (this.ride !=
null && !this.ride.IsDeadOrSleeping)
1661 this.ride.RefreshSpeed();
1662 this._Speed = this.ride._Speed;
1664 else if (this.host !=
null)
1666 if (this.host.ride ==
this)
1668 this._Speed = base.Evalue(79);
1669 this._Speed = this._Speed * 100 / Mathf.Clamp(100 + this._Speed * (this.race.tag.Contains(
"noRide") ? 5 : 1) - base.STR -
this.host.EvalueRiding() * 2 - (
this.race.tag.Contains(
"ride") ? 50 : 0), 100, 1000);
1673 this._Speed = (base.Evalue(79) + this.host.Evalue(79)) / 2;
1678 this._Speed = base.Evalue(79) + base.Evalue(407) / 2;
1680 BodySlot slot = this.body.GetSlot(37,
false,
false);
1681 if (((slot !=
null) ? slot.thing :
null) !=
null && base.HasElement(1209, 1))
1686 if (this.parasite !=
null)
1688 this._Speed = this._Speed * 100 / Mathf.Clamp(120 + this.parasite.LV * 2 - base.STR - base.Evalue(227) * 2, 100, 1000);
1690 if (this.IsPCFaction)
1692 switch (this.burden.GetPhase())
1704 num -= (this.IsPC ? 50 : 100);
1709 int phase = this.stamina.GetPhase();
1721 phase = this.sleepiness.GetPhase();
1733 switch (this.hunger.GetPhase())
1743 num += EClass.player.lastEmptyAlly * base.Evalue(1646);
1745 if (this.IsPCParty &&
EClass.player.lastEmptyAlly < 0)
1747 num += EClass.player.lastEmptyAlly * 10 - 10;
1750 this._Speed = this._Speed * num / 100;
1751 if (this.HasCondition<ConGravity>())
1753 this._Speed = this._Speed * 2 / 3;
1755 if (this._Speed < 10)
1759 this.dirtySpeed =
false;
1763 public void CalculateMaxStamina()
1766 foreach (
Element element
in this.elements.dict.Values)
1768 if (element.source.category ==
"skill")
1772 num += Mathf.Max(element.vBase, 0);
1776 num += Mathf.Max(element.ValueWithoutLink, 0);
1780 int num2 =
EClass.curve(num, 30, 10, 60);
1785 this._maxStamina = num2 + 10;
1789 public override void ApplyEditorTags(EditorTag tag)
1793 case EditorTag.HostilityNeutral:
1794 this.hostility = (base.c_originalHostility = Hostility.Neutral);
1796 case EditorTag.HostilityFriend:
1797 this.hostility = (base.c_originalHostility = Hostility.Friend);
1799 case EditorTag.HostilityEnemy:
1800 this.hostility = (base.c_originalHostility = Hostility.Enemy);
1803 if (tag != EditorTag.Male)
1805 if (tag == EditorTag.Female)
1807 this.bio.SetGender(1);
1808 base.c_idPortrait =
Portrait.GetRandomPortrait(1, this.GetIdPortraitCat());
1813 this.bio.SetGender(2);
1814 base.c_idPortrait =
Portrait.GetRandomPortrait(2, this.GetIdPortraitCat());
1818 base.ApplyEditorTags(tag);
1822 public override void SetSource()
1824 this.source =
EClass.sources.charas.map.TryGetValue(this.
id,
null);
1825 if (this.source ==
null)
1827 Debug.LogWarning(
"Chara " + this.
id +
" not found");
1829 this.source =
EClass.sources.charas.map[this.id];
1831 this.path.walker =
this;
1835 public void SetMainElement(
string id,
int v = 0,
bool elemental =
false)
1837 if (!
id.StartsWith(
"ele"))
1841 this.SetMainElement(
EClass.sources.elements.alias[
id].id, v, elemental);
1845 public void SetMainElement(
int id,
int v = 0,
bool elemental =
false)
1847 if (base.c_idMainElement != 0)
1849 this.elements.SetBase(base.c_idMainElement, 0, 0);
1850 this.elements.ModBase(
EClass.sources.elements.alias[
EClass.sources.elements.map[base.c_idMainElement].aliasRef].id, -20);
1851 base.c_idMainElement = 0;
1858 base.c_idMainElement = id;
1859 this.elements.ModBase(
id, (v == 0) ? 10 : v);
1860 this.elements.ModBase(
EClass.sources.elements.alias[row.aliasRef].id, 20);
1863 base.isElemental =
true;
1865 Color colorSprite =
EClass.setting.elements[this.MainElement.source.alias].colorSprite;
1866 base.c_lightColor = (int)((
byte)Mathf.Clamp(colorSprite.r * 3f, 1f, 31f)) * 1024 + (int)((
byte)Mathf.Clamp(colorSprite.g * 3f, 1f, 31f) * 32) + (int)((
byte)Mathf.Clamp(colorSprite.b * 3f, 1f, 31f));
1868 this._ability =
null;
1872 public void ApplyJob(
bool remove =
false)
1874 this.elements.ApplyElementMap(base.uid, SourceValueType.Chara,
this.job.elementMap, base.DefaultLV,
remove,
true);
1877 EClass.game.uniforms.Apply(this.pccData, this.job.id, base.IsMale,
true);
1882 public void ChangeJob(
string idNew)
1884 this.ApplyJob(
true);
1885 base.c_idJob = idNew;
1887 this.ApplyJob(
false);
1890 PCC.Get(this.pccData).Build(
false);
1895 private int ParseBodySlot(
string s)
1897 uint num = <PrivateImplementationDetails>.ComputeStringHash(s);
1898 if (num <= 2451230377U)
1900 if (num <= 656231480U)
1902 if (num != 44370790U)
1904 if (num == 656231480U)
1912 else if (s ==
"指")
1917 else if (num != 1212265771U)
1919 if (num == 2451230377U)
1927 else if (s ==
"背")
1932 else if (num <= 3467005066U)
1934 if (num != 3039685058U)
1936 if (num == 3467005066U)
1944 else if (s ==
"è¶³")
1949 else if (num != 3477141168U)
1951 if (num != 3596583458U)
1953 if (num == 4097913071U)
1961 else if (s ==
"体")
1966 else if (s ==
"è…•")
1974 public void AddRandomBodyPart(
bool msg =
false)
1987 }.RandomItem<
int>();
1988 this.body.AddBodyPart(num,
null);
1991 base.Say(
"gain_bodyparts",
this,
Element.Get(num).GetName().ToLower(),
null);
1992 base.PlaySound(
"offering", 1f,
true);
1997 public void ApplyRace(
bool remove =
false)
1999 foreach (
string s
in this.race.figure.Split(
'|', StringSplitOptions.None))
2001 int num = this.ParseBodySlot(s);
2006 this.body.RemoveBodyPart(num);
2010 this.body.AddBodyPart(num,
null);
2014 this.elements.ApplyElementMap(base.uid, SourceValueType.Chara,
this.race.elementMap, base.DefaultLV,
remove,
true);
2018 public void ChangeRace(
string idNew)
2020 this.ApplyRace(
true);
2021 base.c_idRace = idNew;
2023 this.ApplyRace(
false);
2024 base.ChangeMaterial(this.race.material);
2028 public void MakePartyMemeber()
2031 EClass.pc.party.AddMemeber(
this);
2035 public void MakeAlly(
bool msg =
true)
2037 if (this.IsLocalChara && !base.IsUnique)
2039 Debug.Log(
"Creating Replacement NPC for:" + ((
this !=
null) ? this.ToString() :
null));
2040 EClass._map.deadCharas.Add(this.CreateReplacement());
2042 if (
EClass.pc.homeBranch !=
null)
2044 EClass.pc.homeBranch.AddMemeber(
this);
2046 this.ReleaseMinion();
2047 this.hostility = (base.c_originalHostility = Hostility.Ally);
2055 EClass.pc.Say(
"hire",
this,
null,
null);
2056 EClass.Sound.Play(
"good");
2058 EClass.pc.party.AddMemeber(
this);
2061 EClass._zone.RefreshListCitizen();
2066 public void _MakeAlly()
2069 this.hostility = (base.c_originalHostility = Hostility.Ally);
2070 this.SetFaction(
EClass.Home);
2072 this.ReleaseMinion();
2074 this.Refresh(
false);
2078 public bool CanBeTempAlly(
Chara c)
2080 return !this.IsPCFaction && !this.IsGlobal && !this.IsMinion && !this.IsMultisize &&
EClass._zone.CountMinions(c) <= c.MaxSummon && base.rarity < Rarity.Legendary && !base.HasElement(1222, 1);
2084 public void MakeMinion(
Chara _master, MinionType type = MinionType.Default)
2086 this.ReleaseMinion();
2087 this.hostility = (base.c_originalHostility = (_master.IsPCFaction ? Hostility.Ally : _master.hostility));
2088 base.c_uidMaster = _master.uid;
2089 base.c_minionType = type;
2090 this.master = _master;
2091 this.Refresh(
false);
2095 public void ReleaseMinion()
2097 Debug.Log(
"released:" + ((
this !=
null) ? this.ToString() :
null));
2098 base.c_uidMaster = 0;
2103 if (chara.enemy ==
this)
2105 chara.SetEnemy(
null);
2110 this.Refresh(
false);
2114 public void SetSummon(
int duration)
2116 base.c_summonDuration = duration;
2117 base.isSummon =
true;
2121 public Chara FindMaster()
2125 this.master =
EClass._map.FindChara(base.c_uidMaster);
2131 public bool IsEscorted()
2133 if (!this.IsPCPartyMinion)
2140 if (questEscort !=
null && questEscort.uidChara == base.uid)
2149 public bool CanDestroyPath()
2151 return this.IsMultisize || (base.rarity >= Rarity.Superior && !base.IsPCFactionOrMinion && this.ai is
GoalCombat && !EClass._zone.IsPCFaction && !(EClass._zone is
Zone_Town));
2155 public bool CanMoveTo(
Point p,
bool allowDestroyPath =
true)
2161 int num = (p.z < this.pos.z) ? 0 : ((p.x > this.pos.x) ? 1 : ((p.z > this.pos.z) ? 2 : 3));
2162 if (allowDestroyPath && this.CanDestroyPath())
2171 if (
EClass._map.cells[p.x, p.z].blocked ||
EClass._map.cells[
this.pos.x,
this.pos.z].weights[num] == 0)
2175 if (p.x !=
this.pos.x && p.z !=
this.pos.z)
2180 int num2 = (z < this.pos.z) ? 0 : ((x > this.pos.x) ? 1 : ((z > this.pos.z) ? 2 : 3));
2181 if (cells[this.pos.x,
this.pos.z].weights[num2] == 0)
2185 if (cells[x, z].blocked)
2189 num2 = ((z < p.z) ? 0 : ((x > p.x) ? 1 : ((z > p.z) ? 2 : 3)));
2190 if (cells[p.x, p.z].weights[num2] == 0)
2196 num2 = ((z < this.pos.z) ? 0 : ((x > this.pos.x) ? 1 : ((z > this.pos.z) ? 2 : 3)));
2197 if (cells[this.pos.x,
this.pos.z].weights[num2] == 0)
2201 if (cells[x, z].blocked)
2205 num2 = ((z < p.z) ? 0 : ((x > p.x) ? 1 : ((z > p.z) ? 2 : 3)));
2206 if (cells[p.x, p.z].weights[num2] == 0)
2214 if (this.IsEnemyOnPath(p,
true))
2219 else if (p.HasChara && !
this.IsMultisize && !
this.CanReplace(p.FirstChara))
2227 public bool IsEnemyOnPath(
Point p,
bool cancelAI =
true)
2229 if (!this.currentZone.IsRegion && p.IsValid)
2232 if (detail !=
null && detail.charas.Count > 0)
2234 foreach (
Chara chara
in p.detail.charas)
2236 if (chara.IsHostile(
this) || !chara.trait.CanBePushed)
2252 public bool CanInteractTo(
Card c)
2254 return this.CanInteractTo(c.pos);
2258 public bool CanInteractTo(
Point p)
2264 if (
EClass._map.cells[p.x, p.z].blocked)
2268 int num = (p.z < this.pos.z) ? 0 : ((p.x > this.pos.x) ? 1 : ((p.z > this.pos.z) ? 2 : 3));
2269 if (
EClass._map.cells[
this.pos.x,
this.pos.z].weights[num] == 0)
2273 if (p.x !=
this.pos.x && p.z !=
this.pos.z)
2278 int num2 = (z < this.pos.z) ? 0 : ((x > this.pos.x) ? 1 : ((z > this.pos.z) ? 2 : 3));
2279 if (cells[this.pos.x,
this.pos.z].weights[num2] == 0)
2283 num2 = ((z < p.z) ? 0 : ((x > p.x) ? 1 : ((z > p.z) ? 2 : 3)));
2284 if (cells[p.x, p.z].weights[num2] == 0)
2290 num2 = ((z < this.pos.z) ? 0 : ((x > this.pos.x) ? 1 : ((z > this.pos.z) ? 2 : 3)));
2291 if (cells[this.pos.x,
this.pos.z].weights[num2] == 0)
2295 num2 = ((z < p.z) ? 0 : ((x > p.x) ? 1 : ((z > p.z) ? 2 : 3)));
2296 if (cells[p.x, p.z].weights[num2] == 0)
2307 return PathManager.Instance.GetFirstStep(this.pos, newPoint,
this, this.IsPC ? 40 : 10, this.IsMultisize ?
PathManager.MoveType.Default : moveType);
2311 public bool MoveRandom()
2313 Point randomNeighbor = this.pos.GetRandomNeighbor();
2314 return !randomNeighbor.Equals(this.pos) && !randomNeighbor.HasChara && this.TryMove(randomNeighbor,
true) ==
Card.MoveResult.Success;
2318 public bool MoveNeighborDefinitely()
2320 List<Point> list =
new List<Point>();
2321 this.pos.ForeachNeighbor(delegate(
Point p)
2325 list.Shuffle<
Point>();
2326 foreach (
Point point
in list)
2328 if (!point.Equals(
this.pos) && !point.HasChara &&
this.TryMove(point,
true) ==
Card.MoveResult.Success)
2337 public void MoveByForce(
Point newPoint,
Card c =
null,
bool checkWall =
false)
2339 if (newPoint.sourceBlock.tileType.IsBlockPass)
2343 if (checkWall && (base.Dist(newPoint) > 1 || !
this.CanMoveTo(newPoint,
false)))
2347 if (this._Move(newPoint,
Card.MoveType.Force) ==
Card.MoveResult.Success &&
this.ai.Current.CancelWhenMoved)
2349 this.ai.Current.TryCancel(c);
2354 public Card.MoveResult TryMoveTowards(
Point p)
2356 if (p.Equals(
this.pos))
2358 return Card.MoveResult.Success;
2360 if (this.IsPC &&
EClass.player.TooHeavyToMove())
2362 return Card.MoveResult.Fail;
2364 Chara._sharedPos.Set(p);
2365 if (this.CanDestroyPath())
2367 this.TryMove(this.pos.GetPointTowards(
Chara._sharedPos),
true);
2369 int num = this.pos.Distance(p);
2371 if (pathProgress.HasPath && pathProgress.nodes.Count < num + 4)
2373 PathFinderNode pathFinderNode = pathProgress.nodes[pathProgress.nodes.Count - 1];
2374 if (this.TryMove(
new Point(pathFinderNode.X, pathFinderNode.Z),
true) ==
Card.MoveResult.Success)
2376 return Card.MoveResult.Success;
2379 pathProgress =
PathManager.Instance.RequestPathImmediate(this.pos, p,
this,
PathManager.MoveType.Combat, num + 4, 1);
2380 if (pathProgress.HasPath && pathProgress.nodes.Count < num + 4)
2382 PathFinderNode pathFinderNode2 = pathProgress.nodes[pathProgress.nodes.Count - 1];
2383 if (this.TryMove(
new Point(pathFinderNode2.X, pathFinderNode2.Z),
true) ==
Card.MoveResult.Success)
2385 return Card.MoveResult.Success;
2388 pathProgress =
PathManager.Instance.RequestPathImmediate(this.pos, p,
this,
PathManager.MoveType.Default, num + 25, 2);
2389 if (pathProgress.HasPath && pathProgress.nodes.Count < num + 25)
2391 PathFinderNode pathFinderNode3 = pathProgress.nodes[pathProgress.nodes.Count - 1];
2392 if (this.TryMove(
new Point(pathFinderNode3.X, pathFinderNode3.Z),
true) ==
Card.MoveResult.Success)
2394 return Card.MoveResult.Success;
2397 pathProgress =
PathManager.Instance.RequestPathImmediate(this.pos, p,
this,
PathManager.MoveType.Combat, num + 25, 2);
2398 if (pathProgress.HasPath && pathProgress.nodes.Count < num + 25)
2400 PathFinderNode pathFinderNode4 = pathProgress.nodes[pathProgress.nodes.Count - 1];
2401 if (this.TryMove(
new Point(pathFinderNode4.X, pathFinderNode4.Z),
true) ==
Card.MoveResult.Success)
2403 return Card.MoveResult.Success;
2406 return Card.MoveResult.Fail;
2410 public Card.MoveResult TryMoveFrom(
Point p)
2412 if (this.IsPC &&
EClass.player.TooHeavyToMove())
2414 return Card.MoveResult.Fail;
2416 Point point = p.Copy();
2417 int num = p.x - this.pos.x;
2418 int num2 = p.z - this.pos.z;
2435 if (num == 0 && num2 == 0)
2438 num2 =
EClass.rnd(3) - 1;
2440 point.Set(this.pos);
2443 if (point.IsValid && !point.HasChara)
2445 return this.TryMove(point,
false);
2447 return Card.MoveResult.Fail;
2451 public Card.MoveResult TryMove(
Point newPoint,
bool allowDestroyPath =
true)
2453 using (List<Condition>.Enumerator enumerator = this.conditions.GetEnumerator())
2455 while (enumerator.MoveNext())
2457 if (!enumerator.Current.TryMove(newPoint))
2459 return Card.MoveResult.Fail;
2463 if (base.isRestrained)
2467 return Card.MoveResult.Fail;
2469 base.isRestrained =
false;
2471 if (!this.CanMoveTo(newPoint, allowDestroyPath))
2473 return Card.MoveResult.Fail;
2475 return this._Move(newPoint,
Card.MoveType.Walk);
2479 public override Card.MoveResult _Move(
Point newPoint,
Card.MoveType type =
Card.MoveType.Walk)
2483 return Card.MoveResult.Fail;
2487 float num =
EClass.setting.defaultActPace;
2488 switch (this.burden.GetPhase())
2497 if (this.currentZone.IsRegion)
2500 if (!
EClass.pc.HasElement(408, 1))
2502 switch (
EClass.world.weather.CurrentCondition)
2507 case Weather.Condition.RainHeavy:
2514 case Weather.Condition.SnowHeavy:
2520 if (newPoint.matFloor.id == 48)
2525 num2 = num2 * 100 / (100 + base.Evalue(240) + base.Evalue(407) * 5);
2526 EClass.world.date.AdvanceMin(num2 * 6);
2527 EClass.player.lastZonePos =
null;
2528 EClass.player.distanceTravel++;
2530 for (
int i = 0; i < num2 * 4; i++)
2532 EClass.pc.party.members.ForeachReverse(delegate(
Chara m)
2539 if (base.hp <
this.MaxHP / 5 && base.hp < hp && !
EClass.player.regionMoveWarned)
2541 EClass.player.regionMoveWarned =
true;
2542 Msg.Say(
"regionAbortMove");
2543 EInput.Consume(
true, 1);
2544 this.SetAI(
new NoGoal());
2545 return Card.MoveResult.Fail;
2548 if (newPoint.cell.CanSuffocate())
2550 this.AddCondition<ConSuffocation>((
EClass.pc.Evalue(200) > 0) ? (2000 / (100 + base.Evalue(200) * 10)) : 30,
false);
2552 int num3 = (condition !=
null) ? condition.GetPhase() : 0;
2555 base.DamageHP(
EClass.rndHalf(10 +
this.MaxHP / 5), AttackSource.Condition,
null);
2559 base.ModExp(200, 8 + num3 * 12);
2562 EClass.player.regionMoveWarned =
false;
2565 return Card.MoveResult.Fail;
2568 if (num >
EClass.setting.defaultActPace * 3f)
2570 num = EClass.setting.defaultActPace * 3f;
2574 Chara chara = (this.ride ==
null) ?
this : this.ride;
2575 if ((!
EClass._zone.IsRegion || chara.IsPC) && ((chara.isConfused &&
EClass.rnd(2) == 0) || (chara.isDrunk &&
EClass.rnd(
this.IsIdle ? 2 : 8) == 0 && !chara.HasElement(1215, 1))) && newPoint.Distance(
this.pos) <= 1)
2577 Point randomNeighbor = this.pos.GetRandomNeighbor();
2578 if (this.CanMoveTo(randomNeighbor,
false))
2580 newPoint = randomNeighbor;
2583 base.Talk(
"drunk",
null,
null,
false);
2587 if (newPoint.x !=
this.pos.x || newPoint.z !=
this.pos.z)
2589 this.LookAt(newPoint);
2592 if (effect !=
null && effect.id == 7)
2595 if (this.race.height < 500 && !
this.race.tag.Contains(
"webfree") &&
EClass.rnd(effect2.power + 25) >
EClass.rnd(base.STR + base.DEX + 1))
2597 base.Say(
"abWeb_caught",
this,
null,
null);
2598 base.PlaySound(
"web", 1f,
true);
2599 effect2.power = effect2.power * 3 / 4;
2600 this.renderer.PlayAnime(AnimeID.Shiver,
default(Vector3),
false);
2601 return Card.MoveResult.Fail;
2603 base.Say(
"abWeb_pass",
this,
null,
null);
2604 EClass._map.SetEffect((
int)base.Cell.x, (
int)base.Cell.z,
null);
2608 if (
EClass._zone.IsRegion)
2610 this.actTime *=
EClass.setting.render.anime.regionSpeed;
2612 else if ((newPoint.x >
this.pos.x && newPoint.z >
this.pos.z) || (newPoint.x <
this.pos.x && newPoint.z <
this.pos.z))
2614 this.actTime += this.actTime *
EClass.setting.render.anime.diagonalSpeed;
2617 if (newPoint.cell.hasDoor)
2619 foreach (
Thing thing
in this.pos.Things)
2622 if (traitDoor !=
null && traitDoor.owner.c_lockLv > 0)
2626 return Card.MoveResult.Fail;
2628 traitDoor.TryOpenLock(
this,
true);
2629 return Card.MoveResult.Door;
2633 Cell cell = newPoint.cell;
2634 Cell cell2 = this.pos.cell;
2635 bool flag = cell.HasLiquid && !this.isLevitating;
2636 bool hasBridge = cell.HasBridge;
2637 bool hasRamp = cell.HasRamp;
2638 bool flag2 = EClass._zone.IsSnowCovered && !cell.HasRoof && !cell.isClearSnow;
2639 TileRow tileRow = hasRamp ? cell.sourceBlock : (hasBridge ? cell.sourceBridge : cell.sourceFloor);
2640 SourceMaterial.Row row = hasRamp ? cell.matBlock : (hasBridge ? cell.matBridge : cell.matFloor);
2641 bool flag3 = cell.IsTopWater && !cell.isFloating;
2642 if (!
EClass._zone.IsRegion)
2644 if (cell.hasDoorBoat)
2646 tileRow =
FLOOR.sourceWood;
2650 else if (flag2 && !tileRow.ignoreSnow)
2652 if (tileRow.tileType.IsWater)
2654 tileRow =
FLOOR.sourceIce;
2659 tileRow =
FLOOR.sourceSnow;
2665 if ((this.pos.sourceFloor.isBeach || cell2.IsSnowTile) && !
this.pos.HasObj)
2667 EClass._map.SetFoormark(this.pos, 1, (
int)Util.GetAngle((
float)(
this.pos.x - newPoint.x), (
float)(
this.pos.z - newPoint.z)), cell2.IsSnowTile ? 312 : 304);
2671 string text = (flag || flag3) ?
"water" : tileRow.soundFoot.IsEmpty(row.soundFoot.IsEmpty(
"default"));
2672 if (cell.obj != 0 && cell.sourceObj.tileType.IsPlayFootSound && !cell.matObj.soundFoot.IsEmpty())
2674 text = cell.matObj.soundFoot;
2676 if (!text.IsEmpty())
2678 SoundManager.altLastData = this.IsPC;
2679 base.PlaySound(
"Footstep/" + text, this.IsPC ? 1f : 0.9f,
true);
2685 bool flag4 = scene.actionMode.gameSpeed > 1f;
2686 scene.psFoot.transform.position = this.renderer.position + pcOrbit.footPos;
2687 scene.psFoot.startColor = row.matColor;
2688 scene.psFoot.Emit(pcOrbit.emitFoot * (flag4 ? 2 : 1));
2689 if (flag4 && this.IsPC)
2691 scene.psSmoke.transform.position = this.renderer.position + pcOrbit.smokePos;
2692 scene.psSmoke.Emit(pcOrbit.emitSmoke);
2697 Effect.Get(
"ripple").Play(0.4f * this.actTime *
EClass.scene.actionMode.gameSpeed, newPoint, 0f,
null,
null);
2700 this.lastPos.Set(this.pos);
2701 if (type !=
Card.MoveType.Force)
2703 if (newPoint.HasChara &&
this.ai.Current.PushChara)
2705 this.TryPush(newPoint);
2707 if (newPoint.HasChara && newPoint.Charas.Count == 1)
2709 Chara chara2 = newPoint.Charas[0];
2710 if (this.CanReplace(chara2))
2712 chara2.MoveByForce(this.lastPos,
this,
false);
2715 base.Say(
"replace_pc", chara, chara2,
null,
null);
2722 foreach (
Thing thing2
in newPoint.Things)
2725 if (traitDoor2 !=
null)
2727 traitDoor2.TryOpen(
this);
2731 EClass._zone.map.MoveCard(newPoint,
this);
2733 if (this.IsPC &&
EClass._zone.PetFollow && (!
EClass._zone.KeepAllyDistance || !
EClass.game.config.tactics.allyKeepDistance) && !
EClass._zone.IsRegion)
2737 if (chara3.isLeashed && !chara3.IsPC && chara3.host ==
null && !chara3.IsDisabled && !chara3.HasCondition<
ConEntangle>() && !chara3.IsInCombat && chara3.Dist(
EClass.pc) > 1)
2739 chara3.TryMoveTowards(
EClass.pc.pos);
2743 if (
EClass.core.config.test.animeFramePCC == 0 &&
this.isSynced &&
this.renderer.hasActor &&
this.renderer.actor.isPCC)
2745 this.renderer.NextFrame();
2749 base.PlaySound(
"Footstep/Extra/pcfootstep", 1f,
true);
2750 if (this.pos.HasThing)
2752 foreach (
Card card
in this.pos.ListCards(
false))
2754 if (card.isThing && card.placeState == PlaceState.roaming && !card.ignoreAutoPick)
2756 this.Pick(card.Thing,
true,
true);
2760 if (
EClass._zone.IsRegion)
2763 if (((cell3 !=
null) ? cell3.zone :
null) !=
null && !cell3.zone.HiddenInRegionMap && (!(cell3.zone is
Zone_Field) || cell3.zone.children.Count > 0 || cell3.zone.IsPCFaction))
2765 Msg.Say((!cell3.zone.source.GetText(
"textFlavor",
false).IsEmpty()) ? cell3.zone.source.GetText(
"textFlavor",
false) : (cell3.zone.ShowDangerLv ?
"seeZoneDanger" :
"seeZone"), cell3.zone.Name, cell3.zone.DangerLv.ToString() ??
"",
null,
null);
2767 if (this.pos.matFloor.alias ==
"snow" &&
EClass.rnd(3) == 0)
2769 Msg.SetColor(
Msg.colors.Ono);
2770 Msg.Say(Lang.GetList(
"walk_snow").RandomItem<
string>());
2772 else if (
EClass.world.weather.CurrentCondition ==
Weather.Condition.RainHeavy &&
EClass.rnd(3) == 0)
2774 Msg.SetColor(
Msg.colors.Ono);
2775 Msg.Say(Lang.GetList(
"walk_storm").RandomItem<
string>());
2782 int num4 = Mathf.Abs((
int)(cell2.topHeight - cell.topHeight));
2783 if ((num4 >= 3 && this.lastPos.sourceBlock.tileType.slopeHeight == 0 && newPoint.sourceBlock.tileType.slopeHeight == 0) || cell2.hasDoorBoat || cell.hasDoorBoat)
2785 this.renderer.PlayAnime((cell2.topHeight >= cell.topHeight) ? AnimeID.JumpDown : ((num4 >= 6) ? AnimeID.Jump : AnimeID.JumpSmall),
default(Vector3),
false);
2789 float surfaceHeight = cell2.GetSurfaceHeight();
2790 float surfaceHeight2 = cell.GetSurfaceHeight();
2791 num4 = (int)Mathf.Abs((surfaceHeight - surfaceHeight2) * 100f);
2794 this.renderer.PlayAnime((surfaceHeight >= surfaceHeight2) ? AnimeID.JumpDown : ((num4 >= 40) ? AnimeID.Jump : AnimeID.JumpSmall),
default(Vector3),
false);
2798 this.lastPos.Things.ForeachReverse(delegate(
Thing t)
2800 t.trait.OnSteppedOut(
this);
2804 this.pos.Things.ForeachReverse(delegate(
Thing t)
2806 t.trait.OnStepped(
this);
2809 if (this.CanDestroyPath())
2811 this.DestroyPath(this.pos);
2815 if (this.renderer.anime ==
null &&
this.renderer.replacer !=
null)
2817 this.renderer.PlayAnime(AnimeID.Hop,
default(Vector3),
false);
2819 if (
EClass.player.flags.isShoesOff)
2821 if (!
FLOOR.IsTatami(
this.pos.cell.sourceSurface.id) &&
this.pos.cell.room ==
null)
2823 EClass.player.flags.isShoesOff =
false;
2825 EClass.pc.SetPCCState(PCCState.Normal);
2828 else if (
FLOOR.IsTatami(
this.pos.cell.sourceSurface.id) &&
this.pos.cell.room !=
null)
2830 EClass.player.flags.isShoesOff =
true;
2832 EClass.pc.SetPCCState(PCCState.ShoesOff);
2835 this.hasMovedThisTurn =
true;
2836 return Card.MoveResult.Success;
2840 public void DestroyPath(
Point pos)
2843 pos.ForeachMultiSize(base.W, base.H, delegate(
Point _p,
bool main)
2851 EClass._map.MineBlock(_p,
false,
this);
2854 EClass._map.MineObj(_p,
null,
this);
2858 if (_p.HasObj && _p.IsBlocked)
2860 EClass._map.MineObj(_p,
null,
this);
2863 _p.Things.ForeachReverse(delegate(
Thing t)
2865 if (t.IsInstalled && (t.trait.IsBlockPath || t.trait.IsDoor))
2867 if (t.isNPCProperty && t.trait.CanBeDestroyed)
2872 t.SetPlaceState(PlaceState.roaming,
false);
2879 Shaker.ShakeCam(
"stomp", 1f);
2884 public void TryPush(
Point point)
2886 point.Charas.ForeachReverse(delegate(
Chara c)
2888 if (c.ai.IsMoveAI || c.IsPC || !c.trait.CanBePushed || c ==
this || c.noMove)
2892 List<Point> list =
new List<Point>();
2893 for (
int i = point.x - 1; i <= point.x + 1; i++)
2895 for (
int j = point.z - 1; j <= point.z + 1; j++)
2897 if (i != point.x || j != point.z)
2900 if (point2.IsValid && !point2.HasChara && !point2.IsBlocked && !point2.cell.hasDoor && !point2.IsBlockByHeight(point))
2911 list.ForeachReverse(delegate(
Point p)
2913 if (p.Equals(
new Point(point.x + point.x -
this.pos.x, point.z + point.z -
this.pos.z)))
2922 this.Say(
"displace",
this, c,
null,
null);
2923 this.PlaySound(
"push", 1f,
true);
2925 else if (c.isSynced)
2927 c.PlayEffect(
"push",
true, 0f,
default(Vector3));
2929 c.MoveByForce(newPoint,
this,
true);
2930 if (this.IsPC && !c.IsPCParty && !c.IsUnique && c.IsHuman &&
EClass.rnd(5) == 0)
2932 c.Talk(
"pushed",
null,
null,
false);
2939 public bool CanReplace(
Chara c)
2941 if (c.IsMultisize || !c.trait.CanBePushed || c.noMove ||
this.IsHostile(c) ||
this.IsMinion)
2949 if (c.IsPC || c.pos.Equals(
EClass.pc.pos) || c.host !=
null)
2953 if (!this.IsHostile(c))
2955 if (c.c_uidMaster != 0 || c.isSummon || base.IsPowerful ||
this.IsEscorted())
2959 if (this.DestDist < c.DestDist)
2963 if (this.IsPCParty && !c.IsPCParty)
2967 if (this.IsPCFaction && c.IsPCFaction && !c.IsPCParty)
2976 public void MoveZone(
string alias)
2993 if (z == this.currentZone)
2999 EClass.player.nextZone = z;
3000 if (this.IsInActiveZone && !
EClass.player.simulatingZone)
3002 if (this.held !=
null && this.held.trait.CanOnlyCarry)
3004 this.DropHeld(
null);
3006 if (z.instance ==
null &&
this.currentZone.instance ==
null && !
EClass.player.deathZoneMove && !
EClass.pc.isDead && (z.IsPCFaction || z.WillAutoSave) && z.GetTopZone() !=
EClass._zone.GetTopZone())
3008 if (
EClass.player.returnInfo !=
null)
3010 EClass.player.returnInfo.turns += 5;
3012 if (!
EClass.debug.ignoreAutoSave)
3014 EClass.game.Save(
true,
null,
false);
3017 EClass.player.deathZoneMove =
false;
3019 this.currentZone.events.OnLeaveZone();
3020 if (this.currentZone.instance !=
null)
3023 z =
EClass.game.spatials.Find(instance.uidZone);
3026 state = instance.ReturnState,
3030 instance.OnLeaveZone();
3033 EInput.Consume(
true, 1);
3034 EClass.player.uidLastZone = this.currentZone.uid;
3035 if (!
EClass.player.simulatingZone)
3037 if (this.currentZone.IsRegion)
3039 Msg.Say(
"enterZone", z.Name,
null,
null,
null);
3045 Msg.Say(
"leaveZone", this.currentZone.Name,
null,
null,
null);
3047 else if (z.id !=
this.currentZone.id)
3049 Msg.Say(
"enterZone", z.Name,
null,
null,
null);
3051 EClass.player.lastZonePos = this.pos.Copy();
3053 EClass.player.lastTransition = transition;
3056 where c.IsPCPartyMinion && c.master !=
EClass.pc
3057 select c).ToList<
Chara>())
3059 EClass._zone.RemoveCard(t);
3061 EClass.player.listSummon = (from c in EClass._map.charas
3062 where c.c_uidMaster != 0 && c.FindMaster() ==
EClass.pc && c.c_minionType == MinionType.Default
3063 select c).ToList<
Chara>();
3066 EClass._zone.RemoveCard(t2);
3069 if (this.party !=
null && this.party.leader ==
this)
3071 foreach (
Chara chara
in this.party.members)
3073 if (chara !=
this && !chara.isDead && chara.parent is
Zone)
3079 if (this.global ==
null)
3081 Debug.Log(base.Name);
3085 Zone currentZone = this.currentZone;
3086 zoneTransition.uidLastZone = ((currentZone !=
null) ? currentZone.uid : 0);
3087 this.global.transition = transition;
3091 this.global.transition =
null;
3094 EClass.player.lastTransition =
null;
3096 z.AddCard(
this, spawnPos);
3097 if (this.IsBranchMember())
3099 EClass._map.rooms.AssignCharas();
3110 public void MoveHome(
string id,
int x = -1,
int z = -1)
3112 this.MoveHome(
EClass.game.world.FindZone(
id), x, z);
3116 public void MoveHome(
Zone zone,
int x = -1,
int z = -1)
3120 this.Revive(
null,
false);
3124 this.Cure(CureType.Death, 100, BlessedState.Normal);
3126 this.CureCondition<ConSuspend>(99999);
3129 EClass.pc.party.RemoveMember(
this);
3141 if (zone.IsActiveZone)
3143 point = point.GetNearestPoint(
false,
false,
true,
false);
3145 zone.AddCard(
this, point);
3146 this.SetHomeZone(zone);
3153 this.orgPos =
new Point(x, z);
3154 if (homeBranch !=
null)
3156 this.RefreshWorkElements(
null);
3157 homeBranch.policies.Validate();
3162 public void FallFromZone()
3165 Zone zone = EClass._zone.isExternalZone ? null :
EClass._zone.GetTopZone().FindZone(
EClass._zone.lv - 1);
3166 zone = (zone ??
EClass.world.region);
3169 state = ZoneTransition.EnterState.Fall,
3176 public override void SetDir(
int d)
3180 this.renderer.RefreshSprite();
3184 public override void Rotate(
bool reverse =
false)
3186 if (this.renderer.hasActor)
3188 base.dir = (base.dir + (reverse ? -1 : 1)).Clamp(0, 3,
true);
3192 base.dir = ((base.dir == 0) ? 1 : 0);
3195 this.renderer.RefreshSprite();
3199 public override void LookAt(
Card c)
3205 public override void LookAt(
Point p)
3207 this.angle = Util.GetAngle((
float)(p.x -
this.pos.x), (
float)(p.z -
this.pos.z));
3208 if (
EClass._zone.IsRegion)
3210 if (this.angle > 100f && this.angle < 170f)
3214 else if (this.angle > 170f && this.angle < 190f)
3218 else if (this.angle > 190f || (this.angle < -10f && this.angle > -100f))
3228 else if (this.angle > 170f && this.angle < 235f)
3232 else if (this.angle > 80f && this.angle < 145f)
3236 else if (this.angle > -100f && this.angle < -35f)
3240 else if (this.angle > -10f && this.angle < 55f)
3244 this.renderer.RefreshSprite();
3248 public void UpdateAngle()
3298 public int GetCurrentDir()
3300 Debug.Log(this.angle);
3301 if (this.renderer.hasActor)
3303 return this.renderer.actor.currentDir;
3305 if (this.angle == 0f || this.angle == 45f || this.angle == 90f)
3309 if (this.angle == -135f || this.angle == 180f || this.angle == -90f)
3313 if (this.angle == 135f)
3321 public void UpdateSight()
3324 for (
int i = -num; i < num + 1; i++)
3326 for (
int j = -num; j < num + 1; j++)
3328 Chara.shared.Set(this.pos.x + i,
this.pos.z + j);
3329 if (!
Chara.shared.IsValid ||
Chara.shared.cell.isSeen || i < -1 || i > 1 || j >= -1)
3337 public bool WillConsumeTurn()
3339 for (
int i = this.conditions.Count - 1; i >= 0; i--)
3341 if (this.conditions[i].ConsumeTurn)
3350 public void TickConditions()
3352 if (this._cooldowns !=
null)
3354 this.TickCooldown();
3357 Chara.consumeTurn =
false;
3358 Chara.preventRegen =
false;
3359 this.emoIcon = Emo2.none;
3362 int c_summonDuration = base.c_summonDuration;
3363 base.c_summonDuration = c_summonDuration - 1;
3364 if (base.c_summonDuration <= 0)
3366 this.Die(
null,
null, AttackSource.None);
3370 if (
EClass.world.weather.IsRaining && !
EClass._map.IsIndoor && !
this.pos.cell.HasRoof)
3372 this.AddCondition<ConWet>(20,
false);
3374 switch (this.turn % 50)
3377 this.happiness = (this.hunger.value + this.stamina.value + this.depression.value + this.bladder.value + this.hygiene.value) / 5;
3380 if (!this.IsPC || !
EClass.debug.godMode)
3384 this.sleepiness.Mod(1);
3390 if (this.IsPC && (this.sleepiness.GetPhase() != 0 ||
this.stamina.GetPhase() <= 1))
3397 if (this.parasite !=
null)
3399 base.ModExp(227, (
EClass._zone.IsRegion ? 5 : 40) * 100 / Mathf.Max(100, 100 + (
this.elements.Base(227) -
this.parasite.LV) * 25));
3401 if (this.ride !=
null)
3403 base.ModExp(226, (
EClass._zone.IsRegion ? 5 : 40) * 100 / Mathf.Max(100, 100 + (
this.elements.Base(226) -
this.ride.LV) * 25));
3407 if (this.turn % 500 == 0)
3409 this.DiminishTempElements(1);
3413 if (this.dirtyWeight)
3417 int phase = this.burden.GetPhase();
3418 int phase2 = this.hunger.GetPhase();
3421 Chara.preventRegen =
true;
3423 if (
EClass.rnd(
EClass._zone.IsRegion ? 100 : 30) == 0 && phase >= 3)
3425 base.Say(
"dmgBurden",
this,
null,
null);
3426 base.DamageHP(this.MaxHP * (base.ChildrenWeight * 100 /
this.WeightLimit) / 1000 + 1, AttackSource.Burden,
null);
3438 base.ModExp(207, 1 + phase * phase);
3443 base.ModExp(207, 5);
3448 if (phase2 >= 5 && !(this.ai is
AI_Eat) &&
EClass.rnd(5) == 0)
3450 base.DamageHP(1 +
EClass.rnd(2) +
this.MaxHP / 50, AttackSource.Hunger,
null);
3456 phase2 = this.stamina.GetPhase();
3459 Chara.preventRegen =
true;
3461 if (this.currentZone.IsRegion &&
EClass.world.weather.CurrentCondition ==
Weather.Condition.RainHeavy && !
EClass.pc.HasElement(408, 1))
3463 if (
EClass.rnd(100) == 0 && !
this.isConfused)
3465 Msg.Say(
"rain_confuse");
3466 this.AddCondition<ConConfuse>(500,
false);
3468 if (
EClass.rnd(300) == 0 && !
this.isBlind)
3470 Msg.Say(
"rain_confuse");
3471 this.AddCondition<ConBlind>(200,
false);
3474 if (this.turn % (150000 / (100 + base.Evalue(409) * 10)) == 0)
3476 this.ModCorruption(1);
3482 int num = base.Evalue(409);
3483 if (num > 0 && this.turn % 1500 * 100 / (100 + num * 10) == 0)
3485 this.ModCorruption(1);
3488 for (
int i = this.conditions.Count - 1; i >= 0; i--)
3490 Condition condition = this.conditions[i];
3491 if (!condition.TimeBased)
3495 if (!condition.IsKilled)
3497 if (condition.ConsumeTurn)
3499 Chara.consumeTurn =
true;
3501 if (condition.PreventRegen)
3503 Chara.preventRegen =
true;
3505 if (condition.EmoIcon != Emo2.none && condition.EmoIcon >
this.emoIcon)
3507 this.emoIcon = condition.EmoIcon;
3515 if (!
Chara.preventRegen)
3517 if (
EClass.rnd(25) == 0 && base.hp <
this.MaxHP)
3519 this.HealHP(
EClass.rnd(base.Evalue(300) / 3 + 1) + 1, HealSource.None);
3520 this.elements.ModExp(300, 8,
false);
3522 if (
EClass.rnd(8) == 0 &&
this.mana.value <
this.mana.max)
3524 this.mana.Mod(
EClass.rnd(base.Evalue(301) / 2 + 1) + 1);
3525 this.elements.ModExp(301, 8,
false);
3527 if (
EClass.rnd(20) == 0 && !
this.IsPC &&
this.stamina.value <
this.stamina.max)
3529 this.stamina.Mod(
EClass.rnd(5) + 1);
3535 public void SyncRide()
3537 if (this.host !=
null)
3539 this.host.SyncRide();
3541 if (this.ride !=
null)
3543 this.SyncRide(this.ride);
3545 if (this.parasite !=
null)
3547 this.SyncRide(this.parasite);
3552 public void SyncRide(
Chara c)
3554 if (!c.pos.Equals(
this.pos))
3556 if (!this.pos.IsValid)
3558 string str =
"exception: pos is not valid:";
3559 Point pos = this.pos;
3560 Debug.LogError(str + ((pos !=
null) ? pos.ToString() :
null) +
"/" + ((
this !=
null) ?
this.ToString() :
null));
3561 this.pos =
new Point();
3563 EClass._map.MoveCard(this.pos, c);
3568 public override void Tick()
3570 Chara.<>c__DisplayClass332_0 CS$<>8__locals1 =
new Chara.<>c__DisplayClass332_0();
3571 CS$<>8__locals1.<>4__this =
this;
3576 if (this.hasMovedThisTurn)
3578 this.pos.Things.ForeachReverse(delegate(
Thing t)
3580 t.trait.OnStepped(CS$<>8__locals1.<>4__this);
3586 this.hasMovedThisTurn =
false;
3587 if (
EClass.player.haltMove)
3589 EClass.player.haltMove =
false;
3594 if (
EClass._zone.IsRegion)
3598 if (chara.hunger.value > 65)
3600 chara.InstantEat(
null,
false);
3603 if (
EClass.player.safeTravel <= 0)
3606 if (cell !=
null && cell.zone ==
null && !
EClass.debug.ignoreEncounter)
3608 bool isRoad =
EClass.scene.elomap.GetTileInfo(
EClass.pc.pos.eloX,
EClass.pc.pos.eloY).isRoad;
3612 int num = isRoad ? 22 : 12;
3615 num = (isRoad ? 16 : 10);
3619 num *= (flag3 ? 2 : 20);
3625 if (
EClass.rnd(num) == 0)
3627 Msg.Say(
"encounter");
3630 EClass.player.safeTravel = 5 +
EClass.rnd(5);
3632 EClass.player.EnterLocalZone(
true);
3638 EClass.player.safeTravel--;
3642 EClass.player.pickupDelay = 0f;
3643 if (
EClass.player.returnInfo !=
null)
3645 EClass.player.returnInfo.turns--;
3646 if (
EClass.player.returnInfo.turns <= 0)
3648 if (
EClass.pc.burden.GetPhase() != 4 ||
EClass.debug.ignoreWeight)
3650 int uidDest =
EClass.player.returnInfo.uidDest;
3654 zone = (
EClass.game.spatials.map.TryGetValue(uidDest,
null) as
Zone);
3656 if (zone ==
null || zone.destryoed)
3658 zone =
EClass.world.region;
3660 if (zone ==
EClass.game.activeZone ||
EClass.game.activeZone.IsRegion)
3662 Msg.Say(
"returnFail");
3666 Msg.Say(
"returnComplete");
3667 EClass.player.uidLastTravelZone = 0;
3669 EClass.player.lastZonePos =
null;
3671 EClass.player.returnInfo =
null;
3674 EClass.player.returnInfo =
null;
3675 Msg.Say(
"returnOverweight");
3678 if ((this.HasNoGoal || !this.ai.IsRunning) && !
this.WillConsumeTurn())
3680 this.SetAI(
Chara._NoGoalPC);
3683 EClass.player.stats.turns++;
3684 if (
EClass.core.config.game.alwaysUpdateRecipe)
3686 RecipeUpdater.dirty =
true;
3688 this.actTime =
EClass.player.baseActTime;
3692 this.actTime = EClass.player.baseActTime * Mathf.Max(0.1f, (
float)
EClass.pc.Speed / (
float)
this.Speed);
3693 this.hasMovedThisTurn =
false;
3695 this.TickConditions();
3696 if (!this.IsAliveInCurrentZone)
3700 this.renderer.RefreshStateIcon();
3701 if (this.host !=
null && !
Chara.consumeTurn)
3703 if (this.host.ride ==
this && (
this.host.hasMovedThisTurn || (
this.enemy !=
null &&
this.turn % 3 != 0)))
3705 Chara.consumeTurn =
true;
3707 if (this.host.parasite ==
this &&
this.enemy !=
null &&
EClass.rnd(10) >
EClass.rnd(
this.host.Evalue(227) + 10))
3709 if (base.Dist(
this.enemy) < 3 &&
EClass.rnd(2) == 0)
3711 base.Say(
"parasite_fail",
this, this.host,
null,
null);
3712 if (
EClass.rnd(2) == 0 && base.GetInt(106,
null) == 0)
3714 base.Talk(
"parasite_fail",
null,
null,
false);
3717 Chara.consumeTurn =
true;
3720 if (
Chara.consumeTurn)
3729 if (base.isRestrained)
3731 base.TryUnrestrain(
false,
null);
3733 if (this.enemy !=
null)
3735 if (!this.enemy.IsAliveInCurrentZone)
3739 else if (!this.IsPC && ((!(this.ai is
GoalCombat) && !(this.ai is
AI_Trolley)) || !this.ai.IsRunning))
3744 if (this.HasNoGoal || !this.ai.IsRunning)
3746 this.ChooseNewGoal();
3750 CS$<>8__locals1.cell = base.Cell;
3751 if (CS$<>8__locals1.cell.IsTopWaterAndNoSnow && !CS$<>8__locals1.cell.isFloating)
3753 this.AddCondition<ConWet>(50,
false);
3755 if (this.IsPC && !
EClass._zone.IsRegion && CS$<>8__locals1.cell.CanSuffocate())
3757 this.AddCondition<ConSuffocation>(800 / (100 + base.Evalue(200) * 10),
false);
3759 if (CS$<>8__locals1.cell.effect !=
null)
3761 Chara.<>c__DisplayClass332_1 CS$<>8__locals2;
3762 CS$<>8__locals2.e = CS$<>8__locals1.cell.effect;
3763 switch (CS$<>8__locals2.e.id)
3768 if (this.isLevitating)
3770 base.Say(
"levitating",
null,
null);
3774 this.AddCondition<ConWet>(50,
false);
3775 CS$<>8__locals1.<Tick>g__ProcEffect|2(ref CS$<>8__locals2);
3779 base.PlaySound(
"fire_step", 1f,
true);
3780 this.AddCondition<ConBurning>(30,
false);
3785 base.PlaySound(
"bubble", 1f,
true);
3786 this.AddCondition<ConWet>(30,
false);
3787 CS$<>8__locals1.<Tick>g__ProcEffect|2(ref CS$<>8__locals2);
3791 if (this.hasMovedThisTurn)
3793 base.Say(
"abMistOfDarkness_step",
this,
null,
null);
3800 if (
EClass.player.currentHotItem.Thing !=
null)
3802 EClass.player.currentHotItem.Thing.trait.OnTickHeld();
3804 EClass.screen.OnEndPlayerTurn();
3809 public bool CanLift(
Card c)
3815 public bool CanAutoPick(
Card c)
3821 public bool CanPick(
Card c)
3827 Card rootCard = c.GetRootCard();
3828 return !rootCard.isDestroyed && (!rootCard.ExistsOnMap || rootCard.pos.Distance(this.pos) <= 1) && (rootCard ==
this || !this.things.IsFull(c.Thing,
true,
true));
3832 public void PickOrDrop(
Point p,
string idThing,
int idMat = -1,
int num = 1,
bool msg =
true)
3838 this.PickOrDrop(p,
ThingGen.Create(idThing, idMat, -1).SetNum(num), msg);
3842 public void PickOrDrop(
Point p,
Thing t,
bool msg =
true)
3844 if (this.things.GetDest(t,
true).IsValid)
3846 this.Pick(t, msg,
true);
3849 EClass._zone.AddCard(t, p);
3853 public Thing Pick(
Thing t,
bool msg =
true,
bool tryStack =
true)
3855 if (t.trait is
TraitCard && t.isNew &&
EClass.game.config.autoCollectCard)
3860 if (t.parent ==
this)
3867 if (t.parent !=
EClass._zone)
3871 base.Say(
"backpack_full_drop", t,
null,
null);
3874 return EClass._zone.AddCard(t, this.pos).Thing;
3878 base.Say(
"backpack_full", t,
null,
null);
3884 if (dest.stack !=
null)
3888 base.PlaySound(
"pick_thing", 1f,
true);
3889 base.Say(
"pick_thing",
this, t,
null,
null);
3891 t.TryStackTo(dest.stack);
3894 if (t.trait is
TraitRod &&
EClass.rnd(2) == 0 && t.c_charges > 0 && base.HasElement(1564, 1))
3896 base.Say(
"absorbRod",
this, t,
null,
null);
3899 if (rod.source !=
null)
3904 if ((predicate = <>9__0) ==
null)
3908 using (IEnumerator<
SourceElement.
Row> enumerator = rows.Where(predicate).GetEnumerator())
3910 if (enumerator.MoveNext())
3915 this.GainAbility(row.id, t.c_charges * 100);
3923 this.mana.Mod(-50 * t.c_charges);
3927 if (t.trait is
TraitPotion && t.id !=
"1165" && !t.source.tag.Contains(
"neg") &&
EClass.rnd(2) == 0 && base.HasElement(1565, 1))
3929 string id = (from a in EClass.sources.things.rows
3930 where a._origin ==
"potion" && a.tag.Contains(
"neg")
3932 base.Say(
"poisonDrip",
this,
null,
null);
3935 t =
ThingGen.Create(
id, -1, -1).SetNum(num);
3939 base.PlaySound(
"pick_thing", 1f,
true);
3940 base.Say(
"pick_thing",
this, t,
null,
null);
3942 this.TryReservePickupTutorial(t);
3943 return dest.container.AddThing(t, tryStack, -1, -1);
3948 public void TryReservePickupTutorial(
Thing t)
3954 if (t.category.id ==
"mushroom")
3958 if (t.category.id ==
"herb")
3962 if (t.id ==
"pasture")
3973 public void TryPickGroundItem()
3975 foreach (
Card card
in this.pos.ListCards(
false))
3980 if (ai_UseCrafter !=
null && ai_UseCrafter.ings.Contains(card))
3985 if (card.isThing && card.placeState == PlaceState.roaming &&
this.CanPick(card))
3987 Thing thing = this.Pick(card.Thing,
true,
true);
3988 if (thing !=
null && !this.IsPC)
3990 thing.isNPCProperty =
true;
3998 public void TryPutShared(
Thing t, List<Thing> containers =
null,
bool dropIfFail =
true)
4000 if (
EClass._zone.TryAddThingInSharedContainer(t, containers,
true,
false,
null,
true))
4006 EClass._zone.AddCard(t, this.pos);
4011 public bool TryHoldCard(
Card t,
int num = -1,
bool pickHeld =
false)
4017 if (t.isDestroyed || t.Num <= 0)
4021 if (!this.CanPick(t))
4023 if (t.parent ==
null)
4025 EClass._zone.AddCard(t, this.pos);
4029 this.HoldCard(t, num);
4034 public void HoldCard(
Card t,
int num = -1)
4036 if (this.held == t || t.isDestroyed || t.Num <= 0)
4040 if (this.IsPC && t.isNPCProperty)
4042 t.isNPCProperty =
false;
4043 EClass.player.ModKarma(-1);
4044 this.pos.TryWitnessCrime(
this,
null, 4,
null);
4046 this.PickHeld(
false);
4049 if (t.IsAliveInCurrentZone)
4051 t.ShowEmo(Emo.love, 0f,
true);
4053 EClass.player.altHeldPos = (t.renderer.data.ForceAltHeldPosition ||
EClass.rnd(2) == 0);
4057 if (num == -1 || num > t.Num)
4066 if (t.GetRootCard() !=
this)
4068 t = this.Pick(t.Thing,
false,
true);
4069 if (t.GetRootCard() !=
this)
4075 if (this.held.GetLightRadius() > 0)
4077 base.RecalculateFOV();
4082 WidgetHotbar.dirtyCurrentItem =
true;
4087 public void PickHeld(
bool msg =
false)
4089 if (this.held ==
null)
4093 Card card = this.held;
4094 if (this.IsPC && this.held.invY == 1)
4096 WidgetHotbar.dirtyCurrentItem =
true;
4101 if (this.held.isChara)
4103 this.DropHeld(
null);
4106 if (this.IsPC && !this.held.IsHotItem &&
this.held.trait.CanOnlyCarry)
4108 base.Say(
"canOnlyCarry", this.held,
null,
null);
4109 this.DropHeld(
null);
4112 bool flag = this.held != this.things.TryStack(this.held.Thing, -1, -1);
4113 if (!flag && this.things.IsOverflowing())
4117 base.Say(
"backpack_full_drop", this.held,
null,
null);
4120 this.DropHeld(
null);
4125 base.PlaySound(
"pick_thing", 1f,
true);
4126 base.Say(
"pick_held",
this, card,
null,
null);
4127 if (this.IsPC && card.id ==
"statue_weird")
4129 base.Say(
"statue_pick",
null,
null);
4134 WidgetHotbar.dirtyCurrentItem =
true;
4138 if (this.held.GetRootCard() !=
EClass.pc)
4140 this.Pick(this.held.Thing,
false,
true);
4148 public Card SplitHeld(
int a)
4150 return this.held.Split(a);
4154 public Card DropHeld(
Point dropPos =
null)
4156 if (this.held ==
null)
4162 WidgetHotbar.dirtyCurrentItem =
true;
4165 Card card =
EClass._zone.AddCard(this.held, dropPos ?? this.pos);
4167 if (card.trait.CanOnlyCarry)
4169 card.SetPlaceState(PlaceState.installed,
false);
4175 public void DropThing(
Thing t,
int num = -1)
4177 if (t.c_isImportant)
4179 Msg.Say(
"markedImportant");
4182 if (!t.trait.CanBeDropped)
4184 Msg.Say(
"cantDrop", t,
null,
null,
null);
4193 Msg.Say(
"dropItem", t.Name,
null,
null,
null);
4194 t.ignoreAutoPick =
true;
4195 base.PlaySound(
"drop", 1f,
true);
4196 EClass._zone.AddCard(t, this.pos);
4200 public AttackStyle GetFavAttackStyle()
4202 int num = base.Evalue(131);
4203 int num2 = base.Evalue(130);
4204 int num3 = base.Evalue(123);
4205 if (num > num2 && num > num3)
4207 return AttackStyle.TwoWield;
4209 if (num2 > num && num2 > num3)
4211 return AttackStyle.TwoHand;
4213 if (num3 > num && num3 > num2)
4215 return AttackStyle.Shield;
4217 return AttackStyle.Default;
4221 public Element GetFavWeaponSkill()
4223 return this.elements.ListElements((
Element e) => e.source.categorySub ==
"weapon" && !e.HasTag(
"ranged"),
null).FindMax((
Element a) => a.Value);
4227 public Element GetFavArmorSkill()
4229 if (this.elements.Value(122) >
this.elements.Value(120))
4231 return this.elements.GetElement(122);
4233 return this.elements.GetElement(120);
4237 public void TryRestock(
bool onCreate)
4239 Chara.isOnCreate = onCreate;
4244 this.RestockInventory(onCreate);
4248 public void RestockEquip(
bool onCreate)
4250 string equip = this.source.equip;
4251 if (equip.IsEmpty())
4253 equip = this.job.equip;
4255 string id = this.id;
4256 uint num = <PrivateImplementationDetails>.ComputeStringHash(
id);
4257 if (num <= 1337759161U)
4259 if (num <= 646060618U)
4261 if (num != 511800731U)
4263 if (num != 613794712U)
4265 if (num != 646060618U)
4269 if (!(
id ==
"seeker"))
4275 this.EQ_ID(
"helm_seeker", -1, Rarity.Random);
4277 this.EQ_ID(
"robe_pope", -1, Rarity.Random);
4278 this.EQ_ID(
"sword_katana", -1, Rarity.Random);
4279 this.EQ_ID(
"staff", -1, Rarity.Random);
4280 this.EQ_ID(
"sword_katana", -1, Rarity.Random);
4283 this.EQ_ID(
"boots_seven", -1, Rarity.Random);
4287 for (
int i = 0; i < 20; i++)
4289 base.AddThing(
ThingGen.CreateFromCategory(
"book", 50),
true, -1, -1);
4291 this.EQ_Item(
"panty", 1);
4292 base.AddThing(
"plat", -1).SetNum(6);
4299 if (!(
id ==
"adv_ivory"))
4303 this.EQ_ID(
"dagger", -1, Rarity.Legendary);
4304 base.AddThing(
"60", -1);
4310 if (!(
id ==
"adv_gaki"))
4316 this.EQ_ID(
"dagger_gaki", -1, Rarity.Random);
4320 this.EQ_ID(
"dagger_ninto", -1, Rarity.Random);
4326 else if (num <= 1184812370U)
4328 if (num != 1052270088U)
4330 if (num != 1184812370U)
4334 if (!(
id ==
"ashland"))
4340 base.AddThing(
"guitar_ash", -1);
4347 if (!(
id ==
"swordkeeper"))
4353 this.EQ_ID(
"EtherDagger", -1, Rarity.Random);
4359 else if (num != 1188679840U)
4361 if (num != 1337759161U)
4365 if (!(
id ==
"adv_verna"))
4371 this.EQ_ID(
"staff_long", -1, Rarity.Legendary);
4375 this.EQ_ID(
"cloak_wing", -1, Rarity.Mythical);
4380 else if (!(
id ==
"loytel"))
4385 else if (num <= 2936881100U)
4387 if (num <= 1491226603U)
4389 if (num != 1488976522U)
4391 if (num != 1491226603U)
4395 if (!(
id ==
"adv_mesherada"))
4401 this.EQ_ID(
"dagger_hathaway", -1, Rarity.Random);
4406 else if (!(
id ==
"quru"))
4411 else if (num != 1808495106U)
4413 if (num != 2936881100U)
4417 if (!(
id ==
"shojo"))
4422 else if (!(
id ==
"kettle"))
4427 else if (num <= 3538562634U)
4429 if (num != 3099445666U)
4431 if (num != 3538562634U)
4435 if (!(
id ==
"adv_wini"))
4441 this.EQ_ID(
"staff_Cat", -1, Rarity.Mythical);
4443 for (
int j = 0; j < 5; j++)
4445 base.AddCard(
ThingGen.CreateSpellbook(9150, 1));
4449 base.AddThing(
"1071", -1);
4456 if (!(
id ==
"big_sister"))
4462 this.EQ_ID(
"sword_muramasa", -1, Rarity.Random);
4468 else if (num != 3590419257U)
4470 if (num != 4273125121U)
4474 if (!(
id ==
"adv_kiria"))
4480 this.EQ_ID(
"sword_zephir", -1, Rarity.Random);
4487 if (!(
id ==
"ephrond"))
4493 base.AddThing(
"guitar_efrond", -1);
4498 this.EQ_ID(
"staff_long", 1, Rarity.Random);
4499 this.EQ_CAT(
"head");
4500 this.EQ_CAT(
"torso");
4504 if (!(equip ==
"archer"))
4506 if (!(equip ==
"inquisitor") && !(equip ==
"gunner"))
4508 if (!(equip ==
"predator") && !(equip ==
"none"))
4512 else if (onCreate || !this.TryEquipRanged())
4517 else if (onCreate || !this.TryEquipRanged())
4519 this.EQ_CAT((
EClass.rnd(4) == 0) ?
"crossbow" :
"bow");
4521 int num2 = (base.rarity >= Rarity.Mythical) ? (base.LV * 3) : ((base.rarity >= Rarity.Legendary) ? (base.LV * 2) : base.LV);
4526 if (this.race.id ==
"asura")
4528 for (
int k = 0; k < 4; k++)
4530 this.EQ_CAT(this.job.weapon.RandomItem<
string>());
4533 for (
int l = 0; l < ((this.race.id ==
"mutant") ? (2 + base.LV / 30) : 1); l++)
4535 if (!this.job.weapon.IsEmpty())
4537 if (this.race.id ==
"mutant" || (
this.body.slotMainHand !=
null &&
this.body.slotMainHand.thing ==
null))
4539 this.EQ_CAT(this.job.weapon.RandomItem<
string>());
4541 if (this.race.id ==
"mutant" || (base.Evalue(131) > 0 &&
EClass.rnd(2) == 0))
4543 this.EQ_CAT(this.job.weapon.RandomItem<
string>());
4546 this.EQ_CAT(
"torso");
4547 if (
EClass.rnd(num2) > 5)
4551 if (
EClass.rnd(num2) > 10)
4553 this.EQ_CAT(
"head");
4555 if (
EClass.rnd(num2) > 15)
4557 this.EQ_CAT(
"back");
4559 if (
EClass.rnd(num2) > 20)
4561 this.EQ_CAT(
"ring");
4563 if (
EClass.rnd(num2) > 25)
4565 this.EQ_CAT(
"amulet");
4567 if (
EClass.rnd(num2) > 30)
4569 this.EQ_CAT(
"foot");
4571 if (
EClass.rnd(num2) > 35)
4573 this.EQ_CAT(
"waist");
4575 if (
EClass.rnd(num2) > 40)
4577 this.EQ_CAT(
"ring");
4582 base.AddThing(
ThingGen.Create(
"lute", -1, -1),
true, -1, -1);
4587 public void RestockInventory(
bool onCreate)
4589 string id = this.id;
4592 this.<RestockInventory>g__Restock|354_0(
"book_story", 1);
4595 if (
id ==
"rock_thrower")
4597 this.<RestockInventory>g__Restock|354_0(
"stone", 10 +
EClass.rnd(10));
4600 if (!(
id ==
"giant"))
4602 if (!(
id ==
"begger"))
4604 if (!(
id ==
"farris"))
4608 this.<RestockInventory>g__Restock|354_0(
"lute", 1);
4612 this.<RestockInventory>g__Restock|354_0(
"rock", 2 +
EClass.rnd(10));
4616 private void SetEQQuality()
4619 Rarity rarity = Rarity.Normal;
4620 int num = (base.LV >= 1000) ? 7 : ((base.LV >= 500) ? 5 : ((base.LV >= 250) ? 3 : ((base.LV >= 100) ? 2 : ((base.LV >= 50) ? 1 : 0))));
4621 Rarity rarity2 = base.rarity;
4622 if (this.
id ==
"big_sister")
4624 num = (Chara.isOnCreate ? 8 : 4);
4630 if (rarity2 == Rarity.Superior &&
EClass.rnd(10) <= num)
4632 rarity = Rarity.Superior;
4634 else if (rarity2 == Rarity.Legendary)
4636 rarity = ((
EClass.rnd(10) <= num) ? Rarity.Legendary : ((
EClass.rnd(5) <= num) ? Rarity.Superior : Rarity.Normal));
4638 else if (rarity2 >= Rarity.Mythical)
4640 rarity = ((
EClass.rnd(30) <= num) ? Rarity.Mythical : ((
EClass.rnd(10) <= num) ? Rarity.Legendary : Rarity.Superior));
4642 if (rarity == Rarity.Normal &&
EClass.rnd(1000) == 0)
4644 rarity = Rarity.Legendary;
4646 CardBlueprint.current.rarity = rarity;
4650 public Thing EQ_ID(
string s,
int mat = -1, Rarity r = Rarity.Random)
4652 this.SetEQQuality();
4653 if (r != Rarity.Random)
4655 CardBlueprint.current.rarity = r;
4658 base.AddThing(thing,
true, -1, -1);
4659 if (!this.body.Equip(thing,
null,
true))
4667 public void EQ_CAT(
string s)
4669 int slot =
EClass.sources.categories.map[s].slot;
4670 BodySlot bodySlot = (slot == 0) ?
null : this.body.GetSlot(slot,
true,
false);
4671 if (slot != 0 && bodySlot ==
null)
4675 if (slot == 37 && base.HasElement(1209, 1))
4679 this.SetEQQuality();
4681 base.AddThing(thing,
true, -1, -1);
4682 if (bodySlot !=
null && !this.body.Equip(thing, bodySlot,
true))
4689 public void EQ_Item(
string s,
int num = 1)
4691 this.SetEQQuality();
4693 base.AddThing(t,
true, -1, -1);
4697 public void Drink(
Card t)
4699 base.Say(
"drink",
this, t.Duplicate(1),
null,
null);
4700 base.Say(
"quaff",
null,
null);
4701 base.PlaySound(
"drink", 1f,
true);
4702 this.hunger.Mod(-2);
4704 t.trait.OnDrink(
this);
4705 bool isPC = this.IsPC;
4709 public void GetRevived()
4711 this.Revive(
EClass.pc.pos.GetNearestPoint(
false,
false,
true,
false),
true);
4712 if (!this.IsPCFaction)
4716 if (!this.IsPC && !this.trait.CanJoinPartyResident)
4718 if (this.homeZone !=
null &&
EClass._zone !=
this.homeZone)
4720 Msg.Say(
"returnHome",
this, this.homeZone.Name,
null,
null);
4725 if (!
EClass._zone.IsPCFaction ||
this.homeBranch !=
EClass.Branch || base.GetInt(103,
null) != 0)
4727 EClass.pc.party.AddMemeber(
this);
4732 public void Revive(
Point p =
null,
bool msg =
false)
4738 this.isDead =
false;
4739 base.hp = this.MaxHP / 3;
4740 this.mana.value = 0;
4741 this.stamina.value = 0;
4742 this.hunger.value = 30;
4743 this.sleepiness.value = 0;
4744 this.hostility = this.OriginalHostility;
4747 if (
EClass.player.preventDeathPenalty)
4749 Msg.Say(
"noDeathPenalty2",
this,
null,
null,
null);
4751 else if (
EClass.player.stats.days <= 90 && !
EClass.debug.enable)
4753 Msg.Say(
"noDeathPenalty",
this,
null,
null,
null);
4757 EClass.pc.ApplyDeathPenalty();
4759 List<Thing> dropList =
new List<Thing>();
4762 if (!t.IsContainer && t.SelfWeight >
EClass.pc.WeightLimit)
4764 t.ignoreAutoPick =
true;
4768 foreach (
Thing thing
in dropList)
4771 Msg.Say(
"backpack_full_drop", thing,
null,
null,
null);
4773 EClass.player.preventDeathPenalty =
false;
4775 if (this.IsPCFaction && this.homeBranch !=
null)
4777 this.homeBranch.Log(
"bRevive",
this,
null,
null,
null);
4785 p.Set(
EClass._map.GetCenterPos().GetNearestPoint(
false,
true,
true,
false) ??
EClass._map.GetCenterPos());
4787 EClass._zone.AddCard(
this, p);
4791 Msg.Say(
"revive",
this,
null,
null,
null);
4792 base.PlayEffect(
"revive",
true, 0f,
default(Vector3));
4797 public void MakeGrave(
string lastword)
4799 if (
EClass._zone.IsRegion)
4803 List<string> list =
new List<string>
4814 if (this.IsPC &&
EClass.rnd(2) == 0 &&
EClass.pc.things.Find(
"letter_will", -1, -1) !=
null)
4816 list =
new List<string>
4824 Thing thing =
ThingGen.Create(list.RandomItem<
string>(), -1, -1);
4825 thing.MakeRefFrom(
this,
null);
4826 if (!lastword.IsEmpty())
4828 thing.c_note = lastword;
4830 thing.isModified =
true;
4831 EClass._zone.AddCard(thing, this.pos).Install();
4835 public void ApplyDeathPenalty()
4839 int currency = base.GetCurrency(
"money");
4842 int num = currency / 3 +
EClass.rnd(currency / 3 + 1);
4847 Msg.Say(
"panaltyMoney",
this, Lang._currency(num,
false, 14),
null,
null);
4848 base.ModCurrency(-num,
"money");
4852 if (
EClass.rnd(5) == 0 && element.IsMainAttribute)
4854 EClass.pc.elements.ModExp(element.id, -500,
false);
4864 int c_vomit = base.c_vomit;
4865 base.c_vomit = c_vomit + 1;
4866 base.Say(
"vomit",
this,
null,
null);
4867 base.PlaySound(
"vomit", 1f,
true);
4868 if (!
EClass._zone.IsRegion)
4871 if (!
EClass._zone.IsPCFaction)
4873 thing.MakeRefFrom(
this,
null);
4875 EClass._zone.AddCard(thing, this.pos);
4877 if (this.HasCondition<ConAnorexia>())
4879 base.ModExp(70, -50);
4880 base.ModExp(71, -75);
4881 base.ModExp(77, -100);
4883 else if (base.c_vomit > 10)
4885 this.AddCondition<ConAnorexia>(100,
false);
4887 this.AddCondition<ConDim>(100,
false);
4888 if (this.HasCondition<ConAnorexia>())
4890 this.ModWeight(-1 * (1 +
EClass.rnd(5)),
false);
4892 if (this.hunger.GetPhase() >= 4)
4894 base.DamageHP(9999, AttackSource.Hunger,
null);
4896 this.hunger.Mod(30);
4900 public override void Die(
Element e =
null,
Card origin =
null, AttackSource attackSource = AttackSource.None)
4902 this.combatCount = 0;
4903 if (this.isDead || this.host !=
null)
4907 bool isInActiveZone = this.IsInActiveZone;
4912 EClass._zone.ResetHostility();
4916 base.Say(
"summon_vanish",
this,
null,
null);
4917 this.pos.PlayEffect(
"vanish");
4918 this.pos.PlaySound(
"vanish",
true, 1f,
true);
4922 Effect.Get(
"blood").Play((this.parent is
Chara) ? (this.parent as
Chara).pos : this.pos, 0f,
null,
null).SetParticleColor(
EClass.Colors.matColors[base.material.alias].main).Emit(50);
4923 base.AddBlood(2 +
EClass.rnd(2), -1);
4924 this.renderer.RefreshSprite();
4925 this.renderer.RefreshStateIcon();
4927 base.PlaySound(base.material.GetSoundDead(
this.source), 1f,
true);
4930 if (LangGame.Has(
"dead_" + attackSource.ToString()))
4932 text =
"dead_" + attackSource.ToString();
4936 if (e !=
Element.Void && e !=
null)
4938 text =
"dead_" + e.source.alias;
4940 if (text ==
"" || !LangGame.Has(text))
4947 string s = (origin ==
null) ? text :
"dead_by";
4948 "dead_in".langGame(
EClass._zone.Name,
null,
null,
null);
4950 EClass.player.deathMsg =
GameLang.Parse(s.langGame(),
true,
EClass.pc.NameBraced,
"dead_in".langGame(
EClass._zone.Name,
null,
null,
null), (origin ==
null) ?
"" : origin.GetName(NameStyle.Full, -1),
null);
4951 Debug.Log(
EClass.player.deathMsg);
4953 if (zoneInstanceRandomQuest !=
null)
4955 zoneInstanceRandomQuest.status =
ZoneInstance.Status.Fail;
4960 if (origin ==
null || !origin.isSynced || (attackSource != AttackSource.Melee && attackSource != AttackSource.Range))
4962 Msg.Say(text,
this,
"",
null,
null);
4964 string text2 = this.TalkTopic(
"dead");
4965 if (!text2.IsEmpty())
4967 text2 = text2.StripBrackets();
4969 bool flag = base.rarity >= Rarity.Legendary && !this.IsPCFaction;
4970 if (!this.IsPC && flag)
4972 this.MakeGrave(text2);
4975 base.SpawnLoot(origin);
4976 if (this.held !=
null && this.held.trait.CanOnlyCarry)
4978 this.DropHeld(
null);
4981 if (this.IsPCFaction)
4983 if (this.homeBranch !=
null)
4985 this.homeBranch.Log(text,
this,
"",
null,
null);
4987 WidgetPopText.Say(
"popDead".lang(base.Name,
null,
null,
null,
null), FontColor.Bad,
null);
4990 if (
EClass.player.stats.allyDeath == 0)
4992 Tutorial.Reserve(
"death_pet",
null);
4994 EClass.player.stats.allyDeath++;
4997 if (this.
id ==
"mandrake")
4999 base.Say(
"a_scream",
this,
null,
null);
5000 ActEffect.ProcAt(EffectId.Scream, base.LV * 3 + 200, BlessedState.Normal,
this,
this,
this.pos,
true,
default(
ActRef));
5002 this.daysStarved = 0;
5005 this._cooldowns =
null;
5006 base.isSale =
false;
5007 EClass._map.props.sales.Remove(
this);
5008 this.Cure(CureType.Death, 100, BlessedState.Normal);
5009 this.SetAI(
new NoGoal());
5010 this.TryDropBossLoot();
5011 if (isInActiveZone &&
EClass._zone.HasLaw &&
this.IsHuman &&
this.OriginalHostility >= Hostility.Neutral)
5013 this.pos.TalkWitnesses((origin !=
null) ? origin.Chara :
null,
"witness", 3, WitnessType.crime, (
Chara c) => !c.IsPCParty && !c.IsUnique, 3);
5017 EClass.player.returnInfo =
null;
5018 EClass.player.uidLastTravelZone = 0;
5021 if (chara.IsHostile())
5023 chara.hostility = chara.OriginalHostility;
5025 if (chara.enemy ==
EClass.pc)
5030 if (
EClass.pc.things.Find(
"letter_will", -1, -1) !=
null &&
EClass.rnd(10) == 0)
5032 EClass.player.preventDeathPenalty =
true;
5037 if (this.currentZone.IsActiveZone &&
this.IsLocalChara)
5039 EClass._map.deadCharas.Add(
this);
5041 this.currentZone.RemoveCard(
this);
5043 if ((origin !=
null && origin.IsPCParty) ||
this.IsPCParty)
5045 this.ModAffinity(
EClass.pc, -10,
false);
5049 if (origin.IsPCParty || origin.IsPCPartyMinion)
5052 if (this.OriginalHostility >= Hostility.Friend &&
this.IsHuman && !
this.IsPCFaction && !
this.IsPCFactionMinion)
5056 else if (this.race.id ==
"cat" &&
this.OriginalHostility >= Hostility.Neutral)
5058 EClass.pc.Say(
"killcat",
null,
null);
5061 if (
EClass.pc.party.HasElement(1563) && num < 0)
5063 num = num * 30 / 100;
5067 EClass.player.ModKarma(num);
5072 EClass.pc.faith.Revelation(
"kill", 10);
5074 else if (origin.IsPCFaction)
5076 origin.Chara.ModAffinity(
EClass.pc, 1,
false);
5077 origin.Chara.ShowEmo(Emo.love, 0f,
true);
5080 if (base.sourceBacker !=
null && origin !=
null && origin.IsPCParty)
5082 EClass.player.doneBackers.Add(base.sourceBacker.id);
5084 base.SetInt(103, this.IsPCParty ? 1 : 0);
5089 EClass.pc.party.RemoveMember(
this);
5090 EClass.pc.Say(
"allyDead",
null,
null);
5091 if (
EClass.game.config.autoCombat.abortOnAllyDead &&
EClass.player.TryAbortAutoCombat())
5093 Msg.Say(
"abort_allyDead");
5097 else if (
EClass.game.config.autoCombat.abortOnEnemyDead &&
EClass.player.TryAbortAutoCombat())
5099 Msg.Say(
"abort_enemyDead");
5101 string id = this.id;
5102 if (!(
id ==
"littleOne"))
5104 if (
id ==
"big_daddy")
5106 if (!this.IsPCFaction)
5109 EClass._zone.AddCard(t, this.pos.Copy());
5110 Msg.Say(
"little_pop");
5116 EClass.player.flags.little_killed =
true;
5117 EClass.player.little_dead++;
5119 if (attackSource == AttackSource.Finish && origin !=
null && origin.Evalue(665) > 0)
5121 Chara chara2 =
CharaGen.CreateFromFilter(
"c_plant", base.LV, -1);
5122 EClass._zone.AddCard(chara2, this.pos.Copy());
5123 if (chara2.LV < base.LV)
5125 chara2.SetLv(base.LV);
5127 chara2.MakeMinion((origin.IsPCParty || origin.IsPCPartyMinion) ?
EClass.pc : origin.Chara, MinionType.Friend);
5128 Msg.Say(
"plant_pop",
this, chara2,
null,
null);
5132 zoneEvent.OnCharaDie(
this);
5137 public void TryDropBossLoot()
5139 if (this.IsPCFaction || this.IsPCFactionMinion)
5146 Point point = this.pos.GetNearestPoint(
true,
false,
false,
true) ?? this.pos;
5147 TreasureType type = TreasureType.BossQuest;
5148 if (
EClass._zone.Boss ==
this)
5150 type = TreasureType.BossNefia;
5152 flag2 = (flag =
true);
5153 EClass._zone.Boss =
null;
5154 Msg.Say(
"boss_win",
EClass._zone.Name,
null,
null,
null);
5157 Msg.Say(
"boss_win_void",
EClass._zone.Name,
null,
null,
null);
5158 EClass.player.flags.KilledBossInVoid =
true;
5160 if (
EClass._zone.IsNefia)
5162 EClass._zone.GetTopZone().isConquered =
true;
5165 EClass.player.ModKarma(5);
5167 string id = this.id;
5168 if (!(
id ==
"vernis_boss"))
5170 if (!(
id ==
"melilith_boss"))
5172 if (!(
id ==
"isygarad"))
5174 if (
id ==
"swordkeeper")
5178 SE.Play(
"kill_boss");
5179 SoundManager.ForceBGM();
5180 LayerDrama.Activate(
"_event",
"event",
"swordkeeper_defeat",
null,
null,
"");
5186 flag2 = (flag =
true);
5188 if (questExploration !=
null)
5190 SE.Play(
"kill_boss");
5191 questExploration.ChangePhase(3);
5192 EClass.Sound.StopBGM(3f,
false);
5193 EClass._zone.SetBGM(1,
false);
5200 flag2 = (flag =
true);
5201 EClass.Sound.StopBGM(3f,
false);
5202 EClass._zone.SetBGM(1,
false);
5208 flag2 = (flag =
true);
5209 EClass.Sound.StopBGM(3f,
false);
5210 EClass._zone.SetBGM(1,
false);
5218 SE.Play(
"kill_boss");
5222 EClass.player.willAutoSave =
true;
5223 Thing thing =
ThingGen.CreateTreasure(
"chest_boss", base.LV, type);
5224 point.SetBlock(0, 0);
5225 point.SetObj(0, 1, 0);
5226 EClass._zone.AddCard(thing, point).Install();
5236 public void Kick(
Point p,
bool ignoreSelf =
false)
5238 foreach (
Chara t
in p.ListCharas())
5240 this.Kick(t, ignoreSelf,
true);
5245 public void Kick(
Chara t,
bool ignoreSelf =
false,
bool karmaLoss =
true)
5247 if (!this.IsAliveInCurrentZone)
5263 Debug.Log(t.pos.GetNearestPoint(
false,
true,
true,
false));
5264 if (this.TryMove(t.pos.GetNearestPoint(
false,
true,
true,
false),
true) !=
Card.MoveResult.Success)
5266 t.MoveImmediate(this.pos.GetNearestPoint(
false,
true,
true,
false) ?? t.pos,
true,
true);
5273 base.Say(
"kick",
this, t,
null,
null);
5274 base.PlaySound(
"kick", 1f,
true);
5275 if ((t.conSuspend ==
null || t.conSuspend.uidMachine != 0) && t.trait.CanBePushed && (!t.IsHostile() ||
EClass.rnd(2) == 0) && !t.noMove && !t.isRestrained)
5277 t.MoveByForce(t.pos.GetNearestPoint(
false,
false,
true,
true),
this, !t.pos.IsBlocked);
5279 if (t.conSleep !=
null)
5281 t.conSleep.Kill(
false);
5283 if (this.IsPC && t.IsFriendOrAbove() && !t.IsPCFactionOrMinion && karmaLoss)
5285 EClass.player.ModKarma(-1);
5287 t.PlayEffect(
"kick",
true, 0f,
default(Vector3));
5292 public bool UseAbility(
string idAct,
Card tc =
null,
Point pos =
null,
bool pt =
false)
5294 Element element = this.elements.GetElement(idAct);
5295 return this.UseAbility(((element !=
null) ? element.act :
null) ??
ACT.Create(idAct), tc, pos, pt);
5299 public bool UseAbility(
Act a,
Card tc =
null,
Point pos =
null,
bool pt =
false)
5301 Chara.<>c__DisplayClass371_0 CS$<>8__locals1 =
new Chara.<>c__DisplayClass371_0();
5302 CS$<>8__locals1.<>4__this =
this;
5303 CS$<>8__locals1.tc = tc;
5304 CS$<>8__locals1.a = a;
5305 CS$<>8__locals1.pos = pos;
5306 CS$<>8__locals1.pt = pt;
5307 if (!this.IsPC && this.HasCooldown(CS$<>8__locals1.a.id))
5312 Act.Cost cost = CS$<>8__locals1.a.GetCost(
this);
5313 CS$<>8__locals1.a.GetPower(
this);
5314 CS$<>8__locals1.n = 1;
5316 if (this.IsPC && this.HasCondition<StanceManaCost>())
5318 num2 = base.Evalue(1657);
5321 if (CS$<>8__locals1.a.TargetType.ForceParty)
5323 CS$<>8__locals1.pt =
true;
5325 if (CS$<>8__locals1.pt)
5327 CS$<>8__locals1.n = 0;
5328 CS$<>8__locals1.<UseAbility>g__ForeachParty|0(delegate(
Chara c)
5330 int n = CS$<>8__locals1.n;
5331 CS$<>8__locals1.n = n + 1;
5335 if (!CS$<>8__locals1.a.TargetType.ForceParty && CS$<>8__locals1.n > 1)
5337 num3 = (this.IsPC ? (CS$<>8__locals1.n * 100) : (50 + CS$<>8__locals1.n * 50));
5339 int num4 = cost.cost * num3 / 100;
5340 if (cost.type ==
Act.CostType.MP && base.Evalue(483) > 0)
5342 num4 = num4 * 100 / (100 + (int)Mathf.Sqrt((
float)(base.Evalue(483) * 10)) * 3);
5344 if (CS$<>8__locals1.n == 0)
5348 Msg.SayNothingHappen();
5352 if (!this.IsPC && cost.type ==
Act.CostType.MP &&
this.mana.value < 0 && (
EClass.rnd(4) != 0 ||
this.IsPCFaction || (base.IsPowerful &&
this.mana.value < -20)))
5358 if (!
Dialog.warned && cost.type ==
Act.CostType.MP && cost.cost > 0 &&
this.mana.value < num4 && !
EClass.debug.godMode)
5360 ActPlan.warning =
true;
5361 Dialog.TryWarnMana(delegate
5363 if (CS$<>8__locals1.<>4__this.UseAbility(CS$<>8__locals1.a, CS$<>8__locals1.tc, CS$<>8__locals1.pos, CS$<>8__locals1.pt))
5365 EClass.player.EndTurn(
true);
5372 if ((this.isConfused &&
EClass.rnd(4) == 0) || (this.isBlind && (CS$<>8__locals1.pt || (CS$<>8__locals1.pos !=
null && !CS$<>8__locals1.pos.Equals(this.pos)) || (CS$<>8__locals1.tc !=
null && CS$<>8__locals1.tc.pos !=
null && !CS$<>8__locals1.tc.pos.Equals(
this.pos))) &&
EClass.rnd(2) == 0))
5374 base.Say(
"shakeHead",
this,
null,
null);
5377 if (CS$<>8__locals1.tc !=
null && CS$<>8__locals1.tc !=
this)
5379 this.LookAt(CS$<>8__locals1.tc.pos);
5381 if (CS$<>8__locals1.pos !=
null && !
this.pos.Equals(CS$<>8__locals1.pos))
5383 this.LookAt(CS$<>8__locals1.pos);
5385 if (CS$<>8__locals1.a.CanRapidFire && base.HasElement(1648, 1))
5387 num = 1 + base.Evalue(1648);
5389 if (this.IsPC && cost.cost > 0 && CS$<>8__locals1.a.Value == 0)
5391 Msg.SayNothingHappen();
5394 if (CS$<>8__locals1.a is
Spell)
5396 string s = this.isConfused ?
"_cast_confuse" : (this.HasCondition<ConDim>() ?
"_cast_dim" :
"");
5397 if (!CS$<>8__locals1.a.source.tag.Contains(
"useHand"))
5399 base.Say(this.race.castStyle.IsEmpty(
"cast"),
this, CS$<>8__locals1.a.source.GetName().ToLower(), s.lang());
5403 int num5 = (CS$<>8__locals1.n + 1) / 2;
5404 if (CS$<>8__locals1.a.vPotential < CS$<>8__locals1.n)
5406 CS$<>8__locals1.n = 1;
5408 Chara._pts.Add(
this);
5410 if (CS$<>8__locals1.a.vPotential < CS$<>8__locals1.n)
5412 Msg.Say(
"noSpellStock");
5413 EInput.Consume(
false, 1);
5416 if (num2 > 0 && CS$<>8__locals1.a.vPotential >= CS$<>8__locals1.n * 2)
5418 CS$<>8__locals1.a.vPotential -= CS$<>8__locals1.n * 2;
5419 num4 = num4 * (100 - num2 * 20) / 100;
5423 CS$<>8__locals1.a.vPotential -= CS$<>8__locals1.n;
5428 else if (CS$<>8__locals1.a.source.langAct.Length != 0 && CS$<>8__locals1.tc !=
null)
5430 string text = CS$<>8__locals1.a.source.langAct[0];
5431 string text2 = (CS$<>8__locals1.a.source.langAct.Length >= 2) ? CS$<>8__locals1.a.source.langAct[1] :
"";
5432 if (text ==
"spell_hand")
5434 string[] list = Lang.GetList(
"attack" + this.race.meleeStyle.IsEmpty(
"Touch"));
5435 string @ref = text2.lang(list[4],
null,
null,
null,
null);
5436 base.Say(CS$<>8__locals1.tc.IsPCParty ?
"cast_hand_ally" :
"cast_hand",
this, CS$<>8__locals1.tc, @ref, CS$<>8__locals1.tc.IsPCParty ? list[1] : list[2]);
5440 base.Say(text,
this, CS$<>8__locals1.tc, text2.IsEmpty() ?
"" : text2.lang(),
null);
5442 if (CS$<>8__locals1.a.source.id == 6630)
5444 base.Talk(
"insult_" + (base.IsMale ?
"m" :
"f"),
null,
null,
false);
5447 Act.CostType type = cost.type;
5448 if (type !=
Act.CostType.MP)
5450 if (type ==
Act.CostType.SP)
5452 this.stamina.Mod(-num4);
5457 if (base.Evalue(1421) >= 2 && base.hp <=
this.MaxHP / (9 - base.Evalue(1421) * 2))
5461 this.mana.Mod(-num4);
5466 this.elements.ModExp(304, Mathf.Clamp(num4 * 2, 1, 200),
false);
5468 if (CS$<>8__locals1.a is
Spell &&
this.GetCondition<
ConSilence>() !=
null)
5470 base.Say(
"cast_silence",
this,
null,
null);
5477 int spellExp = this.elements.GetSpellExp(
this, CS$<>8__locals1.a, num3);
5478 if (
EClass.rnd(100) >= this.CalcCastingChance(CS$<>8__locals1.a, CS$<>8__locals1.n) && !
EClass.debug.godMode)
5480 base.PlayEffect(
"fizzle",
true, 0f,
default(Vector3));
5481 base.PlaySound(
"fizzle", 1f,
true);
5482 if (cost.cost > 0 && CS$<>8__locals1.a.source.lvFactor > 0)
5484 base.ModExp(CS$<>8__locals1.a.id, spellExp / 5);
5486 this.RemoveCondition<ConInvisibility>();
5490 if (CS$<>8__locals1.pt)
5493 CS$<>8__locals1.<UseAbility>g__ForeachParty|0(delegate(
Chara c)
5495 CS$<>8__locals1.a.Perform(CS$<>8__locals1.<>4__this, c, c.pos);
5497 Act.forcePt =
false;
5502 while (num6 < num && (CS$<>8__locals1.a.TargetType ==
TargetType.SelfParty || CS$<>8__locals1.tc ==
null || CS$<>8__locals1.tc.IsAliveInCurrentZone))
5504 ActEffect.RapidCount = num6;
5505 ActEffect.RapidDelay = CS$<>8__locals1.a.RapidDelay;
5506 flag = CS$<>8__locals1.a.Perform(
this, CS$<>8__locals1.tc, CS$<>8__locals1.pos);
5510 if (flag && !this.isDead && cost.cost > 0 && CS$<>8__locals1.a.source.lvFactor > 0)
5512 base.ModExp(CS$<>8__locals1.a.id, spellExp);
5514 ActEffect.RapidCount = 0;
5515 if (!this.IsPC && CS$<>8__locals1.a.source.cooldown > 0)
5517 this.AddCooldown(CS$<>8__locals1.a.id, CS$<>8__locals1.a.source.cooldown);
5519 if (flag && !CS$<>8__locals1.a.source.tag.Contains(
"keepInvisi") &&
EClass.rnd(2) == 0)
5521 this.RemoveCondition<ConInvisibility>();
5527 public int EvalueRiding()
5529 if (this.ride !=
null && this.ride.HasCondition<
ConTransmuteBroom>() && base.HasElement(1417, 1))
5531 return 25 + base.Evalue(226) * 125 / 100;
5533 return base.Evalue(226);
5537 public int CalcCastingChance(
Element e,
int num = 1)
5546 if (this.host !=
null)
5548 if (this.host.ride ==
this)
5550 return num2 * 100 / (100 + 300 / Mathf.Max(5, 10 + this.host.EvalueRiding()));
5552 if (this.host.parasite ==
this)
5554 return num2 * 100 / (100 + 300 / Mathf.Max(5, 10 + this.host.Evalue(227)));
5559 int num3 = base.Evalue(304);
5560 if (!this.IsPCFaction)
5562 num3 = Mathf.Max(num3, base.LV + 5);
5565 bool flag = this.GetArmorSkill() == 122;
5566 AttackStyle attackStyle = this.body.GetAttackStyle();
5570 num5 = 20 - base.Evalue(122) / 5;
5571 num4 += 10 - base.Evalue(1654) * 4;
5575 num5 = 10 - base.Evalue(120) / 5;
5581 if (this.ride !=
null)
5585 if (this.parasite !=
null)
5589 if (attackStyle == AttackStyle.TwoWield)
5593 if (attackStyle == AttackStyle.Shield)
5596 num4 += 10 - base.Evalue(1654) * 4;
5598 if (this.isConfused)
5602 if (this.HasCondition<ConDim>())
5604 num5 += ((base.Evalue(1654) >= 3) ? 1500 : 2500);
5614 return Mathf.Clamp(100 + e.Value - 10 - e.source.LV * e.source.cost[0] * num5 / (10 + num3 * 10), 0, 100 - num4);
5618 public void DoAI(
int wait, Action onPerform)
5632 public bool IsMofuable
5636 return this.race.tag.Contains(
"mofu");
5641 public void Cuddle(
Chara c,
bool headpat =
false)
5643 base.Talk(
"goodBoy",
null,
null,
false);
5644 base.Say(headpat ?
"headpat" :
"cuddle",
this, c,
null,
null);
5645 c.ShowEmo(Emo.love, 0f,
true);
5646 if (
EClass.rnd(
this.IsPC ? 100 : 5000) == 0)
5648 c.MakeEgg(
true, 1,
true);
5650 if (headpat &&
this != c)
5655 c.interest -= 20 +
EClass.rnd(10);
5657 if (this.faith ==
EClass.game.religions.MoonShadow && c.IsPCParty)
5659 foreach (
Chara chara
in this.party.members)
5661 if (!chara.IsPC &&
this.CanSeeLos(chara, -1,
false))
5663 chara.AddCondition<
ConEuphoric>(100 + base.Evalue(6904) * 5,
false);
5676 this.calmCheckTurn = 10 +
EClass.rnd(30);
5682 public void TrySetEnemy(
Chara c)
5684 if (this.IsPC &&
EClass.game.config.autoCombat.bDontChangeTarget)
5688 if (this.enemy !=
null && (
EClass.rnd(5) != 0 || base.Dist(c) > 1))
5692 if (((this.IsPCFaction || this.IsPCFactionMinion) && (c.IsPCFaction || c.IsPCFactionMinion)) || (
this.hostility == Hostility.Enemy && c.hostility == Hostility.Enemy))
5696 if (c.IsPC &&
this.hostility >= Hostility.Neutral)
5704 private void GoHostile(
Card _tg)
5706 if (this.enemy ==
null && !this.IsPC)
5708 if (base.GetInt(106,
null) == 0)
5710 this.TalkTopic(
"aggro");
5712 if (this.OriginalHostility != Hostility.Enemy)
5714 base.ShowEmo(Emo.angry, 0f,
true);
5716 this.SetEnemy(_tg.Chara);
5718 if (!this.IsPCFaction && !this.IsPCFactionMinion && (_tg.IsPCFaction || _tg.IsPCFactionMinion))
5720 if (this.hostility >= Hostility.Neutral)
5722 base.Say(
"angry",
this,
null,
null);
5724 this.hostility = Hostility.Enemy;
5729 public void DoHostileAction(
Card _tg,
bool immediate =
false)
5731 if (_tg ==
null || !_tg.isChara)
5735 Chara chara = _tg.Chara;
5738 EClass.pc.combatCount = 10;
5740 if (!chara.IsAliveInCurrentZone || !
this.IsAliveInCurrentZone || chara ==
this)
5744 if ((this.IsPCFaction || this.IsPCFactionMinion) && (chara.IsPCFaction || chara.IsPCFactionMinion))
5746 chara.Say(
"frown",
this, chara,
null,
null);
5749 if (
EClass._zone.IsRegion)
5755 if (chara.IsFriendOrAbove() && !immediate)
5757 chara.Say(
"frown",
this, chara,
null,
null);
5758 chara.ShowEmo(Emo.sad, 0f,
true);
5759 chara.hostility = Hostility.Neutral;
5762 if (!chara.IsPCFaction && chara.hostility >= Hostility.Neutral)
5764 bool flag = chara.id ==
"fanatic";
5765 if (
EClass.rnd(4) == 0 || flag)
5767 chara.Say(
"callHelp", chara,
null,
null);
5768 chara.CallHelp(
this, flag);
5771 if (chara.hostility > Hostility.Enemy)
5775 using (List<Chara>.Enumerator enumerator =
EClass.pc.party.members.GetEnumerator())
5777 while (enumerator.MoveNext())
5779 Chara chara2 = enumerator.Current;
5780 if (chara2 !=
EClass.pc && chara2.enemy ==
null)
5782 chara2.SetEnemy(chara);
5788 if (chara.IsPC &&
this.hostility <= Hostility.Enemy)
5792 if (chara3 !=
EClass.pc && chara3.enemy ==
null)
5794 chara3.SetEnemy(
this);
5799 if (chara.calmCheckTurn <= 0 ||
this.IsPC)
5801 chara.calmCheckTurn = (this.IsPC ? (20 +
EClass.rnd(30)) : (10 +
EClass.rnd(10)));
5803 if (this.hostility == Hostility.Enemy && chara.hostility == Hostility.Enemy)
5807 this.GoHostile(chara);
5808 chara.GoHostile(
this);
5809 if (base.isHidden && !chara.CanSee(
this) && !chara.IsDisabled && !chara.IsPCParty && !chara.IsPCPartyMinion &&
EClass.rnd(6) == 0)
5812 ActThrow.Throw(chara, this.pos, t, ThrowMethod.Default, 0f);
5817 public void CallHelp(
Chara tg,
bool fanatic =
false)
5821 if (!chara.IsPCFaction && chara.OriginalHostility ==
this.OriginalHostility && (fanatic || base.Dist(chara) <= 6) && (
EClass.rnd(3) != 0 || fanatic))
5823 chara.GoHostile(tg);
5829 public bool FindNewEnemy()
5831 if (
EClass._zone.isPeace && base.IsPCFactionOrMinion)
5835 if (this.enemy !=
null && !this.enemy.IsAliveInCurrentZone)
5839 if (this.enemy !=
null)
5843 bool flag = this.enemy !=
null || this.ai is
GoalCombat;
5844 int num = (base.PER + base.Evalue(210) * 2) * (flag ? 2 : 1);
5845 bool flag2 = this.IsPCParty && !this.IsPC &&
EClass.game.config.tactics.dontWander;
5846 bool flag3 = !this.IsPCParty;
5847 for (
int i = 0; i <
EClass._map.charas.Count; i++)
5850 if (chara !=
this && this.IsHostile(chara) && this.CanSee(chara))
5852 int num2 = base.Dist(chara);
5853 int num3 = base.GetSightRadius() + (flag ? 1 : 0);
5856 if (flag3 &&
EClass.rnd(chara.Evalue(152) + 5) * (100 + num2 * num2 * 10) / 100 >
EClass.rnd(num))
5858 chara.ModExp(152, Mathf.Clamp((num - chara.Evalue(152)) / 2, 1, 20));
5860 else if (
Los.IsVisible(
this.pos.x, chara.pos.x,
this.pos.z, chara.pos.z,
null,
true) && (!flag2 ||
EClass.pc.isBlind ||
EClass.pc.CanSeeLos(chara, -1,
false)))
5862 if (this.IsPCFaction)
5865 if (ai_Shear !=
null && ai_Shear.target == chara)
5870 this.DoHostileAction(chara,
false);
5882 public bool FindNearestNewEnemy()
5884 for (
int i = 0; i <
EClass._map.charas.Count; i++)
5887 if (chara !=
this && chara != this.enemy && this.IsHostile(chara) && base.Dist(chara) <= 1 &&
this.CanInteractTo(chara.pos))
5889 this.DoHostileAction(chara,
false);
5898 public bool IsHostile()
5900 return this.hostility <= Hostility.Enemy;
5904 public bool IsHostile(
Chara c)
5910 if (base.IsPCFactionOrMinion)
5912 if ((c ==
EClass.pc.enemy && !c.IsPCFactionOrMinion) || c.hostility <= Hostility.Enemy)
5919 if (this.trait is
TraitGuard && c.IsPCParty &&
EClass.player.IsCriminal &&
EClass._zone.instance ==
null)
5923 if (this.OriginalHostility >= Hostility.Friend)
5925 if (c.hostility <= Hostility.Enemy && c.OriginalHostility == Hostility.Enemy)
5930 else if (this.OriginalHostility <= Hostility.Enemy && (c.IsPCFactionOrMinion || (c.OriginalHostility != Hostility.Enemy && c.hostility >= Hostility.Friend)))
5939 public bool IsNeutral()
5941 return this.hostility == Hostility.Neutral;
5945 public bool IsNeutralOrAbove()
5947 return this.hostility >= Hostility.Neutral;
5951 public bool IsBranchMember()
5953 return this.faction == EClass.Home && this.homeZone ==
EClass.game.activeZone;
5957 public bool IsHomeMember()
5959 return this.faction ==
EClass.Home;
5963 public bool IsInHomeZone()
5965 return EClass.game.activeZone == this.homeZone;
5969 public bool IsInSpot<T>() where T :
TraitSpot
5971 foreach (T t
in EClass._map.props.installed.traits.List<T>(
null))
5973 foreach (
Point obj
in t.ListPoints(
null,
true))
5975 if (this.pos.Equals(obj))
5985 public bool IsGuest()
5987 return this.memberType == FactionMemberType.Guest;
5991 public bool IsFriendOrAbove()
5993 return this.hostility >= Hostility.Friend;
5997 public bool IsFriendOrAbove(
Chara c)
5999 if (base.IsPCFactionOrMinion ||
this.IsFriendOrAbove())
6001 if (c.IsPCFactionOrMinion || c.IsFriendOrAbove())
6006 else if (this.IsHostile() && c.IsHostile())
6010 return this.race == c.race;
6017 if (this.source.moveAnime ==
"hop")
6019 charaRenderer.hopCurve =
EClass.setting.render.anime.hop;
6021 if (this.host !=
null)
6023 charaRenderer.pccData = PCCData.Create(
"ride");
6024 string text = base.c_idRidePCC.IsEmpty(
EClass.core.pccs.sets[
"ride"].map[
"body"].map.Keys.First<
string>());
6025 charaRenderer.pccData.SetPart(
"body",
"ride", text,
null);
6026 charaRenderer.pccData.ride =
EClass.core.pccs.GetRideData(text);
6030 foreach (
Condition condition
in this.conditions)
6033 if (rendererReplacer !=
null)
6035 charaRenderer.replacer = rendererReplacer;
6036 charaRenderer.data = rendererReplacer.data;
6040 if (charaRenderer.replacer ==
null)
6042 charaRenderer.pccData = this.pccData;
6045 this.renderer = charaRenderer;
6046 this.renderer.SetOwner(
this);
6047 return charaRenderer;
6051 public void SetPCCState(PCCState state)
6055 PCC.Get(this.pccData).Build(state,
false);
6060 public override Sprite GetSprite(
int dir = 0)
6064 PCC pcc = PCC.Get(this.pccData);
6066 return pcc.variation.idle[0, 0];
6068 return this.sourceCard.GetSprite((this.sourceCard._tiles.Length > 1) ? ((base.idSkin != 0 ||
this.source.staticSkin) ? base.idSkin : (base.uid %
this.sourceCard._tiles.Length / 2 * 2 + (base.IsMale ? 0 : 1))) : 0, 0,
false);
6072 public void SetTempHand(
int right = 0,
int left = 0)
6082 this.pccData.tempRight =
EClass.scene.screenElin.renderTempEQ.ConvertTile(right);
6083 this.pccData.tempLeft =
EClass.scene.screenElin.renderTempEQ.ConvertTile(left);
6089 if (this.IsPCC && (this.IsDeadOrSleeping || (!
EClass.player.altHeldPos &&
this.parent is
Chara)))
6091 return EClass.setting.pass.subDeadPCC;
6097 public override void SetRenderParam(
RenderParam p)
6099 p.mat = base.material;
6100 p.matColor = (float)base.colorInt;
6101 if (!this.renderer.usePass)
6105 if (this.renderer.replacer !=
null)
6107 p.tile = (float)(this.renderer.replacer.tile * (
this.flipX ? -1 : 1));
6109 else if (this.source._tiles_snow.Length != 0 &&
EClass._zone.IsSnowCovered)
6111 if (this.source._tiles_snow.Length > 1)
6113 int num = (base.idSkin != 0 || this.source.staticSkin) ? base.idSkin : (base.uid % this.source._tiles_snow.Length / 2 * 2 + (base.IsMale ? 0 : 1));
6114 p.tile = (float)(this.source._tiles_snow[(num <
this.source._tiles_snow.Length) ? num : 0] * (
this.flipX ? -1 : 1));
6118 p.tile = (float)(this.source._tiles_snow[0] * (
this.flipX ? -1 : 1));
6121 else if (this.sourceCard._tiles.Length > 1)
6123 int num2 = (base.idSkin != 0 || this.source.staticSkin) ? base.idSkin : (base.uid % this.sourceCard._tiles.Length / 2 * 2 + (base.IsMale ? 0 : 1));
6124 p.tile = (float)(this.sourceCard._tiles[(num2 <
this.sourceCard._tiles.Length) ? num2 : 0] * (
this.flipX ? -1 : 1));
6128 p.tile = (float)(this.sourceCard._tiles[0] * (
this.flipX ? -1 : 1));
6134 public override string GetHoverText()
6136 string text = base.Name;
6137 if (this.IsFriendOrAbove())
6139 text = text.TagColor(
EClass.Colors.colorFriend);
6141 else if (this.IsHostile())
6143 text = text.TagColor(
EClass.Colors.colorHostile);
6147 if (base.LV >= lv * 5)
6151 else if (base.LV >= lv * 2)
6155 else if (base.LV <= lv / 4)
6159 else if (base.LV <= lv / 2)
6163 string text2 = Lang.GetList(
"lvComparison")[num];
6164 text2 = (
" (" + text2 +
") ").TagSize(14).TagColor(
EClass.Colors.gradientLVComparison.Evaluate(0.25f * (
float)num));
6165 string s = this.IsFriendOrAbove() ?
"HostilityAlly" : (this.IsNeutral() ?
"HostilityNeutral" :
"HostilityEnemy");
6166 s = (
" (" + s.lang() +
") ").TagSize(14);
6169 if (
EClass.pc.HasHigherGround(
this))
6171 text2 +=
"lowerGround".lang();
6173 else if (this.HasHigherGround(
EClass.pc))
6175 text2 +=
"higherGround".lang();
6178 if (base.Evalue(1232) > 0)
6180 text2 =
"milkBaby".lang().TagSize(14) + text2;
6182 if (
EClass.pc.HasElement(481, 1))
6184 text2 += (
"( " + this.faith.Name +
")").TagSize(14);
6186 return text + text2;
6190 public override string GetHoverText2()
6195 str += Environment.NewLine;
6196 str = str +
"<size=14>" +
"favgift".lang(this.GetFavCat().GetName().ToLower(), this.GetFavFood().GetName(),
null,
null,
null) +
"</size>";
6199 if (
EClass.debug.showExtra)
6201 text += Environment.NewLine;
6202 text =
string.Concat(
new string[]
6210 this.MaxHP.ToString(),
6212 this.mana.value.ToString(),
6214 this.mana.max.ToString(),
6220 this.hunger.value.ToString()
6222 text += Environment.NewLine;
6223 string[] array =
new string[7];
6225 array[1] =
"Global:";
6226 array[2] = this.IsGlobal.ToString();
6229 AIAct aiact = this.ai;
6230 array[num] = ((aiact !=
null) ? aiact.ToString() :
null);
6233 string tactics = this.source.tactics;
6236 if ((defaultStr = ((row !=
null) ? row.id :
null)) ==
null)
6239 defaultStr = (((row2 !=
null) ? row2.id :
null) ??
"predator");
6241 array[num2] = tactics.IsEmpty(defaultStr);
6242 text =
string.Concat(array);
6243 text += Environment.NewLine;
6244 string[] array2 =
new string[7];
6246 array2[1] = base.uid.ToString();
6247 array2[2] = this.IsMinion.ToString();
6249 array2[4] = base.c_uidMaster.ToString();
6252 Chara chara = this.master;
6253 array2[num3] = ((chara !=
null) ? chara.ToString() :
null);
6254 text =
string.Concat(array2);
6257 if (this.conditions.Count > 0)
6260 text2 += Environment.NewLine;
6261 text2 +=
"<size=14>";
6262 IEnumerable<BaseStats> first = this.conditions;
6263 IEnumerable<BaseStats> second;
6264 if (!this.IsPCFaction)
6271 array3[0] = this.hunger;
6273 array3[1] = this.stamina;
6275 foreach (
BaseStats baseStats
in first.Concat(second))
6277 string text3 = baseStats.GetPhaseStr();
6278 if (!text3.IsEmpty() && !(text3 ==
"#"))
6280 Color c = Color.white;
6281 string group = baseStats.source.group;
6282 if (!(group ==
"Bad") && !(group ==
"Debuff") && !(group ==
"Disease"))
6284 if (group ==
"Buff")
6286 c =
EClass.Colors.colorBuff;
6291 c =
EClass.Colors.colorDebuff;
6293 if (
EClass.debug.showExtra)
6295 text3 = text3 +
"(" + baseStats.GetValue().ToString() +
")";
6296 if (this.resistCon !=
null && this.resistCon.ContainsKey(baseStats.id))
6298 text3 = text3 +
"{" + this.resistCon[baseStats.id].ToString() +
"}";
6301 text2 = text2 + text3.TagColor(c) +
", ";
6304 text2 = text2.TrimEnd(
", ".ToCharArray()) +
"</size>";
6306 return str + text + text2;
6310 public string GetTopicText(
string topic =
"calm")
6312 string key = this.source.idText.IsEmpty(this.
id);
6322 string text = row.GetText(topic,
true);
6327 if (text.StartsWith(
"@"))
6329 row =
EClass.sources.charaText.map.TryGetValue(text.Replace(
"@",
""),
null);
6334 text = row.GetText(topic,
true);
6340 return text.Split(Environment.NewLine.ToCharArray()).RandomItem<
string>();
6344 public unsafe
string TalkTopic(
string topic =
"calm")
6346 if (this.host ==
null && !this.IsInActiveZone)
6350 if (!this.isSynced && (this.host ==
null || !this.host.isSynced) && topic !=
"dead")
6356 int num = EClass.pc.party.members.Count - 1;
6357 if (!(topic ==
"calm"))
6359 if (!(topic ==
"aggro"))
6361 if (!(topic ==
"kill"))
6368 else if (
EClass.rnd(num * 3) != 0)
6373 else if (
EClass.rnd(num * 10) != 0)
6378 else if (
EClass.rnd(num * 5) != 0)
6383 string text = this.GetTopicText(topic);
6388 string text2 =
"_bracketTalk".lang();
6389 bool flag = text.StartsWith(
"*");
6390 bool flag2 = text.StartsWith(
"(");
6391 bool flag3 = text.StartsWith(text2) || (text.Length > 0 && text[0] == text2[0]) || text[0] ==
'“';
6392 text = base.ApplyTone(text,
false);
6393 text = text.Replace(
"~",
"*");
6394 Msg.SetColor(flag2 ?
Msg.colors.Thinking : (flag3 ?
Msg.colors.Talk :
Msg.colors.Ono));
6395 Msg.Say(text.Replace(
"&",
""));
6396 if (topic ==
"dead")
6398 EClass.ui.popGame.PopText(base.ApplyNewLine(text.StripBrackets()),
null,
"PopTextDead",
default(Color), *
this.pos.Position() +
EClass.setting.render.tc.textPosDead, 0f);
6400 else if (flag || flag3 || flag2)
6402 (this.host ??
this).renderer.Say(base.ApplyNewLine(text.StripBrackets()),
default(Color),
this.IsPCParty ? 0.6f : 0f);
6408 public override Sprite GetImageSprite()
6410 return this.GetSprite(0);
6414 public void ChangeMemberType(FactionMemberType type)
6416 this.memberType = type;
6420 public void ShowDialog()
6423 if (this.IsDeadOrSleeping)
6425 this.ShowDialog(
"_chara",
"sleep",
"");
6428 if (base.isRestrained)
6430 this.ShowDialog(
"_chara",
"strain",
"");
6435 this.ShowDialog(
"_chara",
"invisible",
"");
6438 if (this.IsEscorted())
6440 this.ShowDialog(
"_chara",
"escort",
"");
6445 this.ShowDialog(
"_chara",
"party",
"");
6452 string id = this.id;
6453 if (!(
id ==
"loytel"))
6455 if (!(
id ==
"farris"))
6457 if (!(
id ==
"ashland"))
6459 if (!(
id ==
"fiama"))
6461 if (
id ==
"big_sister")
6463 if (
EClass.player.flags.little_saved)
6465 this.ShowDialog(
"big_sister",
"little_saved",
"");
6466 EClass.player.flags.little_saved =
false;
6469 if (
EClass.player.flags.little_killed)
6471 this.ShowDialog(
"big_sister",
"little_dead",
"");
6472 EClass.player.flags.little_killed =
false;
6479 if (zone_Nymelle !=
null && zone_Nymelle.IsCrystalLv)
6481 SoundManager.ForceBGM();
6482 LayerDrama.ActivateMain(
"mono",
"nymelle_crystal",
null,
null,
"");
6485 if (!
EClass.player.EnableDreamStory)
6487 this.ShowDialog(
"fiama",
"main",
"");
6490 if (!
EClass.player.flags.fiamaFirstDream &&
EClass.player.flags.storyFiama >= 10)
6492 EClass.player.flags.fiamaFirstDream =
true;
6493 this.ShowDialog(
"fiama",
"firstDream",
"");
6496 if (!
EClass.player.flags.fiamaStoryBookGiven &&
EClass.player.flags.storyFiama >= 30)
6498 this.ShowDialog(
"fiama",
"giveStoryBook",
"").SetOnKill(delegate
6500 EClass.player.flags.fiamaStoryBookGiven =
true;
6501 EClass.player.DropReward(
ThingGen.Create(
"book_story", -1, -1),
false);
6505 this.ShowDialog(
"fiama",
"main",
"");
6511 if (zone_Nymelle !=
null && zone_Nymelle.IsCrystalLv)
6513 SoundManager.ForceBGM();
6514 LayerDrama.ActivateMain(
"mono",
"nymelle_crystal",
null,
null,
"");
6517 this.ShowDialog(
"ashland",
"main",
"");
6523 if (
EClass._zone.id ==
"startVillage" ||
EClass._zone.id ==
"startVillage3")
6525 this.ShowDialog(
"_chara",
"main",
"");
6531 this.ShowDialog(
"farris",
"nymelle_noQuest",
"");
6536 this.ShowDialog(
"farris",
"nymelle_first",
"");
6541 this.ShowDialog(
"farris",
"home_first",
"");
6544 this.ShowDialog(
"_chara",
"main",
"");
6550 if (
EClass.player.flags.loytelEscaped)
6552 EClass.game.quests.Get(
"pre_debt_runaway").Complete();
6553 EClass.player.flags.loytelEscaped =
false;
6554 EClass.game.quests.Add(
"debt",
"loytel");
6555 this.ShowDialog(
"loytel",
"loytelEscaped",
"");
6559 if (questDebt !=
null && questDebt.paid)
6562 this.ShowDialog(
"loytel",
"debt" + questDebt.stage.ToString(),
"");
6569 this.ShowDialog(
"guild_doorman",
"main", tag);
6575 this.ShowDialog(
"guild_clerk",
"main", tag2);
6578 if (File.Exists(CorePath.DramaData +
this.id +
".xlsx"))
6580 this.ShowDialog(this.
id,
"main",
"");
6583 this.ShowDialog(
"_chara",
"main",
"");
6587 public LayerDrama ShowDialog(
string book,
string step =
"main",
string tag =
"")
6589 return this._ShowDialog(book,
null, step, tag);
6593 private LayerDrama _ShowDialog(
string book,
string sheet,
string step =
"main",
string tag =
"")
6595 EClass.Sound.Play(
"pop_drama");
6596 if (book ==
"_chara" && this.IsPC)
6600 return LayerDrama.Activate(book, sheet, step,
this,
null, tag);
6604 public Point GetDestination()
6606 return (this.ai.IsRunning ?
this.ai.GetDestination() :
this.pos).Copy();
6610 public int GetHireCost()
6612 return base.LV / 2 + 4;
6616 public int GetHappiness()
6619 if (this.FindBed() !=
null)
6627 public string GetTextHappiness()
6629 return this.GetHappiness().ToString() ??
"";
6633 public string GetActionText()
6635 string result =
"?????";
6636 if (this.ai !=
null)
6638 result = this.ai.GetCurrentActionText();
6644 public override void WriteNote(UINote n, Action<UINote> onWriteNote =
null,
IInspect.NoteMode mode =
IInspect.NoteMode.Default,
Recipe recipe =
null)
6647 UIItem uiitem = n.AddHeaderCard(base.Name.ToTitleCase(
false),
null);
6648 this.SetImage(uiitem.image2);
6649 uiitem.text2.SetText(this.race.GetText(
"name",
false).ToTitleCase(
true) +
" " +
this.job.GetText(
"name",
false).ToTitleCase(
true));
6650 n.AddText(
"", FontColor.DontChange);
6655 public override void SetSortVal(UIList.SortMode m, CurrencyType currency = CurrencyType.Money)
6657 if (m <= UIList.SortMode.ByRace)
6659 if (m == UIList.SortMode.ByJob)
6661 this.sortVal = this.job._index * 10000 + this.sourceCard._index;
6664 if (m == UIList.SortMode.ByRace)
6666 this.sortVal = this.race._index * 10000 * (this.IsHuman ? -1 : 1) + this.sourceCard._index;
6672 if (m == UIList.SortMode.ByWorkk)
6676 if (m == UIList.SortMode.ByFeat)
6678 this.sortVal = -this.GetTotalFeat();
6682 this.sortVal = this.sourceCard._index * (this.IsHuman ? -1 : 1);
6686 public void ClearBed(
Map map =
null)
6692 foreach (
Card card
in map.props.installed.all.Values)
6695 if (traitBed !=
null && traitBed.IsHolder(
this))
6697 traitBed.RemoveHolder(
this);
6705 foreach (
Card card
in EClass._map.props.installed.all.Values)
6708 if (traitBed !=
null && traitBed.IsHolder(
this))
6719 if (this.memberType == FactionMemberType.Livestock || (!
this.IsPCFaction && !
this.IsGuest()))
6723 foreach (
Card card
in EClass._map.props.installed.all.Values)
6726 if (traitBed !=
null && traitBed.CanAssign(
this))
6728 traitBed.AddHolder(
this);
6729 Msg.Say(
"claimBed",
this,
null,
null,
null);
6737 public void TryPutSharedItems(IEnumerable<Thing> containers,
bool msg =
true)
6739 if (base.GetInt(113,
null) != 0)
6743 Chara._ListItems.Clear();
6744 Thing bestRangedWeapon = this.GetBestRangedWeapon();
6745 foreach (
Thing thing
in this.things)
6747 if (thing.category.slot != 0 && !thing.isEquipped)
6749 Chara._ListItems.Add(thing);
6751 else if (thing.IsRangedWeapon && thing.category.slot == 0 && bestRangedWeapon != thing)
6753 Chara._ListItems.Add(thing);
6756 if (
Chara._ListItems.Count == 0)
6760 List<Thing> containers2 = containers.ToList<
Thing>();
6763 EClass._zone.TryAddThingInSharedContainer(t, containers2,
true,
true,
this,
true);
6768 public void TryPutSharedItems(
bool msg =
true)
6770 this.TryPutSharedItems(
EClass._map.props.installed.containers,
true);
6774 public void TryTakeSharedItems(
bool msg =
true)
6776 this.TryTakeSharedItems(
EClass._map.props.installed.containers,
true,
true);
6780 public void TryTakeSharedItems(IEnumerable<Thing> containers,
bool msg =
true,
bool shouldEat =
true)
6788 bool flag = base.GetInt(113,
null) == 0;
6792 foreach (
Thing thing
in this.things)
6794 if (this.CanEat(thing, shouldEat))
6798 if (thing.trait.GetHealAction(
this) !=
null)
6802 if (thing.id ==
"polish_powder")
6807 Chara._ListItems.Clear();
6808 foreach (
Thing thing2
in containers)
6810 if (thing2.IsSharedContainer)
6812 foreach (
Thing thing3
in thing2.things)
6814 if (!thing3.c_isImportant)
6816 if (num3 > 0 && thing3.id ==
"polish_powder")
6818 Chara._ListItems.Add(thing3);
6823 Chara._ListItems.Add(thing3);
6828 Chara._ListItems.Add(thing3);
6831 else if (num > 0 && this.CanEat(thing3, shouldEat))
6833 Chara._ListItems.Add(thing3);
6836 else if (num2 > 0 && thing3.trait.GetHealAction(
this) !=
null)
6838 Chara._ListItems.Add(thing3);
6841 else if (flag && thing3.IsEquipmentOrRanged && !thing3.HasTag(CTAG.gift) &&
this.ShouldEquip(thing3,
true))
6843 Chara._ListItems.Add(thing3);
6849 if (
Chara._ListItems.Count == 0)
6853 Chara._ListItems.ForeachReverse(delegate(
Thing t)
6855 if (!t.IsEquipmentOrRanged)
6860 int slot = t.category.slot;
6861 int equipValue = t.GetEquipValue();
6864 if (thing7.category.slot == slot && thing7.GetEquipValue() > equipValue)
6872 Chara._ListItems.Remove(t);
6878 Thing thing5 = thing4;
6879 if (this.things.IsFull(thing5,
true,
true))
6886 thing5 = thing5.Split(2);
6890 base.Say(
"takeSharedItem",
this, thing5, thing6.GetName(NameStyle.Full, -1),
null);
6892 base.AddCard(thing5);
6893 if (this.ShouldEquip(thing5,
true) && thing5.category.slot != 0)
6895 this.TryEquip(thing5,
true);
6901 this.TryPutSharedItems(containers,
true);
6906 public void InstantEat(
Thing t =
null,
bool sound =
true)
6910 t = this.things.Find((
Thing a) => this.CanEat(a,
true),
true);
6914 t = this.things.Find((
Thing a) => this.CanEat(a,
false),
true);
6920 base.Say(
"eat_start",
this, t.Duplicate(1),
null,
null);
6923 base.PlaySound(
"eat", 1f,
true);
6930 public bool CanEat(
Thing t,
bool shouldEat =
false)
6932 return (!t.IsDecayed || base.HasElement(480, 1)) && (!shouldEat || t.trait is
TraitFoodPrepared) && (!t.IsNegativeGift && !t.HasTag(CTAG.ignoreUse) && !t.isEquipped) && t.trait.CanEat(
this);
6936 public bool ShouldEquip(
Thing t,
bool useFav =
false)
6938 if (t.IsRangedWeapon && t.category.slot == 0)
6940 if (!this.CanEquipRanged(t))
6945 foreach (
Thing thing
in this.things)
6947 if (thing.IsRangedWeapon)
6949 if (thing.category.slot != 0 && thing.isEquipped)
6953 if (this.CanEquipRanged(thing) && thing.GetEquipValue() > num)
6955 num = thing.GetEquipValue();
6959 return t.GetEquipValue() > num;
6963 BodySlot bodySlot = this.body.GetSlot(t,
false,
false);
6964 if (bodySlot ==
null)
6970 switch (this.GetFavAttackStyle())
6972 case AttackStyle.Default:
6973 case AttackStyle.TwoHand:
6974 if (t.IsMeleeWeapon)
6976 bodySlot = this.body.slotMainHand;
6978 else if (bodySlot.elementId == 35)
6983 case AttackStyle.TwoWield:
6984 if (bodySlot.elementId == 35 && !t.IsMeleeWeapon)
6989 case AttackStyle.Shield:
6990 if (t.IsMeleeWeapon)
6992 bodySlot = this.body.slotMainHand;
6994 else if (bodySlot.elementId == 35 && t.IsMeleeWeapon)
7001 return this.body.IsEquippable(t, bodySlot,
false) && (bodySlot.thing ==
null || (bodySlot.thing.blessedState > BlessedState.Cursed && bodySlot.thing.GetEquipValue() < t.GetEquipValue()));
7006 public bool TryEquip(
Thing t,
bool useFav =
false)
7008 if (!this.ShouldEquip(t, useFav))
7012 if (t.category.slot == 0)
7018 BodySlot slot = this.body.GetSlot(t,
false,
false);
7019 AttackStyle favAttackStyle = this.GetFavAttackStyle();
7020 if (favAttackStyle > AttackStyle.TwoHand)
7022 if (favAttackStyle == AttackStyle.Shield)
7024 if (t.IsMeleeWeapon)
7026 slot = this.body.slotMainHand;
7030 else if (t.IsMeleeWeapon)
7032 slot = this.body.slotMainHand;
7034 this.body.Equip(t, slot,
true);
7038 this.body.Equip(t,
null,
true);
7040 base.Say(
"equip",
this, t,
null,
null);
7045 public bool CanEquipRanged(
Thing t)
7047 return !this.body.IsTooHeavyToEquip(t);
7051 public Thing TryGetThrowable()
7053 Chara.<>c__DisplayClass431_0 CS$<>8__locals1 =
new Chara.<>c__DisplayClass431_0();
7054 CS$<>8__locals1.<>4__this =
this;
7055 CS$<>8__locals1.dest =
null;
7058 this.things.Foreach(delegate(
Thing t)
7060 if (t.HasTag(CTAG.throwWeapon) || (!CS$<>8__locals1.<>4__this.IsPCFactionOrMinion && t.HasTag(CTAG.throwWeaponEnemy)))
7062 CS$<>8__locals1.dest = t;
7066 return CS$<>8__locals1.dest;
7068 if (
EClass.game.config.autoCombat.bUseHotBar)
7070 return CS$<>8__locals1.<TryGetThrowable>g__FindThrowable|0(
true);
7076 public Thing GetBestRangedWeapon()
7078 Thing result =
null;
7080 foreach (
Thing thing
in this.things)
7082 if (thing.IsRangedWeapon &&
this.CanEquipRanged(thing) && thing.GetEquipValue() > num)
7084 num = thing.GetEquipValue();
7092 public bool TryEquipRanged()
7097 if (((thing !=
null) ? thing.trait :
null) is
TraitToolRange &&
this.CanEquipRanged(thing))
7099 this.ranged = thing;
7106 if (this.ranged !=
null && this.ranged.parent ==
this)
7110 this.ranged = this.GetBestRangedWeapon();
7111 return this.ranged !=
null;
7116 public override int GetArmorSkill()
7118 if (this.body.GetWeight(
true) <= 30000)
7126 public bool TryUse(
Thing t)
7130 Thing thing = this.things.Find((
Thing a) => a.IsEquipmentOrRanged && !a.isAcidproof,
true);
7133 base.Say(
"dip",
this, thing, t.GetName(NameStyle.Full, 1),
null);
7135 t.trait.OnBlend(thing,
this);
7142 if (t.IsNegativeGift || t.source.HasTag(CTAG.ignoreUse))
7146 if (t.trait.CanEat(
this) &&
this.hunger.GetPhase() > ((
this.IsPCFaction ||
this.IsPCFactionMinion) ? 2 : 0))
7148 this.SetAIImmediate(
new AI_Eat
7154 if (t.trait.CanDrink(
this))
7159 if (t.trait.CanRead(
this))
7161 this.SetAIImmediate(
new AI_Read
7172 public Room FindRoom()
7174 TraitBed traitBed = this.FindBed();
7175 if (traitBed ==
null)
7179 return traitBed.owner.pos.cell.room;
7183 public void ModAffinity(
Chara c,
int a,
bool show =
true)
7191 c.ModAffinity(
EClass.pc, a, show);
7196 a = this.affinity.Mod(a);
7203 base.Say(
"affinityNone",
this, c,
null,
null);
7206 base.ShowEmo(flag ? Emo.love : Emo.angry, 0f,
true);
7207 c.ShowEmo(flag ? Emo.love : Emo.sad, 0f,
true);
7208 base.Say(flag ?
"affinityPlus" :
"affinityMinus",
this, c,
null,
null);
7213 public bool TryIdentify(
Thing t,
int count = 1,
bool show =
true)
7215 int num = base.Evalue(289);
7221 if (
EClass.rnd(num * num + 5) >
EClass.rnd(lv * lv) * 20)
7223 t.Identify(show, (num >= 20) ? IDTSource.SkillHigh : IDTSource.Skill);
7227 num2 += (lv - num) * 10;
7229 this.elements.ModExp(289, Mathf.Min(num2, 1000),
false);
7236 public Chara CreateReplacement()
7239 chara.c_originalHostility = base.c_originalHostility;
7240 if (chara.c_originalHostility != (Hostility)0)
7242 chara.hostility = chara.c_originalHostility;
7244 if (this.orgPos !=
null)
7246 chara.orgPos = this.orgPos.Copy();
7248 chara.pos = this.pos.Copy();
7249 chara.isImported =
true;
7250 chara.c_editorTags = base.c_editorTags;
7251 chara.c_editorTraitVal = base.c_editorTraitVal;
7252 chara.c_idTrait = base.c_idTrait;
7253 chara.homeZone = this.homeZone;
7260 if (
Chara._listFavFood.Count == 0)
7264 if (row._origin ==
"dish" && row.value != 0)
7266 Chara._listFavFood.Add(row);
7271 Rand.UseSeed(base.uid +
EClass.game.seed, delegate
7273 r = Chara._listFavFood.RandomItem<SourceThing.Row>();
7282 if (
Chara._listFavCat.Count == 0)
7288 Chara._listFavCat.Add(row);
7292 Rand.UseSeed(base.uid +
EClass.game.seed, delegate
7294 r = Chara._listFavCat.RandomItem<SourceCategory.Row>();
7300 public int GetTotalFeat()
7303 if (base.c_upgrades !=
null)
7305 num += base.c_upgrades.spent;
7307 if (base.c_genes !=
null)
7309 num += base.c_genes.GetTotalCost();
7311 return num + base.feat;
7315 public bool CanInsult()
7317 using (List<
ActList.
Item>.Enumerator enumerator = this.ability.list.items.GetEnumerator())
7319 while (enumerator.MoveNext())
7321 if (enumerator.Current.act.id == 6630)
7331 public string GetIdPortraitCat()
7333 string id = this.race.id;
7334 if ((
id ==
"mifu" ||
id ==
"nefu") &&
EClass.rnd(2) == 0)
7346 public string GetIdPortrait()
7348 if (this.
id ==
"olderyoungersister")
7350 if (base.idSkin != 2)
7352 return "UN_olderyoungersister";
7354 return "UN_olderyoungersister_alt";
7358 if (
Portrait.allIds.Contains(
"UN_" +
this.id +
".png"))
7360 return "UN_" + this.id;
7362 return base.c_idPortrait;
7369 EClass.player.forceTalk =
true;
7370 base.Talk(
"giveBirth",
null,
null,
false);
7371 EClass._zone.TryAddThing(t, this.pos,
false);
7374 base.PlayEffect(
"revive",
true, 0f,
default(Vector3));
7375 base.PlaySound(
"egg", 1f,
true);
7376 base.PlayAnime(AnimeID.Shiver,
false);
7377 this.AddCondition<ConDim>(200,
false);
7383 public Thing MakeGene(
DNA.Type? type =
null)
7385 return DNA.GenerateGene(
this, type);
7389 public Thing MakeBraineCell()
7391 return DNA.GenerateGene(
this,
new DNA.Type?(
DNA.Type.Brain));
7395 public Thing MakeMilk(
bool effect =
true,
int num = 1,
bool addToZone =
true)
7398 thing.MakeRefFrom(
this,
null);
7399 int num2 = base.LV - this.source.LV;
7402 thing.SetEncLv(num2 / 10);
7408 return this.GiveBirth(thing, effect);
7412 public Thing MakeEgg(
bool effect =
true,
int num = 1,
bool addToZone =
true)
7414 Thing thing =
ThingGen.Create((
EClass.rnd(
EClass.debug.enable ? 1 : 20) == 0) ?
"egg_fertilized" :
"_egg", -1, -1).SetNum(num);
7415 thing.MakeFoodFrom(
this);
7416 thing.c_idMainElement = base.c_idMainElement;
7421 return this.GiveBirth(thing, effect);
7425 public void OnInsulted()
7431 if (base.HasElement(1231, 1))
7433 base.Talk(
"insulted",
null,
null,
false);
7434 this.AddCondition<ConEuphoric>(100,
false);
7439 this.SetFeat(1231, 1,
true);
7444 public bool IsValidGiftWeight(
Card t,
int num = -1)
7446 int num2 = base.HasElement(1411, 1) ? 3 : 1;
7447 return this.GetBurden(t, num) < num2;
7451 public bool CanAcceptItem(
Card t,
int num = -1)
7453 return this.IsValidGiftWeight(t, num) && !t.c_isImportant && ((!t.category.IsChildOf(
"furniture") && !t.category.IsChildOf(
"junk")) || base.HasElement(1411, 1));
7457 public bool CanAcceptGift(
Chara c,
Card t)
7459 return !this.things.IsFull(0) && !t.c_isImportant && (t.id ==
"1084" || t.trait is
TraitBookSecret || (!t.trait.CanOnlyCarry && !t.trait.CanExtendBuild && t.rarity != Rarity.Artifact && !t.IsContainer));
7465 if (c.IsHostile() || c.IsDeadOrSleeping)
7467 Msg.Say(
"affinityNone", c,
this,
null,
null);
7470 if (t.IsCursed && t.IsEquipmentOrRanged && c.HasElement(1414, 1))
7472 bool flag = t.blessedState == BlessedState.Doomed;
7473 int num = 200 + t.LV * 3;
7474 if (t.rarity == Rarity.Legendary)
7478 if (t.rarity >= Rarity.Mythical)
7486 EClass.pc.PlayEffect(
"identify",
true, 0f,
default(Vector3));
7487 EClass.pc.PlaySound(
"identify", 1f,
true);
7488 c.PlayEffect(
"mutation",
true, 0f,
default(Vector3));
7489 c.Say(
"draw_curse", c, t,
null,
null);
7491 List<Element> list =
new List<Element>();
7494 if (element is
Spell)
7499 if (list.Count == 0)
7501 EClass.pc.SayNothingHappans();
7505 EClass.pc.ModExp(element2.id, num);
7506 EClass.pc.Say(
"draw_curse2",
EClass.pc, element2.Name,
null);
7511 if ((t.id ==
"lovepotion" || t.id ==
"dreambug") && !Application.isEditor)
7513 this.GiveLovePotion(c, t);
7516 if (t.trait is
TraitErohon && c.id == t.c_idRefName)
7523 if (t.id ==
"flyer")
7525 this.stamina.Mod(-1);
7526 if (c.things.Find((
Thing a) => a.id ==
"flyer",
true) !=
null)
7528 c.Talk(
"flyer_miss",
null,
null,
false);
7529 this.DoHostileAction(c,
false);
7532 if (
EClass.rnd(20) != 0 && c.CHA >
EClass.rnd(base.CHA + base.Evalue(291) * 3 + 10))
7534 Msg.Say(
"affinityNone", c,
this,
null,
null);
7536 this.elements.ModExp(291, 10,
false);
7539 this.elements.ModExp(291, 30,
false);
7541 if (t.id ==
"statue_weird")
7543 EClass.pc.Say(
"statue_sell",
null,
null);
7546 c.nextUse = c.affinity.OnGift(t);
7549 EClass.game.quests.list.ForeachReverse(delegate(
Quest q)
7553 if (c.TryEquip(t,
false))
7561 c.Talk(
"ticket",
null,
null,
false);
7563 if (
id ==
"ticket_massage")
7565 c.ModAffinity(
EClass.pc, 10,
true);
7572 if (
id ==
"ticket_armpillow")
7574 c.ModAffinity(
EClass.pc, 20,
true);
7582 if (!(
id ==
"ticket_champagne"))
7586 c.ModAffinity(
EClass.pc, 10,
true);
7593 public void OnGiveErohon(
Thing t)
7595 base.Say(
"give_erohon",
this,
null,
null);
7596 this.AddCondition<ConParalyze>(50,
true);
7597 this.AddCondition<ConConfuse>(50,
true);
7598 this.AddCondition<ConFear>(1000,
true);
7599 this.ModAffinity(
EClass.pc, 100,
true);
7601 base.Talk(
"pervert",
null,
null,
false);
7607 c.Say(
"give_love", c, t,
null,
null);
7608 c.PlaySound(t.material.GetSoundDead(
null), 1f,
true);
7609 c.ShowEmo(Emo.angry, 0f,
true);
7610 c.ModAffinity(
EClass.pc, -20,
false);
7611 c.Talk(
"pervert",
null,
null,
false);
7616 public void RequestProtection(
Chara attacker, Action<Chara> action)
7618 if (this.HasCondition<StanceTaunt>() || base.isRestrained || attacker ==
this)
7622 if (this.host !=
null && this.host.isRestrained)
7626 if (this.IsPCFaction && attacker.IsPCFaction)
7633 if (chara != attacker && chara.enemy !=
this && chara !=
this && chara.host ==
null && !chara.IsDisabled && chara.IsFriendOrAbove(
this) && chara.conSuspend ==
null && (!chara.IsPCParty ||
this.IsPCParty) && (!
this.IsPCFaction || chara.IsPCFaction))
7635 bool flag2 = chara.HasElement(1225, 1);
7636 if ((flag2 || (!flag &&
EClass.rnd(2) != 0 && chara.HasCondition<
StanceTaunt>())) && !chara.HasCooldown(1225))
7638 int num = Mathf.Max(chara.Evalue(1649), chara.IsPC ? 0 : (flag2 ? 3 : 1));
7639 int num2 = base.Dist(chara);
7642 if (num2 > num || !chara.CanSeeLos(
this.pos, num2))
7648 if (base.Dist(chara) < 5)
7650 chara.GoHostile(attacker);
7651 chara.SetEnemy(attacker);
7652 attacker.SetEnemy(chara);
7655 Point nearestPoint = this.pos.GetNearestPoint(
false,
false,
true,
true);
7656 if (!nearestPoint.IsValid)
7660 chara.Teleport(nearestPoint,
false,
false);
7661 chara.AddCooldown(1225, 10);
7662 num2 = base.Dist(chara);
7663 base.Say(
"intercept_loyal", chara,
this,
null,
null);
7664 chara.SetEnemy(attacker);
7665 attacker.SetEnemy(chara);
7666 if (num2 > num || !chara.CanSeeLos(
this.pos, num2))
7671 if (!flag && !base.HasElement(1225, 1))
7673 base.Say(
"intercept", chara,
this,
null,
null);
7676 chara.Talk(
"intercept", base.NameSimple,
null,
false);
7678 if (attacker.enemy ==
this)
7680 attacker.SetEnemy(chara);
7692 public void ClearInventory(ClearInventoryType type)
7696 for (
int i = this.things.Count - 1; i >= 0; i--)
7698 Thing thing = this.things[i];
7699 if ((!this.IsPCFaction || ((!thing.IsFood || !(thing.category.id !=
"fish") || thing.IsDecayed) && !thing.HasTag(CTAG.throwWeapon) && thing.trait.GetHealAction(
this) ==
null && !thing.IsThrownWeapon && !thing.IsRangedWeapon)) && !thing.isEquipped && thing.rarity < Rarity.Legendary && (!flag || !(thing.trait is
TraitToolMusic)) && !(thing.trait is
TraitCurrency))
7701 if (type == ClearInventoryType.Party)
7703 if (!thing.isGifted && !thing.isNPCProperty)
7708 else if ((this.IsPCFaction && this.things.Count <
this.things.GridSize * 3 / 2) || (!(thing.id ==
"flyer") && ((!thing.IsDecayed &&
EClass.rnd(3) == 0) || (thing.IsRangedWeapon && !
this.things.IsFull(0)))))
7712 num += thing.GetPrice(CurrencyType.Money,
true, PriceType.Default,
this) * thing.Num;
7719 base.ModCurrency(num,
"money");
7720 if (type == ClearInventoryType.Party)
7722 Msg.Say(
"party_sell",
this, num.ToString() ??
"",
null,
null);
7723 base.PlaySound(
"pay", 1f,
true);
7729 public void ResetUpgrade()
7735 public void TryUpgrade(
bool msg =
true)
7737 if (!
EClass.debug.enable)
7741 if (this.IsPC || !this.IsGlobal || !this.IsPCFaction)
7745 for (
int i = 0; i < 100; i++)
7751 if (base.c_upgrades ==
null)
7755 if (base.c_upgrades.halt)
7759 Rand.SetSeed(base.uid + base.c_upgrades.count);
7760 int num =
EClass.rnd(100);
7766 where !this.elements.Has(a) && a.category ==
"skill" && !a.tag.Contains(
"noPet")
7768 List<Element> list = this.ListAvailabeFeats(
true);
7769 if (num >= 90 && list.Count > 0)
7773 num4 = element.CostLearn;
7782 num2 =
Element.List_MainAttributesMajor.RandomItem<
int>();
7788 if (num4 > base.feat)
7793 base.c_upgrades.count++;
7794 base.c_upgrades.spent += num4;
7800 if (item.idEle == num2)
7819 if (row.category ==
"feat")
7821 this.SetFeat(num2, this.elements.ValueWithoutLink(num2) + 1,
true);
7823 else if (this.elements.ValueWithoutLink(row.id) == 0)
7825 this.elements.Learn(row.id, 1);
7829 this.elements.ModBase(num2, num3);
7835 public void AddCooldown(
int idEle,
int turns = 0)
7837 if (this._cooldowns ==
null)
7839 this._cooldowns =
new List<int>();
7843 this._cooldowns.Add(idEle * 1000 + turns);
7847 if (row.cooldown > 0)
7849 this._cooldowns.Add(idEle * 1000 + row.cooldown);
7854 public bool HasCooldown(
int idEle)
7856 if (this._cooldowns !=
null)
7858 for (
int i = 0; i < this._cooldowns.Count; i++)
7860 if (this._cooldowns[i] / 1000 == idEle)
7870 public void TickCooldown()
7872 for (
int i = this._cooldowns.Count - 1; i >= 0; i--)
7874 if (this._cooldowns[i] % 1000 == 1)
7876 this._cooldowns.RemoveAt(i);
7880 List<int> cooldowns = this._cooldowns;
7882 int num = cooldowns[index];
7883 cooldowns[index] = num - 1;
7886 if (this._cooldowns.Count == 0)
7888 this._cooldowns =
null;
7893 public void ChooseNewGoal()
7895 if (this.IsPC &&
EClass.AdvMode)
7900 if (this.IsPCParty || base.noMove)
7905 if ((this.IsHomeMember() && this.IsInHomeZone()) || this.IsGuest())
7907 Goal goalFromTimeTable = this.GetGoalFromTimeTable(
EClass.world.date.hour);
7908 if (goalFromTimeTable !=
null)
7910 this.SetAI(goalFromTimeTable);
7913 goalFromTimeTable.Tick();
7918 if (this.goalList.index == -2)
7920 this.goalList.Refresh(
this, this.goalListType);
7922 this.SetAI(this.goalList.Next());
7926 public Goal GetGoalFromTimeTable(
int hour)
7932 switch (
TimeTable.GetSpan(
this.idTimeTable, hour))
7939 return this.GetGoalHobby();
7947 return this.GetGoalWork();
7949 if (this.sleepiness.value > 10 ||
EClass._zone.isSimulating)
7959 public Goal GetGoalWork()
7961 if (this.IsPrisoner)
7965 if (this.memberType == FactionMemberType.Livestock)
7973 public Goal GetGoalHobby()
7975 if (this.IsPrisoner)
7979 if (this.memberType == FactionMemberType.Livestock)
7987 public void SetAIIdle()
7992 public void SetAIAggro()
7998 public AIAct SetNoGoal()
8000 return this.SetAI(
Chara._NoGoalPC);
8008 EClass.player.queues.OnSetGoal(g);
8010 if (this.ai.IsRunning)
8012 if (this.ai == g && this.ai.IsNoGoal)
8019 string str =
"goal is g:";
8020 AIAct aiact = this.ai;
8021 Debug.Log(str + ((aiact !=
null) ? aiact.ToString() :
null) +
"/" + ((
this !=
null) ?
this.ToString() :
null));
8025 if (this.HasCondition<ConWait>())
8027 this.RemoveCondition<ConWait>();
8030 this.ai.SetOwner(
this);
8035 public void SetAIImmediate(
AIAct g)
8037 bool hasNoGoal = this.HasNoGoal;
8043 if (hasNoGoal && !(this.renderer as
CharaRenderer).IsMoving)
8050 public List<Hobby> ListWorks(
bool useMemberType =
true)
8052 Chara.listHobby.Clear();
8053 if (useMemberType && this.memberType == FactionMemberType.Livestock)
8062 if (this._works ==
null)
8064 this.RerollHobby(
true);
8066 foreach (
int id in this._works)
8074 return Chara.listHobby;
8078 public List<Hobby> ListHobbies(
bool useMemberType =
true)
8080 Chara.listHobby.Clear();
8081 if (!useMemberType || this.memberType != FactionMemberType.Livestock)
8083 if (this._hobbies ==
null)
8085 this.RerollHobby(
true);
8087 foreach (
int id in this._hobbies)
8095 return Chara.listHobby;
8099 public Hobby GetWork(
string id)
8101 foreach (
Hobby hobby
in this.ListWorks(
true))
8103 if (hobby.source.alias ==
id)
8108 foreach (
Hobby hobby2
in this.ListHobbies(
true))
8110 if (hobby2.source.alias ==
id)
8121 if (this.workElements !=
null)
8123 this.workElements.SetParent(
null);
8125 this.workElements =
null;
8126 if (this.IsPCParty || this.homeBranch ==
null || this.homeBranch.owner ==
null)
8130 foreach (
Hobby h
in this.ListHobbies(
true))
8132 this.<RefreshWorkElements>g__TryAdd|483_0(h);
8134 foreach (
Hobby h2
in this.ListWorks(
true))
8136 this.<RefreshWorkElements>g__TryAdd|483_0(h2);
8138 if (this.workElements !=
null)
8140 this.workElements.SetParent(parent);
8145 public string GetTextHobby(
bool simple =
false)
8147 string text = simple ?
"" : (
"hobby".lang() +
":");
8148 foreach (
Hobby hobby
in this.ListHobbies(
true))
8150 text = text +
" " + hobby.Name.TagColor((hobby.GetEfficiency(
this) > 0) ? FontColor.Good : FontColor.Warning,
null) +
",";
8152 return text.TrimEnd(
',');
8156 public string GetTextWork(
bool simple =
false)
8158 string text = simple ?
"" : (
"work".lang() +
":");
8159 foreach (
Hobby hobby
in this.ListWorks(
true))
8161 text = text +
" " + hobby.Name.TagColor((hobby.GetEfficiency(
this) > 0) ? FontColor.Good : FontColor.Warning,
null) +
",";
8163 return text.TrimEnd(
',');
8167 public void AddHobby(
int id)
8169 using (List<int>.Enumerator enumerator = this._hobbies.GetEnumerator())
8171 while (enumerator.MoveNext())
8173 if (enumerator.Current ==
id)
8179 this._hobbies.Add(
id);
8183 public void AddWork(
int id)
8185 using (List<int>.Enumerator enumerator = this._works.GetEnumerator())
8187 while (enumerator.MoveNext())
8189 if (enumerator.Current ==
id)
8195 this._works.Add(
id);
8199 public void RerollHobby(
bool extraSlotChance =
true)
8201 if (this._hobbies !=
null && this._works !=
null)
8203 this._hobbies.Clear();
8204 this._works.Clear();
8208 this._hobbies =
new List<int>();
8209 this._works =
new List<int>();
8211 if (this.source.hobbies.IsEmpty())
8217 foreach (
string key
in this.source.hobbies)
8219 this.AddHobby(
EClass.sources.hobbies.alias[key].id);
8222 if (this.source.works.IsEmpty())
8228 foreach (
string key2
in this.source.works)
8230 this.AddWork(
EClass.sources.hobbies.alias[key2].id);
8233 this.GetWorkSummary().Reset();
8239 if (this._workSummary ==
null)
8243 return this._workSummary;
8249 TimeTable.Span span =
TimeTable.GetSpan(this.idTimeTable, date.hour);
8257 if (workSummary.work !=
null)
8259 this.PerformWork(workSummary.work,
false, date.IsRealTime);
8263 else if (workSummary.hobbies.Count > 0)
8265 this.PerformWork(workSummary.hobbies.RandomItem<
WorkSession>(),
true, date.IsRealTime);
8272 if (
EClass.world.date.IsExpired(base.GetInt(51,
null)))
8275 base.SetInt(51,
EClass.world.date.GetRaw(0) + 60 * (expedition.hours + 24));
8276 this.homeBranch.expeditions.Add(expedition);
8283 public void PerformWork(
WorkSession session,
bool isHobby =
false,
bool IsRealTime =
false)
8285 Chara.<>c__DisplayClass494_0 CS$<>8__locals1;
8286 CS$<>8__locals1.session = session;
8288 hobby.id = CS$<>8__locals1.session.id;
8290 hobby.GetAI(
this).OnPerformWork(IsRealTime);
8293 workSummary.progress +=
EClass.rnd(5) + 5;
8295 int num =
Chara.<PerformWork>g__PerformWork|494_0(hobby, 0, isHobby, ref CS$<>8__locals1);
8296 int num2 =
Chara.<PerformWork>g__PerformWork|494_0(hobby, 1, isHobby, ref CS$<>8__locals1);
8297 int num3 =
Chara.<PerformWork>g__PerformWork|494_0(hobby, 2, isHobby, ref CS$<>8__locals1);
8298 int num4 =
Chara.<PerformWork>g__PerformWork|494_0(hobby, 3, isHobby, ref CS$<>8__locals1);
8299 workSummary.money += num;
8300 workSummary.food += num2;
8301 workSummary.knowledge += num3;
8302 workSummary.material += num4;
8306 public void ValidateWorks()
8308 Chara._goalWork.FindWork(
this,
false);
8309 Chara._goalHobby.ValidateHobby(
this);
8318 return Stats.Hunger.Set(this._cints, 10,
this);
8328 return Stats.Burden.Set(this._cints, 11,
this);
8334 public Stats stamina
8338 return Stats.Stamina.Set(this._cints, 12,
this);
8344 public Stats depression
8348 return Stats.Depression.Set(this._cints, 13,
this);
8354 public Stats bladder
8358 return Stats.Bladder.Set(this._cints, 14,
this);
8364 public Stats hygiene
8368 return Stats.Hygiene.Set(this._cints, 15,
this);
8378 return Stats.Mana.Set(this._cints, 16,
this);
8384 public Stats sleepiness
8388 return Stats.Sleepiness.Set(this._cints, 17,
this);
8398 return Stats.SAN.Set(this._cints, 17,
this);
8403 public void InitStats(
bool onDeserialize =
false)
8407 this._cints[10] = 20;
8408 this._cints[11] = 70;
8409 this._cints[13] = 70;
8410 this._cints[14] = 70;
8411 this._cints[15] = 70;
8412 this._cints[17] = 0;
8414 foreach (
Condition condition
in this.conditions)
8416 condition.SetOwner(
this, onDeserialize);
8421 public Condition AddCondition<T>(
int p = 100,
bool force =
false) where T :
Condition
8423 return this.AddCondition(typeof(T).Name, p, force);
8427 public Condition AddCondition(
string id,
int p = 100,
bool force =
false)
8429 return this.AddCondition(
Condition.Create(
id, p,
null), force);
8440 if (base.ResistLv(964) >= 3)
8446 else if (base.ResistLv(950) >= 3)
8450 if (c.GainResistFactor > 0 &&
this.CanGainConResist)
8452 if (c.GainResistFactor >= 400)
8464 if (c.source.negate.Length != 0)
8466 foreach (
string id in c.source.negate)
8468 if (base.HasElement(
id, 1))
8474 Element defenseAttribute = c.GetDefenseAttribute(
this);
8475 if (defenseAttribute !=
null)
8477 c.power = 100 * c.power / (100 + defenseAttribute.Value);
8479 if (c.source.resistance.Length != 0)
8481 int num = base.ResistLv(
EClass.sources.elements.alias[c.source.resistance[0]].id);
8484 c.power /= num * num + 1;
8491 c.power = c.EvaluatePower(c.power);
8497 for (
int j = 0; j < this.conditions.Count; j++)
8499 if (this.conditions[j].
id == c.id)
8501 if (c.Type == ConditionType.Stance || c.IsToggle)
8503 this.conditions[j].Kill(
false);
8506 if (this.conditions[j].CanStack(c))
8508 if (this.conditions[j].WillOverride)
8510 this.conditions[j].Kill(
true);
8513 if (this.CanGainConResist)
8515 this.AddResistCon(c);
8517 this.conditions[j].OnStacked(c.power);
8518 this.conditions[j].OnStartOrStack();
8519 this.conditions[j].PlayEffect();
8521 if (!this.conditions[j].AllowMultipleInstance)
8528 using (List<Condition>.Enumerator enumerator = this.conditions.GetEnumerator())
8530 while (enumerator.MoveNext())
8532 if (enumerator.Current.TryNullify(c))
8538 int num2 = c.EvaluateTurn(c.power);
8544 this.conditions.Add(c);
8545 if (this.CanGainConResist)
8547 this.AddResistCon(c);
8549 c.SetOwner(
this,
false);
8551 this.SetDirtySpeed();
8552 if (c.ShouldRefresh)
8554 this.Refresh(
false);
8556 if (this.IsPC && c.ConsumeTurn && !
EClass.pc.isRestrained)
8558 EClass.player.EndTurn(
true);
8560 if (c.SyncRide && (
this.ride !=
null ||
this.parasite !=
null))
8562 if (this.ride !=
null)
8564 this.ride.AddCondition(
Condition.Create(c.source.alias, c.power,
null),
false);
8566 if (this.parasite !=
null)
8568 this.parasite.AddCondition(
Condition.Create(c.source.alias, c.power,
null),
false);
8575 public override bool HasCondition<T>()
8577 for (
int i = 0; i < this.conditions.Count; i++)
8579 if (this.conditions[i] is T)
8588 public bool HasCondition(
string alias)
8590 for (
int i = 0; i < this.conditions.Count; i++)
8592 if (this.conditions[i].source.alias == alias)
8601 public Element GetBuffStats(
string alias)
8603 return this.GetBuffStats(
EClass.sources.elements.alias[alias].id);
8607 public Element GetBuffStats(
int ele)
8609 for (
int i = 0; i < this.conditions.Count; i++)
8612 if (conBuffStats !=
null && conBuffStats.refVal == ele)
8614 return conBuffStats.elements.GetElement(ele);
8621 public void CureCondition<T>(
int v = 99999) where T :
Condition
8623 T condition = this.GetCondition<T>();
8624 if (condition ==
null)
8628 ref T ptr = ref condition;
8630 if (condition.value <= 0)
8632 condition.Kill(
false);
8637 public T GetCondition<T>() where T :
Condition
8639 for (
int i = 0; i < this.conditions.Count; i++)
8641 if (this.conditions[i] is T)
8643 return this.conditions[i] as T;
8650 public void RemoveCondition<T>() where T :
Condition
8652 for (
int i = this.conditions.Count - 1; i >= 0; i--)
8654 if (this.conditions[i] is T)
8656 this.conditions[i].Kill(
false);
8663 public void CureHost(CureType type,
int p = 100, BlessedState state = BlessedState.Normal)
8665 if (this.parasite !=
null)
8667 this.parasite.Cure(type, p, state);
8669 if (this.ride !=
null)
8671 this.ride.Cure(type, p, state);
8673 this.Cure(type, p, state);
8677 public void Cure(CureType type,
int p = 100, BlessedState state = BlessedState.Normal)
8679 bool flag = state == BlessedState.Blessed;
8683 case CureType.Prayer:
8684 this.CureCondition<ConFear>(99999);
8685 this.CureCondition<ConBlind>(2 * p / 100 + 5);
8686 this.CureCondition<ConPoison>(5 * p / 100 + 5);
8687 this.CureCondition<ConConfuse>(10 * p / 100 + 10);
8688 this.CureCondition<ConDim>(p / 100 + 5);
8689 this.CureCondition<ConBleed>(2 * p / 100 + 10);
8696 case CureType.HealComplete:
8697 case CureType.Death:
8700 this.CureTempElements(p * 100,
true,
true);
8701 for (
int i = this.conditions.Count - 1; i >= 0; i--)
8703 Condition condition = this.conditions[i];
8704 if (condition.Type == ConditionType.Bad || condition.Type == ConditionType.Debuff || condition.Type == ConditionType.Disease)
8706 condition.Kill(
false);
8708 else if (type == CureType.Death && condition.isPerfume)
8710 condition.Kill(
false);
8713 this.CureCondition<ConWait>(99999);
8714 this.CureCondition<ConSleep>(99999);
8715 if (type == CureType.Death)
8717 this.hunger.value = 30;
8719 if (type == CureType.Jure)
8722 if (base.HasElement(1206, 1))
8724 this.SetFeat(1206, 0,
true);
8728 case CureType.Sleep:
8730 for (
int j = this.conditions.Count - 1; j >= 0; j--)
8732 Condition condition2 = this.conditions[j];
8735 if (condition2.isPerfume)
8737 condition2.Mod(-1,
true);
8739 else if (condition2.Type == ConditionType.Bad || condition2.Type == ConditionType.Debuff)
8741 condition2.Kill(
false);
8745 this.CureCondition<ConWait>(99999);
8746 this.CureCondition<ConDisease>((
EClass.rnd(20) + 10) * p / 100);
8747 bool flag2 = this.HasCondition<ConAnorexia>();
8748 base.c_vomit -= (flag2 ? 3 : 2) * p / 100;
8749 if (base.c_vomit < 0)
8754 this.RemoveCondition<ConAnorexia>();
8760 case CureType.CureBody:
8761 this.CureCondition<ConBlind>(5 * p / 100 + 15);
8762 this.CureCondition<ConPoison>(10 * p / 100 + 15);
8763 this.CureCondition<ConBleed>(5 * p / 100 + 20);
8764 this.CureTempElements(p,
true,
false);
8766 case CureType.CureMind:
8767 this.CureCondition<ConFear>(99999);
8768 this.CureCondition<ConDim>(3 * p / 100 + 10);
8769 this.CureTempElements(p,
false,
true);
8777 public bool TryNeckHunt(
Chara TC,
int power,
bool harvest =
false)
8783 if (
TC.hp >
TC.MaxHP * Mathf.Min(5 + (
int)Mathf.Sqrt((
float)power), harvest ? 35 : 25) / 100)
8787 if (
TC.HasElement(427, 1))
8791 base.PlaySound(
"hit_finish", 1f,
true);
8792 base.Say(
"finish",
null,
null);
8793 base.Say(
"finish2",
this,
TC,
null,
null);
8794 TC.DamageHP(
TC.MaxHP, AttackSource.Finish,
this);
8800 public bool CanGainConResist
8804 return base.rarity >= Rarity.Legendary && !this.IsPCFaction;
8811 if (con.power <= 0 || con.GainResistFactor <= 0)
8816 if (this.resistCon ==
null)
8818 this.resistCon =
new Dictionary<int, int>();
8820 if (this.resistCon.ContainsKey(
id))
8822 Dictionary<int, int> dictionary = this.resistCon;
8824 dictionary[key] += con.power * con.GainResistFactor / 100;
8827 this.resistCon[id] = con.power * con.GainResistFactor / 100;
8833 if (con.power <= 0 ||
this.resistCon ==
null)
8837 int a = this.resistCon.TryGetValue(con.id, 0);
8838 if (1000 <
EClass.rnd(a))
8861 con.pcPillow = pillow;
8862 con.pickup = pickup;
8863 con.posBed = posBed;
8864 con.posPillow = posPillow;
8869 public void OnSleep(
Thing bed =
null,
int days = 1)
8872 int num = (bed ==
null) ? 20 : bed.Power;
8873 if (traitPillow !=
null)
8875 num += traitPillow.owner.Power / 2;
8877 num += base.Evalue(750) * 5;
8878 this.OnSleep(num, days);
8882 public void OnSleep(
int power,
int days = 1)
8888 int num = power * days;
8889 if (this.stamina.value < 0)
8891 this.stamina.Set(1);
8893 this.HealHP(num, HealSource.None);
8894 this.stamina.Mod(10 + 25 * num / 100 * (100 + this.elements.GetFeatRef(1642, 0)) / 100);
8896 if (this.IsPCFaction)
8898 this.hunger.Mod(20);
8900 this.sleepiness.Set(0);
8901 this.interest = 100;
8902 this.Cure(CureType.Sleep, power, BlessedState.Normal);
8906 public void ModHeight(
int a)
8908 int num = this.bio.height;
8909 num = num * (100 + a) / 100 + ((a > 0) ? 1 : -1);
8914 if (num == this.bio.height)
8918 this.bio.height = num;
8919 base.Say((a > 0) ?
"height_gain" :
"height_lose",
this,
null,
null);
8923 public void ModWeight(
int a,
bool ignoreLimit =
false)
8929 int num = this.bio.weight;
8930 int height = this.bio.height;
8931 int num2 = height * height * 18 / 25000;
8932 int num3 = height * height * 24 / 10000;
8933 if (!ignoreLimit && (num <= num2 || num >= num3))
8937 num = num * (100 + a) / 100 + ((a > 0) ? 1 : -1);
8942 if (num == this.bio.weight)
8946 this.bio.weight = num;
8947 base.Say((a > 0) ?
"weight_gain" :
"weight_lose",
this,
null,
null);
8951 public void ModCorruption(
int a)
8953 if (a > 0 && base.ResistLv(962) > 0 &&
EClass.rnd(base.ResistLv(962) + 1) != 0)
8957 int num = (this.corruption + a) / 100 - this.corruption / 100;
8959 while (num2 < Mathf.Abs(num) &&
this.MutateRandom((num > 0) ? 1 : -1, 100,
true, BlessedState.Normal))
8963 this.corruption += a;
8965 foreach (
Element element
in this.elements.dict.Values)
8967 if (element.source.category ==
"ether")
8969 num3 += element.Value;
8972 if (num3 > 0 && this.IsPC)
8976 this.corruption = num3 * 100 + this.corruption % 100;
8980 public List<Element> ListAvailabeFeats(
bool pet =
false)
8982 List<Element> list =
new List<Element>();
8984 where a.@group ==
"FEAT" && a.cost[0] != -1 && !a.categorySub.IsEmpty()
8987 Feat feat = this.elements.GetOrCreateElement(row.id) as
Feat;
8988 int num = (feat.ValueWithoutLink > 0) ? (feat.ValueWithoutLink + 1) : 1;
8989 if (num <= feat.source.max && !feat.HasTag(
"class") && !feat.HasTag(
"hidden") && !feat.HasTag(
"innate") && (!pet || !feat.HasTag(
"noPet")) && feat.IsAvailable(
this.elements, feat.Value))
8998 public void SetFeat(
int id,
int value = 1,
bool msg =
false)
9000 Feat feat = this.elements.GetElement(
id) as
Feat;
9002 if (feat !=
null && feat.Value > 0)
9004 if (value == feat.Value)
9009 feat.Apply(-feat.Value,
this.elements,
false);
9013 feat = (this.elements.SetBase(
id, value - ((feat !=
null) ? feat.vSource : 0), 0) as
Feat);
9014 feat.Apply(feat.Value,
this.elements,
false);
9018 this.elements.Remove(
id);
9020 if (
EClass.core.IsGameStarted)
9022 this.Refresh(
false);
9023 this.CalculateMaxStamina();
9027 if (feat.source.textInc.IsEmpty())
9029 base.PlaySound(
"ding_skill", 1f,
true);
9030 Msg.SetColor(
Msg.colors.Ding);
9031 base.Say(
"gainFeat",
this, feat.FullName,
null);
9035 bool flag = value < num;
9036 if (feat.source.tag.Contains(
"neg"))
9040 base.PlaySound(
"mutation", 1f,
true);
9041 Msg.SetColor(flag ?
Msg.colors.Negative :
Msg.colors.Ding);
9042 base.Say((value > num) ? feat.source.GetText(
"textInc",
false) : feat.source.GetText(
"textDec",
false),
this, feat.FullName,
null);
9044 this.elements.CheckSkillActions();
9049 public bool MutateRandom(
int vec = 0,
int tries = 100,
bool ether =
false, BlessedState state = BlessedState.Normal)
9051 if (!ether && vec >= 0 && base.HasElement(406, 1) &&
EClass.rnd(5) != 0)
9053 base.Say(
"resistMutation",
this,
null,
null);
9057 where a.category == (ether ?
"ether" :
"mutation")
9059 for (
int i = 0; i < tries; i++)
9062 Element element = this.elements.GetElement(row.id);
9064 if ((vec >= 0 || (element !=
null && element.Value > 0)) && (vec <= 0 || element ==
null || element.Value < row.max))
9066 if (element ==
null && !row.aliasParent.IsEmpty() &&
this.elements.Has(row.aliasParent))
9068 row =
EClass.sources.elements.alias[row.aliasParent];
9069 element = this.elements.GetElement(row.id);
9071 bool flag = row.tag.Contains(
"neg");
9074 if (state >= BlessedState.Blessed && flag)
9078 if (state <= BlessedState.Cursed && !flag)
9083 else if (vec < 0 && ((state >= BlessedState.Blessed && !flag) || (state <= BlessedState.Cursed && flag)))
9088 if (element !=
null)
9090 num = element.Value + ((vec != 0) ? vec : ((
EClass.rnd(2) == 0) ? 1 : -1));
9091 if (num > element.source.max)
9093 num = element.source.max - 1;
9095 flag = ((flag && num > element.Value) || (!flag && num < element.Value));
9096 flag2 = (num > element.Value);
9097 if (vec > 0 && !flag2)
9102 base.Say(flag2 ?
"mutation_gain" :
"mutation_loose",
this,
null,
null);
9103 this.SetFeat(row.id, num,
false);
9104 if ((flag2 & ether) && this.IsPC && !
EClass.player.flags.gotEtherDisease)
9106 EClass.player.flags.gotEtherDisease =
true;
9108 thing.SetStr(53,
"letter_ether");
9110 thing2.SetBlessedState(BlessedState.Normal);
9116 EClass.world.SendPackage(p);
9118 if (
EClass.core.IsGameStarted &&
this.pos !=
null)
9120 base.PlaySound(
"mutation", 1f,
true);
9121 base.PlayEffect(
"mutation",
true, 0f,
default(Vector3));
9122 Msg.SetColor(flag ?
Msg.colors.MutateBad :
Msg.colors.MutateGood);
9123 base.Say(row.GetText(flag ?
"textDec" :
"textInc",
true) ?? row.alias,
this,
null,
null);
9129 base.Say(
"nothingHappens",
null,
null);
9134 public void GainAbility(
int ele,
int mtp = 100)
9136 Element orCreateElement = this.elements.GetOrCreateElement(ele);
9137 if (orCreateElement.ValueWithoutLink == 0)
9139 this.elements.ModBase(orCreateElement.id, 1);
9141 if (orCreateElement is
Spell)
9143 int num = mtp * orCreateElement.source.charge * (100 + base.Evalue(307) + (base.HasElement(307, 1) ? 20 : 0)) / 100 / 100;
9144 if (orCreateElement.source.charge == 1)
9148 orCreateElement.vPotential += Mathf.Max(1, num / 2 +
EClass.rnd(num / 2 + 1));
9150 base.Say(
"spell_gain",
this, orCreateElement.Name,
null);
9155 public bool TryNullifyCurse()
9159 using (List<Chara>.Enumerator enumerator =
EClass.pc.party.members.GetEnumerator())
9161 while (enumerator.MoveNext())
9163 Chara chara = enumerator.Current;
9164 if (chara.HasElement(1641, 1) &&
EClass.rnd(3) != 0)
9166 Msg.Say(
"curse_nullify", chara,
null,
null,
null);
9173 if (base.HasElement(1641, 1) &&
EClass.rnd(3) != 0)
9175 base.Say(
"curse_nullify",
this,
null,
null);
9179 if (this.GetCondition<ConHolyVeil>() !=
null &&
EClass.rnd(5) != 0)
9181 base.Say(
"curse_nullify",
this,
null,
null);
9188 public int GetPietyValue()
9192 return 10 + (int)(Mathf.Sqrt((
float)base.c_daysWithGod) * 2f + (
float)base.Evalue(85)) / 2;
9194 return 10 + (int)(Mathf.Sqrt((
float)base.LV) * 5f + (
float)base.Evalue(306)) / 2;
9198 public void RefreshFaithElement()
9200 if (this.faithElements !=
null)
9202 this.faithElements.SetParent(
null);
9205 if (this.idFaith ==
"eyth" && !base.HasElement(1228, 1))
9218 this.faithElements.SetBase(row2.id, 1, 0);
9220 if (!this.HasCondition<ConExcommunication>())
9222 int[] elements = row.elements;
9223 int num = this.GetPietyValue() * (120 + base.Evalue(1407) * 15) / 100;
9224 for (
int i = 0; i < elements.Length; i += 2)
9226 int num2 = elements[i + 1] * num / 50;
9227 if (elements[i] == 79)
9229 num2 =
EClass.curve(num2, 100, 20, 60);
9231 if (num2 >= 20 && elements[i] >= 950 && elements[i] < 970)
9235 this.faithElements.SetBase(elements[i], Mathf.Max(num2, 1), 0);
9238 this.faithElements.SetParent(
this);
9242 public void ModTempElement(
int ele,
int a,
bool naturalDecay =
false)
9244 if (a < 0 && !naturalDecay)
9247 if (base.HasElement((row !=
null) ? row.id : 0, 1))
9252 if (this.tempElements ==
null)
9255 this.tempElements.SetParent(
this);
9257 if (a > 0 && this.tempElements.Base(ele) > a)
9259 a = a * 100 / (200 + (this.tempElements.Base(ele) - a) * 10);
9261 Element element = this.tempElements.ModBase(ele, a);
9262 if (element.vBase == 0)
9264 this.tempElements.Remove(element.id);
9265 if (this.tempElements.dict.Count == 0)
9267 this.tempElements =
null;
9273 public void DamageTempElements(
int p,
bool body,
bool mind)
9277 this.DamageTempElement(
Element.List_Body.RandomItem<
int>(), p);
9281 this.DamageTempElement(
Element.List_Mind.RandomItem<
int>(), p);
9286 public void DamageTempElement(
int ele,
int p)
9288 this.ModTempElement(ele, -(p / 100 +
EClass.rnd(p / 100 + 1) + 1),
false);
9292 public void EnhanceTempElements(
int p,
bool body,
bool mind)
9296 this.EnhanceTempElement(
Element.List_Body.RandomItem<
int>(), p);
9300 this.EnhanceTempElement(
Element.List_Mind.RandomItem<
int>(), p);
9305 public void EnhanceTempElement(
int ele,
int p)
9307 this.ModTempElement(ele, p / 100 +
EClass.rnd(p / 100 + 1),
false);
9311 public void DiminishTempElements(
int a = 1)
9313 if (this.tempElements ==
null)
9317 foreach (
Element element
in this.tempElements.dict.Values.ToList<
Element>())
9319 if (element.vBase > 0)
9321 this.ModTempElement(element.id, -Mathf.Min(a, element.vBase),
true);
9327 public void CureTempElements(
int p,
bool body,
bool mind)
9329 Chara.<>c__DisplayClass553_0 CS$<>8__locals1;
9330 CS$<>8__locals1.<>4__this =
this;
9331 CS$<>8__locals1.p = p;
9332 if (this.tempElements ==
null)
9338 this.<CureTempElements>g__Cure|553_0(
Element.List_Body, ref CS$<>8__locals1);
9342 this.<CureTempElements>g__Cure|553_0(
Element.List_Mind, ref CS$<>8__locals1);
9348 private void <RestockInventory>g__Restock|354_0(
string id,
int num)
9350 if (this.things.Find(
id, -1, -1) ==
null)
9352 base.AddCard(
ThingGen.Create(
id, -1, -1).SetNum(num));
9358 private void <RefreshWorkElements>g__TryAdd|483_0(
Hobby h)
9360 if (h.source.elements.IsEmpty())
9364 if (this.workElements ==
null)
9369 while (i < h.source.elements.Length)
9371 int num = h.source.elements[i];
9372 int num2 = h.source.elements[i + 1];
9378 num3 = h.GetEfficiency(
this) * this.homeBranch.efficiency / 100;
9387 this.workElements.ModBase(num, (num2 < 0) ? (num2 / 10) : Mathf.Max(1, h.source.elements[i + 1] * num3 / 1000));
9394 internal static int <PerformWork>g__PerformWork|494_0(
Hobby work,
int idx,
bool isHobby, ref
Chara.<>c__DisplayClass494_0 A_3)
9396 if (idx >= work.source.resources.Length)
9400 int num = work.source.resources[idx];
9402 num = Rand.Range(num * (100 - work.source.resources[idx]) / 100, num);
9403 num = num * (isHobby ? 50 : 100) * A_3.session.efficiency / 10000;
9404 if (num2 > 0 && num <= 0)
9413 private void <CureTempElements>g__Cure|553_0(
int[] eles, ref
Chara.<>c__DisplayClass553_0 A_2)
9415 foreach (
int num
in eles)
9417 if (this.tempElements ==
null)
9421 Element element = this.tempElements.GetElement(num);
9422 if (element !=
null && element.vBase < 0)
9424 this.ModTempElement(num, Mathf.Clamp(A_2.p / 20 +
EClass.rnd(A_2.p / 20), 1, -element.vBase),
false);
9433 private static List<Hobby> listHobby =
new List<Hobby>();
9436 public static string[] IDTimeTable =
new string[]
9444 public int contribution;
9448 public Point orgPos;
9460 public Chara parasite;
9477 [JsonProperty(PropertyName =
"T1")]
9481 [JsonProperty(PropertyName =
"T2")]
9482 public FactionMemberType memberType;
9485 [JsonProperty(PropertyName =
"T3")]
9486 public List<int> _hobbies;
9489 [JsonProperty(PropertyName =
"T4")]
9490 public List<int> _works;
9493 [JsonProperty(PropertyName =
"T5")]
9497 [JsonProperty(PropertyName =
"T6")]
9498 public List<int> _cooldowns;
9501 [JsonProperty(PropertyName =
"T7")]
9502 public List<int> _listAbility;
9505 [JsonProperty(PropertyName =
"1")]
9506 public PCCData pccData;
9509 [JsonProperty(PropertyName =
"2")]
9513 [JsonProperty(PropertyName =
"3")]
9514 public int[] rawSlots;
9517 [JsonProperty(PropertyName =
"4")]
9521 [JsonProperty(PropertyName =
"8")]
9522 public string[] _strs =
new string[5];
9525 [JsonProperty(PropertyName =
"9")]
9526 public int[] _cints =
new int[30];
9529 public BitArray32 _cbits1;
9535 public Chara master;
9550 public Thing ranged;
9553 public Thing nextUse;
9562 public Emo2 emoIcon;
9565 public int happiness;
9568 public int turnLastSeen = -100;
9571 public int idleActTimer;
9574 public int combatCount;
9577 public int calmCheckTurn;
9580 public int sharedCheckTurn;
9583 public float idleTimer;
9586 public bool isDrunk;
9589 public bool isConfused;
9592 public bool isFainted;
9595 public bool isBlind;
9598 public bool isParalyzed;
9601 public bool isLevitating;
9604 public bool isCreated;
9607 public bool canSeeInvisible;
9610 public bool hasTelepathy;
9616 public bool bossText;
9640 public bool dirtySpeed =
true;
9646 private static Point _sharedPos =
new Point();
9649 private bool hasMovedThisTurn;
9652 public float actTime = 0.3f;
9655 public static bool consumeTurn;
9658 public static bool preventRegen;
9661 public static bool isOnCreate;
9664 private static List<Chara> _pts =
new List<Chara>();
9667 private static List<Thing> _ListItems =
new List<Thing>();
9695 public List<Condition> conditions =
new List<Condition>();
9699 public Dictionary<int, int> resistCon;