public override string Compile() { string output = ""; WeaponInfo oldWeapon = null; WeaponInfo newWeapon = null; BuildableInfo entity = null; if (ApplicationType == ApplicationTypes.ApplyToEntity) { if (this.Parent.Parent is BuildableInfo) { entity = ((BuildableInfo)Parent.Parent); } } else { entity = DataDumper.Units[Target] as BuildableInfo; } try { if (entity != null) { WeaponHardPointInfo whpInfo = entity.WeaponHardPoints[HardPoint] as WeaponHardPointInfo; oldWeapon = (WeaponInfo)whpInfo.Weapons[whpInfo.UpgradeValue]; whpInfo.UpgradeValue++; newWeapon = (WeaponInfo)whpInfo.Weapons[whpInfo.UpgradeValue]; if (!oldWeapon.IsDummyWeapon()) { if (ApplicationType == ApplicationTypes.ApplyToEntityType) { output += "Upgrades " + entity.Name + "'s " + Translation.Translate(oldWeapon.Name) + " to " + Translation.Translate(newWeapon.Name); } else if (ApplicationType == ApplicationTypes.ApplyToEntity) { output += "Upgrades " + Translation.Translate(oldWeapon.Name) + " to " + Translation.Translate(newWeapon.Name); } } else { output += "Equips " + entity.Name + " with " + Translation.Translate(newWeapon.Name); } } } catch { } return(output); }
public FearInfo() { Weapon = new WeaponInfo(); }
public MinefieldInfo() { Weapon = new WeaponInfo(); }