/// <summary> /// Returns the Defense modifier from the paladin weapon based on the weapon level. /// </summary> /// <param name="belongsToUnitType">Which <see cref="BaseUnit"/> does this weapon influence.</param> /// <param name="weaponLevel">The weapon level 1-3</param> /// <returns></returns> public static decimal GetDefModifierFromWeapon(UnitType belongsToUnitType, int weaponLevel) { foreach (BaseWeapon weapon in WeaponOptions.Where(weapon => weapon.BelongsToUnitType == belongsToUnitType)) { return(weapon.GetDefModifier(weaponLevel)); } return(1m); }
/// <summary> /// This returns the cost of the weapon system's 'flaggable' options. /// </summary> /// <returns></returns> public double GetOptionCostMult() { double x = 1.0; switch (GetWeaponType()) { case (WeaponTypes.Beam): Options &= BeamOptions; break; case (WeaponTypes.Missile): Options &= MissileOptions; break; case (WeaponTypes.Projectile): Options &= ProjectileOptions; break; case (WeaponTypes.EMW): Options &= EMWOptions; break; case (WeaponTypes.Melee): Options &= MeleeOptions; break; default: throw new System.ArgumentException("GetWeaponType() failed to have a valid weapon type."); } switch (Options & (WeaponOptions.AllPurpose)) { case (WeaponOptions.AllPurpose): x *= 2.6; break; case (WeaponOptions.AntiMissileVariable): if (GetWeaponType() == WeaponTypes.Projectile) { x *= 1.4; break; } goto case (WeaponOptions.AntiMissileAntiPersonnel); case (WeaponOptions.AntiMissileAntiPersonnel): if (GetWeaponType() == WeaponTypes.Projectile) { x *= 1.6; break; } goto case (WeaponOptions.AntiPersonnelVariable); case (WeaponOptions.AntiPersonnelVariable): { x *= 1.8; break; } case (WeaponOptions.AntiMissile): if (GetWeaponType() == WeaponTypes.Projectile) { x *= 0.5; break; } x *= 1.0; break; case (WeaponOptions.AntiPersonnel): { x *= 1.0; break; } } if ((Options & WeaponOptions.ArmorPiercing) > 0) { x *= 2.0; } if ((Options & WeaponOptions.Disruptor) > 0) { x *= 2.0; } if ((Options & WeaponOptions.Quick) > 0) { x *= 2.0; } if ((Options & WeaponOptions.Handy) > 0) { x *= 1.5; } if ((Options & WeaponOptions.MegaBeam) > 0) { x *= 10.0; } if ((Options & WeaponOptions.Rechargable) > 0) { x *= 1.1; } if ((Options & WeaponOptions.Thrown) > 0) { x *= 1.2; } if ((Options & WeaponOptions.LongRange) > 0) { x *= 1.33; } if ((Options & WeaponOptions.HydroBeam) > 0) { x *= 0.2; } if ((Options & WeaponOptions.Fragile) > 0) { x *= 1.0; } if ((Options & WeaponOptions.ShockAdded) == WeaponOptions.ShockAdded) { x *= 3.0; } else if ((Options & WeaponOptions.ShockOnly) > 0) { x *= 2.0; } if ((Options & WeaponOptions.Returning) > 0) { x *= 1.5; } if ((Options & WeaponOptions.Entangle) > 0) { x *= 1.25; } if ((Options & WeaponOptions.Clumsy) > 0) { x *= 0.5; } if ((Options & WeaponOptions.ClipFed) > 0) { x *= 0.9; } if ((Options & WeaponOptions.Foam) > 0) { x *= 1.33; } if ((Options & WeaponOptions.Nuclear) > 0) { x *= 1000.0; } if ((Options & WeaponOptions.Flare) > 0) { x *= 1.0; } if ((Options & WeaponOptions.ScatterSmoke) == WeaponOptions.ScatterSmoke) { x *= 1.0; } else if ((Options & WeaponOptions.Smoke) > 0) { x *= 0.5; } else if ((Options & WeaponOptions.Scatter) > 0) { x *= 0.5; } if ((Options & WeaponOptions.HyperVelocity) > 0) { x *= 1.25; } if ((Options & WeaponOptions.Fuse) > 0) { x *= 1.1; } if ((Options & WeaponOptions.HyperEMW) > 0) { x *= 7.5; } if ((Options & WeaponOptions.BeamShieldVariable) == WeaponOptions.BeamShieldVariable) { x *= 2.0; } else if ((Options & WeaponOptions.BeamShield) > 0) { x *= 1.5; } if ((Options & WeaponOptions.SpecialEffect) > 0) { x *= 1.33; } return(x); }