Skip to content

Commit 25dc753

Browse files
committed
add EffectBlocksInvasion and EffectBlocksBombers to planetwars structure types
1 parent 63468cb commit 25dc753

6 files changed

Lines changed: 210 additions & 3 deletions

ZkData/Ef/Planet.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,31 +93,46 @@ public int GetUpkeepCost()
9393
return PlanetStructures.Sum(y => (int?)y.StructureType.UpkeepEnergy) ?? 0;
9494
}
9595

96+
public bool BlocksBombers()
97+
{
98+
return PlanetStructures.Any(x => x.IsActive && x.StructureType.EffectBlocksBombers == true);
99+
}
100+
101+
public bool BlocksInvasion()
102+
{
103+
return PlanetStructures.Any(x => x.IsActive && x.StructureType.EffectBlocksInvasion == true);
104+
}
105+
96106
public bool CanDropshipsAttack(Faction attacker)
97107
{
98108
if (attacker.FactionID == OwnerFactionID) return false; // cannot attack own
109+
if (BlocksInvasion()) return false;
99110
return CheckLinkAttack(attacker, x => x.EffectPreventDropshipAttack == true, x => x.EffectAllowDropshipPass == true);
100111
}
101112

102113
public bool CanDropshipsWarp(Faction attacker)
103114
{
104115
if (attacker.FactionID == OwnerFactionID) return false; // cannot attack own
116+
if (BlocksInvasion()) return false;
105117
return CheckWarpAttack(attacker, x => x.EffectPreventDropshipAttack == true);
106118
}
107119

108120
public bool CanBombersAttack(Faction attacker)
109121
{
122+
if (BlocksBombers()) return false;
110123
return CheckLinkAttack(attacker, x => x.EffectPreventBomberAttack == true, x => x.EffectAllowBomberPass == true);
111124
}
112125

113126
public bool CanBombersWarp(Faction attacker)
114127
{
128+
if (BlocksBombers()) return false;
115129
return CheckWarpAttack(attacker, x => x.EffectPreventBomberAttack == true);
116130
}
117131

118132
public bool CanMatchMakerPlay(Faction attacker)
119133
{
120134
if (attacker == null) return false;
135+
if (BlocksInvasion()) return false;
121136

122137
if (CanDropshipsAttack(attacker) ||
123138
PlanetFactions.Where(x => x.FactionID == attacker.FactionID).Sum(y => y.Dropships) >

ZkData/Ef/StructureType.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,10 @@ public StructureType()
6161

6262
public double? EffectPreventInfluenceDecayBelow { get; set; }
6363

64-
64+
public bool? EffectBlocksBombers { get; set; }
65+
public bool? EffectBlocksInvasion { get; set; }
66+
67+
6568
public double Cost { get; set; }
6669
public bool IsBuildable { get; set; }
6770
public bool IsIngameDestructible { get; set; }

ZkData/Migrations/202604231755110_AddStructureBlockFlags.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: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
namespace ZkData.Migrations
2+
{
3+
using System;
4+
using System.Data.Entity.Migrations;
5+
6+
public partial class AddStructureBlockFlags : DbMigration
7+
{
8+
public override void Up()
9+
{
10+
AddColumn("dbo.StructureTypes", "EffectBlocksBombers", c => c.Boolean());
11+
AddColumn("dbo.StructureTypes", "EffectBlocksInvasion", c => c.Boolean());
12+
13+
// HQ-class structures (those that win the game on capture) become immune to both attack vectors by default.
14+
Sql("UPDATE dbo.StructureTypes SET EffectBlocksBombers = 1, EffectBlocksInvasion = 1 WHERE OwnerChangeWinsGame = 1");
15+
}
16+
17+
public override void Down()
18+
{
19+
DropColumn("dbo.StructureTypes", "EffectBlocksInvasion");
20+
DropColumn("dbo.StructureTypes", "EffectBlocksBombers");
21+
}
22+
}
23+
}

ZkData/Migrations/202604231755110_AddStructureBlockFlags.resx

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

ZkData/ZkData.csproj

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,13 @@
496496
<DependentUpon>202404060935038_AddPopularMapsFraction.cs</DependentUpon>
497497
</Compile>
498498
<Compile Include="Migrations\202604222356320_AddPwDynamicConfigs.cs" />
499-
<Compile Include="Migrations\202604222356320_AddPwDynamicConfigs.Designer.cs" />
499+
<Compile Include="Migrations\202604222356320_AddPwDynamicConfigs.Designer.cs">
500+
<DependentUpon>202604222356320_AddPwDynamicConfigs.cs</DependentUpon>
501+
</Compile>
502+
<Compile Include="Migrations\202604231755110_AddStructureBlockFlags.cs" />
503+
<Compile Include="Migrations\202604231755110_AddStructureBlockFlags.Designer.cs">
504+
<DependentUpon>202604231755110_AddStructureBlockFlags.cs</DependentUpon>
505+
</Compile>
500506
<Compile Include="SpringFilesUnitsyncAttempt.cs" />
501507
<Compile Include="SteamWebApi.cs" />
502508
<Compile Include="UserLanguageNoteAttribute.cs" />
@@ -948,7 +954,12 @@
948954
<EmbeddedResource Include="Migrations\202404060935038_AddPopularMapsFraction.resx">
949955
<DependentUpon>202404060935038_AddPopularMapsFraction.cs</DependentUpon>
950956
</EmbeddedResource>
951-
<EmbeddedResource Include="Migrations\202604222356320_AddPwDynamicConfigs.resx" />
957+
<EmbeddedResource Include="Migrations\202604222356320_AddPwDynamicConfigs.resx">
958+
<DependentUpon>202604222356320_AddPwDynamicConfigs.cs</DependentUpon>
959+
</EmbeddedResource>
960+
<EmbeddedResource Include="Migrations\202604231755110_AddStructureBlockFlags.resx">
961+
<DependentUpon>202604231755110_AddStructureBlockFlags.cs</DependentUpon>
962+
</EmbeddedResource>
952963
<EmbeddedResource Include="ZkDataResources.resx">
953964
<Generator>ResXFileCodeGenerator</Generator>
954965
<LastGenOutput>ZkDataResources.Designer.cs</LastGenOutput>

0 commit comments

Comments
 (0)