1using System.Collections.Generic;
23 public override string Name
31 return "ActReload".lang();
35 public override string GetText(
string str =
"")
39 return base.GetText(str);
103 int numFire = effectData.
num;
104 int numFireWithoutDamageLoss = numFire;
105 int num = GetWeaponEnc(602);
106 int drill = GetWeaponEnc(606);
107 int scatter = GetWeaponEnc(607);
108 int chaser = GetWeaponEnc(620);
111 numFire += Mathf.Min(num / 10 + ((num % 10 >
EClass.
rnd(10)) ? 1 : 0), 10);
112 numFireWithoutDamageLoss += num / 100 + ((num % 100 >
EClass.
rnd(100)) ? 1 : 0);
116 int num3 = 1 + weapon.material.hardness / 30 +
EClass.
rnd(3);
117 int num4 =
weapon.Evalue(604);
120 for (
int i = 0; i < numFire; i++)
122 if (Mathf.Sqrt(num4) * 5f + 10f > (float)
EClass.
rnd(100))
127 num3 = Mathf.Max(1, num3 * 100 / (100 + num4 * 5));
129 string missSound = ((weapon.trait is
TraitToolRangeGun) ?
"miss_bullet" :
"miss_arrow");
134 num3 += item.source.LV / 15;
146 ActPlan.warning =
true;
198 List<Point> points =
new List<Point>();
203 else if (scatter > 0)
207 points.Add(_p.
Copy());
215 if (points.Count > 0)
218 foreach (
Point item2
in points)
223 if ((firstChara ==
null || firstChara.
IsHostile(
Act.
CC)) && (firstChara !=
null || scatter != 0))
232 weapon.c_ammo -= num2;
233 if (
weapon.ammoData !=
null)
235 weapon.ammoData.Num =
weapon.c_ammo;
240 weapon.ammoData =
null;
247 if (
Act.
TC !=
null && !hasHit)
263 int GetWeaponEnc(
int ele)
270 AttackProcess.Current.numFire = numFire;
271 AttackProcess.Current.numFireWithoutDamageLoss = numFireWithoutDamageLoss;
272 AttackProcess.Current.posRangedAnime =
Act.
TP.
Copy();
273 AttackProcess.Current.ignoreAnime = index > 1;
274 AttackProcess.Current.ignoreAttackSound =
false;
275 if (drill > 0 && points.Count > 0)
277 AttackProcess.Current.posRangedAnime = points.LastItem();
279 else if (scatter > 0)
281 AttackProcess.Current.ignoreAnime =
false;
282 AttackProcess.Current.ignoreAttackSound = index > 1;
292 if (effect !=
null && effect.
id == 6 &&
EClass.
rnd(2) == 0)
305 for (
int j = 0; j < numFire; j++)
315 for (
int k = 0; k < 10; k++)
317 if (chaser >
EClass.
rnd(4 + (
int)Mathf.Pow(4f, k + 2 + j)))
348 if (
weapon.ammoData !=
null)
350 if (
weapon.ammoData.Num > 0)
354 weapon.ammoData =
null;
365 if (!
weapon.IsMeleeWithAmmo)
382 weapon.ammoData = thing;
386 reloadTurn = reloadTurn * 100 / (100 +
Act.
CC.
Evalue(1652) * 100);
387 if (traitToolRange.
NeedReload && reloadTurn > 0)
override CursorInfo CursorIcon
override int PerformDistance
static bool TryReload(Thing weapon, Thing ammo=null)
override string GetText(string str="")
override bool CanPerform()
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)
static AttackProcess Current
void PlayRangedAnime(int numFire)
bool IsRestrainedResident
SoundSource PlaySound(string id, float v=1f, bool spatial=true)
virtual bool IsAliveInCurrentZone
void Say(string lang, string ref1=null, string ref2=null)
bool IsTooHeavyToEquip(Thing thing)
Condition AddCondition(string id, int p=100, bool force=false)
Thing FindAmmo(Thing weapon)
bool CanSeeLos(Card c, int dist=-1)
bool RequestProtection(Chara attacker, Action< Chara > action)
bool HasCondition(string alias)
void DoHostileAction(Card _tg, bool immediate=false)
override void LookAt(Card c)
Thing Pick(Thing t, bool msg=true, bool tryStack=true)
static CursorInfo IconRange
static void TryWarnMana(Action action)
static void Wait(float a, Card c)
static GameSetting setting
ElementContainerFaction charaElements
UD_String_EffectData guns
static void SetDirty(Thing t)
List< Point > ListPointsInLine(Point center, Point to, int radius)
static string Say(string idLang, string ref1, string ref2=null, string ref3=null, string ref4=null)
void EndTurn(bool consume=true)
Point Set(int _x, int _z)
void ForeachNeighbor(Action< Point > action, bool diagonal=true)
bool Equals(int _x, int _z)
bool TryGetValue(TKey key, out TValue value)