private void cbbWeapon_SelectionChangeCommitted(object sender, EventArgs e) { cbbModList.Enabled = true; btnCalc.Enabled = true; Data.WeaponType currType = ((Weapon)cbbWeapon.SelectedValue).type; if (lastType == currType || (lastType == Data.WeaponType.Rifle && currType == Data.WeaponType.Bow) || (lastType == Data.WeaponType.Bow && currType == Data.WeaponType.Rifle)) { ShowStats(); return; } switch (currType) { case Data.WeaponType.Rifle: case Data.WeaponType.Bow: cbbModList.DataSource = new BindingSource(ModList.rifleModList, null); break; case Data.WeaponType.Shotgun: cbbModList.DataSource = new BindingSource(ModList.shotgunModList, null); break; } cbbModList.DisplayMember = "Key"; cbbModList.ValueMember = "Value"; cbbModList.SelectedIndex = -1; for (char i = '1'; i <= '8'; i++) { Controls.Find("btnMod" + i, true).FirstOrDefault().Tag = new Data.ModData(new Mod(), "", "", 0); } lastType = currType; ShowStats(); }
public Weapon(Damage _damage, double _multiShot, double _fireRate, double _critChan, double _critMult, double _totalStatChan, double _reload, int _clip, Data.WeaponType _type, bool raw = false) { damage = raw ? _damage.Scale(1 / _multiShot) : _damage; multiShot = _multiShot; fireRate = _fireRate; critChan = _critChan; critMult = _critMult; totalStatChan = _totalStatChan; pelletStatChan = (totalStatChan >= 1) ? 1 : 1 - Math.Pow((1 - totalStatChan), 1 / multiShot); reload = _reload; clip = _clip; type = _type; }
public Weapon(double[] _dmgArray, double _multiShot, double _fireRate, double _critChan, double _critMult, double _totalStatChan, double _reload, int _clip, Data.WeaponType _type, bool raw = false) { damage = new Damage(_dmgArray); if (raw) { damage = damage.Scale(1 / _multiShot); } multiShot = _multiShot; fireRate = _fireRate; critChan = _critChan; critMult = _critMult; totalStatChan = _totalStatChan; pelletStatChan = (totalStatChan >= 1) ? 1 : 1 - Math.Pow((1 - totalStatChan), 1 / multiShot); reload = _reload; clip = _clip; type = _type; }