Skip to content

Commit 5439f0d

Browse files
committed
added PwBomberMinimumIpFloor (5) and PwBomberSelfIpRate (0.5)
1 parent 25dc753 commit 5439f0d

6 files changed

Lines changed: 202 additions & 10 deletions

Zero-K.info/Controllers/PlanetwarsController.cs

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -70,19 +70,23 @@ public ActionResult BombPlanet(int planetID, int count, bool? useWarp)
7070
double ipKillAmmount = ipKillCount * GlobalConst.BomberKillIpAmount;
7171
if (ipKillAmmount > 0)
7272
{
73-
var influenceDecayMin = planet.PlanetStructures.Where(x => x.IsActive && x.StructureType.EffectPreventInfluenceDecayBelow != null).Select(x => x.StructureType.EffectPreventInfluenceDecayBelow).OrderByDescending(x => x).FirstOrDefault() ?? 0;
73+
var structureFloor = planet.PlanetStructures.Where(x => x.IsActive && x.StructureType.EffectPreventInfluenceDecayBelow != null).Select(x => x.StructureType.EffectPreventInfluenceDecayBelow).OrderByDescending(x => x).FirstOrDefault() ?? 0;
74+
var globalFloor = DynamicConfig.Instance.PwBomberMinimumIpFloor;
75+
var selfRate = DynamicConfig.Instance.PwBomberSelfIpRate;
7476

75-
76-
foreach (PlanetFaction pf in planet.PlanetFactions.Where(x => x.FactionID != acc.FactionID))
77+
foreach (PlanetFaction pf in planet.PlanetFactions)
7778
{
78-
pf.Influence -= ipKillAmmount;
79-
if (pf.Influence < 0) pf.Influence = 0;
80-
81-
// prevent bombing below influence decaymin for owner - set by active structures
82-
if (pf.FactionID == planet.OwnerFactionID && pf.Influence < influenceDecayMin) pf.Influence = influenceDecayMin;
83-
}
79+
bool isOwn = pf.FactionID == acc.FactionID;
80+
double damage = isOwn ? ipKillAmmount * selfRate : ipKillAmmount;
81+
if (damage <= 0) continue;
8482

83+
// owner gets max of global floor and any structure-provided floor; everyone else gets global only
84+
double floor = (pf.FactionID == planet.OwnerFactionID) ? Math.Max(globalFloor, structureFloor) : globalFloor;
8585

86+
// floor only prevents pushing below it — a faction already below the floor is not raised by bombing
87+
double effectiveFloor = Math.Min(pf.Influence, floor);
88+
pf.Influence = Math.Max(pf.Influence - damage, Math.Max(effectiveFloor, 0));
89+
}
8690
}
8791

8892
var args = new List<object>

ZkData/Ef/DynamicConfig.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,13 @@ public class DynamicConfig
4747
public int PwAttackChargesMax { get; set; } = 2;
4848

4949
[Description("PlanetWars: minutes a player must sit below max charges before gaining one passively.")]
50-
public int PwAttackChargesRechargeMinutes { get; set; } = 60;
50+
public int PwAttackChargesRechargeMinutes { get; set; } = 60;
51+
52+
[Description("PlanetWars: fraction of enemy bomber IP damage also applied to the bomber's own faction. 0 disables self-damage.")]
53+
public double PwBomberSelfIpRate { get; set; } = 0.5;
54+
55+
[Description("PlanetWars: minimum IP (0-100) below which bombers cannot push any faction. 0 disables the floor.")]
56+
public double PwBomberMinimumIpFloor { get; set; } = 5.0;
5157

5258

5359
public static DynamicConfig Instance;

ZkData/Migrations/202604231826040_AddPwBomberNerfConfigs.Designer.cs

Lines changed: 29 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
namespace ZkData.Migrations
2+
{
3+
using System;
4+
using System.Data.Entity.Migrations;
5+
6+
public partial class AddPwBomberNerfConfigs : DbMigration
7+
{
8+
public override void Up()
9+
{
10+
AddColumn("dbo.DynamicConfigs", "PwBomberSelfIpRate", c => c.Double(nullable: false, defaultValue: 0.5));
11+
AddColumn("dbo.DynamicConfigs", "PwBomberMinimumIpFloor", c => c.Double(nullable: false, defaultValue: 5.0));
12+
}
13+
14+
public override void Down()
15+
{
16+
DropColumn("dbo.DynamicConfigs", "PwBomberMinimumIpFloor");
17+
DropColumn("dbo.DynamicConfigs", "PwBomberSelfIpRate");
18+
}
19+
}
20+
}

ZkData/Migrations/202604231826040_AddPwBomberNerfConfigs.resx

Lines changed: 126 additions & 0 deletions
Large diffs are not rendered by default.

ZkData/ZkData.csproj

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -503,6 +503,10 @@
503503
<Compile Include="Migrations\202604231755110_AddStructureBlockFlags.Designer.cs">
504504
<DependentUpon>202604231755110_AddStructureBlockFlags.cs</DependentUpon>
505505
</Compile>
506+
<Compile Include="Migrations\202604231826040_AddPwBomberNerfConfigs.cs" />
507+
<Compile Include="Migrations\202604231826040_AddPwBomberNerfConfigs.Designer.cs">
508+
<DependentUpon>202604231826040_AddPwBomberNerfConfigs.cs</DependentUpon>
509+
</Compile>
506510
<Compile Include="SpringFilesUnitsyncAttempt.cs" />
507511
<Compile Include="SteamWebApi.cs" />
508512
<Compile Include="UserLanguageNoteAttribute.cs" />
@@ -960,6 +964,9 @@
960964
<EmbeddedResource Include="Migrations\202604231755110_AddStructureBlockFlags.resx">
961965
<DependentUpon>202604231755110_AddStructureBlockFlags.cs</DependentUpon>
962966
</EmbeddedResource>
967+
<EmbeddedResource Include="Migrations\202604231826040_AddPwBomberNerfConfigs.resx">
968+
<DependentUpon>202604231826040_AddPwBomberNerfConfigs.cs</DependentUpon>
969+
</EmbeddedResource>
963970
<EmbeddedResource Include="ZkDataResources.resx">
964971
<Generator>ResXFileCodeGenerator</Generator>
965972
<LastGenOutput>ZkDataResources.Designer.cs</LastGenOutput>

0 commit comments

Comments
 (0)