private void SaveFile() { bool error = false; newBloon = new Bloon(); newBloon = bloon; newBloon.SpriteFile = SpriteFile_TextBox.Text; if (InitialHealth_TextBox.Text.Length > 0) { long initialHealth = 0; try { initialHealth = Int64.Parse(InitialHealth_TextBox.Text); if (initialHealth <= 0) { ConsoleHandler.force_append_Notice("Inital Health must be at least 1, automatically setting it to 1"); initialHealth = 1; } newBloon.InitialHealth = initialHealth; } catch (FormatException) { ConsoleHandler.force_append_Notice("Your initial health is not a valid number..."); error = true; } } try { newBloon.BaseSpeed = Double.Parse(BaseSpeed_TextBox.Text); } catch (FormatException) { ConsoleHandler.force_append_Notice("Your base speed is not a valid number..."); error = true; } try { newBloon.SpeedMultiplier = Double.Parse(SpeedMultiplier_TextBox.Text); } catch (FormatException) { ConsoleHandler.force_append_Notice("Your speed multiplier is not a valid number..."); error = true; } try { newBloon.Rbe = Int64.Parse(RBE_TextBox.Text); } catch (FormatException) { ConsoleHandler.force_append_Notice("Your RBE is not a valid number..."); error = true; } if (Radius_TextBox.Text.Length > 0) { try { newBloon.Radius = Double.Parse(Radius_TextBox.Text); } catch (FormatException) { ConsoleHandler.force_append_Notice("Your radius is not a valid number..."); error = true; } } if (Scale_TextBox.Text.Length > 0) { try { newBloon.Scale = Double.Parse(Scale_TextBox.Text); } catch (FormatException) { ConsoleHandler.force_append_Notice("Your scale is not a valid number..."); error = true; } } if (ChildEffectScale_TextBox.Text.Length > 0) { try { newBloon.ChildEffectScale = Double.Parse(ChildEffectScale_TextBox.Text); } catch (FormatException) { ConsoleHandler.force_append_Notice("Your child effect scale is not a valid number..."); error = true; } } if (HitAddon_TextBox.Visible == true) { if (HitAddon_TextBox.Text.Length > 0) { try { newBloon.HitAddon = Double.Parse(HitAddon_TextBox.Text); } catch (FormatException) { ConsoleHandler.force_append_Notice("Your hit addon is not a valid number..."); error = true; } } } if (DrawLayer_LB.Visible == true) { if (DrawLayer_LB.Text.Length > 0) { newBloon.DrawLayer = DrawLayer_LB.SelectedItem.ToString(); } } if (!AdvancedView_Checkbox.Checked || forceAdvancedView == false) { newBloon.CanGoUnderground = true; } //if(CanGoUnderground_CheckBox.Visible == true) if (RotateToPathDirection_Checkbox.Visible == true) { newBloon.RotateToPathDirection = RotateToPathDirection_Checkbox.Checked; } //Save child bloons object[] children = new object[0]; foreach (var item in CurrentChildBloon_ListBox.Items) { Array.Resize(ref children, children.Length + 1); string childName = item.ToString(); if (!item.ToString().EndsWith(".bloon")) { childName = childName + ".bloon"; } children[children.Length - 1] = childName; } newBloon.ChildBloons = children; newBloon.StatusImmunity = CreateStringArray_FromCheckedLB(StatusImmunity_CheckedListBox); newBloon.DamageImmunity = CreateStringArray_FromCheckedLB(DamageImmunity_CheckedListBox); if (game == "BTD5") { newBloon.BloonAbility = CreateStringArray_FromCheckedLB(BloonAbility_CheckedListBox); newBloon.ApplyStatus = CreateStringArray_FromCheckedLB(ApplyStatus_CheckedListBox); } if (!error) { var saveFile = SerializeBloon.ToJson(newBloon); File.WriteAllText(path, saveFile); } }
/// <summary> /// Check if this has a specific Behavior /// </summary> /// <typeparam name="T">The Behavior you're checking for</typeparam> /// <param name="bloon"></param> /// <returns></returns> public static bool HasBloonBehavior <T>(this Bloon bloon) where T : BloonBehavior { return(bloon.bloonBehaviors.HasItemsOfType <BloonBehavior, T>()); }
/// <summary> /// Called right after a Bloon is damaged /// /// Equivalent to a HarmonyPostFix on Bloon.Damaged /// </summary> public virtual void PostBloonDamaged(Bloon bloon, float amount, DamageType damageType, [Optional] Projectile projectile, [Optional] DamageDistributionMethod distributeToChildren, [Optional] Tower damageBy, bool allowTransform = true) { }
public NBloonEntity(Bloon theBloon) { this.theBloon = theBloon; }
/// <summary> /// Called right after a Bloon is first created /// /// Equivalent to a HarmonyPostFix on Bloon.Initialise /// </summary> public virtual void OnBloonCreated(Bloon bloon) { }
/// <summary> /// Called right after a Bloon is destroyed /// /// Equivalent to a HarmonyPostFix on Bloon.OnDestroy /// </summary> public virtual void OnBloonDestroy(Bloon bloon) { }
/// <summary> /// Called right after a Bloon leaks. /// Return 'false' to prevent the leak from happening /// /// Equivalent to a HarmonyPostFix on Bloon.Leaked /// </summary> public virtual void PostBloonLeaked(Bloon bloon) { }
/// <summary> /// Called right before a Bloon would leak. /// Return 'false' to prevent the leak from happening /// /// Equivalent to a HarmonyPreFix on Bloon.Leaked /// </summary> public virtual bool PreBloonLeaked(Bloon bloon) { return(true); }
internal static void Postfix(Bloon __instance, float amount, bool ignoreNonTargetable = false) { MelonMain.DoPatchMethods(mod => mod.PostBloonDamaged(__instance, amount, ignoreNonTargetable)); }
public virtual void ModifyStats(Bloon bloon) { }
internal static void Postfix(Bloon __instance) { MelonMain.PerformHook(mod => mod.PostBloonLeaked(__instance)); }