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);
104 int numFire = effectData.
num;
105 int numFireWithoutDamageLoss = numFire;
106 int num = GetWeaponEnc(602);
107 int drill = GetWeaponEnc(606);
108 int scatter = GetWeaponEnc(607);
109 int chaser = GetWeaponEnc(620);
112 numFire += Mathf.Min(num / 10 + ((num % 10 >
EClass.
rnd(10)) ? 1 : 0), 10);
113 numFireWithoutDamageLoss += num / 100 + ((num % 100 >
EClass.
rnd(100)) ? 1 : 0);
117 int num3 = 1 + weapon.material.hardness / 30 +
EClass.
rnd(3);
118 int num4 =
weapon.Evalue(604);
121 for (
int i = 0; i < numFire; i++)
123 if (Mathf.Sqrt(num4) * 5f + 10f > (float)
EClass.
rnd(100))
128 num3 = Mathf.Max(1, num3 * 100 / (100 + num4 * 5));
130 string missSound = ((weapon.trait is
TraitToolRangeGun) ?
"miss_bullet" :
"miss_arrow");
135 num3 += item.source.LV / 15;
147 ActPlan.warning =
true;
199 List<Point> points =
new List<Point>();
204 else if (scatter > 0)
208 points.Add(_p.
Copy());
216 if (points.Count > 0)
219 foreach (
Point item2
in points)
237 else if (firstChara ==
null)
246 weapon.c_ammo -= num2;
247 if (
weapon.ammoData !=
null)
249 weapon.ammoData.Num =
weapon.c_ammo;
254 weapon.ammoData =
null;
261 if (
Act.
TC !=
null && !hasHit)
277 int GetWeaponEnc(
int ele)
284 AttackProcess.Current.numFire = numFire;
285 AttackProcess.Current.numFireWithoutDamageLoss = numFireWithoutDamageLoss;
286 AttackProcess.Current.posRangedAnime =
Act.
TP.
Copy();
287 AttackProcess.Current.ignoreAnime = index > 1;
288 AttackProcess.Current.ignoreAttackSound =
false;
289 if (drill > 0 && points.Count > 0)
291 AttackProcess.Current.posRangedAnime = points.LastItem();
293 else if (scatter > 0)
295 AttackProcess.Current.ignoreAnime =
false;
296 AttackProcess.Current.ignoreAttackSound = index > 1;
299 void Shoot(
Card _tc,
Point _tp,
bool subAttack)
306 if (effect !=
null && effect.
id == 6 &&
EClass.
rnd(2) == 0)
319 for (
int j = 0; j < numFire; j++)
333 if (
weapon.id ==
"gun_laser")
351 AttackProcess.Current.TC = chara;
353 AttackProcess.Current.posRangedAnime = chara.
pos;
362 for (
int k = 0; k < 10; k++)
364 if (chaser >
EClass.
rnd(4 + (
int)Mathf.Pow(4f, k + 2 + j)))
381 aliasEle =
"eleImpact"
407 if (
weapon.ammoData !=
null)
409 if (
weapon.ammoData.Num > 0)
413 weapon.ammoData =
null;
424 if (!
weapon.IsMeleeWithAmmo)
441 weapon.ammoData = thing;
445 reloadTurn = reloadTurn * 100 / (100 +
Act.
CC.
Evalue(1652) * 100);
446 if (traitToolRange.
NeedReload && reloadTurn > 0)
static void ProcAt(EffectId id, int power, BlessedState state, Card cc, Card tc, Point tp, bool isNeg, ActRef actRef=default(ActRef))
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, float delay=0f)
bool IsRestrainedResident
bool HasElement(int ele, int req=1)
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)
List< Chara > ListCharasInRadius(Chara cc, int dist, Func< Chara, bool > func, bool onlyVisible=true)
bool Equals(int _x, int _z)
Thing FindThing(Func< Thing, bool > func)
Point GetRandomNeighbor()
bool TryGetValue(TKey key, out TValue value)