Skip to content
This repository has been archived by the owner on Apr 14, 2020. It is now read-only.

Commit

Permalink
Merge pull request #881 from NoImageAvailable/v163
Browse files Browse the repository at this point in the history
v1.7
  • Loading branch information
NoImageAvailable authored Nov 11, 2019
2 parents efd29cb + 45c54cc commit d58916a
Show file tree
Hide file tree
Showing 14 changed files with 79 additions and 24 deletions.
2 changes: 1 addition & 1 deletion About/About.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
<li>1.0</li>
</supportedVersions>
<url>https://ludeon.com/forums/index.php?topic=33461.0</url>
<description>Version: 1.0.1.6a\n\nExtends combat mechanics to make them deeper and more tactical.</description>
<description>Version: 1.0.1.7\n\nExtends combat mechanics to make them deeper and more tactical.</description>
</ModMetaData>
2 changes: 1 addition & 1 deletion About/Manifest.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Manifest>
<identifier>CombatExtended</identifier>
<version>1.0.1.6a</version>
<version>1.0.1.7</version>
<dependencies>
</dependencies>
<incompatibleWith>
Expand Down
2 changes: 1 addition & 1 deletion About/ModSync.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<ModSyncNinjaData>
<ID>32418f60-269c-4a70-ae6e-a51d7a34cb2f</ID>
<ModName>Combat Extended</ModName>
<Version>1.0.1.6a</Version>
<Version>1.0.1.7</Version>
<SaveBreaking>False</SaveBreaking>
<Host name="Github">
<Owner>NoImageAvailable</Owner>
Expand Down
Binary file modified Assemblies/CombatExtended.dll
Binary file not shown.
12 changes: 6 additions & 6 deletions Defs/Ammo/Rifle/762x39mmSoviet.xml
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@
</graphicData>
<projectile Class="CombatExtended.ProjectilePropertiesCE">
<damageAmountBase>17</damageAmountBase>
<armorPenetrationSharp>7</armorPenetrationSharp>
<armorPenetrationSharp>6</armorPenetrationSharp>
<armorPenetrationBlunt>41.08</armorPenetrationBlunt>
</projectile>
</ThingDef>
Expand All @@ -162,7 +162,7 @@
</graphicData>
<projectile Class="CombatExtended.ProjectilePropertiesCE">
<damageAmountBase>10</damageAmountBase>
<armorPenetrationSharp>14</armorPenetrationSharp>
<armorPenetrationSharp>12</armorPenetrationSharp>
<armorPenetrationBlunt>41.08</armorPenetrationBlunt>
</projectile>
</ThingDef>
Expand All @@ -176,7 +176,7 @@
</graphicData>
<projectile Class="CombatExtended.ProjectilePropertiesCE">
<damageAmountBase>21</damageAmountBase>
<armorPenetrationSharp>4</armorPenetrationSharp>
<armorPenetrationSharp>3</armorPenetrationSharp>
<armorPenetrationBlunt>41.08</armorPenetrationBlunt>
</projectile>
</ThingDef>
Expand All @@ -186,7 +186,7 @@
<label>7.62mm Soviet bullet (AP-I)</label>
<projectile Class="CombatExtended.ProjectilePropertiesCE">
<damageAmountBase>10</damageAmountBase>
<armorPenetrationSharp>14</armorPenetrationSharp>
<armorPenetrationSharp>12</armorPenetrationSharp>
<armorPenetrationBlunt>41.08</armorPenetrationBlunt>
<secondaryDamage>
<li>
Expand All @@ -202,7 +202,7 @@
<label>7.62mm Soviet bullet (HE)</label>
<projectile Class="CombatExtended.ProjectilePropertiesCE">
<damageAmountBase>17</damageAmountBase>
<armorPenetrationSharp>7</armorPenetrationSharp>
<armorPenetrationSharp>6</armorPenetrationSharp>
<armorPenetrationBlunt>41.08</armorPenetrationBlunt>
<secondaryDamage>
<li>
Expand All @@ -218,7 +218,7 @@
<label>7.62mm Soviet bullet (Sabot)</label>
<projectile Class="CombatExtended.ProjectilePropertiesCE">
<damageAmountBase>8</damageAmountBase>
<armorPenetrationSharp>25</armorPenetrationSharp>
<armorPenetrationSharp>21</armorPenetrationSharp>
<armorPenetrationBlunt>53.36</armorPenetrationBlunt>
<speed>216</speed>
</projectile>
Expand Down
12 changes: 6 additions & 6 deletions Defs/Ammo/Rifle/762x51mmNATO.xml
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@
<label>7.62mm NATO bullet (FMJ)</label>
<projectile Class="CombatExtended.ProjectilePropertiesCE">
<damageAmountBase>20</damageAmountBase>
<armorPenetrationSharp>6</armorPenetrationSharp>
<armorPenetrationSharp>7</armorPenetrationSharp>
<armorPenetrationBlunt>66.72</armorPenetrationBlunt>
</projectile>
</ThingDef>
Expand All @@ -153,7 +153,7 @@
<label>7.62mm NATO bullet (AP)</label>
<projectile Class="CombatExtended.ProjectilePropertiesCE">
<damageAmountBase>12</damageAmountBase>
<armorPenetrationSharp>12</armorPenetrationSharp>
<armorPenetrationSharp>14</armorPenetrationSharp>
<armorPenetrationBlunt>66.72</armorPenetrationBlunt>
</projectile>
</ThingDef>
Expand All @@ -163,7 +163,7 @@
<label>7.62mm NATO bullet (HP)</label>
<projectile Class="CombatExtended.ProjectilePropertiesCE">
<damageAmountBase>25</damageAmountBase>
<armorPenetrationSharp>3</armorPenetrationSharp>
<armorPenetrationSharp>4</armorPenetrationSharp>
<armorPenetrationBlunt>66.72</armorPenetrationBlunt>
</projectile>
</ThingDef>
Expand All @@ -173,7 +173,7 @@
<label>7.62mm NATO bullet (AP-I)</label>
<projectile Class="CombatExtended.ProjectilePropertiesCE">
<damageAmountBase>12</damageAmountBase>
<armorPenetrationSharp>12</armorPenetrationSharp>
<armorPenetrationSharp>14</armorPenetrationSharp>
<armorPenetrationBlunt>66.72</armorPenetrationBlunt>
<secondaryDamage>
<li>
Expand All @@ -189,7 +189,7 @@
<label>7.62mm NATO bullet (HE)</label>
<projectile Class="CombatExtended.ProjectilePropertiesCE">
<damageAmountBase>20</damageAmountBase>
<armorPenetrationSharp>6</armorPenetrationSharp>
<armorPenetrationSharp>7</armorPenetrationSharp>
<armorPenetrationBlunt>66.72</armorPenetrationBlunt>
<secondaryDamage>
<li>
Expand All @@ -205,7 +205,7 @@
<label>7.62mm NATO bullet (Sabot)</label>
<projectile Class="CombatExtended.ProjectilePropertiesCE">
<damageAmountBase>10</damageAmountBase>
<armorPenetrationSharp>21</armorPenetrationSharp>
<armorPenetrationSharp>25</armorPenetrationSharp>
<armorPenetrationBlunt>86.28</armorPenetrationBlunt>
<speed>252</speed>
</projectile>
Expand Down
3 changes: 3 additions & 0 deletions Languages/English/Keyed/ModMenu.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@

<CE_Settings_AllowMeleeHunting_Title>Allow hunting with melee weapons</CE_Settings_AllowMeleeHunting_Title>
<CE_Settings_AllowMeleeHunting_Desc>Hunters will still be allowed to hunt if they have a melee weapon equipped.</CE_Settings_AllowMeleeHunting_Desc>

<CE_Settings_SmokeEffects_Title>Smoke effects</CE_Settings_SmokeEffects_Title>
<CE_Settings_SmokeEffects_Desc>Fire generates dangerous black smoke clouds, causing health complications to anyone not wearing protective gear.</CE_Settings_SmokeEffects_Desc>

<!-- ========== Ammo settings ========== -->

Expand Down
4 changes: 2 additions & 2 deletions Patches/Core/Stats/Stats.xml
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,14 @@
<Operation Class="PatchOperationReplace">
<xpath>Defs/StatDef[defName = "ArmorRating_Sharp"]/description</xpath>
<value>
<description>The chance to affect sharp damage like bullets, knife stabs, explosions, and animal bites.\n\nUpon taking damage, the attack's armor penetration value is compared against this armor rating.\n\nDamage is scaled based on the ratio of penetration to armor, where post-armor damage is 50% if both values are equal, 0% if penetration is half or less of armor and 100% if it is twice the value of armor.\n\nArmor penetration is scaled by the same factor, making it harder to penetrate subsequent layers of armor.\n\nAfterwards, the attack has to pass a deflection check, where the remaining armor penetration is randomized by +-0.05 and compared against the armor. If the randomized penetration value is higher than the armor value it will penetrate, else it will be converted into blunt damage and checked again against this apparel's blunt armor.</description>
<description>Mitigation effect on sharp damage such as bullets, knife stabs, and animal bites.\n\nThis armor rating is compared against an attack's armor penetration, with deflection occurring if armor is the higher stat. Otherwise, armor penetration has the armor rating subtracted from it, and damage is reduced by the ratio of modified to initial AP, as follows:\n\nModifiedAP = InitialAP - ArmorRating\nModifiedDamage = InitialDamage * (ModifiedAP / InitialAP)\n\nThese reductions apply for each layer the attack goes through, lowering its ability to penetrate and damage subsequent layers. If an attack is deflected, it's converted to blunt, and checked against the apparel's blunt armor rating.</description>
</value>
</Operation>

<Operation Class="PatchOperationReplace">
<xpath>Defs/StatDef[defName = "ArmorRating_Blunt"]/description</xpath>
<value>
<description>The chance to affect sharp damage like bullets, knife stabs, explosions, and animal bites.\n\nUpon taking damage, the attack's armor penetration value is compared against this armor rating.\n\nDamage is scaled based on the ratio of penetration to armor, where post-armor damage is 50% if both values are equal, 0% if penetration is half or less of armor and 100% if it is twice the value of armor.\n\nArmor penetration is scaled by the same factor, making it harder to penetrate subsequent layers of armor.</description>
<description>Mitigation effect on blunt-force damage such as maces, explosions, and animal hoofs.\n\nThis armor rating is compared against an attack's armor penetration, with no damage occurring if armor is the higher stat. Otherwise, armor penetration has the armor rating subtracted from it, and damage is reduced by the ratio of modified to initial AP, as follows:\n\nModifiedAP = InitialAP - ArmorRating\nModifiedDamage = InitialDamage * (ModifiedAP / InitialAP)\n\nThese reductions apply for each layer the attack goes through, lowering its ability to penetrate and damage subsequent layers.</description>
</value>
</Operation>

Expand Down
2 changes: 2 additions & 0 deletions Source/CombatExtended/CombatExtended.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@
<Compile Include="Harmony\Harmony_FireUtility.cs" />
<Compile Include="Harmony\Harmony_FireWatcher.cs" />
<Compile Include="Harmony\Harmony_Hediff_Injury.cs" />
<Compile Include="Harmony\Harmony_ListerThings.cs" />
<Compile Include="Harmony\Harmony_PathFinder.cs" />
<Compile Include="Harmony\Harmony-WorkGiver_HunterHunt.cs" />
<Compile Include="Harmony\Harmony-WorkGiver_InteractAnimal.cs" />
Expand All @@ -311,6 +312,7 @@
<Compile Include="Harmony\Harmony-ShieldBelt.cs" />
<Compile Include="Harmony\Harmony_PawnGraphicSet.cs" />
<Compile Include="Harmony\Harmony_PawnRenderer.cs" />
<Compile Include="Harmony\Harmony_Region.cs" />
<Compile Include="Harmony\Harmony_SappersUtility.cs" />
<Compile Include="Harmony\Harmony_Verb_BeatFire.cs" />
<Compile Include="Harmony\TradeUtility.cs" />
Expand Down
4 changes: 4 additions & 0 deletions Source/CombatExtended/CombatExtended/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@ public class Settings : ModSettings
private bool showCasings = true;
private bool showTaunts = true;
private bool allowMeleeHunting = false;
private bool smokeEffects = true;

public bool ShowCasings => showCasings;
public bool ShowTaunts => showTaunts;
public bool AllowMeleeHunting => allowMeleeHunting;
public bool SmokeEffects => smokeEffects;

public bool ShowTutorialPopup = true;

Expand Down Expand Up @@ -67,6 +69,7 @@ public override void ExposeData()
Scribe_Values.Look(ref showCasings, "showCasings", true);
Scribe_Values.Look(ref showTaunts, "showTaunts", true);
Scribe_Values.Look(ref allowMeleeHunting, "allowMeleeHunting", false);
Scribe_Values.Look(ref smokeEffects, "smokeEffects", true);

#if DEBUG
// Debug settings
Expand Down Expand Up @@ -107,6 +110,7 @@ public void DoWindowContents(Rect canvas)
list.CheckboxLabeled("CE_Settings_ShowCasings_Title".Translate(), ref showCasings, "CE_Settings_ShowCasings_Desc".Translate());
list.CheckboxLabeled("CE_Settings_ShowTaunts_Title".Translate(), ref showTaunts, "CE_Settings_ShowTaunts_Desc".Translate());
list.CheckboxLabeled("CE_Settings_AllowMeleeHunting_Title".Translate(), ref allowMeleeHunting, "CE_Settings_AllowMeleeHunting_Desc".Translate());
list.CheckboxLabeled("CE_Settings_SmokeEffects_Title".Translate(), ref smokeEffects, "CE_Settings_SmokeEffects_Desc".Translate());

#if DEBUG
// Do Debug settings
Expand Down
14 changes: 7 additions & 7 deletions Source/CombatExtended/CombatExtended/Things/Smoke.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class Smoke : Gas
private int _ticksUntilMove;
private const int BaseTicksUntilMove = 40;
private const int TicksUntilMoveDelta = 20;
private const float InhalationPerSec = 0.0075f / GenTicks.TicksPerRealSecond;
private const float InhalationPerSec = 0.0150f / GenTicks.TicksPerRealSecond;

public override void ExposeData()
{
Expand Down Expand Up @@ -84,12 +84,12 @@ private void ApplyHediffs()
return;

var pawns = Position.GetThingList(Map).Where(t => t is Pawn).ToList();
foreach (var cell in GenAdjFast.AdjacentCells8Way(Position))
{
if (!cell.InBounds(Map))
continue;
pawns.AddRange(cell.GetThingList(Map).Where(t => t is Pawn));
}
//foreach (var cell in GenAdjFast.AdjacentCells8Way(Position))
//{
// if (!cell.InBounds(Map))
// continue;
// pawns.AddRange(cell.GetThingList(Map).Where(t => t is Pawn));
//}

foreach (Pawn pawn in pawns)
{
Expand Down
1 change: 1 addition & 0 deletions Source/CombatExtended/Harmony/Harmony-Fire.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ internal static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruct
internal static void Postfix(Fire __instance)
{
if (__instance.Spawned
&& Controller.settings.SmokeEffects
&& __instance.IsHashIntervalTick(TicksPerSmoke)
&& __instance.Position.Roofed(__instance.Map)
&& __instance.Position.GetGas(__instance.Map) == null)
Expand Down
19 changes: 19 additions & 0 deletions Source/CombatExtended/Harmony/Harmony_ListerThings.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using Harmony;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Verse;

namespace CombatExtended.Harmony
{
[HarmonyPatch(typeof(ListerThings), "EverListable")]
internal static class Harmony_ListerThings_AllowSavingGas
{
internal static void Postfix(ref bool __result, ThingDef def, ListerThingsUse use)
{
__result = __result || def.category == ThingCategory.Gas;
return;
}
}
}
26 changes: 26 additions & 0 deletions Source/CombatExtended/Harmony/Harmony_Region.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using Harmony;
using RimWorld;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Verse;

namespace CombatExtended.Harmony
{
[HarmonyPatch(typeof(Region), "DangerFor")]
internal static class Harmony_Region_DangerFor
{
internal static void Postfix(Pawn p, Region __instance, ref Danger __result)
{
if (p.GetStatValue(CE_StatDefOf.SmokeSensitivity) > 0)
{
int smokeCount = __instance?.ListerThings?.AllThings?.Where(t => t is Smoke)?.Count() ?? 0;
if (smokeCount > 0)
{
__result = Danger.Deadly;
}
}
}
}
}

0 comments on commit d58916a

Please sign in to comment.