public override void Event_Projectile_Impact(RuneComp rune, Projectile projectile, Thing hitThing, Thing launcher, Thing weapon) { //Log.Message("launcher: " + launcher.ToString()); int finalDamage = damageAmount; float finalRadius = radius; if (scaleToDamage != 0) { float damageScale = (float)projectile.def.projectile.GetDamageAmount(weapon) / (float)scaleToDamage; if (maximumScalingFactor != -1f && damageScale > maximumScalingFactor) { damageScale = maximumScalingFactor; } finalDamage = (int)Math.Ceiling(damageAmount * damageScale); finalRadius = (float)Math.Ceiling(finalRadius * damageScale); } GenExplosion.DoExplosion(projectile.Position, launcher.Map, finalRadius, damageDef, launcher, damAmount: finalDamage); }
public override string GetDescriptionPart(RuneComp rune) { StringBuilder builder = new StringBuilder(); if (damageDef != null) { builder.AppendLine(" " + "RunesSpecialUpgradeExplosionDamageType".Translate() + ": " + damageDef.LabelCap); } builder.AppendLine(" " + "RunesSpecialUpgradeExplosionRadius".Translate() + ": " + radius); if (damageAmount > -1f) { builder.AppendLine(" " + "RunesSpecialUpgradeExplosionDamage".Translate() + ": " + damageAmount); } if (scaleToDamage != 0) { builder.AppendLine(" " + "RunesSpecialUpgradeExplosionScaleToDamage".Translate() + ": " + scaleToDamage); if (maximumScalingFactor != -1f) { builder.AppendLine(" " + "RunesSpecialUpgradeExplosionMaximumScalingFactor".Translate() + ": " + maximumScalingFactor.ToStringByStyle(ToStringStyle.PercentZero, ToStringNumberSense.Absolute)); } } return(builder.ToString()); }
public override string TransformLabel(string label) { if (socketedThings.Count <= 0) { return(base.TransformLabel(label)); } var runePrefixes = SocketedRunes?.Where(rune => rune.RuneProps.prefix != null); var runeSufffixes = SocketedRunes?.Where(rune => rune.RuneProps.suffix != null); if (runePrefixes != null) { RuneComp resultRune = runePrefixes.OrderByDescending(rune => rune.RuneProps.labelPower).FirstOrDefault(); if (resultRune != null) { label = resultRune.RuneProps.prefix + " " + label; } } if (runePrefixes != null) { RuneComp resultRune = runeSufffixes.OrderByDescending(rune => rune.RuneProps.labelPower).FirstOrDefault(); if (resultRune != null) { if (label.Contains('(')) { label = label.Insert(label.LastIndexOf('(') - 1, " " + resultRune.RuneProps.suffix); } else { label = label + resultRune.RuneProps.suffix; } } } return(label); }
/// <summary> /// Makes a optional description part for this upgrade. /// </summary> /// <returns>Any extra descriptions.</returns> public virtual string GetDescriptionPart(RuneComp rune) { return(null); }
/// <summary> /// Event: On Projectile Impact. /// </summary> /// <param name="rune">Rune associated with the impact.</param> /// <param name="projectile">Projectile impacting.</param> /// <param name="hitThing">What got hit, if any.</param> public virtual void Event_Projectile_Impact(RuneComp rune, Projectile projectile, Thing hitThing, Thing launcher, Thing weapon) { }