2using System.Collections.Generic;
13 private static List<Hobby>
listHobby =
new List<Hobby>();
15 public static string[]
IDTimeTable =
new string[2] {
"default",
"owl" };
42 [JsonProperty(PropertyName =
"T1")]
45 [JsonProperty(PropertyName =
"T2")]
48 [JsonProperty(PropertyName =
"T3")]
51 [JsonProperty(PropertyName =
"T4")]
54 [JsonProperty(PropertyName =
"T5")]
57 [JsonProperty(PropertyName =
"T6")]
60 [JsonProperty(PropertyName =
"T7")]
63 [JsonProperty(PropertyName =
"T8")]
66 [JsonProperty(PropertyName =
"1")]
69 [JsonProperty(PropertyName =
"2")]
72 [JsonProperty(PropertyName =
"3")]
75 [JsonProperty(PropertyName =
"4")]
78 [JsonProperty(PropertyName =
"8")]
79 public string[]
_strs =
new string[5];
81 [JsonProperty(PropertyName =
"9")]
190 private static List<Chara>
_pts =
new List<Chara>();
480 if (base.c_originalHostility == (
Hostility)0)
482 if (!
source.hostility.IsEmpty())
488 return base.c_originalHostility;
498 if (
source.idActor.Length <= 1)
530 return "CharaActorPCC";
542 if (base.dir != 1 && base.dir != 2)
558 return base.dir == 2;
572 return base.ExistsOnMap;
618 if (base.c_love !=
null)
620 return base.c_love.dateMarriage != 0;
650 return base.c_uidMaster != 0;
726 public override int MaxHP => (int)Mathf.Clamp(((
long)(base.END * 2 + base.STR + base.WIL / 2) * (
long)Mathf.Min(base.LV, 25) / 25 + base.END + 10) *
Evalue(60) / 100 * ((base.IsPCFactionOrMinion ? 100 : (100 + (int)base.rarity * 300)) + (
IsPC ? (
EClass.
player.
lastEmptyAlly *
Evalue(1646)) : 0)) / 100, 1f, 1E+09f);
728 public override int WeightLimit => (int)Mathf.Clamp(((
long)base.STR * 500L + base.END * 250 +
Evalue(207) * 2000) * ((!
HasElement(1411)) ? 1 : 5) + 45000, 1000f, 1.0737418E+09f);
732 public int MaxSummon => Mathf.Max((
int)Mathf.Sqrt(base.CHA), 1) +
Evalue(1647) + ((!base.IsPCFactionOrMinion) ? ((
int)base.rarity * 5) : 0);
738 if (base.c_idMainElement == 0)
746 public override int DV
757 num = 50 + (num - 50) / 10;
760 int WeaknessMod(
int a)
762 if (HasCondition<ConWeakness>())
775 public override int PV
786 num = 50 + (num - 50) / 10;
789 int WeaknessMod(
int a)
791 if (HasCondition<ConWeakness>())
812 spriteReplacer.data.tryFixPrefNotLoadedAtStart =
true;
867 if (!
IsGlobal && !base.isSubsetCard)
1013 if (!(
race.id ==
"cat") && !(
race.id ==
"catsister"))
1015 return race.id ==
"catgod";
1031 return race.id ==
"mutant";
1055 return EClass.Branch.uidMaid == base.uid;
1081 if (!
source.works.Contains(
"Rich"))
1083 return source.hobbies.Contains(
"Rich");
1109 if (base.c_genes !=
null)
1111 return base.c_genes.GetGeneSlot(
this);
1137 if (!
race.tag.Contains(
"mofu"))
1164 if (!h.
source.elements.IsEmpty())
1166 for (
int i = 0; i < h.
source.elements.Length; i += 2)
1168 int ele = h.
source.elements[i];
1169 int v = h.
source.elements[i + 1];
1199 if (base.rarity >=
Rarity.Legendary)
1214 if (
host ==
null || includeRide)
1218 return base.hp <
MaxHP / 5;
1233 return num > num2 + 0.1f;
1330 return p.cell.room.data.accessType
switch
1333 BaseArea.AccessType.Private =>
false,
1360 for (
int i = 0; i < slots.Count; i++)
1369 _cbits1.Bits = (uint)
_cints[0];
1380 pccData.state = (base.isCensored ? PCCState.Naked : PCCState.Normal);
1389 if (
source.tag.Contains(
"boss"))
1410 string text = base.c_altName ??
source.GetName(
this);
1411 if (HasCondition<ConTransmuteShadow>())
1418 if (base.c_bossType ==
BossType.Evolved)
1420 text =
"_evolved".lang(text.ToTitleCase(wholeText:
true));
1423 if (text.Length > 0 &&
char.IsLower(text[0]))
1425 if (base.rarity >=
Rarity.Legendary)
1427 text = text.ToTitleCase();
1431 text = text.AddArticle();
1438 int num2 = ((base.rarity ==
Rarity.Mythical) ? 3 : ((base.rarity >=
Rarity.Legendary) ? 2 : ((!
_alias.IsEmpty()) ? 1 : (-1))));
1443 text = (
Aka.IsEmpty() ? text.Bracket(num2) : (num2
switch
1448 }).lang((num2 == -1) ?
Aka :
Aka.ToTitleCase(wholeText:
true), text.Bracket(num2)));
1450 return text + text2;
1455 if (r != base.rarity)
1483 Hostility hostility2 = (base.c_originalHostility = h);
1484 this.hostility = hostility2;
1500 if (uniqueData !=
null)
1539 base.isSubsetCard =
false;
1541 base.c_uidMaster = 0;
1573 if (
source.tag.Contains(
"boss"))
1577 int num = ((bp.lv != -999) ?
bp.
lv : base.LV);
1599 if (
source.idActor.Length > 2)
1608 if (
source.mainElement.Length != 0)
1610 int _genLv = Mathf.Min(
genLv, 100);
1611 List<Tuple<string, int, int>> list =
new List<Tuple<string, int, int>>();
1612 string[] mainElement =
source.mainElement;
1613 for (
int i = 0; i < mainElement.Length; i++)
1615 string[] array = mainElement[i].Split(
'/');
1617 int num2 = source.LV * row.eleP / 100;
1618 if (list.Count == 0 || num2 < _genLv || array[0] ==
bp.
idEle)
1620 list.Add(
new Tuple<string, int, int>(array[0], (array.Length > 1) ?
int.Parse(array[1]) : 0, num2));
1623 Tuple<string, int, int> tuple = list.RandomItemWeighted((Tuple<string, int, int> a) => 10000 / Mathf.Max(100 + (_genLv - a.Item3) * 25, 1));
1626 tuple = list.Where((Tuple<string, int, int> a) => a.Item1 == bp.idEle ||
"ele" + a.Item1 ==
bp.
idEle).FirstOrDefault() ?? tuple;
1628 SetMainElement(tuple.Item1, (tuple.Item2 == 0) ? 10 : tuple.Item2, elemental:
true);
1629 if (list.Count >= 2)
1631 num = tuple.Item3 + base.LV -
source.LV;
1636 base.c_altName = NameGen.getRandomName();
1640 _alias = AliasGen.GetRandomAlias();
1653 if (base.LV > 5 &&
race.id ==
"mutant")
1655 for (
int j = 0; j < Mathf.Min(1 + base.LV / 5, 20); j++)
1662 case "putty_mech_b":
1671 if (
race.EQ.Length != 0 || !
source.equip.IsEmpty())
1689 case "olderyoungersister":
1692 case "sister_undead":
1696 if (
id ==
"sister_undead" &&
EClass.
rnd(10) == 0)
1715 if (!
source.faith.IsEmpty())
1776 Debug.LogError(
"source is null");
1796 base.isHidden =
false;
1821 item.Talk(
"fusion");
1826 chara.PlayAnime(
AnimeID.Shiver);
1844 if (c.
c_bossType != 0 || base.c_bossType != 0)
1874 if (con !=
DuplicateCondition.Water && (HasCondition<ConPoison>() || HasCondition<ConConfuse>() || HasCondition<ConDim>() || HasCondition<ConParalyze>() || HasCondition<ConSleep>() || HasCondition<ConBurning>() || HasCondition<ConFreeze>() || HasCondition<ConMiasma>()))
1902 dest = dest.
GetRandomPoint(2, requireLos:
false, allowChara:
false, allowBlocked:
false, 200);
1903 if (dest ==
null || dest.Equals(
pos) || !dest.IsValid || !
CanDuplicate(con))
1905 Say(
"split_fail",
this);
1922 if (
item.Key != 1275)
1924 Element orCreateElement = chara.elements.GetOrCreateElement(
item.Key);
1925 orCreateElement.vBase = item.Value.ValueWithoutLink - orCreateElement.
vSource;
1928 chara.SetFaith(
faith);
1929 chara.bio = IO.DeepCopy(
bio);
1931 chara.c_daysWithGod = base.c_daysWithGod;
1932 chara.RefreshFaithElement();
1933 chara.hp = (int)Mathf.Clamp((
float)chara.MaxHP * ((float)base.hp / (
float)
MaxHP) * 0.99f, 0f, chara.MaxHP);
1934 chara.isCopy =
true;
1935 chara.isScaled = base.isScaled;
1936 chara.c_altName = base.c_altName;
1940 chara.pccData = IO.DeepCopy(
pccData);
1951 int num2 = (base.ChildrenWeight + ((t !=
null) ? ((num == -1) ? t.ChildrenAndSelfWeight : (t.SelfWeight * num)) : 0)) * 100 /
WeightLimit;
1960 int num3 = ((num2 >= 100) ? ((num2 - 100) / 10 + 1) : 0);
1970 int num = base.ChildrenWeight * 100 / Mathf.Max(1,
WeightLimit);
1986 Say(flag ?
"dmgBurdenStairs" :
"dmgBurdenFallDown",
this);
1992 long num2 = (num * (base.ChildrenWeight * 100 /
WeightLimit) / (flag ? 100 : 200) + 1) * mtp / 100;
2020 info?.AddText(
"rideSpeed".lang(
_Speed.ToString() ??
""));
2022 else if (
host !=
null)
2028 int value = 100 + (int)
_Speed * ((!
race.tag.Contains(
"noRide")) ? 1 : 5) * Mathf.Max(a, 1) - base.STR -
host.
EvalueRiding() * 2 - (
race.tag.Contains(
"ride") ? 50 : 0);
2049 info?.AddText(
_Speed - speed,
"parasiteSpeed".lang());
2061 num = 50 + Mathf.Clamp((
int)Mathf.Sqrt(num2) * 5 -
EClass.
_zone.
DangerLv / 50, (num3 > 0) ? 50 : ((base.IsPowerful ||
IsMultisize) ? 40 : 0), 50) + Mathf.Clamp((
int)Mathf.Sqrt(num2), 0, 25);
2062 if (info !=
null && num != 100)
2089 num -= (
IsPC ? 50 : 100);
2129 num += EClass.player.lastEmptyAlly *
Evalue(1646);
2134 num += EClass.player.lastEmptyAlly * 10 - 10;
2140 num +=
EClass.
curve((base.LV - 900) / 100 * 10, 500, 100);
2141 info?.AddFix(
EClass.
curve((base.LV - 900) / 100 * 10, 500, 100),
"enemySpeedBuff".lang());
2143 if (HasCondition<ConGravity>())
2146 info?.AddFix(-30, GetCondition<ConGravity>().
Name);
2156 info?.AddText(
"minSpeed".lang(10.
ToString() ??
""));
2167 if (value.
source.category ==
"skill")
2187 this.hostility = hostility2;
2193 this.hostility = hostility2;
2199 this.hostility = hostility2;
2214 base.ApplyEditorTags(tag);
2222 Debug.LogWarning(
"Chara " +
id +
" not found");
2231 if (!
id.StartsWith(
"ele"))
2240 if (base.c_idMainElement != 0)
2242 SetElements(base.c_idMainElement,
remove:
true);
2243 base.c_idMainElement = 0;
2248 SetElements(
id,
remove:
false);
2249 base.c_idMainElement =
id;
2252 base.isElemental =
true;
2255 base.c_lightColor = (byte)Mathf.Clamp(colorSprite.r * 3f, 1f, 31f) * 1024 + (byte)Mathf.Clamp(colorSprite.g * 3f, 1f, 31f) * 32 + (byte)Mathf.Clamp(colorSprite.b * 3f, 1f, 31f);
2259 void SetElements(
int idEle,
bool remove)
2319 base.c_idJob = idNew;
2347 int ele =
new int[9] { 30, 31, 33, 35, 35, 36, 34, 37, 39 }.RandomItem();
2351 Say(
"gain_bodyparts",
this,
Element.
Get(ele).GetName().ToLower());
2372 for (
int num =
body.
slots.Count - 1; num >= 0; num--)
2381 string[] array =
race.figure.Split(
'|');
2382 foreach (
string s
in array)
2395 string[] array =
race.figure.Split(
'|');
2396 foreach (
string s
in array)
2421 bool flag =
id ==
"chara" ||
id ==
"player";
2422 if (
race.id ==
"bike" &&
id !=
"bike_cub")
2439 base.c_idRace = idNew;
2455 Debug.Log(
"Creating Replacement NPC for:" +
this);
2483 this.hostility = hostility2;
2485 base.c_summonDuration = 0;
2486 base.isSummon =
false;
2507 owner?.
Say(
"summon_vanish",
this);
2517 Hostility hostility2 = (base.c_originalHostility = (_master.IsPCFaction ? Hostility.Ally : _master.
hostility));
2518 this.hostility = hostility2;
2519 base.c_uidMaster = _master.
uid;
2520 base.c_minionType = type;
2527 base.c_uidMaster = 0;
2532 if (chara.
enemy ==
this)
2544 List<Chara> list =
new List<Chara>();
2572 base.c_summonDuration = duration;
2573 base.isSummon =
true;
2620 int num = ((p.z >=
pos.
z) ? ((p.
x >
pos.
x) ? 1 : ((p.z >
pos.
z) ? 2 : 3)) : 0);
2639 int num2 = ((z >=
pos.
z) ? ((x >
pos.
x) ? 1 : ((z >
pos.
z) ? 2 : 3)) : 0);
2648 num2 = ((z >= p.
z) ? ((x > p.
x) ? 1 : ((z > p.
z) ? 2 : 3)) : 0);
2655 num2 = ((z >=
pos.
z) ? ((x >
pos.
x) ? 1 : ((z >
pos.
z) ? 2 : 3)) : 0);
2664 num2 = ((z >= p.
z) ? ((x > p.
x) ? 1 : ((z > p.
z) ? 2 : 3)) : 0);
2690 if (detail !=
null && detail.
charas.Count > 0)
2725 int num = ((p.z >=
pos.
z) ? ((p.
x >
pos.
x) ? 1 : ((p.z >
pos.
z) ? 2 : 3)) : 0);
2735 int num2 = ((z >=
pos.
z) ? ((x >
pos.
x) ? 1 : ((z >
pos.
z) ? 2 : 3)) : 0);
2740 num2 = ((z >= p.
z) ? ((x > p.
x) ? 1 : ((z > p.
z) ? 2 : 3)) : 0);
2747 num2 = ((z >=
pos.
z) ? ((x >
pos.
x) ? 1 : ((z >
pos.
z) ? 2 : 3)) : 0);
2752 num2 = ((z >= p.
z) ? ((x > p.
x) ? 1 : ((z > p.
z) ? 2 : 3)) : 0);
2783 List<Point> list =
new List<Point>();
2831 if (pathProgress.
HasPath && pathProgress.
nodes.Count < num + 4)
2840 if (pathProgress.
HasPath && pathProgress.
nodes.Count < num + 4)
2849 if (pathProgress.
HasPath && pathProgress.
nodes.Count < num + 25)
2858 if (pathProgress.
HasPath && pathProgress.
nodes.Count < num + 25)
2873 if (!condition.
TryMove(newPoint))
2878 if (base.isRestrained)
2884 base.isRestrained =
false;
2886 if (!
CanMoveTo(newPoint, allowDestroyPath))
2890 return _Move(newPoint);
2941 EClass.player.lastZonePos =
null;
2944 for (
int i = 0; i < num2 * 4; i++)
2955 EClass.player.regionMoveWarned =
true;
2956 Msg.
Say(
"regionAbortMove");
2967 AddCondition<ConSuffocation>((
Evalue(200) != 0) ? (2000 / (100 +
EvalueMax(200, -5) * 10)) : 30, force:
true);
2969 int num4 = GetCondition<ConSuffocation>()?.GetPhase() ?? 0;
2976 ModExp(200, ((!flag) ? 1 : 10) + num4 * 12);
2979 EClass.player.regionMoveWarned =
false;
2987 num = EClass.setting.defaultActPace * 3f;
3015 if (
CanMoveTo(randomNeighbor, allowDestroyPath:
false))
3017 newPoint = randomNeighbor;
3025 if (newPoint.
x !=
pos.
x || newPoint.
z !=
pos.
z)
3030 if (effect !=
null && effect.
id == 7)
3035 Say(
"abWeb_caught",
this);
3037 effect2.power = effect2.power * 3 / 4;
3041 Say(
"abWeb_pass",
this);
3046 EClass.player.renderExtraTime = 0f;
3051 else if ((newPoint.
x >
pos.
x && newPoint.
z >
pos.
z) || (newPoint.
x <
pos.
x && newPoint.
z <
pos.
z))
3060 if (
item.mimicry !=
null &&
item.IsHostile(
this))
3062 if (
item.mimicry.ShouldRevealOnPush)
3064 item.mimicry.Reveal(
this, surprise:
true);
3080 traitDoor.TryOpenLock(
this);
3090 bool flag4 = EClass._zone.IsSnowCovered && !cell.HasRoof && !cell.
isClearSnow;
3093 bool flag5 = cell.IsTopWater && !cell.
isFloating;
3123 string text = ((flag3 || flag5) ?
"water" : tileRow.
soundFoot.IsEmpty(row.
soundFoot.IsEmpty(
"default")));
3124 if (cell.
obj != 0 && cell.
sourceObj.tileType.IsPlayFootSound && !cell.
matObj.soundFoot.IsEmpty())
3126 text = cell.
matObj.soundFoot;
3138 if (!text.IsEmpty())
3140 SoundManager.altLastData =
IsPC;
3147 bool flag6 = scene.actionMode.gameSpeed > 1f;
3148 scene.psFoot.transform.position = renderer.position + pcOrbit.
footPos;
3149 scene.psFoot.startColor = row.
matColor;
3153 scene.psSmoke.transform.position = renderer.position + pcOrbit.
smokePos;
3177 Say(
"replace_pc", chara, chara2);
3188 traitDoor2.TryOpen(
this);
3227 if ((dataPick.
noRotten && item2.
IsDecayed) || (dataPick.onlyRottable && item2.trait.Decay == 0))
3244 foreach (
int cat
in dataPick.
cats)
3252 else if (!dataPick.
flag.HasFlag(containerFlag))
3294 num6 = (int)Mathf.Abs((surfaceHeight - surfaceHeight2) * 100f);
3311 EClass.player.flags.isShoesOff =
false;
3318 EClass.player.flags.isShoesOff =
true;
3348 AddExp(Mathf.Clamp((
int)Mathf.Sqrt(base.ExpToNext / 100), 1, 1000));
3368 EClass._map.MineBlock(_p, recoverBlock: false, this);
3371 EClass._map.MineObj(_p, null, this);
3377 EClass._map.MineObj(_p, null, this);
3384 if (t.isNPCProperty && t.trait.CanBeDestroyed)
3390 t.SetPlaceState(PlaceState.roaming);
3406 if (list.Count == 0)
3410 list.Copy().ForeachReverse(delegate(
Chara c)
3414 List<Point> list2 = new List<Point>();
3415 for (int i = point.x - 1; i <= point.x + 1; i++)
3417 for (int j = point.z - 1; j <= point.z + 1; j++)
3419 if (i != point.x || j != point.z)
3421 Point point2 = new Point(i, j);
3422 if (point2.IsValid && !point2.HasChara && !point2.IsBlocked && !point2.cell.hasDoor && !point2.IsBlockByHeight(point))
3429 if (list2.Count > 0)
3431 if (list2.Count > 1)
3433 list2.ForeachReverse(delegate(Point p)
3435 if (p.Equals(new Point(point.x + point.x - pos.x, point.z + point.z - pos.z)))
3441 Point newPoint = list2.RandomItem();
3444 Say(
"displace",
this, c);
3454 int num =
EClass.
rndHalf(10 + Mathf.Min(GetCurrency() / 100, 1000));
3456 Say(
"pushed_money",
this, c);
3521 if (z == currentZone)
3525 if (HasCondition<ConInvulnerable>())
3527 RemoveCondition<ConInvulnerable>();
3531 EClass.player.nextZone = z;
3539 EClass.player.returnInfo.turns += 5;
3546 EClass.player.deathZoneMove =
false;
3548 currentZone.events.OnLeaveZone();
3549 if (currentZone.instance !=
null)
3563 EClass.player.uidLastZone = currentZone.uid;
3566 if (currentZone.IsRegion)
3574 Msg.
Say(
"leaveZone", currentZone.Name);
3576 else if (z.
id != currentZone.id)
3580 EClass.player.lastZonePos = pos.Copy();
3582 EClass.player.lastTransition = transition;
3604 if (party !=
null && party.
leader ==
this)
3616 Debug.Log(base.Name);
3619 transition.uidLastZone = currentZone?.uid ?? 0;
3620 global.transition = transition;
3624 global.transition =
null;
3627 EClass.player.lastTransition =
null;
3630 if (IsBranchMember())
3641 public void MoveHome(
string id,
int x = -1,
int z = -1)
3656 CureCondition<ConSuspend>();
3683 orgPos =
new Point(x, z);
3684 if (factionBranch !=
null)
3686 RefreshWorkElements();
3698 state = ZoneTransition.EnterState.Fall,
3708 renderer.RefreshSprite();
3711 public override void Rotate(
bool reverse =
false)
3713 if (renderer.hasActor)
3715 base.dir = (base.dir + ((!reverse) ? 1 : (-1))).Clamp(0, 3, loop:
true);
3719 base.dir = ((base.dir == 0) ? 1 : 0);
3722 renderer.RefreshSprite();
3732 angle =
Util.GetAngle(p.
x - pos.x, p.
z - pos.z);
3735 if (angle > 100f && angle < 170f)
3739 else if (angle > 170f && angle < 190f)
3743 else if (angle > 190f || (angle < -10f && angle > -100f))
3753 else if (angle > 170f && angle < 235f)
3757 else if (angle > 80f && angle < 145f)
3761 else if (angle > -100f && angle < -35f)
3765 else if (angle > -10f && angle < 55f)
3769 renderer.RefreshSprite();
3780 else if (base.dir == 1)
3784 else if (base.dir == 2)
3788 else if (base.dir == 3)
3793 else if (base.dir == 0)
3797 else if (base.dir == 1)
3801 else if (base.dir == 2)
3805 else if (base.dir == 3)
3814 if (!renderer.hasActor)
3816 if (angle == 0f || angle == 45f || angle == 90f)
3820 if (angle == -135f || angle == 180f || angle == -90f)
3830 return renderer.actor.currentDir;
3836 for (
int i = -num; i < num + 1; i++)
3838 for (
int j = -num; j < num + 1; j++)
3840 shared.
Set(pos.x + i, pos.z + j);
3851 for (
int num = conditions.Count - 1; num >= 0; num--)
3853 if (conditions[num].ConsumeTurn)
3863 if (_cooldowns !=
null)
3868 consumeTurn =
false;
3869 preventRegen =
false;
3870 emoIcon =
Emo2.none;
3873 base.c_summonDuration--;
3874 if (base.c_summonDuration <= 0)
3882 AddCondition<ConWet>(20);
3887 happiness = (hunger.value + stamina.value + depression.value + bladder.value + hygiene.
value) / 5;
3892 if (
EClass.
rnd(2) == 0 && !HasCondition<ConAwakening>())
3907 if (parasite !=
null)
3920 num = ((!IsPC) ? ((phase > 3) ? 50 : 0) : ((phase > 3) ? 50 : 0));
3937 AddCondition<ConBurning>(1000, force:
true);
3941 if (HasElement(1250))
3943 if (!HasCondition<ConVampire>())
3945 AddCondition<ConVampire>();
3947 if (!IsPC && !HasCooldown(8793))
3950 flag = ((!HasCondition<ConTransmuteBat>()) ? (!HasElement(431) && pos.IsSunLit) : (body.
HasElement(431) || (EClass.world.date.IsNight && !pos.IsSunLit)));
3957 UseAbility(
"SpTransmuteBat",
this);
3961 if (HasElement(1423) && !HasCondition<ConPeaky>())
3963 AddCondition<ConPeaky>();
3967 if (turn % 200 == 0)
3969 DiminishTempElements();
3981 preventRegen =
true;
3985 Say(
"dmgBurden",
this);
3986 DamageHP(MaxHP * (base.ChildrenWeight * 100 / WeightLimit) / 1000 + 1,
AttackSource.Burden);
3998 ModExp(207, 1 + phase2 * phase2);
4026 preventRegen =
true;
4030 if (
EClass.
rnd(100) == 0 && !isConfused)
4033 AddCondition<ConConfuse>(500);
4038 AddCondition<ConBlind>(200);
4041 if (turn % (200000 / Mathf.Max(100 + Evalue(409) * 10, 50)) == 0)
4049 int num2 = Evalue(409);
4050 if (num2 > 0 && turn % (200000 / Mathf.Max(100 + num2 * 10, 50)) == 0)
4055 for (
int num3 = conditions.Count - 1; num3 >= 0; num3--)
4057 if (num3 < conditions.Count)
4072 preventRegen =
true;
4087 case "cocoon_alien":
4097 if (elements.Base(79) >= 30)
4101 elements.SetTo(79, elements.Base(79) * 3 / 4);
4108 if (pos.IsBlocked && pos.HasBlock)
4110 preventRegen =
true;
4114 if (
EClass.
rnd(25) == 0 && base.hp < MaxHP)
4116 HealHP(
EClass.
rnd(Evalue(300) / 3 + 1) + 1);
4117 elements.ModExp(300, 8f);
4122 elements.ModExp(301, 8f);
4141 if (parasite !=
null)
4153 Debug.LogError(
"exception: pos is not valid:" + pos?.ToString() +
"/" +
this);
4164 ignoreSPAbsorb =
false;
4167 if (hasMovedThisTurn)
4169 pos.Things.ForeachReverse(delegate(
Thing t)
4173 AI_Goto aI_Goto = ai.Current as AI_Goto;
4174 if ((aI_Goto == null && !(ai is GoalManualMove)) || (aI_Goto != null && !aI_Goto.dest.Equals(pos)))
4185 hasMovedThisTurn =
false;
4188 EClass.player.haltMove =
false;
4222 EClass.player.safeTravel = 5 +
EClass.
rnd(5);
4233 if (!tileInfo.
shore)
4238 int num2 = (tileInfo.isRoad ? 22 : 12);
4241 num2 = (tileInfo.isRoad ? 16 : 10);
4245 num2 *= (flag2 ? 2 : 20);
4256 EClass.player.safeTravel = 5 +
EClass.
rnd(5);
4269 EClass.player.pickupDelay = 0f;
4277 EClass.player.returnInfo =
null;
4300 Msg.
Say(
"returnComplete");
4301 EClass.player.uidLastTravelZone = 0;
4303 EClass.player.lastZonePos =
null;
4305 EClass.player.returnInfo =
null;
4308 EClass.player.returnInfo =
null;
4309 Msg.
Say(
"returnOverweight");
4313 if ((HasNoGoal || !ai.
IsRunning) && !WillConsumeTurn())
4321 RecipeUpdater.dirty =
true;
4327 actTime = EClass.player.baseActTime * Mathf.Max(0.1f, (
float)
EClass.
pc.
Speed / (
float)Speed);
4328 hasMovedThisTurn =
false;
4331 if (!IsAliveInCurrentZone)
4335 renderer.RefreshStateIcon();
4336 if (host !=
null && !consumeTurn)
4338 if (host.
ride ==
this && ((host.
hasMovedThisTurn && IsInCombat) || (enemy !=
null && turn % 3 != 0)))
4344 if (Dist(enemy) < 3 &&
EClass.
rnd(2) == 0)
4346 Say(
"parasite_fail",
this, host);
4347 if (
EClass.
rnd(2) == 0 && GetInt(106) == 0)
4349 Talk(
"parasite_fail");
4364 if (base.isRestrained)
4385 Cell cell = base.Cell;
4388 AddCondition<ConWet>(50);
4389 if (pos.IsHotSpring)
4396 AddCondition<ConBurning>();
4400 AddCondition<ConSuffocation>(800 / (100 + EvalueMax(200, -5) * 10), force:
true);
4416 AddCondition<ConWet>(50);
4420 PlaySound(
"fire_step");
4421 AddCondition<ConBurning>(30);
4426 PlaySound(
"bubble");
4427 AddCondition<ConWet>(30);
4432 if (hasMovedThisTurn)
4434 Say(
"abMistOfDarkness_step",
this);
4436 AddCondition<ConDark>(e.
power);
4458 aliasEle = EClass.sources.elements.map[e.idEle].alias,
4488 if (rootCard !=
this && things.IsFull(c.
Thing))
4495 public void PickOrDrop(
Point p,
string idThing,
int idMat = -1,
int num = 1,
bool msg =
true)
4505 if (things.GetDest(t).IsValid)
4526 t = TryPoisonPotion(t);
4534 Say(
"backpack_full_drop", t);
4541 Say(
"backpack_full", t);
4545 if (dest.
stack !=
null)
4549 PlaySound(
"pick_thing");
4550 Say(
"pick_thing",
this, t);
4558 PlaySound(
"pick_thing");
4559 Say(
"pick_thing",
this, t);
4561 TryReservePickupTutorial(t);
4571 Say(
"poisonDrip",
this);
4585 Say(
"absorbRod",
this, t);
4588 if (
rod.source !=
null)
4591 if (enumerator.MoveNext())
4623 if (t.
id ==
"pasture")
4635 foreach (
Card item in pos.ListCards())
4640 if (thing !=
null && !IsPC)
4642 thing.isNPCProperty =
true;
4687 t.isNPCProperty =
false;
4691 pos.TryWitnessCrime(
this);
4701 EClass.player.altHeldPos = t.renderer.data.ForceAltHeldPosition ||
EClass.
rnd(2) == 0;
4705 if (num == -1 || num > t.
Num)
4716 t =
Pick(t.
Thing, msg:
false, tryStack:
false);
4731 WidgetHotbar.dirtyCurrentItem =
true;
4742 if (IsPC && held.
invY == 1)
4744 WidgetHotbar.dirtyCurrentItem =
true;
4756 Say(
"canOnlyCarry", held);
4761 if (!flag && things.IsOverflowing())
4765 Say(
"backpack_full_drop", held);
4773 PlaySound(
"pick_thing");
4774 Say(
"pick_held",
this,
card);
4775 if (IsPC &&
card.id ==
"statue_weird")
4782 WidgetHotbar.dirtyCurrentItem =
true;
4797 return held.
Split(a);
4820 WidgetHotbar.dirtyCurrentItem =
true;
4825 if (
card.trait.CanOnlyCarry)
4836 Msg.
Say(
"markedImportant");
4851 t.ignoreAutoPick =
true;
4862 int num = Evalue(131);
4863 int num2 = Evalue(130);
4864 int num3 = Evalue(123);
4865 if (num > num2 && num > num3)
4869 if (num2 > num && num2 > num3)
4873 if (num3 > num && num3 > num2)
4887 if (elements.Value(122) > elements.Value(120))
4889 return elements.GetElement(122);
4891 return elements.GetElement(120);
4896 isOnCreate = onCreate;
4901 RestockInventory(onCreate);
4906 string equip = source.
equip;
4907 if (equip.IsEmpty())
4911 if (equip ==
"none")
4922 EQ_ID(
"staff_long", 1);
4930 EQ_ID(
"tail_snowleopard");
4936 EQ_ID(
"sword_zephir");
4939 case "adv_mesherada":
4942 EQ_ID(
"dagger_hathaway");
4948 EQ_ID(
"staff_long", -1,
Rarity.Legendary);
4952 EQ_ID(
"cloak_wing", -1,
Rarity.Mythical);
4958 EQ_ID(
"sword_muramasa");
4964 EQ_ID(
"dagger_gaki");
4968 EQ_ID(
"dagger_ninto");
4972 EQ_ID(
"dagger", -1,
Rarity.Legendary);
4978 EQ_ID(
"staff_Cat", -1,
Rarity.Mythical);
4989 AddThing(
"gun_gravity2");
4995 AddThing(
"bow_vindale");
5001 EQ_ID(
"martial_ring");
5007 EQ_ID(
"EtherDagger2");
5010 case "keeper_garden":
5013 EQ_ID(
"sword_ragnarok");
5019 EQ_ID(
"axe_destruction");
5025 EQ_ID(
"ribbon_duponne");
5031 EQ_ID(
"helm_seeker");
5034 EQ_ID(
"sword_katana");
5036 EQ_ID(
"sword_katana");
5039 EQ_ID(
"boots_seven");
5043 for (
int i = 0; i < 20; i++)
5048 AddThing(
"plat").SetNum(6);
5054 AddThing(
"guitar_efrond");
5060 AddThing(
"guitar_ash");
5066 EQ_ID(
"EtherDagger");
5074 thing.rarity =
Rarity.Normal;
5086 EQ_ID(
"staff_magius");
5092 EQ_ID(
"staff_insanity");
5098 EQ_ID(
"sword_katana");
5104 EQ_ID(
"staff_leek");
5110 EQ_ID(
"dagger_hocho");
5121 if (!TryEquipRanged())
5128 AddThing(
"gun_laser");
5132 Thing thing2 = AddThing(
"panzerfaust");
5141 EQ_CAT((
EClass.
rnd(4) == 0) ?
"crossbow" :
"bow");
5151 int num = ((base.rarity >=
Rarity.Mythical) ? (base.LV * 3) : ((base.rarity >=
Rarity.Legendary) ? (base.LV * 2) : base.LV));
5156 if (race.
id ==
"asura")
5158 for (
int j = 0; j < 4; j++)
5160 EQ_CAT(job.
weapon.RandomItem());
5163 for (
int k = 0; k < ((!(race.id ==
"mutant")) ? 1 : (2 + base.LV / 30)); k++)
5171 else if (!job.
weapon.IsEmpty())
5175 EQ_CAT(job.
weapon.RandomItem());
5177 if (race.
id ==
"mutant" || (Evalue(131) > 0 &&
EClass.
rnd(2) == 0))
5179 EQ_CAT(job.
weapon.RandomItem());
5222 EQ_ID(
"shield_lute");
5225 if (HasTag(
CTAG.shield))
5236 if (ShouldRestock(
"_meat"))
5242 Restock(
"book_story", 1);
5244 case "rock_thrower":
5252 Restock(
"book_story_home", 1);
5257 void Restock(
string id,
int num)
5259 if (ShouldRestock(
id))
5264 bool ShouldRestock(
string id)
5266 return things.Find(
id) ==
null;
5274 int num = ((base.LV >= 1000) ? 7 : ((base.LV >= 500) ? 5 : ((base.LV >= 250) ? 3 : ((base.LV >= 100) ? 2 : ((base.LV >= 50) ? 1 : 0)))));
5275 Rarity rarity2 = base.rarity;
5276 if (
id ==
"big_sister")
5278 num = (isOnCreate ? 8 : 4);
5286 rarity =
Rarity.Superior;
5288 else if (rarity2 ==
Rarity.Legendary)
5292 else if (rarity2 >=
Rarity.Mythical)
5298 rarity =
Rarity.Legendary;
5300 CardBlueprint.current.rarity = rarity;
5308 CardBlueprint.current.rarity = r;
5311 if (body.
GetSlot(thing, onlyEmpty:
true) ==
null)
5316 if (!body.
Equip(thing))
5327 if ((slot == 0 || bodySlot !=
null) && (slot != 37 || !HasElement(1209)))
5332 if (bodySlot !=
null && !body.
Equip(thing, bodySlot))
5368 if (!IsPC && (!trait.CanJoinPartyResident || !trait.CanJoinParty || memberType != 0))
5372 Msg.
Say(
"returnHome",
this, homeZone.Name);
5389 base.hp = MaxHP / 3;
5392 if (hunger.
value > 30)
5396 sleepiness.value = 0;
5397 hostility = OriginalHostility;
5398 RemoveCondition<StanceTaunt>();
5399 if (
id ==
"keeper_garden")
5407 Msg.
Say(
"noDeathPenalty2",
this);
5411 Msg.
Say(
"noDeathPenalty",
this);
5417 List<Thing> dropList =
new List<Thing>();
5422 t.ignoreAutoPick = true;
5425 }, onlyAccessible:
false);
5431 EClass.player.preventDeathPenalty =
false;
5433 if (IsPCFaction && homeBranch !=
null)
5435 homeBranch.
Log(
"bRevive",
this);
5448 PlayEffect(
"revive");
5450 SetCensored(enable:
false);
5456 ModCorruption(-100000);
5457 if (base.LV < 10000000)
5459 SetLv(base.LV * 10 + 9);
5463 mana.value = mana.
max;
5464 stamina.value = stamina.
max;
5472 List<string> list =
new List<string> {
"930",
"931",
"947",
"948",
"949",
"950",
"951",
"952" };
5475 list =
new List<string> {
"944",
"946",
"backerGrave",
"backerGrave2" };
5479 if (!lastword.IsEmpty())
5481 thing.c_note = lastword;
5483 thing.isModified =
true;
5529 if (HasCondition<ConAnorexia>())
5535 else if (base.c_vomit > 10)
5537 AddCondition<ConAnorexia>();
5539 AddCondition<ConDim>();
5540 if (HasCondition<ConAnorexia>())
5561 if ((uint)(attackSource - 17) > 1u)
5563 AddCondition<ConFaint>(200, force:
true);
5568 bool isInActiveZone = IsInActiveZone;
5571 if (
id ==
"putty" && origin !=
null && origin.IsPCParty)
5581 if (
id ==
"tsunami")
5583 pos.PlaySound(
"water");
5587 Say(
"summon_vanish",
this);
5588 pos.PlayEffect(
"vanish");
5589 pos.PlaySound(
"vanish");
5594 if ((uint)(attackSource - 17) <= 1u)
5604 PlayEffect(
"revive");
5605 PlaySound(
"chime_angel");
5612 PlaySound(base.material.GetSoundDead(source));
5614 renderer.RefreshSprite();
5615 renderer.RefreshStateIcon();
5624 string text2 = ((origin ==
null) ?
"" : origin.GetName(
NameStyle.Full));
5627 text =
"dead_" + attackSource;
5633 text =
"dead_" + e.
source.alias;
5642 EClass._zone.isDeathLocation =
true;
5643 string s = ((origin ==
null) ? text :
"dead_by");
5655 AI_PlayMusic.keepPlaying =
false;
5661 Msg.
Say(
"goto_heaven",
this);
5665 if (originalTarget !=
null || origin ==
null || !origin.isSynced || (attackSource !=
AttackSource.Melee && attackSource !=
AttackSource.Range))
5667 Msg.
Say(text,
this,
"", text2);
5669 string text3 = TalkTopic(
"dead");
5670 if (!text3.IsEmpty())
5672 text3 = text3.StripBrackets();
5674 bool flag = base.rarity >= Rarity.Legendary && !IsPCFaction;
5689 if (homeBranch !=
null)
5691 homeBranch.
Log(text,
this,
"");
5703 if (
id ==
"mandrake" || HasElement(488))
5705 Say(
"a_scream",
this);
5710 ClearTempElements();
5713 base.isSale =
false;
5725 EClass.player.returnInfo =
null;
5726 EClass.player.uidLastTravelZone = 0;
5735 chara3.enemy =
null;
5740 EClass.player.preventDeathPenalty =
true;
5745 bool flag2 = currentZone.IsActiveZone && IsLocalChara && !currentZone.IsPCFaction;
5754 currentZone.RemoveCard(
this);
5756 if ((origin !=
null && origin.IsPCParty) || IsPCFaction)
5759 if (IsPCFaction && !IsPCParty && (origin ==
null || !origin.IsPCParty))
5763 ModAffinity(
EClass.
pc, a, show:
false);
5765 if (!(text4 ==
"quru"))
5767 if (text4 ==
"corgon")
5779 if (origin.IsPCParty || origin.IsPCPartyMinion)
5786 else if (OriginalHostility >=
Hostility.Friend && IsHuman && !base.IsPCFactionOrMinion)
5790 else if (race.
id ==
"cat" && OriginalHostility >=
Hostility.Neutral)
5797 num = num * 30 / 100;
5808 else if (origin.IsPCFaction)
5810 origin.Chara.ModAffinity(
EClass.
pc, 1, show:
false);
5811 origin.Chara.ShowEmo(
Emo.love);
5814 if (base.sourceBacker !=
null && origin !=
null && origin.IsPCParty)
5818 if (base.IsPCFactionOrMinion)
5822 Msg.
Say(
"abort_allyDead");
5827 Msg.
Say(
"abort_enemyDead");
5829 if (IsPCParty && !IsPC)
5832 base.c_wasInPcParty =
true;
5838 if (attackSource !=
AttackSource.Euthanasia && !IsPCFaction)
5840 EClass.player.flags.little_killed =
true;
5854 case "shark_sister":
5863 if (attackSource ==
AttackSource.Finish && origin !=
null && origin.Evalue(665) > 0)
5867 if (chara2.
LV < base.LV)
5869 chara2.
SetLv(base.LV);
5871 chara2.
MakeMinion((origin.IsPCParty || origin.IsPCPartyMinion) ? EClass.pc : origin.Chara,
MinionType.Friend);
5872 Msg.
Say(
"plant_pop",
this, chara2);
5880 if (IsPCFaction || IsPCFactionMinion)
5887 Point point = pos.
GetNearestPoint(allowBlock:
true, allowChara:
false, allowInstalled:
false, ignoreCenter:
true) ?? pos;
5893 flag = (flag2 =
true);
5894 EClass._zone.Boss =
null;
5899 EClass.player.flags.KilledBossInVoid =
true;
5905 SE.Play(
"Jingle/fanfare2");
5915 flag = (flag2 =
true);
5925 flag = (flag2 =
true);
5937 flag = (flag2 =
true);
5942 EClass.player.flags.killedDuponne =
true;
5948 flag = (flag2 =
true);
5954 case "melilith_boss":
5956 flag = (flag2 =
true);
5963 if (questCurry !=
null)
5966 flag = (flag2 =
true);
5976 bool num2 =
EClass.
_map.
FindChara((
id ==
"fairy_raina") ?
"fairy_poina" :
"fairy_raina") ==
null;
5978 if (num2 && questNasu !=
null && questNasu.
phase <= 1)
5980 if (questNasu.
phase == 0)
5985 flag = (flag2 =
true);
5996 flag = (flag2 =
true);
5998 if (questExploration !=
null)
6000 SE.Play(
"kill_boss");
6010 SE.Play(
"kill_boss");
6011 SoundManager.ForceBGM();
6017 SE.Play(
"kill_boss");
6031 EClass.player.willAutoSave =
true;
6046 return UseAbility(elements.GetElement(idAct)?.act ??
ACT.
Create(idAct), tc, pos, pt);
6051 return UseAbility(elements.GetElement(idAct)?.act ??
ACT.
Create(idAct), tc, pos, pt);
6056 if (HasCooldown(a.
id))
6064 if (a.
source.proc.TryGet(0) ==
"Heal" && HasElement(1422) && !IsPC)
6066 List<int> list =
new List<int> { 8400, 8401, 8402, 8403, 8404, 8405 };
6067 int num = list.IndexOf(a.
id);
6070 int num2 = list.TryGet(num + Evalue(1422));
6071 a = elements.GetElement(num2)?.
act ??
ACT.
Create(num2);
6080 bool flag2 = ability.
Has(a.
id);
6081 if (IsPC && HasCondition<StanceManaCost>())
6083 num4 = Evalue(1657);
6095 ForeachEnemy(delegate
6102 ForeachParty(delegate
6118 num5 = (IsPC ? (i * 100) : (50 + i * 50));
6120 int num6 = cost.cost * num5 / 100;
6123 num6 = num6 * 100 / (100 + (int)Mathf.Sqrt(Evalue(483) * 10) * 3);
6133 if (!IsPC && cost.
type ==
Act.
CostType.MP && mana.
value < 0 && (
EClass.
rnd(4) != 0 || IsPCFaction || (base.IsPowerful && mana.value < -20)))
6142 ActPlan.warning =
true;
6145 EClass.scene.mouseTarget.card = cardBk;
6146 if (UseAbility(a, tc, pos, pt))
6155 if ((isConfused &&
EClass.
rnd(4) == 0) || (isBlind && (pt || (pos !=
null && !pos.Equals(base.pos)) || (tc !=
null && tc.pos !=
null && !tc.pos.Equals(base.pos))) &&
EClass.
rnd(2) == 0))
6157 Say(
"shakeHead",
this);
6160 if (tc !=
null && tc !=
this)
6164 if (pos !=
null && !base.pos.Equals(pos))
6170 num3 = 1 + Evalue(1648);
6172 if (IsPC && cost.
cost > 0 && a.
Value == 0 && !flag2)
6179 string s = (isConfused ?
"_cast_confuse" : (HasCondition<ConDim>() ?
"_cast_dim" :
""));
6180 if (!a.
source.tag.Contains(
"useHand"))
6182 Say(race.
castStyle.IsEmpty(
"cast"),
this, a.
source.GetName().ToLower(), s.lang());
6193 if (num4 > 0 && (a.
vPotential >= i * 2 || flag2))
6197 a.vPotential -= i * 2;
6199 num6 = num6 * (100 - num4 * 20) / 100;
6210 if (IsPC && HasElement(1274) && a.vPotential < 0 && !flag2 && !a.
HasTag(
"dontForget"))
6216 if (a.
source.langAct.Length != 0 && tc !=
null)
6218 string text = a.
source.langAct[0];
6219 string text2 = ((a.source.langAct.Length >= 2) ? a.
source.langAct[1] :
"");
6220 if (text ==
"spell_hand")
6223 string @ref = text2.lang(list2[4]);
6224 Say(tc.IsPCParty ?
"cast_hand_ally" :
"cast_hand",
this, tc, @ref, tc.IsPCParty ? list2[1] : list2[2]);
6228 Say(text,
this, tc, text2.IsEmpty() ?
"" : text2.lang());
6232 Talk(
"insult_" + (base.IsMale ?
"m" :
"f"));
6239 if (Evalue(1421) >= 2 && base.hp <= MaxHP / Mathf.Max(1, 9 - Evalue(1421) * 2))
6252 elements.ModExp(304, Mathf.Clamp(num6 * 2, 1, 200));
6256 ignoreSPAbsorb =
true;
6259 if (a is
Spell && GetCondition<ConSilence>() !=
null)
6261 Say(
"cast_silence",
this);
6268 int spellExp = elements.GetSpellExp(
this, a, num5);
6271 Say(
"fizzle",
this);
6272 PlayEffect(
"fizzle");
6273 PlaySound(
"fizzle");
6276 ModExp(a.
id, spellExp / 5);
6278 RemoveCondition<ConInvisibility>();
6282 if (a.
source.cooldown > 0 && (!IsPC || !a.
source.tag.Contains(
"CD_npc")))
6284 AddCooldown(a.
id, a.
source.cooldown);
6286 if (HasTalk(
"phrase_" + a.
source.alias))
6288 EClass.player.forceTalk =
true;
6289 Talk(
"phrase_" + a.
source.alias);
6296 ForeachEnemy(delegate(
Chara c)
6303 ForeachParty(delegate(
Chara c)
6308 Act.forcePt =
false;
6312 for (
int j = 0; j < num3; j++)
6318 ActEffect.RapidCount = j;
6320 flag3 = a.
Perform(
this, tc, pos);
6323 if (flag3 && !isDead)
6327 elements.ModBase(a.
id, 1);
6331 ModExp(a.
id, spellExp);
6334 ActEffect.RapidCount = 0;
6335 if (flag3 && !a.
source.tag.Contains(
"keepInvisi") &&
EClass.
rnd(2) == 0)
6337 RemoveCondition<ConInvisibility>();
6338 RemoveCondition<ConDark>();
6340 if (!base.IsPCFactionOrMinion && a.
HasTag(
"specialAbility"))
6342 string name = a.
Name;
6343 renderer.Say(
"| " + name +
" ");
6346 void ForeachEnemy(Action<Chara> action)
6348 if (_pts.Count == 0)
6353 if (chara3 !=
this && CanSeeLos(chara3) && chara3.
IsHostile(
this))
6359 for (
int num11 = _pts.Count - 1; num11 >= 0; num11--)
6361 action(_pts[num11]);
6364 void ForeachParty(Action<Chara> action)
6366 if (_pts.Count == 0)
6373 if (chara ==
this || chara.
host !=
null || CanSeeLos(chara))
6384 if ((chara2 ==
this || (chara2.
IsFriendOrAbove(
this) && CanSeeLos(chara2))) && (chara2 == tc || _pts.Count < 3 ||
EClass.
rnd(_pts.Count * _pts.Count) > 6))
6391 for (
int num9 = _pts.Count - 1; num9 >= 0; num9--)
6402 return 25 + Evalue(226) * 125 / 100;
6418 if (host.
ride ==
this)
6420 return num2 * 100 / (100 + 300 / Mathf.Max(5, 10 + host.
EvalueRiding()));
6424 return num2 * 100 / (100 + 300 / Mathf.Max(5, 10 + host.
Evalue(227)));
6429 int num3 = Evalue(304);
6432 num3 = Mathf.Max(num3, base.LV + 5);
6436 bool num6 = GetArmorSkill() == 122;
6440 num4 = 20 - Evalue(122) / 5;
6441 num5 += 10 - Evalue(1654) * 4;
6445 num4 = 10 - Evalue(120) / 5;
6455 if (parasite !=
null)
6466 num5 += 20 - Evalue(1654) * 8;
6472 if (HasCondition<ConDim>())
6474 num4 += ((Evalue(1654) >= 3) ? 1500 : 2500);
6484 return Mathf.Clamp(100 + e.
Value - 10 - e.
source.LV * e.
source.cost[0] * num4 / Mathf.Max(10 + num3 * 10, 1), 0, 100 - num5);
6487 public void DoAI(
int wait, Action onPerform)
6502 Say(headpat ?
"headpat" :
"cuddle",
this, c);
6508 if (headpat &&
this != c)
6519 if (!member.
IsPC && CanSeeLos(member))
6529 if (c.
id ==
"hedgehog_ether")
6533 Say(
"reflect_thorne",
this, c);
6540 EClass.player.forceTalk =
true;
6541 Talk(
"kiss",
null,
null, IsPC);
6543 renderer.PlayAnime(
AnimeID.Kiss, c);
6546 if (num > 0 &&
EClass.
rnd(IsPC ? 100 : 5000) == 0)
6550 if (IsPC &&
this != c)
6562 Effect.
Get(
"love").
_Play(pos, isSynced ? renderer.position : pos.Position(), 0f, c.
pos);
6567 if (
id ==
"olderyoungersister")
6572 Say(
"slap",
this, c);
6609 if (enemy ==
null && !IsPC)
6611 if (GetInt(106) == 0)
6615 if (OriginalHostility !=
Hostility.Enemy)
6619 SetEnemy(_tg.
Chara);
6633 if (_tg ==
null || !_tg.
isChara)
6640 EClass.pc.combatCount = 10;
6648 chara.
Say(
"frown",
this, chara);
6660 chara.
Say(
"frown",
this, chara);
6667 bool flag = chara.id ==
"fanatic";
6670 chara.
Say(
"callHelp", chara);
6742 if (mimicry !=
null && mimicry.
IsThing)
6746 bool flag = enemy !=
null || ai is
GoalCombat;
6747 int num = (base.PER + Evalue(210) * 2) * ((!flag) ? 1 : 2);
6749 bool flag3 = !IsPCParty;
6755 if (chara2 ==
this || !IsHostile(chara2) || !CanSee(chara2) || (chara2.mimicry !=
null && chara2.
mimicry.
IsThing))
6759 int num3 = Dist(chara2);
6760 int num4 = GetSightRadius() + (flag ? 1 : 0);
6767 if (
this == pos.FirstChara)
6769 chara2.
ModExp(152, Mathf.Clamp((num - chara2.
Evalue(152)) / 2, 1, Mathf.Max(30 - stealthSeen * 2, 1)));
6777 DoHostileAction(chara2);
6790 DoHostileAction(chara);
6802 if (chara !=
this && chara != enemy && (chara.
mimicry ==
null || !chara.
mimicry.
IsThing) && IsHostile(chara) && Dist(chara) <= 1 && CanInteractTo(chara.
pos))
6804 DoHostileAction(chara);
6823 if (base.IsPCFactionOrMinion)
6836 if (OriginalHostility >=
Hostility.Friend)
6852 if (
id ==
"unicorn" && (Evalue(418) < 0 || (c.
HasElement(1216) && c.
Evalue(418) < 1)))
6885 return EClass.game.activeZone == currentZone;
6892 foreach (
Point item2
in item.ListPoints())
6894 if (pos.Equals(item2))
6915 if (base.IsPCFactionOrMinion || IsFriendOrAbove())
6939 charaRenderer.pccData = PCCData.Create(
"ride");
6940 string idPart = base.c_idRidePCC.IsEmpty(
EClass.
core.
pccs.sets[
"ride"].map[
"body"].map.Keys.First());
6941 charaRenderer.
pccData.SetPart(
"body",
"ride", idPart);
6942 charaRenderer.pccData.ride =
EClass.
core.
pccs.GetRideData(idPart);
6946 foreach (
Condition condition
in conditions)
6949 if (rendererReplacer !=
null)
6951 charaRenderer.replacer = rendererReplacer;
6952 charaRenderer.data = rendererReplacer.
data;
6953 charaRenderer.pccData = rendererReplacer.
pccData;
6957 if (charaRenderer.
replacer ==
null)
6959 charaRenderer.pccData = pccData;
6962 renderer = charaRenderer;
6964 if (cardRenderer !=
null)
6966 renderer.SetFirst(first:
false, cardRenderer.
position);
6968 return charaRenderer;
6975 PCC.Get(pccData).Build(state);
6981 string str = GetStr(
"sprite_override");
6984 Sprite sprite = ModUtil.LoadSprite(str);
6992 PCC pCC = PCC.Get(pccData);
6994 return pCC.variation.idle[0, 0];
6998 if (spriteReplacer?.data !=
null)
7000 Sprite sprite2 = spriteReplacer.
GetSprite(dir, skin, snow);
7006 if (sourceCard.
tiles.Length > 1)
7008 skin = ((base.idSkin == 0 && !source.
staticSkin) ? (base.uid % sourceCard.
tiles.Length / 2 * 2 + ((!base.IsMale) ? 1 : 0)) : base.idSkin);
7010 return sourceCard.
GetSprite(dir, skin, snow);
7031 else if (conSleep !=
null && host ==
null && pos.Equals(
EClass.
pc.
pos) && IsHuman && (GetBool(123) || affinity.
CanSleepBeside()))
7040 p.mat = base.material;
7041 p.matColor = base.colorInt;
7042 if (!renderer.usePass)
7046 if (renderer.replacer !=
null)
7048 p.tile = renderer.replacer.tile * ((!flipX) ? 1 : (-1));
7049 if (renderer.replacer.mat != -1)
7053 p.color -= 1048576f;
7060 int num = ((base.idSkin != 0 || source.
staticSkin) ? base.idSkin : (base.uid % source.
_tiles_snow.Length / 2 * 2 + ((!base.IsMale) ? 1 : 0)));
7065 p.tile = source.
_tiles_snow[0] * ((!flipX) ? 1 : (-1));
7068 else if (sourceCard.
_tiles.Length > 1)
7070 int num2 = ((base.idSkin != 0 || source.
staticSkin) ? base.idSkin : (base.uid % sourceCard.
_tiles.Length / 2 * 2 + ((!base.IsMale) ? 1 : 0)));
7071 p.tile = sourceCard.
_tiles[(num2 >= 0 && num2 < sourceCard.
_tiles.Length) ? num2 : 0] * ((!flipX) ? 1 : (-1));
7075 p.tile = sourceCard.
_tiles[0] * ((!flipX) ? 1 : (-1));
7082 if (mimicry !=
null && mimicry.
IsThing)
7086 string text = ((mimicry !=
null && mimicry.Card !=
this) ? mimicry.
GetName(
NameStyle.Full) : base.Name);
7087 if (IsFriendOrAbove())
7091 else if (IsHostile())
7097 if (base.LV >= lV * 5)
7101 else if (base.LV >= lV * 2)
7105 else if (base.LV <= lV / 4)
7109 else if (base.LV <= lV / 2)
7115 string s = (IsFriendOrAbove() ?
"HostilityAlly" : (IsNeutral() ?
"HostilityNeutral" :
"HostilityEnemy"));
7116 s = (
" (" + s.lang() +
") ").TagSize(14);
7120 s += (
" (" +
"guest".lang() +
") ").TagSize(14);
7124 s += (
" (" +
"livestock".lang() +
") ").TagSize(14);
7130 text2 +=
"lowerGround".lang();
7132 else if (HasHigherGround(
EClass.
pc))
7134 text2 +=
"higherGround".lang();
7137 if (Evalue(1232) > 0)
7139 text2 =
"milkBaby".lang().TagSize(14) + text2;
7143 text2 =
"hasBounty".lang().TagSize(14) + text2;
7147 text2 += (
"(" + faith.Name +
")").TagSize(14);
7153 return text + text2 + s;
7158 if (mimicry !=
null && mimicry.
IsThing)
7165 text += Environment.NewLine;
7166 text = text +
"<size=14>" +
"favgift".lang(GetFavCat().GetName().ToLower(), GetFavFood().GetName()) +
"</size>";
7171 text2 += Environment.NewLine;
7172 text2 = text2 +
"Lv:" + base.LV +
" HP:" + base.hp +
"/" + MaxHP +
" MP:" + mana.value +
"/" + mana.max +
" DV:" + DV +
" PV:" + PV +
" Hunger:" + hunger.
value;
7173 text2 += Environment.NewLine;
7175 text2 += Environment.NewLine;
7176 text2 = text2 + base.uid + IsMinion +
"/" + base.c_uidMaster +
"/" + master;
7177 text2 = text2 +
" dir:" + base.dir +
" skin:" + base.idSkin +
" scaled:" + base.
isScaled;
7181 text2 += Environment.NewLine;
7182 text2 +=
"<size=14>";
7185 text2 = text2 + item.Name +
", ";
7187 foreach (
Hobby item2
in ListHobbies())
7189 text2 = text2 + item2.Name +
", ";
7191 text2 = text2.TrimEnd(
", ".ToCharArray()) +
"</size>";
7194 IEnumerable<BaseStats> enumerable = conditions.Concat((!IsPCFaction) ?
new BaseStats[0] :
new BaseStats[2] { hunger, stamina });
7195 if (enumerable.Count() > 0)
7197 text3 += Environment.NewLine;
7198 text3 +=
"<size=14>";
7207 if (text4.IsEmpty() || text4 ==
"#")
7212 switch (item3.
source.group)
7225 text4 = text4 +
"(" + item3.
GetValue() +
")";
7226 if (resistCon !=
null && resistCon.ContainsKey(item3.
id))
7228 text4 = text4 +
"{" + resistCon[item3.
id] +
"}";
7232 text3 = text3 + text4.TagColor(c) +
", ";
7241 text3 = text3.TrimEnd(
", ".ToCharArray()) +
"</size>";
7246 text3 += Environment.NewLine;
7249 text3 = text3 + item4.act.Name +
", ";
7251 text3 = text3.TrimEnd(
", ".ToCharArray());
7253 return text + text2 + text3;
7259 string key = ((condition ==
null) ? source : condition.
chara.
source).idText.IsEmpty((condition ==
null) ? id : condition.
chara.
id);
7269 string text = row.GetText(topic, returnNull:
true);
7274 if (text.StartsWith(
"@"))
7281 text = row.GetText(topic, returnNull:
true);
7287 return text.Split(Environment.NewLine.ToCharArray()).RandomItem();
7292 if (host ==
null && !IsInActiveZone)
7296 if (!isSynced && (host ==
null || !host.
isSynced) && topic !=
"dead")
7302 int num = EClass.pc.party.members.Count - 1;
7327 string topicText = GetTopicText(topic);
7328 if (topicText.IsEmpty())
7332 HashSet<string> obj =
new HashSet<string>
7334 "_bracketTalk".lang(),
7339 bool flag = topicText.StartsWith(
"*");
7340 bool flag2 = topicText.StartsWith(
"(");
7341 bool flag3 = obj.Any(topicText.StartsWith);
7342 topicText = ApplyTone(topicText);
7343 topicText = topicText.Replace(
'~',
'*');
7345 Msg.
Say(StripTalkSpecialCharacters(topicText.Replace(
"&",
"")));
7346 if (topic ==
"dead")
7350 else if (flag || flag3 || flag2)
7352 (host ??
this).renderer.Say(ApplyNewLine(topicText.StripBrackets()),
default(
Color), IsPCParty ? 0.6f : 0f);
7370 if (conSuspend !=
null && IsPCParty)
7372 RemoveCondition<ConSuspend>();
7376 if (IsDeadOrSleeping)
7378 ShowDialog(
"_chara",
"sleep");
7383 ShowDialog(
"_chara",
"invisible");
7389 ShowDialog(
"_chara",
"give_card");
7398 if (GetInt(71) == -2)
7400 ShowDialog(
"_chara",
"give_lunch");
7406 if (base.isRestrained)
7408 ShowDialog(
"_chara",
"strain");
7413 ShowDialog(
"_chara",
"escort");
7418 string step = ((!(EClass._zone is
Zone_Wedding)) ?
"party" : (IsPCParty ?
"wedding_love" : ((IsMarried || affinity.
IsWeddingHater) ?
"wedding_hater" :
"wedding")));
7421 step =
"wedding_cutter";
7423 base.c_love.gaveCutter =
true;
7425 ShowDialog(
"_chara", step);
7443 EClass.player.flags.loytelEscaped =
false;
7445 ShowDialog(
"loytel",
"loytelEscaped");
7449 if (questDebt !=
null && questDebt.
paid)
7452 if (questDebt.
stage > 7)
7454 questDebt.stage = 7;
7456 ShowDialog(
"loytel",
"debt" + questDebt.
stage);
7464 ShowDialog(
"farris");
7470 ShowDialog(
"farris",
"nymelle_noQuest");
7473 ShowDialog(
"farris",
"nymelle_first");
7476 ShowDialog(
"farris",
"home_first");
7479 ShowDialog(
"farris");
7484 ShowDialog(
"ashland");
7489 SoundManager.ForceBGM();
7496 EClass.player.flags.fiamaFirstDream =
true;
7497 ShowDialog(
"fiama",
"firstDream");
7501 ShowDialog(
"fiama",
"giveStoryBook").SetOnKill(delegate
7503 EClass.player.flags.fiamaStoryBookGiven =
true;
7509 ShowDialog(
"fiama");
7514 ShowDialog(
"fiama");
7520 ShowDialog(
"big_sister",
"little_saved");
7521 EClass.player.flags.little_saved =
false;
7526 ShowDialog(
"big_sister",
"little_dead");
7527 EClass.player.flags.little_killed =
false;
7535 ShowDialog(
"guild_doorman",
"main", tag);
7541 ShowDialog(
"guild_clerk",
"main", tag2);
7550 string book =
"_chara";
7553 string text = GetStr(
"drama_override").IsEmpty(
id);
7554 if (File.Exists(PackageIterator.GetFiles(
"Dialog/Drama/" + text +
".xlsx").LastOrDefault()?.FullName ?? (
CorePath.
DramaData +
id +
".xlsx")))
7564 return _ShowDialog(
book,
null, step, tag);
7570 if (
book ==
"_chara" && IsPC)
7588 return base.LV / 2 + 4;
7594 if (FindBed() !=
null)
7603 return GetHappiness().ToString() ??
"";
7608 string result =
"?????";
7621 uIItem.
text2.
SetText(race.GetText().ToTitleCase(wholeText:
true) +
" " + job.GetText().ToTitleCase(wholeText:
true));
7631 sortVal = job._index * 10000 + sourceCard.
_index;
7634 sortVal = race._index * 10000 * ((!IsHuman) ? 1 : (-1)) + sourceCard.
_index;
7637 sortVal = -GetTotalFeat();
7643 sortVal = sourceCard._index * ((!IsHuman) ? 1 : (-1));
7650 sortVal -= 100000000;
7660 foreach (
Card item in map.props.installed.all)
7664 traitBed.RemoveHolder(
this);
7683 if (!IsPCFaction && !IsGuest())
7692 Msg.
Say(
"claimBed",
this);
7701 if (GetInt(113) != 0)
7706 Thing bestRangedWeapon = GetBestRangedWeapon();
7707 foreach (
Thing thing
in things)
7713 _ListItems.Add(thing);
7717 _ListItems.Add(thing);
7721 if (_ListItems.Count == 0)
7725 List<Thing> containers2 = containers.ToList();
7726 foreach (
Thing listItem
in _ListItems)
7751 bool flag = GetInt(113) == 0;
7760 foreach (
Thing thing3
in things)
7762 if (CanEat(thing3, shouldEat))
7778 if (thing3.
id ==
"polish_powder")
7792 foreach (
Thing container
in containers)
7802 if (num4 > 0 && thing4.
id ==
"polish_powder")
7804 _ListItems.Add(thing4);
7809 _ListItems.Add(thing4);
7814 _ListItems.Add(thing4);
7819 _ListItems.Add(thing4);
7822 else if (num > 0 && CanEat(thing4, shouldEat) && !thing4.
c_isImportant)
7824 _ListItems.Add(thing4);
7829 _ListItems.Add(thing4);
7834 _ListItems.Add(thing4);
7839 if (_ListItems.Count == 0)
7843 _ListItems.ForeachReverse(delegate(
Thing t)
7848 int slot = t.category.slot;
7849 int equipValue = t.GetEquipValue();
7850 foreach (Thing listItem in _ListItems)
7852 if (listItem.category.slot == slot && listItem.GetEquipValue() > equipValue)
7860 _ListItems.Remove(t);
7865 foreach (
Thing listItem2
in _ListItems)
7867 Thing thing = listItem2;
7868 if (things.IsFull(thing))
7877 thing = thing.
Split(1);
7880 else if (thing.
Num > 2)
7882 thing = thing.
Split(2);
7889 if (ShouldEquip(thing, useFav:
true) && thing.
category.slot != 0)
7891 TryEquip(thing, useFav:
true);
7897 TryPutSharedItems(containers);
7903 Thing result =
null;
7911 int num2 = CountNumEaten(
item);
7912 int num3 = 100 - num2 + (
item.HasElement(757) ? 10 : 0);
7926 t = FindBestFoodToEat();
7938 Say(
"eat_start",
this, t.Duplicate(1));
7972 if (!CanEquipRanged(t))
7977 foreach (
Thing thing
in things)
7998 if (bodySlot ==
null)
8004 switch (GetFavAttackStyle())
8043 if (!base.IsPCFactionOrMinion)
8048 if (value.
Value <= 0)
8065 num2 += value.Value * num3 / 100;
8082 if (!ShouldEquip(t, useFav))
8093 switch (GetFavAttackStyle())
8109 body.
Equip(t, slot);
8115 Say(
"equip",
this, t);
8131 return FindThrowable(hotbar:
true);
8135 things.Foreach(delegate(
Thing t)
8137 if (t.
HasTag(
CTAG.throwWeapon) || (!base.IsPCFactionOrMinion && t.
HasTag(
CTAG.throwWeaponEnemy)))
8143 Thing FindThrowable(
bool hotbar)
8145 things.Foreach(delegate(
Thing t)
8182 return things.Find((
Thing t) => ranged.
IsAmmo(t));
8187 Thing result =
null;
8189 foreach (
Thing thing
in things)
8212 if (ranged !=
null && ranged.
parent ==
this)
8216 ranged = GetBestRangedWeapon();
8217 return ranged !=
null;
8222 if (body.
GetWeight(armorOnly:
true) <= (HasElement(1204) ? 6000 : 30000))
8247 if (t.
id ==
"cigar")
8257 if (t.
trait.
CanEat(
this) && hunger.
GetPhase() > ((IsPCFaction || IsPCFactionMinion) ? 2 : 0))
8259 SetAIImmediate(
new AI_Eat
8273 if (base.hp < MaxHP * 90 / 100)
8276 if (healAction !=
null)
8287 return FindBed()?.owner.pos.cell.room;
8302 if (!trait.CanChangeAffinity)
8307 if (IsPCFaction && homeBranch !=
null)
8309 num += (int)Mathf.Sqrt(homeBranch.
Evalue(2117)) * 5;
8326 Say(
"affinityNone",
this, c);
8331 ShowEmo((!flag) ?
Emo.angry :
Emo.love);
8335 Say(flag ?
"affinityPlus" :
"affinityMinus",
this, c);
8341 a = affinity.
Mod(a);
8348 int num = Evalue(289);
8360 num2 += (lV - num) * 10;
8362 elements.
ModExp(289, Mathf.Min(num2, 1000));
8378 chara.orgPos = orgPos.
Copy();
8380 chara.pos = pos.
Copy();
8381 chara.isImported =
true;
8382 chara.c_editorTags = base.c_editorTags;
8383 chara.c_editorTraitVal = base.c_editorTraitVal;
8384 chara.c_idTrait = base.c_idTrait;
8385 chara.homeZone = homeZone;
8393 content.RefreshCharaBio(
this);
8394 if (!content.favFood.IsEmpty() &&
EClass.
sources.
things.map.TryGetValue(content.favFood, out var value))
8399 if (_listFavFood.Count == 0)
8403 if (row._origin ==
"dish" && row.value != 0 && row.chance != 0)
8405 _listFavFood.Add(row);
8412 r = _listFavFood.RandomItem();
8421 content.RefreshCharaBio(
this);
8422 if (!content.favCategory.IsEmpty() &&
EClass.
sources.
categories.map.TryGetValue(content.favCategory, out var value) && value.gift > 0)
8428 if (_listFavCat.Count == 0)
8434 _listFavCat.Add(row);
8440 r = _listFavCat.RandomItem();
8447 if (base.c_love ==
null)
8454 SetFeat(1275, 1, msg:
true);
8460 if (base.c_love !=
null)
8462 base.c_love.dateMarriage = 0;
8463 base.c_love.dateWedding = 0;
8471 using (List<Chara>.Enumerator enumerator = pos.ListCharasInRadius(
this, 3, (
Chara c) => c !=
this && c.
race.id ==
"cat").GetEnumerator())
8473 if (enumerator.MoveNext())
8475 return enumerator.Current;
8483 Say(
"abCatSniff",
this, c);
8488 c.
Talk(
new string[4] {
"labor",
"disgust",
"scold",
"callGuards" }.RandomItem());
8494 if (base.c_upgrades !=
null)
8496 num += base.c_upgrades.spent;
8498 if (base.c_genes !=
null)
8500 num += base.c_genes.GetTotalCost();
8502 return num + base.feat;
8509 if (
item.act.id == 6630)
8519 string text = race.
id;
8520 if ((text ==
"mifu" || text ==
"nefu") &&
EClass.
rnd(2) == 0)
8533 string str = GetStr(
"portrait_override");
8538 if (
id ==
"olderyoungersister")
8540 if (base.idSkin != 2)
8542 return "UN_olderyoungersister";
8544 return "UN_olderyoungersister_alt";
8550 return base.c_idPortrait;
8569 if (HasElement(1231))
8572 AddCondition<ConEuphoric>(100 * Evalue(1231));
8576 SetFeat(1231, 1, msg:
true);
8586 int num2 = ((!HasElement(1411)) ? 1 : 3);
8587 if (GetBurden(t, num) >= num2)
8600 if (!IsValidGiftWeight(t, num))
8617 if (things.IsFull())
8644 Msg.
Say(
"affinityNone", c,
this);
8650 int num2 = 200 + t.LV * 3;
8666 c.
Say(
"draw_curse", c, t);
8668 List<Element> list =
new List<Element>();
8676 if (list.Count == 0)
8681 Element element = list.RandomItem();
8687 if ((t.
id ==
"lovepotion" || t.
id ==
"dreambug") && !Application.isEditor)
8689 GiveLovePotion(c, t);
8703 case "ticket_massage":
8710 case "ticket_armpillow":
8718 case "ticket_champagne":
8725 if (t.
id ==
"flyer")
8730 c.
Talk(
"flyer_miss");
8736 Msg.
Say(
"affinityNone", c,
this);
8738 elements.ModExp(291, 10f);
8741 elements.ModExp(291, 50f);
8743 if (t.
id ==
"statue_weird")
8768 Say(
"give_erohon",
this);
8769 AddCondition<ConParalyze>(50, force:
true);
8770 AddCondition<ConConfuse>(50, force:
true);
8771 AddCondition<ConFear>(1000, force:
true);
8779 c.
Say(
"give_love", c, t);
8789 if (HasCondition<StanceTaunt>() || base.isRestrained || attacker ==
this)
8813 int num = Mathf.Max(chara.
Evalue(1649), (!flag2) ? 1 : 3);
8814 int num2 = Dist(chara);
8819 if (num2 > num || !chara.
CanSeeLos(pos, num2))
8825 Point nearestPoint = pos.
GetNearestPoint(allowBlock:
false, allowChara:
false, allowInstalled:
true, ignoreCenter:
true);
8833 Say(
"intercept_loyal", chara,
this);
8836 if (num2 > num || !chara.
CanSeeLos(pos, num2))
8841 if (!flag && !HasElement(1225))
8843 Say(
"intercept", chara,
this);
8846 chara.
Talk(
"intercept", base.NameSimple);
8848 if (attacker.enemy ==
this)
8850 attacker.SetEnemy(chara);
8913 if (t.
id ==
"flyer")
8938 if (!things.IsAlmostFull())
8967 for (
int num2 = things.Count - 1; num2 >= 0; num2--)
8969 Thing thing = things[num2];
8970 if (ShouldThrowAway(thing, type))
8981 Msg.
Say(
"party_sell",
this, num.ToString() ??
"");
8989 _ = base.c_upgrades;
8998 for (
int i = 0; i < 100; i++)
9004 if (base.c_upgrades ==
null)
9008 if (base.c_upgrades.halt)
9019 List<Element> list = ListAvailabeFeats(pet:
true);
9020 if (num >= 90 && list.Count > 0)
9022 Element element = list.RandomItem();
9026 else if (num >= 60 && ie.Any())
9028 num2 = ie.RandomItem().id;
9039 if (num4 > base.feat)
9044 base.c_upgrades.count++;
9045 base.c_upgrades.spent += num4;
9051 if (
item.idEle == num2)
9072 SetFeat(num2, elements.ValueWithoutLink(num2) + 1, msg:
true);
9074 else if (elements.ValueWithoutLink(row.
id) == 0)
9076 elements.Learn(row.
id);
9080 elements.ModBase(num2, num3);
9087 if (IsPC || base.isScaled || HasElement(1273))
9093 if (base.c_daysWithPC > 360)
9104 if (_cooldowns ==
null)
9106 _cooldowns =
new List<int>();
9110 _cooldowns.Add(idEle * 1000 + turns);
9116 _cooldowns.Add(idEle * 1000 + row.
cooldown);
9122 if (_cooldowns ==
null)
9124 _cooldowns =
new List<int>();
9127 for (
int i = 0; i < _cooldowns.Count; i++)
9129 if (_cooldowns[i] / 1000 == idEle)
9133 _cooldowns.RemoveAt(i);
9137 _cooldowns[i] = idEle * 1000 + turns;
9143 if (!flag && turns > 0)
9145 AddCooldown(idEle, turns);
9147 if (_cooldowns.Count == 0)
9155 return GetCooldown(idEle) != 0;
9160 if (_cooldowns !=
null)
9162 for (
int i = 0; i < _cooldowns.Count; i++)
9164 if (_cooldowns[i] / 1000 == idEle)
9166 return _cooldowns[i] % 1000;
9175 for (
int num = _cooldowns.Count - 1; num >= 0; num--)
9177 if (_cooldowns[num] % 1000 == 1)
9179 _cooldowns.RemoveAt(num);
9186 if (_cooldowns.Count == 0)
9199 if (IsPCParty || base.noMove)
9204 if ((IsHomeMember() && IsInHomeZone()) || IsGuest())
9207 if (goalFromTimeTable !=
null)
9209 SetAI(goalFromTimeTable);
9212 goalFromTimeTable.
Tick();
9217 if (goalList.
index == -2)
9219 goalList.
Refresh(
this, goalListType);
9221 SetAI(goalList.
Next());
9245 return GetGoalWork();
9251 return GetGoalHobby();
9286 if (_works ==
null || _hobbies ==
null)
9290 foreach (
int work
in _works)
9297 foreach (
int hobby
in _hobbies)
9318 return SetAI(_NoGoalPC);
9336 Debug.Log(
"goal is g:" + ai?.ToString() +
"/" +
this);
9340 if (HasCondition<ConWait>())
9342 RemoveCondition<ConWait>();
9348 renderer.RefreshStateIcon();
9355 bool hasNoGoal = HasNoGoal;
9390 listHobby.Add(
new Hobby
9401 foreach (
int work
in _works)
9403 listHobby.Add(
new Hobby
9417 if (_hobbies ==
null)
9421 foreach (
int hobby
in _hobbies)
9423 listHobby.Add(
new Hobby
9436 if (
item.source.alias ==
id)
9441 foreach (
Hobby item2
in ListHobbies())
9443 if (item2.
source.alias ==
id)
9453 if (workElements !=
null)
9457 workElements =
null;
9458 if (IsPCParty || homeBranch ==
null || homeBranch.
owner ==
null)
9466 foreach (
Hobby item2
in ListWorks())
9470 if (workElements !=
null)
9474 void TryAdd(
Hobby h)
9476 if (!h.
source.elements.IsEmpty())
9478 if (workElements ==
null)
9482 for (
int i = 0; i < h.
source.elements.Length; i += 2)
9484 int num = h.
source.elements[i];
9485 int num2 = h.
source.elements[i + 1];
9487 if (num != 2115 && num != 2207)
9495 workElements.
ModBase(num, (num2 < 0) ? (num2 / 10) : Mathf.Max(1, h.
source.elements[i + 1] * num3 / 1000));
9503 string text = (simple ?
"" : (
"hobby".lang() +
":"));
9508 return text.TrimEnd(
',');
9513 string text = (simple ?
"" : (
"work".lang() +
":"));
9518 return text.TrimEnd(
',');
9523 foreach (
int hobby
in _hobbies)
9535 foreach (
int work
in _works)
9547 if (_hobbies !=
null && _works !=
null)
9554 _hobbies =
new List<int>();
9555 _works =
new List<int>();
9563 string[] hobbies = source.
hobbies;
9564 foreach (
string text
in hobbies)
9571 ModUtil.LogModError(
"source chara row '" + source.
id +
"' has invalid hobby '" + text +
"'", source);
9574 if (source.
works.IsEmpty())
9580 string[] hobbies = source.
works;
9581 foreach (
string text2
in hobbies)
9588 ModUtil.LogModError(
"source chara row '" + source.
id +
"' has invalid work '" + text2 +
"'", source);
9591 GetWorkSummary().Reset();
9596 if (_workSummary ==
null)
9600 return _workSummary;
9613 if (workSummary.
work !=
null)
9618 else if (workSummary.
hobbies.Count > 0)
9639 hobby.id = session.
id;
9644 workSummary.progress +=
EClass.
rnd(5) + 5;
9646 int num = PerformWork(hobby, 0, isHobby);
9647 int num2 = PerformWork(hobby, 1, isHobby);
9648 int num3 = PerformWork(hobby, 2, isHobby);
9649 int num4 = PerformWork(hobby, 3, isHobby);
9650 workSummary.money += num;
9651 workSummary.food += num2;
9652 workSummary.knowledge += num3;
9653 workSummary.material += num4;
9654 int PerformWork(
Hobby work,
int idx,
bool isHobby)
9656 if (idx >= work.
source.resources.Length)
9660 int num5 = work.
source.resources[idx];
9662 num5 =
Rand.
Range(num5 * (100 - work.
source.resources[idx]) / 100, num5);
9663 num5 = num5 * (isHobby ? 50 : 100) * session.
efficiency / 10000;
9664 if (num6 > 0 && num5 <= 0)
9674 _goalWork.
FindWork(
this, setAI:
false);
9690 foreach (
Condition condition
in conditions)
9692 condition.
SetOwner(
this, onDeserialize);
9698 return AddCondition(typeof(T).Name, p, force);
9711 if (c is
ConBleed && ResistLv(964) >= 3)
9716 else if (ResistLv(950) >= 3)
9734 if (c.
source.negate.Length != 0)
9736 string[] negate = c.
source.negate;
9737 foreach (
string text
in negate)
9739 if (HasElement(text))
9746 if (defenseAttribute !=
null)
9748 c.power = 100 * c.power / Mathf.Max(100 + defenseAttribute.
Value, 1);
9750 if (c.
source.resistance.Length != 0)
9755 c.power /= num * num + 1;
9771 num2 = num2 * (100 + (int)Mathf.Sqrt(Evalue(494)) * 10) / 100;
9777 for (
int j = 0; j < conditions.Count; j++)
9779 if (conditions[j].
id != c.
id)
9785 conditions[j].Kill();
9788 if (conditions[j].CanStack(c))
9790 if (conditions[j].ShouldOverride(c))
9792 if (conditions[j].IsOverrideConditionMet(c, num2))
9794 conditions[j].Kill(silent:
true);
9799 if (CanGainConResist)
9803 conditions[j].OnStacked(c.
power);
9804 conditions[j].OnStartOrStack();
9805 conditions[j].PlayEffect();
9807 if (!conditions[j].AllowMultipleInstance)
9812 foreach (
Condition condition
in conditions)
9821 if (CanGainConResist)
9828 if (c.ShouldRefresh)
9840 if (c.SyncRide && (ride !=
null || parasite !=
null))
9846 if (parasite !=
null)
9854 public override bool HasCondition<T>()
9856 for (
int i = 0; i < conditions.Count; i++)
9858 if (conditions[i] is T)
9868 for (
int i = 0; i < conditions.Count; i++)
9870 if (conditions[i].source.alias == alias)
9885 for (
int i = 0; i < conditions.Count; i++)
9889 return conBuffStats.elements.GetElement(ele);
9898 foreach (
Condition condition
in conditions)
9908 public void CureCondition<T>(
int v = 99999) where T :
Condition
9910 T condition = GetCondition<T>();
9911 if (condition !=
null)
9913 condition.value -= v;
9914 if (condition.value <= 0)
9921 public override T GetCondition<T>()
9923 for (
int i = 0; i < conditions.Count; i++)
9925 if (conditions[i] is T)
9927 return conditions[i] as T;
9935 for (
int num = conditions.Count - 1; num >= 0; num--)
9937 if (conditions[num] is T)
9939 conditions[num].
Kill();
9947 if (parasite !=
null)
9949 parasite.
Cure(type, p, state);
9953 ride.
Cure(type, p, state);
9955 Cure(type, p, state);
9965 CureCondition<ConFear>();
9966 CureCondition<ConBlind>(2 * p / 100 + 5);
9967 CureCondition<ConPoison>(5 * p / 100 + 5);
9968 CureCondition<ConConfuse>(10 * p / 100 + 10);
9969 CureCondition<ConDim>(p / 100 + 5);
9970 CureCondition<ConBleed>(2 * p / 100 + 10);
9977 CureCondition<ConBlind>(5 * p / 100 + 15);
9978 CureCondition<ConPoison>(10 * p / 100 + 15);
9979 CureCondition<ConBleed>(5 * p / 100 + 20);
9980 CureTempElements(p, body:
true, mind:
false);
9983 CureCondition<ConFear>();
9984 CureCondition<ConDim>(3 * p / 100 + 10);
9985 CureTempElements(p, body:
false, mind:
true);
9989 for (
int num2 = conditions.Count - 1; num2 >= 0; num2--)
9991 Condition condition2 = conditions[num2];
9996 condition2.
Mod(-1, force:
true);
10004 CureCondition<ConWait>();
10005 CureCondition<ConDisease>((
EClass.
rnd(20) + 10) * p / 100);
10006 bool flag2 = HasCondition<ConAnorexia>();
10007 base.c_vomit -= (flag2 ? 3 : 2) * p / 100;
10008 if (base.c_vomit < 0)
10013 RemoveCondition<ConAnorexia>();
10024 CureTempElements(p * 100, body:
true, mind:
true);
10025 for (
int num = conditions.Count - 1; num >= 0; num--)
10032 switch (condition.
Type)
10052 CureCondition<ConWait>();
10053 CureCondition<ConSleep>();
10060 RemoveCondition<ConBrightnessOfLife>();
10061 RemoveCondition<ConDeathSentense>();
10065 if (HasElement(1206))
10067 SetFeat(1206, 0, msg:
true);
10069 RemoveCondition<ConBrightnessOfLife>();
10070 RemoveCondition<ConDeathSentense>();
10084 for (
int num = conditions.Count - 1; num >= 0; num--)
10100 if (
TC.hp > (
long)
TC.MaxHP * (
long)(Mathf.Min(5 + (
int)Mathf.Sqrt(power),
harvest ? 35 : 25) + Evalue(1426) * 5) / (
TC.IsPowerful ? 200 : 100))
10104 if (
TC.HasElement(427))
10112 PlaySound(
"hit_finish");
10114 Say(
"finish2",
this,
TC);
10124 if (resistCon ==
null)
10126 resistCon =
new Dictionary<int, int>();
10128 if (resistCon.ContainsKey(key))
10130 resistCon[key] += con.power * con.GainResistFactor / 100;
10134 resistCon[key] = con.power * con.GainResistFactor / 100;
10141 if (con.
power > 0 && resistCon !=
null)
10143 int a =
ClassExtension.TryGetValue<int,
int>((IDictionary<int, int>)resistCon, con.
id, 0);
10165 RemoveCondition<ConAwakening>();
10170 con.pcPillow = pillow;
10171 con.pickup = pickup;
10172 con.posBed = posBed;
10173 con.posPillow = posPillow;
10179 bool isSunLit = pos.IsSunLit;
10181 int num =
bed?.Power ?? 20;
10182 if (traitPillow !=
null)
10184 num += traitPillow.owner.Power / 2;
10188 num +=
bed.Evalue(750) * 5;
10194 OnSleep(num, days, isSunLit);
10197 public void OnSleep(
int power,
int days = 1,
bool isSunLit =
false)
10203 int num = power * days;
10204 if (stamina.
value < 0)
10208 if (isWeakToSunlight && isSunLit)
10211 if (mana.
value > 0)
10215 AddCondition<ConBurning>(1000, force:
true);
10220 stamina.
Mod(10 + 25 * num / 100 * (100 + elements.GetFeatRef(1642)) / 100);
10237 if (!HasElement(450))
10239 long num = bio.height;
10240 num = num * (100 + a) / 100 + ((a > 0) ? 1 : (-1));
10245 if (num > 999999999)
10249 if (num != bio.height)
10251 bio.height = (int)num;
10252 Say((a > 0) ?
"height_gain" :
"height_lose",
this);
10259 if (HasElement(450) || a == 0)
10263 long num = bio.weight;
10264 long num2 = bio.height;
10265 long num3 = num2 * num2 * 18 / 25000;
10266 long num4 = num2 * num2 * 24 / 10000;
10267 if (ignoreLimit || (num > num3 && num < num4))
10269 num = num * (100 + a) / 100 + ((a > 0) ? 1 : (-1));
10274 if (num > 999999999)
10278 if (num != bio.weight)
10280 bio.weight = (int)num;
10281 Say((a > 0) ?
"weight_gain" :
"weight_lose",
this);
10290 if (Evalue(962) >= 25 || (ResistLv(962) > 0 &&
EClass.
rnd(ResistLv(962) + 1) != 0))
10294 int num = Evalue(412);
10297 float num2 = (float)a * 100f / (
float)Mathf.Max(100 + num * 2, 10);
10298 a = (int)num2 + ((
EClass.
rndf(1f) < num2 % 1f) ? 1 : 0);
10305 int num3 = (corruption + a) / 100 - corruption / 100;
10306 for (
int i = 0; i < Mathf.Abs(num3); i++)
10308 if (!MutateRandom((num3 > 0) ? 1 : (-1), 100, ether:
true))
10315 foreach (
Element value
in elements.dict.Values)
10317 if (value.
source.category ==
"ether")
10319 num4 += value.
Value;
10322 if (num4 > 0 && IsPC)
10326 corruption = num4 * 100 + corruption % 100;
10331 List<Element> list =
new List<Element>();
10334 Feat feat = elements.GetOrCreateElement(
item.id) as
Feat;
10335 int num = ((feat.ValueWithoutLink <= 0) ? 1 : (feat.
ValueWithoutLink + 1));
10344 public void SetFeat(
int id,
int value = 1,
bool msg =
false)
10346 Feat feat = elements.GetElement(
id) as
Feat;
10348 if (feat !=
null && feat.
Value > 0)
10350 if (value == feat.
Value)
10357 feat = elements.SetBase(
id, value - (feat?.vSource ?? 0)) as
Feat;
10358 if (feat.
Value != 0)
10365 CalculateMaxStamina();
10371 if (feat.
source.textInc.IsEmpty())
10373 PlaySound(
"ding_skill");
10375 Say(
"gainFeat",
this, feat.
FullName);
10379 bool flag = value < num;
10380 if (feat.
source.tag.Contains(
"neg"))
10389 PlaySound(
"chime_angel");
10395 PlaySound(
"chime_devil");
10399 PlaySound(
"mutation");
10403 Say((value > num) ? feat.
source.GetText(
"textInc") : feat.
source.GetText(
"textDec"),
this, feat.
FullName);
10405 elements.CheckSkillActions();
10412 Element element = elements.GetElement(idEle);
10413 Element element2 = elements.GetElement(row2.
id);
10414 int num = element?.
Value ?? 0;
10423 bool flag = (row.
tag.Contains(
"neg") ? (a > num) : (a < num));
10424 if (a == 0 && (element ==
null || element.
Value == 0))
10426 SayNothingHappans();
10429 if (element !=
null && element.
Value == a)
10431 SayNothingHappans();
10434 if (element2 !=
null && element2.
Value > 0)
10436 SetFeat(element2.
id, 0);
10439 PlaySound(
"mutation");
10440 PlayEffect(
"mutation");
10442 Say(row.GetText(flag ?
"textDec" :
"textInc", returnNull:
true) ?? row.
alias,
this);
10447 if (!ether && vec >= 0 && HasElement(406) &&
EClass.
rnd(5) != 0)
10449 Say(
"resistMutation",
this);
10453 for (
int i = 0; i < tries; i++)
10456 if (i == 0 && vec < 0 && ether && base.c_corruptionHistory != null && base.c_corruptionHistory.Count > 0)
10462 base.c_corruptionHistory.RemoveAt(base.c_corruptionHistory.Count - 1);
10463 if (base.c_corruptionHistory.Count == 0)
10465 base.c_corruptionHistory =
null;
10468 Element element = elements.GetElement(row.
id);
10470 if ((vec > 0 && ((row.
id == 1563 && corruption < 300) || (row.
id == 1562 && corruption < 1000 && base.IsPowerful))) || (vec < 0 && (element ==
null || element.
Value <= 0)) || (vec > 0 && element !=
null && element.
Value >= row.
max))
10477 element = elements.GetElement(row.
id);
10479 bool flag = row.
tag.Contains(
"neg");
10492 if (element !=
null)
10494 num = element.Value + ((vec != 0) ? vec : ((
EClass.
rnd(2) == 0) ? 1 : (-1)));
10495 if (num > element.
source.max)
10497 num = element.source.max - 1;
10499 flag = (flag && num > element.
Value) || (!flag && num < element.
Value);
10500 flag2 = num > element.
Value;
10501 if (vec > 0 && !flag2)
10506 Say(flag2 ?
"mutation_gain" :
"mutation_loose",
this);
10507 SetFeat(row.
id, num);
10508 if (flag2 && ether)
10510 if (base.c_corruptionHistory ==
null)
10512 base.c_corruptionHistory =
new List<int>();
10514 base.c_corruptionHistory.Add(row.
id);
10517 Element element2 = elements.GetElement(row.
id);
10522 EClass.player.flags.gotEtherDisease =
true;
10524 thing.
SetStr(53,
"letter_ether");
10533 PlaySound(ether ?
"mutation_ether" :
"mutation");
10534 PlayEffect(
"mutation");
10536 Say(row.GetText(flag ?
"textDec" :
"textInc", returnNull:
true) ?? row.
alias,
this);
10540 Say(
"nothingHappens");
10546 Element orCreateElement = elements.GetOrCreateElement(ele);
10549 elements.ModBase(orCreateElement.
id, 1);
10551 if (orCreateElement is
Spell)
10553 int num =
EClass.
curve(Evalue(307), 50, 20) + (HasElement(307) ? 20 : 0);
10554 int num2 = origin?.Evalue(765) ?? 0;
10555 num = num * (100 - num2) / 100;
10556 int a = mtp * orCreateElement.source.charge * (100 + num) / 100 / 100;
10558 if (orCreateElement.
source.charge == 1)
10562 orCreateElement.vPotential += a;
10564 Say(
"spell_gain",
this, orCreateElement.
Name);
10576 Msg.
Say(
"curse_nullify", member);
10581 else if (HasElement(1641) &&
EClass.
rnd(3) != 0)
10583 Say(
"curse_nullify",
this);
10586 if (GetCondition<ConHolyVeil>() !=
null &&
EClass.
rnd(5) != 0)
10588 Say(
"curse_nullify",
this);
10596 if (_historyFood !=
null)
10598 while (_historyFood.Count > 5)
10600 _historyFood.RemoveAt(_historyFood.Count - 1);
10602 if (_historyFood[0].Count > 0)
10604 _historyFood.Insert(0,
new List<string>());
10611 if (!IsPCFaction || !IsGlobal)
10613 _historyFood =
null;
10616 if (_historyFood ==
null)
10618 _historyFood =
new List<List<string>>
10623 if (_historyFood[0].Count < 5)
10625 _historyFood[0].Add(
food.id);
10631 if (_historyFood ==
null)
10636 foreach (List<string>
item in _historyFood)
10638 foreach (
string item2
in item)
10640 if (item2 ==
food.id)
10653 return 10 + (int)(Mathf.Sqrt(base.c_daysWithGod) * 2f + (float)Evalue(85)) / 2;
10655 return 10 + (int)(Mathf.Sqrt(base.LV) * 5f + (float)Evalue(306)) / 2;
10660 if (faithElements !=
null)
10665 if (idFaith ==
"eyth" && !HasElement(1228))
10675 if (!HasCondition<ConExcommunication>())
10683 int num = GetPietyValue() * (120 + Evalue(1407) * 15 + Evalue(1228) * 20) / 100;
10684 for (
int i = 0; i < array.Length; i += 2)
10686 int num2 = array[i + 1] * num / 50;
10687 if (array[i] == 79)
10689 num2 =
EClass.
curve(num2, array[i + 1] * 2, 10, 50);
10691 if (num2 >= 20 && array[i] >= 950 && array[i] < 970)
10695 faithElements.
SetBase(array[i], Mathf.Max(num2, 1));
10701 public void ModTempElement(
int ele,
int a,
bool naturalDecay =
false,
bool onlyRenew =
false)
10707 bool flag = HasElement(1215);
10708 if (tempElements ==
null)
10717 int num = elements.ValueWithoutLink(ele);
10718 int num2 = Mathf.Abs(num) + 100;
10719 int num3 = num2 / (flag ? 2 : 4);
10720 int num4 = -num - 100;
10721 int num5 = tempElements.
Base(ele);
10722 int num6 = num5 + a;
10725 num3 = Mathf.Min(a, num3);
10726 num4 = Mathf.Max(a, -num2 / 3);
10728 if (a > 0 && num6 > num3)
10730 a = ((num3 > num5) ? (num3 - num5) : 0);
10732 if (a < 0 && num6 < num4)
10734 a = ((num4 < num5) ? (num4 - num5) : 0);
10737 if (element.
vBase == 0)
10740 if (tempElements.
dict.Count == 0)
10742 tempElements =
null;
10761 ModTempElement(ele, onlyRenew ? (-p / 20) : (-(p / 100 +
EClass.
rnd(p / 100 + 1) + 1)), naturalDecay:
false, onlyRenew);
10767 foreach (
int ele
in array)
10769 EnhanceTempElement(ele, p, onlyRenew);
10775 ModTempElement(ele, onlyRenew ? (p / 20) : (p / 100 +
EClass.
rnd(p / 100 + 1)), naturalDecay:
false, onlyRenew);
10780 if (tempElements ==
null)
10786 if (
item.vBase > 0)
10788 ModTempElement(
item.id, -Mathf.Min(
item.vBase * 5 / 100 + 1,
item.vBase), naturalDecay:
true);
10795 if (tempElements !=
null)
10806 void Cure(
int[] eles)
10808 foreach (
int ele
in eles)
10810 if (tempElements ==
null)
10815 if (element !=
null && element.
vBase < 0)
10817 ModTempElement(ele, Mathf.Clamp(p / 20 +
EClass.
rnd(p / 20), 1, -element.
vBase));
10825 if (tempElements !=
null)
10828 tempElements =
null;
static Act Create(int id)
virtual bool ShouldAllyAttack(Chara tg)
virtual bool CancelOnAggro
override string ToString()
virtual bool CancelWhenMoved
string GetCurrentActionText()
virtual Point GetDestination()
virtual void OnPerformWork(bool realtime)
bool TryCancelInteraction(bool sound=true)
void SetTurbo(int mtp=-1)
static void ProcAt(EffectId id, int power, BlessedState state, Card cc, Card tc, Point tp, bool isNeg, ActRef actRef=default(ActRef))
static void Unride(Chara host, Chara mount, bool talk=true)
static EffectIRenderer Throw(Card c, Point p, Thing t, ThrowMethod method=ThrowMethod.Default, float failChance=0f)
static void Search(Chara c, bool manual=false)
virtual TargetType TargetType
virtual bool ValidatePerform(Chara _cc, Card _tc, Point _tp)
bool IsTargetHostileParty()
virtual bool CanRapidFire
static Affinity Get(Chara c)
virtual RendererReplacer GetRendererReplacer()
virtual bool PreventRegen
virtual int EvaluatePower(int p)
virtual int GainResistFactor
virtual bool TryMove(Point p)
Element GetDefenseAttribute(Chara c=null)
virtual int EvaluateTurn(int p)
void Mod(int a, bool force=false)
virtual void SetOwner(Chara _owner, bool onDeserialize=false)
virtual bool TryNullify(Condition c)
virtual void OnEndPlayerTurn()
virtual ConditionType Type
virtual string GetPhaseStr()
static int GetColorInt(ref Color matColor, int p)
static void Set(CardBlueprint _bp=null)
static CardBlueprint CharaGenEQ
GlobalCharaList globalCharas
void PlayAnime(AnimeID id, bool force)
RendererReplacer replacer
virtual string GetName(NameStyle style, int num=-1)
void Teleport(Point point, bool silent=false, bool force=false)
int EvalueMax(int ele, int min=0)
void MakeFigureFrom(string id)
ElementContainerCard elements
Hostility c_originalHostility
SourceMaterial.Row material
SoundSource PlaySound(string id, float v=1f, bool spatial=true)
Card ChangeMaterial(int idNew, bool ignoreFixedMaterial=false)
void SetInt(string id, int value=0)
Card MakeRefFrom(string id)
virtual int GetPrice(CurrencyType currency=CurrencyType.Money, bool sell=false, PriceType priceType=PriceType.Default, Chara c=null)
virtual CardRenderer _CreateRenderer()
Thing AddThing(string id, int lv=-1)
void Talk(string idTopic, string ref1=null, string ref2=null, bool forceSync=false)
virtual void SetBlessedState(BlessedState s)
Effect PlayEffect(string id, bool useRenderPos=true, float range=0f, Vector3 fix=default(Vector3))
void ShowEmo(Emo _emo=Emo.none, float duration=0f, bool skipSame=true)
void ModCurrency(int a, string id="money")
virtual bool IsAliveInCurrentZone
void DamageHP(long dmg, AttackSource attackSource=AttackSource.None, Card origin=null)
void SetStr(string id, string value=null)
BlessedState blessedState
bool TryStackTo(Thing to)
virtual bool IsPCFactionMinion
void ApplyBacker(int bid)
void ModExp(string alias, int a)
void PlayAnime(AnimeID id, bool force=false)
SourceCategory.Row category
void ModNum(int a, bool notify=true)
virtual RenderRow TileRow
void AddExp(int a, bool applyMod=true)
bool HasElement(int ele, bool includeNagative=false)
void Say(string lang, string ref1=null, string ref2=null)
Thing MakeEgg(bool effect=true, int num=1, bool addToZone=true, int fertChance=20, BlessedState? state=null)
SourceCellEffect.Row source
SourceBlock.Row sourceBlock
SourceFloor.Row sourceFloor
SourceMaterial.Row matObj
SourceFloor.Row sourceBridge
SourceMaterial.Row matFloor
SourceFloor.Row sourceSurface
void RemoveBodyPartAt(int idx)
void SetOwner(Chara chara, bool deserialized=false)
void AddBodyPart(int ele, Thing thing=null)
bool HasElement(int idEle)
bool IsTooHeavyToEquip(Thing thing)
AttackStyle GetAttackStyle()
bool IsEquippable(Thing thing, BodySlot slot, bool text=true)
int GetWeight(bool armorOnly=false)
bool Equip(Thing thing, BodySlot slot=null, bool msg=true)
BodySlot GetSlot(Thing t, bool onlyEmpty=false, bool secondSlot=false)
void RemoveBodyPart(int ele)
static Chara CreateFromFilter(string id, int lv=-1, int levelRange=-1)
static Chara Create(string id, int lv=-1)
override void SetOwner(Card c)
SourceCategory.Row GetFavCat()
void DamageTempElement(int ele, int p, bool onlyRenew=false)
bool UseAbility(string idAct, Card tc=null, Point pos=null, bool pt=false)
void Refresh(bool calledRecursive=false)
void ChangeRace(string idNew)
bool HasHobbyOrWork(string alias)
static List< Chara > _pts
override string actorPrefab
override bool IsAliveInCurrentZone
bool IsFriendOrAbove(Chara c)
int GetBurden(Card t=null, int num=-1)
override void ApplyEditorTags(EditorTag tag)
Thing FindBestFoodToEat()
Hostility OriginalHostility
void TryPickGroundItem(Func< Card, bool > func=null)
LayerDrama _ShowDialog(string book, string sheet, string step="main", string tag="")
bool CanAcceptGift(Chara c, Card t)
WorkSummary GetWorkSummary()
override void Rotate(bool reverse=false)
Chara TryDuplicate(DuplicateCondition con=DuplicateCondition.Default, Point dest=null)
Chara CreateReplacement()
override Sprite GetImageSprite()
void MoveHome(Zone zone, int x=-1, int z=-1)
void ChangeMemberType(FactionMemberType type)
void CureTempElements(int p, bool body, bool mind)
bool TryNeckHunt(Chara TC, int power, bool harvest=false)
Element GetBuffStats(string alias)
void Cuddle(Chara c, bool headpat=false)
List< Chara > ListFussableCharas(int radius=2)
bool IsCriticallyWounded(bool includeRide=false)
void ModTempElement(int ele, int a, bool naturalDecay=false, bool onlyRenew=false)
bool CanInteractTo(Point p)
override void SetSortVal(UIList.SortMode m, CurrencyType currency=CurrencyType.Money)
void TryPutShared(Thing t, List< Thing > containers=null, bool dropIfFail=true)
void CureHost(CureType type, int p=100, BlessedState state=BlessedState.Normal)
void RefreshWorkElements(ElementContainer parent=null)
bool MutateRandom(int vec=0, int tries=100, bool ether=false, BlessedState state=BlessedState.Normal)
void InstantEat(Thing t=null, bool sound=true)
Goal GetGoalFromTimeTable(int hour)
Condition AddCondition(string id, int p=100, bool force=false)
override Sprite GetSprite(int dir=0)
Thing FindAmmo(Thing weapon)
void ModAffinity(Chara c, int a, bool show=true, bool showOnlyEmo=false)
GoalListType goalListType
bool CanAcceptItem(Card t, int num=-1, bool skipImportantCheck=false)
override CardRow sourceRenderCard
override int GetArmorSkill()
void EnhanceTempElement(int ele, int p, bool onlyRenew=false)
void SetFaith(Religion r)
bool IsValidGiftWeight(Card t, int num=-1)
Condition AddCondition(Condition c, bool force=false)
Point GetFirstStep(Point newPoint, PathManager.MoveType moveType=PathManager.MoveType.Default)
Chara GetNearbyCatToSniff()
static List< SourceCategory.Row > _listFavCat
void SetFeat(int id, int value=1, bool msg=false)
bool CanSeeLos(Card c, int dist=-1)
override MoveResult TryMove(Point newPoint, bool allowDestroyPath=true)
override void WriteNote(UINote n, Action< UINote > onWriteNote=null, IInspect.NoteMode mode=IInspect.NoteMode.Default, Recipe recipe=null)
override string ToString()
void TryTakeSharedItems(IEnumerable< Thing > containers, bool msg=true, bool shouldEat=true)
ElementContainer tempElements
void TryPutSharedItems(bool msg=true)
void SetMainElement(int id, int v=0, bool elemental=false)
void ApplyRace(bool remove=false)
bool RequestProtection(Chara attacker, Action< Chara > action)
bool TryWorkOutside(SourceHobby.Row sourceWork)
override void OnSerializing()
List< Condition > conditions
void SetMutation(int idEle, int a=0)
void HoldCard(Card t, int num=-1)
void PickHeld(bool msg=false)
bool HasCondition(string alias)
SpriteReplacer spriteReplacer
static List< Thing > _ListItems
Chara SetHomeZone(Zone zone)
Chara SetFaction(Faction f)
void SetMainElement(string id, int v=0, bool elemental=false)
Thing GetBestRangedWeapon()
bool CanDuplicate(DuplicateCondition con=DuplicateCondition.Default)
void DiminishTempElements(int a=1)
override string GetName(NameStyle style, int num=-1)
Chara SetGlobal(Zone _home, int x, int z)
void EnhanceTempElements(int p, bool body, bool mind, bool onlyRenew=false)
override string GetHoverText()
override void OnDeserialized()
override void SetSource()
bool TryHoldCard(Card t, int num=-1, bool pickHeld=false)
static List< Hobby > listHobby
int CalcCastingChance(Element e, int num=1)
bool ShouldEquip(Thing t, bool useFav=false)
bool CanMoveTo(Point p, bool allowDestroyPath=true)
bool HasMinion(string id)
void DestroyPath(Point pos)
override CardRenderer _CreateRenderer()
void PickOrDrop(Point p, string idThing, int idMat=-1, int num=1, bool msg=true)
void TryPutSharedItems(IEnumerable< Thing > containers, bool msg=true)
override bool IsPCFaction
override bool IsPCPartyMinion
void CalculateMaxStamina()
void MoveZone(Zone z, ZoneTransition transition)
void TryUpgrade(bool msg=true)
void MakeMinion(Chara _master, MinionType type=MinionType.Default)
override void LookAt(Point p)
List< Element > ListAvailabeFeats(bool pet=false, bool showAll=false)
override bool IsPCFactionMinion
void SetCooldown(int idEle, int turns=0)
void Slap(Chara c, bool slapToDeath=false)
override MoveResult _Move(Point newPoint, MoveType type=MoveType.Walk)
bool CanEat(Thing t, bool shouldEat=false)
bool ShouldThrowAway(Thing t, ClearInventoryType type)
ElementContainer _baseWorkElements
override void Die(Element e=null, Card origin=null, AttackSource attackSource=AttackSource.None, Chara originalTarget=null)
bool TryFuse(int chance=10)
void SetAIImmediate(AIAct g)
void PerformWork(WorkSession session, bool isHobby=false, bool IsRealTime=false)
void PickOrDrop(Point p, Thing t, bool msg=true)
static GoalHobby _goalHobby
override bool IsDeadOrSleeping
List< Hobby > ListHobbies(bool useMemberType=true)
void MakeAlly(bool msg=true)
void RemoveLastBodyPart(bool msg=false)
ElementContainer baseWorkElements
void TickWork(VirtualDate date)
void Stumble(int mtp=100)
void ClearInventory(ClearInventoryType type)
void GainAbility(int ele, int mtp=100, Thing origin=null)
void MoveByForce(Point newPoint, Card c=null, bool checkWall=false)
FactionMemberType memberType
string TalkTopic(string topic="calm")
string GetIdPortraitCat()
bool HasHigherGround(Card c)
void TryRestock(bool onCreate)
void RestockInventory(bool onCreate)
List< List< string > > _historyFood
bool MoveNeighborDefinitely()
bool UseAbility(int idAct, Card tc=null, Point pos=null, bool pt=false)
bool visibleWithTelepathy
void ChangeJob(string idNew)
SourceThing.Row GetFavFood()
void SetTempHand(int right=0, int left=0)
void ApplyJob(bool remove=false)
void AddRandomBodyPart(bool msg=false)
List< Hobby > ListWorks(bool useMemberType=true)
Card DropHeld(Point dropPos=null)
void Revive(Point p=null, bool msg=false)
void TryReservePickupTutorial(Thing t)
LayerDrama ShowDialog(string book, string step="main", string tag="")
void RefreshFaithElement()
ElementContainer faithElements
override void ChangeRarity(Rarity r)
void GiveLovePotion(Chara c, Thing t)
void AddCooldown(int idEle, int turns=0)
void RerollHobby(bool extraSlotChance=true)
Thing MakeGene(DNA.Type? type=null)
void RefreshSpeed(Element.BonusInfo info=null)
static List< SourceRace.Row > ListAdvRace
bool CanBeTempAlly(Chara c)
int GetCooldown(int idEle)
override string AliasMaterialOnCreate
void ModWeight(int a, bool ignoreLimit=false)
void AddFoodHistory(Thing food)
override CardRow sourceCard
bool CanInteractTo(Card c)
string GetTopicText(string topic="calm")
static NoGoal _NoGoalRepeat
void ModCorruption(int a)
void RestockEquip(bool onCreate)
override void SetDir(int d)
MoveResult TryMoveTowards(Point p)
bool FindNearestNewEnemy()
Element GetFavWeaponSkill()
void DropThing(Thing t, int num=-1)
void GiveGift(Chara c, Thing t)
void EQ_Item(string s, int num=1)
string GetTextHappiness()
override bool IsMultisize
Chara SetEnemy(Chara c=null)
void CallHelp(Chara tg, bool fanatic=false)
void DoHostileAction(Card _tg, bool immediate=false)
bool CanSeeSimple(Point p)
Thing EQ_ID(string s, int mat=-1, Rarity r=Rarity.Random)
void ClearBed(Map map=null)
override void SetRenderParam(RenderParam p)
void AddResistCon(Condition con)
void MoveZone(Zone z, ZoneTransition.EnterState state=ZoneTransition.EnterState.Auto)
bool UseAbility(Act a, Card tc=null, Point pos=null, bool pt=false)
bool TryEquip(Thing t, bool useFav=false)
override SubPassData GetSubPassData()
bool CanSeeLos(Point p, int dist=-1)
int CountNumEaten(Thing food)
void ResistCon(Condition con)
void SetSummon(int duration)
Element GetFavArmorSkill()
void DamageTempElements(int p, bool body, bool mind, bool onlyRenew=false)
bool IsEnemyOnPath(Point p, bool cancelAI=true)
void InitStats(bool onDeserialize=false)
void MoveHome(string id, int x=-1, int z=-1)
bool TryIdentify(Thing t, int count=1, bool show=true)
Thing TryPoisonPotion(Thing t)
void TryTakeSharedItems(bool msg=true)
override void LookAt(Card c)
static List< SourceThing.Row > _listFavFood
ConBaseTransmuteMimic mimicry
void Cure(CureType type, int p=100, BlessedState state=BlessedState.Normal)
static string[] IDTimeTable
TimeTable.Span CurrentSpan
Chara SetHostility(Hostility h)
Thing Pick(Thing t, bool msg=true, bool tryStack=true)
void TrySetEnemy(Chara c)
override void OnCreate(int genLv)
void TryAbsorbRod(Thing t)
string GetTextWork(bool simple=false)
void TryPush(Point point)
string GetTextHobby(bool simple=false)
Dictionary< int, int > resistCon
void OnSleep(Thing bed=null, int days=1)
override string GetHoverText2()
int ParseBodySlot(string s)
bool CanEquipRanged(Thing t)
void Sleep(Thing bed=null, Thing pillow=null, bool pickup=false, ItemPosition posBed=null, ItemPosition posPillow=null)
void OnGiveErohon(Thing t)
AttackStyle GetFavAttackStyle()
bool HasCooldown(int idEle)
static GoalWork _goalWork
void OnSleep(int power, int days=1, bool isSunLit=false)
void DoAI(int wait, Action onPerform)
ElementContainer workElements
static List< SourceJob.Row > ListAdvJob
void MoveZone(string alias)
void SetPCCState(PCCState state)
Element GetBuffStats(int ele)
void MakeGrave(string lastword)
override void OnBeforeCreate()
bool DroppedCard(string id)
void MarkCardDrop(string id)
UD_String_MatData matColors
Gradient gradientLVComparison
virtual string GetHoverText2()
virtual string GetName(NameStyle style, int num=-1)
virtual string GetHoverText()
void Kill(bool silent=false)
static Condition Create(string alias, int power=100, Action< Condition > onCreate=null)
static void Collect(Thing t)
bool ignoreBackerDestoryFlag
BackerContentConfig backer
static Thing MakeLoveLunch(Chara c)
static string GetBloodText(Chara c)
static Thing GenerateGene(Chara c, Type? type=null)
int GetRaw(int offsetHours=0)
static void TryWarnMana(Action action)
static int curve(long _a, int start, int step, int rate=75)
static ColorProfile Colors
static SourceManager sources
static float rndf(float a)
static FactionBranch Branch
static BaseGameScreen screen
static int rndHalf(int a)
static SoundManager Sound
static GameSetting setting
Effect _Play(Point from, Vector3 fromV, float fixY=0f, Point to=null, Sprite sprite=null)
static Effect Get(Effect original)
void Play(float delay, Point from, float fixY=0f, Point to=null, Sprite sprite=null)
void ModExp(int ele, float a, bool chain=false)
Dictionary< int, Element > dict
int ValueWithoutLink(int ele)
Element ModBase(int ele, int v)
void ApplyElementMap(int uid, SourceValueType type, Dictionary< int, int > map, int lv, bool invert=false, bool applyFeat=false)
void SetTo(int id, int v)
Element SetBase(string alias, int v, int potential=0)
Element GetElement(string alias)
static SourceElement.Row Get(int id)
virtual int GetPower(Card c)
static Element Create(int id, int v=0)
virtual Act.Cost GetCost(Chara c)
static List< SourceElement.Row > ListElements
virtual bool PotentialAsStock
static int[] List_MainAttributesMajor
TileInfo GetTileInfo(int gx, int gy)
static Expedition Create(Chara c, ExpeditionType type)
static SourceFloor.Row sourceSnow
static SourceFloor.Row sourceIce
static bool IsTatami(int id)
static SourceFloor.Row sourceWood
ExpeditionManager expeditions
void RemoveMemeber(Chara c)
string Log(string idLang, string ref1=null, string ref2=null, string ref3=null, string ref4=null)
Dictionary< string, Faction > dictAll
virtual List< string > Apply(int a, ElementContainer owner, bool hint=false)
override bool IsPurchaseFeatReqMet(ElementContainer owner, int lv=-1)
static void ProcDrink(Chara c, Thing food)
static void Proc(Chara c, Thing food, bool consume=true)
Dictionary< int, byte > lastPoints
static string Parse(string text, bool thirdPerson, string val1, string val2=null, string val3=null, string val4=null)
bool disableDeathPenaltyProtection
UD_String_ElementRef elements
ConfigPreference preference
ConfigAutoCombat autoCombat
ReligionManager religions
bool Save(bool isAutoSave=false, bool silent=false)
PCCUniformManager uniforms
void Refresh(Chara owner, GoalListType type)
void ValidateHobby(Chara c)
bool FindWork(Chara c, bool setAI=true)
static GuildFighter Fighter
int GetEfficiency(Chara c)
static bool Has(string id)
static string[] GetList(string id)
static string _currency(object a, string IDCurrency)
static void SetDirty(Element a)
static LayerDrama Activate(string book, string idSheet, string idStep, Chara target=null, Card ref1=null, string tag="")
static LayerDrama ActivateMain(string idSheet, string idStep=null, Chara target=null, Card ref1=null, string tag="")
static void SetDirty(Thing t)
static bool IsVisible(Point p1, Point p2, Action< Point, bool > _onVisit=null)
static SourceMaterial.Row sourceOak
static SourceMaterial.Row sourceSnow
static SourceMaterial.Row sourceIce
bool Contains(int dx, int dz)
Thing FindThing(Func< Thing, bool > func)
Chara FindChara(string id)
void MoveCard(Point p, Card t)
void SetLiquid(int x, int z, CellEffect effect=null)
void SetFoormark(Point pos, int id, int angle, int offset=0)
void SetEffect(int x, int z, CellEffect effect=null)
static ThirstPersonInfo thirdPerson1
static string SayNothingHappen()
static string Say(string idLang, string ref1, string ref2=null, string ref3=null, string ref4=null)
bool HasElement(int ele, bool excludePC=false)
void RemoveMember(Chara c)
void AddMemeber(Chara c, bool showMsg=false)
void RequestPathImmediate(PathProgress progress)
Point GetFirstStep(Point origin, Point _dest, IPathfindWalker walker, int maxDist=20, MoveType moveType=MoveType.Default)
static PathManager Instance
List< PathFinderNode > nodes
void EndTurn(bool consume=true)
void EnterLocalZone(bool encounter=false, Chara mob=null)
List< Chara > listCarryoverMap
HashSet< int > doneBackers
Thing DropReward(Thing t, bool silent=false)
bool TryAbortAutoCombat(bool immediate=true)
SourceMaterial.Row matFloor
SourceBlock.Row sourceBlock
void ForeachMultiSize(int w, int h, Action< Point, bool > action)
void SetObj(int id=0, int value=1, int dir=0)
ref Vector3 Position(int height)
List< Card > ListCards(bool includeMasked=false)
override string ToString()
Point Set(int _x, int _z)
void ForeachNeighbor(Action< Point > action, bool diagonal=true)
Point GetNearestPoint(bool allowBlock=false, bool allowChara=true, bool allowInstalled=true, bool ignoreCenter=false, int minRadius=0)
SoundSource PlaySound(string id, bool synced=true, float v=1f, bool spatial=true)
Point GetPointTowards(Point dest)
List< Chara > ListCharasInRadius(Chara cc, int dist, Func< Chara, bool > func, bool onlyVisible=true)
bool Equals(int _x, int _z)
List< Chara > ListCharas()
SourceFloor.Row sourceFloor
void SetBlock(int idMat=0, int idBlock=0)
Effect PlayEffect(string id)
Point GetRandomNeighbor()
Point GetRandomPoint(int radius, bool requireLos=true, bool allowChara=true, bool allowBlocked=false, int tries=100)
bool IsActive(int id, int days=-1)
static string GetRandomPortrait(string idDict)
static HashSet< string > allIds
bool OnShowDialog(Chara c)
Quest Add(string id, string idGlobalChara=null)
virtual void OnGiveItem(Chara c, Thing t)
void OnSetGoal(AIAct newGoal)
static int Range(int min, int max)
static void UseSeed(int seed, Action action)
static void SetSeed(int a=-1)
static int Set(Zone zone)
Dictionary< string, Religion > dictAll
ReligionMoonShadow MoonShadow
ReligionTrickery Trickery
Religion GetRandomReligion(bool onlyJoinable=true, bool includeMinor=false)
virtual void Revelation(string idTalk, int chance=100)
static Religion recentWrath
int ConvertTile(int tile)
bool ContainsTag(string _tag)
Sprite GetSprite(int dir=0, int skin=0, bool snow=false)
static void ShakeCam(string id="default", float magnitude=1f)
SourceCharaText charaText
SourceCategory categories
virtual bool ShowDangerLv
virtual int DangerLvBoost
virtual bool IsSnowCovered
bool tryFixPrefNotLoadedAtStart
Sprite GetSprite(string suffix="")
static int GetAffinityMod(int phase)
static StatsSleepiness Sleepiness
static StatsHygiene Hygiene
static StatsBurden Burden
Stats Set(int[] _raw, int _rawIndex, Chara _CC)
static StatsStamina Stamina
static StatsHunger Hunger
static void GetAchievement(ID_Achievement id)
static SubPassData Default
static TargetTypeSelfParty SelfParty
List< Thing > List(Func< Thing, bool > func, bool onlyAccessible=false)
void DestroyAll(Func< Thing, bool > funcExclude=null)
void Foreach(Action< Thing > action, bool onlyAccessible=true)
static void TryLickChest(Thing chest)
static Thing CreateTreasure(string id, int lv, TreasureType type=TreasureType.Map)
static Thing CreateParcel(string idLang=null, params Thing[] things)
static Thing CreateSpellbook(string alias, int num=1)
static Thing CreateFromCategory(string idCat, int lv=-1)
static Thing CreateScroll(int ele, int num=1)
static Thing CreateCurrency(int a, string id="money")
static Thing Create(string id, int idMat=-1, int lv=-1)
override int GetPrice(CurrencyType currency=CurrencyType.Money, bool sell=false, PriceType priceType=PriceType.Default, Chara c=null)
override string GetName(NameStyle style, int _num=-1)
Thing Identify(bool show=true, IDTSource idtSource=IDTSource.Identify)
virtual bool UseRandomName
virtual bool UseRandomAlias
virtual bool CanExtendBuild
virtual void OnTickHeld()
virtual void OnSteppedOut(Chara c)
virtual bool IgnoreOnSteppedWhenMoving
virtual bool CanBeDestroyed
virtual bool CanRead(Chara c)
virtual ShopType ShopType
virtual bool CanEat(Chara c)
virtual bool IsChangeFloorHeight
virtual void OnStepped(Chara c)
virtual bool CanBeDropped
virtual Action GetHealAction(Chara c)
virtual void SetName(ref string s)
virtual bool CanDrink(Chara c)
virtual bool CanOnlyCarry
virtual void OnBlend(Thing t, Chara c)
static void Reserve(string idStep, Action onBeforePlay=null)
static void Play(string idStep)
UIItem AddHeaderCard(string text, Sprite sprite=null)
UIItem AddText(string text, FontColor color=FontColor.DontChange)
Condition CurrentCondition
static void Say(string text, FontColor fontColor=FontColor.Default, Sprite sprite=null)
FilterResult IsFilterPass(string text)
List< WorkSession > hobbies
void SendPackage(Thing p)
virtual ZoneTransition.EnterState ReturnState
virtual void OnLeaveZone()
void RefreshDeathSentense()
int CountMinions(Chara c)
void SetBGM(List< int > ids, bool refresh=true, float fadeDuration=0f)
bool TryAddThingInSharedContainer(Thing t, List< Thing > containers=null, bool add=true, bool msg=false, Chara chara=null, bool sharedOnly=true)
Chara SpawnMob(string id, Point pos=null)
virtual bool IsUnderwater
virtual bool WillAutoSave
virtual bool KeepAllyDistance
virtual bool HiddenInRegionMap
void RefreshListCitizen()
Card AddCard(Card t, Point point)
Point GetSpawnPos(Chara c, ZoneTransition.EnterState destState=ZoneTransition.EnterState.Auto)