public Ammunition(string ammoName, int qnty) : base() { Appearance = AllChars.AmmunitionChar; Color = ConsoleColor.White; name = ammoName; Quantity = qnty; weight = 0; switch (name) { case "Arrow": TypeOfAmmunition = AmmoTypes.Arrow; break; case "Bullet": TypeOfAmmunition = AmmoTypes.Bullet; break; //If you see this ingame, then there is probably a bug somewhere default: name = "??DEFAULT_AMMO??"; TypeOfAmmunition = AmmoTypes.Arrow; break; } }
public void FindAmmo(List <Item> list, AmmoTypes ammoType) { for (int i = 0; i < this.itemList.Count; i++) { this.itemList[i].FindAmmo(list, ammoType); } }
public void Activate(Unit unit, AmmoTypes ammoType, bool active, Transform holder, float rise = 0.0f, float rotation = 0, float startingScale = 1, float timeToShow = 0.5f) { _active = active; if (!_active || unit == null) { gameObject.SetActive(false); return; } /*this checked earlier/above //skip if same visual effect already present and active if (unit.ActiveUnitVisuals[ammoType]) { _active = false; gameObject.SetActive(false); return; }*/ _unit = unit; _ammoType = ammoType; _showTimer = timeToShow; _timeToShow = timeToShow; _showAboveTransform = holder; _rise = rise; _rotation = rotation; _startingRotation = Random.Range(0, 359); _startingScale = startingScale; }
public void FindAmmo(List <Item> list, AmmoTypes ammoType) { for (int index = 0; index < this.itemList.Count; ++index) { this.itemList[index].FindAmmo(list, ammoType); } }
public bool HasAmmo(AmmoTypes ammoType) { if (this.containerMain.HasAmmo(ammoType)) { return(true); } return(this.containerBelt.HasAmmo(ammoType)); }
public int GetAmmo(AmmoTypes ammoType) { if (!Ammunition.ContainsKey(ammoType)) { return(0); } return(this.Ammunition[ammoType]); }
public void AddAmmo(AmmoTypes ammoType, uint ammo) { foreach (AmmoSlots slot in ammoSlots) { if (ammoType == slot.ammoType) { slot.ammoCount += ammo; } } }
public void ReduceAmmo(AmmoTypes ammoType) { foreach (AmmoSlots slot in ammoSlots) { if (ammoType == slot.ammoType) { slot.ammoCount--; } } }
public void FindAmmo(List <Item> list, AmmoTypes ammoType) { if (this.containerMain != null) { this.containerMain.FindAmmo(list, ammoType); } if (this.containerBelt != null) { this.containerBelt.FindAmmo(list, ammoType); } }
public bool HasAmmo(AmmoTypes ammoType) { for (int i = 0; i < this.itemList.Count; i++) { if (this.itemList[i].HasAmmo(ammoType)) { return(true); } } return(false); }
public uint GetAmmo(AmmoTypes ammoType) { foreach (AmmoSlots slot in ammoSlots) { if (ammoType == slot.ammoType) { return(slot.ammoCount); } } return(0); }
public virtual void ChangeAmmoAmount(AmmoTypes type, int amount) { if(ammo.ContainsKey(type)) { ammo[type] += amount; } else { print("ammo type not found, something wrong with inventory"); } }
public bool HasAmmo(AmmoTypes ammoType) { for (int index = 0; index < this.itemList.Count; ++index) { if (this.itemList[index].HasAmmo(ammoType)) { return(true); } } return(false); }
private static void Main(string[] args) { var commandLineArgs = new CommandLineArguments(args); var inputFileName = commandLineArgs.GetKeyValue("pdf"); if (inputFileName == null) { ShowHelp(); return; } var output = ReadPdfFile(inputFileName); debugVerbose = commandLineArgs.HasArg("debugVerbose"); debugWholeOptions = commandLineArgs.HasArg("debugWholeOptions"); debugIndividualOptions = commandLineArgs.HasArg("debugIndividualOptions"); justText = commandLineArgs.HasArg("justText"); var outputFileName = commandLineArgs.GetKeyValue("out") ?? "Output.xml"; StreamWriter outFile = new StreamWriter(outputFileName); if (justText) { outFile.Write(output); } else { outFile.WriteLine("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); units = new Units(); options = new Options(); ignoreLines = new IgnoreLines(); sections = new Sections(); ammoTypes = new AmmoTypes(); var lines = output.Split(new[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries); foreach (var line in lines) { if (debugVerbose) { outFile.WriteLine("<line>" + line + "</line>"); } else { DealWithLine(line, outFile); } } CloseTag(outFile, true, true, true); outFile.WriteLine("</army-list>"); } outFile.Close(); }
public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.ReadInt(); switch (version) { case 1: m_AmmoType = (AmmoTypes)reader.ReadInt(); break; } }
public void FindAmmo(List <Item> list, AmmoTypes ammoType) { ItemModProjectile component; if (info.TryGetComponent <ItemModProjectile>(out component) && component.IsAmmo(ammoType)) { list.Add(this); } else if (contents != null) { contents.FindAmmo(list, ammoType); } }
public bool HasAmmo(AmmoTypes ammoType) { ItemModProjectile component = this.info.GetComponent <ItemModProjectile>(); if (component && component.IsAmmo(ammoType)) { return(true); } if (this.contents == null) { return(false); } return(this.contents.HasAmmo(ammoType)); }
public bool HasAmmo(AmmoTypes ammoType) { ItemModProjectile component = (ItemModProjectile)((Component)this.info).GetComponent <ItemModProjectile>(); if (Object.op_Implicit((Object)component) && component.IsAmmo(ammoType)) { return(true); } if (this.contents != null) { return(this.contents.HasAmmo(ammoType)); } return(false); }
public void FindAmmo(List <Item> list, AmmoTypes ammoType) { ItemModProjectile component = this.info.GetComponent <ItemModProjectile>(); if (component && component.IsAmmo(ammoType)) { list.Add(this); return; } if (this.contents != null) { this.contents.FindAmmo(list, ammoType); } }
public bool HasAmmo(AmmoTypes ammoType) { ItemModProjectile component; if (info.TryGetComponent <ItemModProjectile>(out component) && component.IsAmmo(ammoType)) { return(true); } if (contents != null) { return(contents.HasAmmo(ammoType)); } return(false); }
public bool Type(WeaponList targetWeaponType, AmmoTypes ammoType, RangeWeaponParts part) { switch (targetWeaponType) { case WeaponList.AR15: return(part.weaponList == targetWeaponType && part.ammoType == ammoType); case WeaponList.AK47: return(part.weaponList == targetWeaponType && part.ammoType == ammoType); case WeaponList.M4A1: return(part.weaponList == targetWeaponType && part.ammoType == ammoType); default: return(false); } }
public void FindAmmo(List <Item> list, AmmoTypes ammoType) { ItemModProjectile component = (ItemModProjectile)((Component)this.info).GetComponent <ItemModProjectile>(); if (Object.op_Implicit((Object)component) && component.IsAmmo(ammoType)) { list.Add(this); } else { if (this.contents == null) { return; } this.contents.FindAmmo(list, ammoType); } }
public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.ReadInt(); switch (version) { case 4: { m_ArrowType = ( AmmoTypes )reader.ReadEncodedInt(); goto case 3; } case 3: { m_Balanced = reader.ReadBool(); m_Velocity = reader.ReadInt(); goto case 2; } case 2: case 1: { break; } case 0: { /*m_EffectID =*/ reader.ReadInt(); break; } } if (version < 2) { WeaponAttributes.MageWeapon = 0; WeaponAttributes.UseBestSkill = 0; } }
public void SetAmmo(AmmoTypes ammoTypes, int amount) { this.Ammunition[ammoTypes] = amount; }
public void Reload() { BaseProjectile attachedWeapon = GetAttachedWeapon(); if (attachedWeapon == null) { return; } nextShotTime = Mathf.Max(nextShotTime, UnityEngine.Time.time + Mathf.Min(attachedWeapon.GetReloadDuration() * 0.5f, 2f)); AmmoTypes ammoTypes = attachedWeapon.primaryMagazine.definition.ammoTypes; if (attachedWeapon.primaryMagazine.contents > 0) { base.inventory.AddItem(attachedWeapon.primaryMagazine.ammoType, attachedWeapon.primaryMagazine.contents, 0uL); attachedWeapon.primaryMagazine.contents = 0; } List <Item> obj = Facepunch.Pool.GetList <Item>(); base.inventory.FindAmmo(obj, ammoTypes); if (obj.Count > 0) { Effect.server.Run(reloadEffect.resourcePath, this, StringPool.Get("WeaponAttachmentPoint"), Vector3.zero, Vector3.zero); totalAmmoDirty = true; attachedWeapon.primaryMagazine.ammoType = obj[0].info; int num = 0; while (attachedWeapon.primaryMagazine.contents < attachedWeapon.primaryMagazine.capacity && num < obj.Count) { if (obj[num].info == attachedWeapon.primaryMagazine.ammoType) { int b = attachedWeapon.primaryMagazine.capacity - attachedWeapon.primaryMagazine.contents; b = Mathf.Min(obj[num].amount, b); obj[num].UseItem(b); attachedWeapon.primaryMagazine.contents += b; } num++; } } ItemDefinition ammoType = attachedWeapon.primaryMagazine.ammoType; if ((bool)ammoType) { ItemModProjectile component = ammoType.GetComponent <ItemModProjectile>(); GameObject gameObject = component.projectileObject.Get(); if ((bool)gameObject) { if ((bool)gameObject.GetComponent <Projectile>()) { currentAmmoGravity = 0f; currentAmmoVelocity = component.GetMaxVelocity(); } else { ServerProjectile component2 = gameObject.GetComponent <ServerProjectile>(); if ((bool)component2) { currentAmmoGravity = component2.gravityModifier; currentAmmoVelocity = component2.speed; } } } } Facepunch.Pool.FreeList(ref obj); attachedWeapon.SendNetworkUpdate(); }
public BaseAmmo(int itemID, AmmoTypes type) : base(itemID) { Stackable = true; AmmoTypes = type; }
public bool IsAmmo(AmmoTypes ammo) { return((int)(this.ammoType & ammo) != 0); }
public override void ChangeAmmoAmount(AmmoTypes type, int amount) { base.ChangeAmmoAmount(type, amount); UpdateAmmoTexts(); }
public bool IsAmmo(AmmoTypes ammo) { return((ammoType & ammo) != 0); }
public static void ApplyDamageEffect(Mobile defender, Mobile attacker, AmmoTypes typeAmmo) { double luck = attacker.Luck * .02; int physicaldamage = (int)((100 - defender.GetResistance(ResistanceType.Physical)) * .07 + luck); int colddamage = (int)((100 - defender.GetResistance(ResistanceType.Cold)) * .07 + luck); int firedamage = (int)((100 - defender.GetResistance(ResistanceType.Fire)) * .07 + luck); int poisondamage = (int)((100 - defender.GetResistance(ResistanceType.Poison)) * .07 + luck); int energydamage = (int)((100 - defender.GetResistance(ResistanceType.Energy)) * .07 + luck); if (physicaldamage < 1) { physicaldamage = 1; } if (colddamage < 1) { colddamage = 1; } if (firedamage < 1) { firedamage = 1; } if (poisondamage < 1) { poisondamage = 1; } if (energydamage < 1) { energydamage = 1; } switch (typeAmmo) { case AmmoTypes.Oak: { if ((0.1 + luck) > Utility.RandomDouble()) { defender.Damage(physicaldamage, attacker); } else { AOS.Damage(defender, Utility.Random(1, 5), 100, 0, 0, 0, 0); } break; } case AmmoTypes.Yew: { if ((0.1 + luck) > Utility.RandomDouble()) { defender.Damage(physicaldamage + 3, attacker); } else { AOS.Damage(defender, Utility.Random(3, 6), 100, 0, 0, 0, 0); } break; } case AmmoTypes.Ash: { if ((0.1 + luck) > Utility.RandomDouble()) { SpellHelper.Damage(new FireballSpell(attacker, null), defender, Utility.RandomMinMax(10, 30), 0, 100, 0, 0, 0); attacker.MovingParticles(defender, 0x36D4, 7, 0, false, true, 9502, 4019, 0x160); attacker.PlaySound(Core.AOS ? 0x15E : 0x44B); } else { AOS.Damage(defender, Utility.Random(1, 5), 0, 100, 0, 0, 0); } break; } case AmmoTypes.Bloodwood: { if ((0.1 + luck) > Utility.RandomDouble()) { defender.PlaySound(0x133); defender.FixedParticles(0x377A, 244, 25, 9950, 31, 0, EffectLayer.Waist); BleedAttack.BeginBleed(defender, attacker); } else { AOS.Damage(defender, Utility.Random(1, 5), 100, 0, 0, 0, 0); } break; } case AmmoTypes.Heartwood: { if ((0.1 + luck) > Utility.RandomDouble()) { defender.PlaySound(0xDD); defender.FixedParticles(0x3728, 244, 25, 9941, 1266, 0, EffectLayer.Waist); if (attacker.Skills[SkillName.Poisoning].Value > Utility.RandomMinMax(50, 250)) { defender.ApplyPoison(attacker, Poison.Deadly); } else { defender.ApplyPoison(attacker, Poison.Regular); } } else { AOS.Damage(defender, Utility.Random(1, 5), 0, 0, 0, 100, 0); } break; } case AmmoTypes.Frostwood: { if ((0.15 + luck) > Utility.RandomDouble()) { TimeSpan duration = defender.Player ? TimeSpan.FromSeconds(4) : TimeSpan.FromSeconds(8); defender.Paralyze(duration); ParalyzingBlow.BeginImmunity(defender, duration + TimeSpan.FromSeconds(4)); defender.FixedEffect(0x376A, 9, 32); defender.PlaySound(0x204); } else { AOS.Damage(defender, Utility.Random(1, 5), 0, 100, 15, 0, 0); } break; } case AmmoTypes.DullCopper: { if ((0.3 + luck) > Utility.RandomDouble()) { AOS.Damage(defender, Utility.RandomMinMax(8, 18), true, 100, 0, 0, 0, 0); defender.FixedParticles(0x3728, 1, 26, 0x26D6, 0, 0, EffectLayer.Waist); defender.PlaySound(0x56); } else { AOS.Damage(defender, Utility.Random(1, 8), 100, 0, 0, 0, 0); } break; } case AmmoTypes.ShadowIron: { if ((0.1 + luck) > Utility.RandomDouble()) { defender.Damage(energydamage, attacker); defender.PlaySound(0x56); } else { AOS.Damage(defender, 5, 0, 0, 0, 0, 40); } break; } case AmmoTypes.Copper: { if ((0.1 + luck) > Utility.RandomDouble()) { defender.Damage(energydamage, attacker); defender.Damage(poisondamage, attacker); defender.PlaySound(0x56); } else { AOS.Damage(defender, 5, 0, 0, 0, 30, 30); } break; } case AmmoTypes.Bronze: { if ((0.1 + luck) > Utility.RandomDouble()) { defender.Damage(physicaldamage, attacker); defender.Damage(firedamage, attacker); defender.PlaySound(0x56); } else { AOS.Damage(defender, 5, 15, 40, 0, 0, 0); } break; } case AmmoTypes.Gold: { if ((0.1 + luck) > Utility.RandomDouble()) { defender.Damage(physicaldamage, attacker); defender.Damage(firedamage, attacker); defender.Damage(colddamage, attacker); defender.PlaySound(0x56); } else { AOS.Damage(defender, 5, 20, 15, 15, 0, 0); } break; } case AmmoTypes.Agapite: { if ((0.1 + luck) > Utility.RandomDouble()) { defender.Damage(physicaldamage, attacker); defender.Damage(firedamage, attacker); defender.Damage(energydamage, attacker); defender.PlaySound(0x56); } else { AOS.Damage(defender, 5, 25, 30, 0, 0, 20); } break; } case AmmoTypes.Verite: { if ((0.1 + luck) > Utility.RandomDouble()) { defender.Damage(physicaldamage, attacker); defender.Damage(poisondamage, attacker); defender.Damage(energydamage, attacker); defender.PlaySound(0x56); } else { AOS.Damage(defender, 5, 30, 0, 0, 40, 20); } break; } case AmmoTypes.Valorite: { if ((0.1 + luck) > Utility.RandomDouble()) { defender.Damage(physicaldamage, attacker); defender.Damage(firedamage, attacker); defender.Damage(colddamage, attacker); defender.Damage(poisondamage, attacker); defender.Damage(energydamage, attacker); defender.PlaySound(0x56); } else { AOS.Damage(defender, 5, 50, 10, 20, 10, 20); } break; } default: break; } }
public bool IsAmmo(AmmoTypes ammo) { return((this.ammoType & ammo) > 0); }