2using System.Collections.Generic;
84 return weapon.category.skill == 100;
116 int num = w?.
Evalue(ele) ?? 0;
135 return Mathf.Clamp(
CC.
Evalue(130) / 15, 0, 2) * 25;
142 string @ref = (
IsMartial ?
"evalHand".lang() :
"evalWeapon".lang((
attackIndex + 1).ToString() ??
""));
143 return "attackEval".lang(@ref, text,
dMulti.ToString(
"F2") ??
"",
toHit.ToString() ??
"",
penetration.ToString() ??
"");
180 int num3 = Mathf.Clamp(
weapon.
material.hardness, flag ? 40 : 20, 200);
345 toHit += 25 + (int)Mathf.Sqrt(Mathf.Max(0,
CC.
Evalue(130)) * 2);
350 int num5 = ((num4 >= 50) ? 10 : ((num4 >= 25) ? 12 : 15));
367 if (
TC.isChara &&
TC.Chara.isBlind)
375 if (
TC.isChara &&
TC.Chara.HasHigherGround(
CC))
407 if (!
string.IsNullOrEmpty(customData?.caneColor))
410 effColor = (customData.caneColorBlend ?
Color.Lerp(effColor, color, 0.5f) : color);
414 bool isRail = isLaser && (weapon.id ==
"gun_rail" || (customData?.
forceRail ??
false));
415 for (
int i = 0; i <
numFire; i++)
417 TweenUtil.Delay((
float)i * data.
delay + delay, delegate
419 if (EClass.core.IsGameStarted && _CC.IsAliveInCurrentZone && _zone == _CC.currentZone)
421 Vector3 fromV = (_CC.isSynced ? _CC.renderer.position : _CC.pos.Position());
425 _CC.PlayEffect(
"laser_rail").GetComponent<SpriteBasedLaser>().Play(_TP.PositionCenter());
428 _CC.PlayEffect(
"laser").GetComponent<SpriteBasedLaser>().Play(_TP.PositionCenter());
430 case
"gun_laser_assault":
431 Effect.Get(
"ranged_laser")._Play(_CC.pos, fromV, 0f, _TP, data.sprite);
436 string id = (isRail ?
"laser_rail" :
"laser");
437 _CC.PlayEffect(id).GetComponent<SpriteBasedLaser>().Play(_TP.PositionCenter());
441 Effect effect = Effect.Get(
"ranged_arrow")._Play(_CC.pos, fromV, 0f, _TP, data.sprite);
444 effect.sr.color = effColor;
453 _CC.PlaySound(customData?.idSoundEject.IsEmpty(
"bullet_drop"));
455 _CC.PlayEffect(
"bullet").Emit(1);
461 _weapon.PlayEffect(data.idEffect.IsEmpty(
"gunfire"), useRenderPos: true, 0f, firePos);
465 _CC.PlayEffect(data.idEffect.IsEmpty(
"gunfire"));
470 _CC.PlaySound(data.idSound.IsEmpty(
"attack_gun"));
479 return (30 + (dNum * dDim + dBonus) + (dNumAmmo * dDimAmmo + dBonusAmmo)) * (100 + (int)Mathf.Sqrt(weaponSkill.Value) * 8) / 100;
484 bool flag = CC.HasCondition<
ConReload>();
485 long num =
Dice.
Roll(dNum, dDim, dBonus, CC);
486 if (
ammo !=
null && !flag)
488 num +=
Dice.
Roll(dNumAmmo, dDimAmmo, dBonusAmmo, CC);
493 if (
ammo !=
null && !flag)
495 num +=
Dice.
RollMax(dNumAmmo, dDimAmmo, dBonusAmmo);
497 if (crit && (IsMartial || IsMartialWeapon))
502 if (CC.Evalue(1355) > 0)
506 num = (long)(dMulti * (
float)num * dmgMulti);
507 long num2 = 99999999L;
509 if (condition !=
null)
511 num = num * (100 + condition.lv * 10) / 100;
512 num2 = num2 * (100 + condition.lv * 5) / 100;
514 return (
long)Mathf.Clamp(num, 0f, num2);
519 foreach (
BodySlot slot
in CC.body.slots)
528 public static void ProcAbility(List<Element> list,
Chara CC,
Card TC,
int bonus,
bool subAttack =
false,
int mtpChance = 100)
536 ProcAbility(
item, CC,
TC, bonus, subAttack, mtpChance);
546 int num = (10 + e.Value / 5) * mtpChance / 100;
547 int power =
EClass.
curve((100 + e.
Value * 10) * (100 + bonus) / 100, 400, 100);
557 Card card = (obj.TargetType.CanSelectSelf ? CC :
TC);
558 string text = ((e.source.proc.Length >= 2) ? e.
source.proc[1] :
"");
559 string text2 = obj.
source.abilityType.TryGet(0);
591 if (
card.IsAliveInCurrentZone)
597 aliasEle = e.
source.aliasRef,
598 noFriendlyFire =
true
604 public bool Perform(
int count,
bool hasHit,
float dmgMulti = 1f,
bool maxRoll =
false,
bool subAttack =
false)
606 bool flag = CC.HasCondition<
ConReload>();
607 bool flag2 = CC.HasElement(486) && CC.IsPCFactionOrMinion;
609 if (CC.id ==
"tsunami")
613 long num = GetRawDamage(dmgMulti, crit, maxRoll);
614 if (IsRanged && count >= numFireWithoutDamageLoss)
616 num = num * 100 / (100 + (count - numFireWithoutDamageLoss + 1) * 30);
622 List<Element> list =
new List<Element>();
623 int num2 = CC.Evalue(91);
625 if ((
id ==
"stalker" ||
id ==
"stalker_shadow") &&
TC.isChara &&
TC.Chara.CanSee(CC))
632 list =
weapon.elements.dict.Values.ToList();
633 if (
ammo !=
null && !flag)
635 list = list.Concat(
ammo.elements.dict.Values).ToList();
637 num2 +=
weapon.Evalue(91, ignoreGlobalElement:
true);
638 num3 +=
weapon.Evalue(603, ignoreGlobalElement:
true);
640 foreach (
Element value
in CC.elements.dict.Values)
647 if (!IsRanged && !isThrow && CC.HasElement(1426))
655 AddBane(valid:
true, 468, 50);
656 AddBane(
TC.Chara.IsUndead, 461, 100);
657 AddBane(
TC.Chara.IsAnimal, 463, 100);
658 AddBane(
TC.Chara.IsHuman, 464, 100);
659 AddBane(
TC.Chara.IsDragon, 460, 100);
660 AddBane(
TC.Chara.IsGod, 466, 100);
661 AddBane(
TC.Chara.IsMachine, 465, 100);
662 AddBane(
TC.Chara.IsFish, 467, 100);
663 AddBane(
TC.Chara.IsFairy, 462, 100);
666 num = num * (100 + bane * 3) / 100;
673 if (value2.
Value > 0)
686 CC.Say((critFury ?
"fury_" :
"") + (CC.IsHostile() ?
"critical_enemy" :
"critical"));
689 CC.PlaySound(
"critical");
692 if (CC.isSynced || (
TC !=
null &&
TC.isSynced))
694 if (toolRange !=
null && (!IsRanged || count == 0) && !flag && !ignoreAnime)
696 PlayRangedAnime((!IsRanged) ? 1 : numFire);
698 if (hit &&
TC !=
null && !hasHit)
707 CC.Say(IsRanged ?
"attack_air_range" :
"attack_air", CC);
717 CC.Say(evadePlus ?
"evadePlus2" :
"evade2", CC,
TC);
721 TC.Say(evadePlus ?
"evadePlus" :
"evade",
TC, CC);
726 ProcAbility(list, CC,
TC, weaponSkill.Value * (100 + GetTwoHandEncBonus(CC,
weapon)) / 100, subAttack);
732 EClass.
pc.
Say(
"attackMeleeToPC", CC,
TC, GetAttackText(attackType, 3));
736 CC.Say(
"attackMelee", CC,
TC, GetAttackText(attackType, 0));
738 bool showEffect =
true;
747 if (value3.
source.categorySub ==
"eleConvert")
750 num5 = 50 + value3.Value * 2;
751 num6 = Mathf.Min(value3.
Value, 100);
760 conWeapon = CC.GetCondition<
ConWeapon>();
762 num5 = conWeapon.power / 2;
763 num6 = (int)Mathf.Min(40f + MathF.Sqrt(conWeapon.
power), 80f);
765 if (conWeapon ==
null && (
weapon ==
null || IsMartialWeapon) && (CC.MainElement != Element.Void || CC.HasElement(1565)))
767 num4 = (CC.HasElement(1565) ? 915 : CC.MainElement.id);
768 num5 = CC.Power / 3 +
EClass.
rnd(CC.Power / 2);
771 num5 += CC.MainElement.Value;
778 IEnumerable<Element> enumerable =
weapon.elements.dict.Values.Where((
Element e) => e.source.categorySub ==
"eleAttack");
779 if (enumerable.Count() > 0)
781 num4 = enumerable.RandomItem().id;
794 long num8 = num * num6 / 100;
796 long num9 = num * penetration / 100;
798 num =
TC.ApplyProtection(num) + num9 + num8;
799 int weaponEnc = GetWeaponEnc(CC,
weapon, 609, addSelfEnc:
true);
801 if (conWeapon !=
null && (weaponEnc <= 0 || !(Mathf.Min(10f + Mathf.Sqrt(weaponEnc) * 5f, 90f) > (
float)
EClass.
rnd(100))))
805 bool flag3 = IsCane || (
weapon !=
null &&
weapon.Evalue(482) > 0);
806 int attackStyleElement = CC.body.GetAttackStyleElement(attackStyle);
809 int mod2 = 100 / (count + 1);
810 if (!IsRanged || count == 0)
812 ModExpAtk(weaponSkill.id, mod2);
813 ModExpAtk(flag3 ? 304 : (IsRanged ? 133 : 132), mod2);
819 if (count == 0 && attackStyleElement != 0)
821 ModExpAtk(attackStyleElement, 100);
824 if (!CC.IsAliveInCurrentZone || !
TC.IsAliveInCurrentZone)
828 if (
EClass.
rnd(8) == 0 &&
TC.isChara && CC.HasElement(1219))
830 CC.Say(
"abCrab", CC,
TC);
834 if (list.Count > 0 && !flag2)
838 if (!
TC.IsAliveInCurrentZone)
842 if (!
item.IsActive(
weapon) || !(item.source.categorySub ==
"eleAttack"))
847 long num11 =
EClass.
rnd(num * (100 +
item.Value * 10) / 500 + 5);
848 num11 = num11 * (100 + GetTwoHandEncBonus(CC,
weapon)) / 100;
861 ProcAbility(list, CC,
TC, weaponSkill.Value * (100 + GetTwoHandEncBonus(CC,
weapon)) / 100, subAttack);
863 if (!CC.IsAliveInCurrentZone || !
TC.IsAliveInCurrentZone)
867 if (!IsRanged && !flag2 && attackStyle ==
AttackStyle.Shield)
869 int num12 = CC.Evalue(123);
870 int num13 = CC.Evalue(381);
871 if (CC.elements.ValueWithoutLink(123) >= 10 && Mathf.Clamp(Mathf.Sqrt(num12) - 2f, 8f, 15f) + Mathf.Min(Mathf.Sqrt(num13), 25f) > (
float)
EClass.
rnd(100))
873 num = num7 * (Mathf.Min(50 + num12 + num13, 200) + (int)Mathf.Min(Mathf.Sqrt(num13), 100f)) / 100;
874 penetration = (int)Mathf.Sqrt(num13) + ((num13 != 0) ? 20 : 0);
875 if (penetration > 100)
879 num9 = num * penetration / 100;
881 num =
TC.ApplyProtection(num) + num9;
882 Debug.Log(
"Bash:" + num +
"/" + num7);
883 CC.PlaySound(
"shield_bash");
884 CC.Say(
"shield_bash", CC,
TC);
886 if (
TC.IsAliveInCurrentZone &&
TC.isChara)
890 TC.Chara.AddCondition<
ConDim>(50 + (int)Mathf.Sqrt(num12) * 10);
894 if (!
TC.isRestrained)
896 ProcShieldEncs(CC,
TC, 500 + num13);
898 if (CC.IsAliveInCurrentZone)
904 if (!CC.IsAliveInCurrentZone || !
TC.IsAliveInCurrentZone)
908 if (CC.HasElement(1253))
912 if (!CC.IsAliveInCurrentZone || !
TC.IsAliveInCurrentZone)
918 TC.pos.PlayEffect(
"vanish");
919 TC.PlaySound(
"push", 1.5f);
922 void AddBane(
bool valid,
int idEle,
int mod)
926 bane += (CC.Evalue(idEle) + ((
weapon !=
null) ?
weapon.Evalue(idEle, ignoreGlobalElement:
true) : 0) + ((
ammo !=
null) ?
ammo.Evalue(idEle, ignoreGlobalElement:
true) : 0)) * mod / 100;
933 return TC.HasEditorTag(
EditorTag.InvulnerableToMobs);
937 void ModExpAtk(
int ele,
int mod)
939 if (!IgnoreExp() && (!
TC.isCopy ||
EClass.
rnd(10) == 0))
941 int a = (Mathf.Clamp((
TC.LV + 10 - CC.elements.ValueWithoutLink(ele)) / 2, 1, 10) + Mathf.Min(
TC.LV / 10, 10)) * mod / 100;
942 a = Mathf.Min(a, 200);
949 CC.ModExp(ele, a +
EClass.
rnd(a / 2 + 1));
953 void ModExpDef(
int ele,
int mod)
955 if (!IgnoreExp() && (!CC.isCopy ||
EClass.
rnd(10) == 0))
957 int a2 = (Mathf.Clamp((CC.LV + 10 -
TC.elements.ValueWithoutLink(ele)) / 2, 1, 10) + Mathf.Min(CC.LV / 10, 10)) * mod / 100;
958 a2 = Mathf.Min(a2,
TC.isRestrained ? 10 : 200);
963 if (!
TC.IsPC && !
TC.isRestrained && !
TC.HasHost)
975 string id2 =
"hit_default";
976 string id3 =
"hit_default";
1004 TC.PlayEffect(id3).SetScale(crit ? 1.25f : 0.75f);
1032 if (CC.HasCondition<
ConSevenSense>() && (CC.HasElement(1244) || CC.HasElement(1246) || CC.HasElement(1247) || CC.HasElement(1253)))
1042 if (
TC.IsDeadOrSleeping)
1046 int num =
TC.Evalue(151);
1047 if (num != 0 && toHit < num * 10)
1049 float num2 = (float)(evasion * 100) / Mathf.Clamp(toHit, 1f, toHit);
1050 if (num2 > 300f &&
EClass.
rnd(num + 250) > 100)
1054 if (num2 > 200f &&
EClass.
rnd(num + 250) > 150)
1058 if (num2 > 150f &&
EClass.
rnd(num + 250) > 200)
1063 int num3 =
TC.Evalue(57);
1071 else if (num3 < 0 && num3 * -1 >
EClass.
rnd(100))
1096 if (
EClass.
rnd(5000) < CC.Evalue(73) + 50)
1100 if ((
float)(CC.Evalue(90) + ((
weapon !=
null) ?
weapon.Evalue(90, ignoreGlobalElement:
true) : 0)) + Mathf.Sqrt(CC.Evalue(134)) > (
float)
EClass.
rnd(200))
1104 if (CC.Evalue(1420) > 0)
1106 int num4 = Mathf.Min(100, 100 - CC.hp * 100 / CC.MaxHP) * (50 + CC.Evalue(1420) * 50) / 100;
1107 if (num4 >= 50 && num4 * num4 * num4 * num4 / 3 >
EClass.
rnd(100000000))
static void ProcAt(EffectId id, int power, BlessedState state, Card cc, Card tc, Point tp, bool isNeg, ActRef actRef=default(ActRef))
void Prepare(Chara _CC, Thing _weapon, Card _TC=null, Point _TP=null, int _attackIndex=0, bool _isThrow=false)
bool Perform(int count, bool hasHit, float dmgMulti=1f, bool maxRoll=false, bool subAttack=false)
string GetAttackText(AttackType type, int id)
static void ProcAbility(List< Element > list, Chara CC, Card TC, int bonus, bool subAttack=false, int mtpChance=100)
static AttackProcess Current
long GetRawDamage(float dmgMulti, bool crit, bool maxRoll)
static void ProcAbility(Element e, Chara CC, Card TC, int bonus, bool subAttack=false, int mtpChance=100)
static int GetTwoHandEncBonus(Chara CC, Thing w)
int numFireWithoutDamageLoss
void PlayRangedAnime(int numFire, float delay=0f)
static int GetWeaponEnc(Chara CC, Thing w, int ele, bool addSelfEnc=false)
static void ProcShieldEncs(Chara CC, Card TC, int mtpChance=100)
void Mod(int a, bool force=false)
SourceElement.Row sourceElement
int EvalueMax(int ele, int min=0)
ElementContainerCard elements
SourceMaterial.Row material
SourceCategory.Row category
bool HasElement(int ele, bool includeNagative=false)
void Say(string lang, string ref1=null, string ref2=null)
AttackStyle GetAttackStyle()
bool HasCondition(string alias)
bool HasHigherGround(Card c)
UD_String_Color elementColors
static int RollMax(int num, int sides, int bonus=0)
static int Roll(int num, int sides, int bonus=0, Card card=null)
static int curve(long _a, int start, int step, int rate=75)
static ColorProfile Colors
static SourceManager sources
static GameSetting setting
Dictionary< int, Element > dict
Element GetOrCreateElement(Element ele)
static Element Create(int id, int v=0)
Element GetParent(Card c)
ElementContainerFaction charaElements
UD_String_EffectData guns
static string[] GetList(string id)
bool TryGetValue(TKey key, out TValue value)