public static void GrandSaboteur(TowerModel model) { BloonSabotage(model); model.range += 10; List <string[]> tags = new List <string[]> { new [] { "Moab" }, new [] { "Bfb" }, new [] { "Zomg" }, new [] { "Ddt" }, new [] { "Bad" }, }; foreach (var weaponModel in model.GetWeapons()) { for (var i = 0; i < tags.Count; i++) { var t = tags[i]; var behavior = new DamageModifierForTagModel("DamageModifierForTagModel_" + i, t[0], 1.0f, 10 * (i + 1), false, false) { tags = t }; weaponModel.projectile.AddBehavior(behavior); weaponModel.projectile.pierce += 10; weaponModel.projectile.GetDamageModel().damageTypes = new Il2CppStringArray(new[] { "Normal" }); } } }
public static void BloonSabotage(TowerModel model) { model.range += 10; var ability = model.GetAbilites()[0]; var abilityAttack = ability.GetBehavior <ActivateAttackModel>().attacks[0].Duplicate(); var abilityWeapon = abilityAttack.weapons[0]; var slowMutator = abilityWeapon.projectile.GetBehavior <SlowMinusAbilityDurationModel>().Mutator; var dontSlowBadBehavior = abilityWeapon.projectile.GetBehavior <SlowModifierForTagModel>(); var slowBehavior = new SlowModel("Sabotage", 0f, 2f, slowMutator.mutationId, "", 999, new Il2CppSystem.Collections.Generic.Dictionary <string, AssetPathModel>(), 0, true, false, null, false, false) { mutator = slowMutator }; foreach (var weaponModel in model.GetWeapons()) { weaponModel.projectile.AddBehavior(slowBehavior); weaponModel.projectile.AddBehavior(dontSlowBadBehavior); weaponModel.projectile.pierce += 5; weaponModel.projectile.GetDamageModel().damageTypes = new Il2CppStringArray(new[] { "Normal" }); } }
public static void BloonAreNotPrepared(TowerModel model) { if (model.appliedUpgrades.Contains("Heart of Vengeance")) { foreach (var weaponModel in model.GetWeapons()) { var lbasm = weaponModel.GetBehavior <LifeBasedAttackSpeedModel>(); if (lbasm != null) { var bonus = lbasm.lifeCap * lbasm.ratePerLife + lbasm.baseRateIncrease; weaponModel.Rate /= 1 + bonus; weaponModel.RemoveBehavior <LifeBasedAttackSpeedModel>(); } } } if (model.appliedUpgrades.Contains("Druid of Wrath")) { var dbasm = model.GetBehavior <DamageBasedAttackSpeedModel>(); if (dbasm != null) { var bonus = dbasm.maxStacks * dbasm.increasePerThreshold; foreach (var weaponModel in model.GetWeapons()) { weaponModel.Rate /= 1 + bonus; } } } if (model.appliedUpgrades.Contains("Avatar of Wrath")) { var dvem = model.GetBehavior <DruidVengeanceEffectModel>(); if (dvem != null) { var dmwm = dvem.damageModifierWrathModel; dmwm.rbeThreshold = 1; dvem.epicGlowEffectStacks = -1; } } }
/// <summary> /// (Cross-Game compatible) Return the first WeaponModel this TowerModel has, if it has one. /// </summary> public static WeaponModel GetWeapon(this TowerModel towerModel) { return(towerModel.GetWeapons().FirstOrDefault()); }
/// <summary> /// (Cross-Game compatible) Return one of the WeaponModels this TowerModel has. By default will return the first one /// </summary> /// <param name="index">Index of WeaponModel that you want</param> public static WeaponModel GetWeapon(this TowerModel towerModel, int index) { return(towerModel.GetWeapons()[index]); }
public static void CrystalBall(TowerModel model) { if (!model.appliedUpgrades.Contains("Guided Magic")) { return; } model.ignoreBlockers = false; var guidedMagic = model.GetWeapon().projectile.GetBehavior <TrackTargetModel>(); foreach (var attackModel in model.GetAttackModels()) { if (attackModel.GetBehavior <TargetFirstModel>() != null) { attackModel.RemoveBehavior <TargetFirstModel>(); attackModel.AddBehavior(new TargetFirstSharedRangeModel("TargetFirstSharedRangeModel_", true, true, false, false)); } if (attackModel.GetBehavior <TargetLastModel>() != null) { attackModel.RemoveBehavior <TargetLastModel>(); attackModel.AddBehavior(new TargetLastSharedRangeModel("TargetLastSharedRangeModel_", true, true, false, false)); } if (attackModel.GetBehavior <TargetCloseModel>() != null) { attackModel.RemoveBehavior <TargetCloseModel>(); attackModel.AddBehavior(new TargetCloseSharedRangeModel("TargetCloseSharedRangeModel_", true, true, false, false)); } if (attackModel.GetBehavior <TargetStrongModel>() != null) { attackModel.RemoveBehavior <TargetStrongModel>(); attackModel.AddBehavior(new TargetStrongSharedRangeModel("TargetStrongSharedRangeModel_", true, true, false, false)); } attackModel.attackThroughWalls = false; } foreach (var weaponModel in model.GetWeapons()) { weaponModel.emission.AddBehavior( new EmissionCamoIfTargetIsCamoModel("EmissionCamoIfTargetIsCamoModel_CamoEmissionBehavior")); } foreach (var projectileModel in model.GetAllProjectiles()) { var travelStraitModel = projectileModel.GetBehavior <TravelStraitModel>(); if (travelStraitModel != null) { var newLifeSpan = travelStraitModel.Lifespan * (150 / travelStraitModel.Speed); travelStraitModel.Lifespan = Math.Max(travelStraitModel.Lifespan, newLifeSpan); if (projectileModel.GetBehavior <TrackTargetModel>() == null) { projectileModel.AddBehavior(guidedMagic.Duplicate()); } } projectileModel.ignoreBlockers = false; } }