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

Commit

Permalink
Melee formulas (#219)
Browse files Browse the repository at this point in the history
* Implemented smoke into CE shooting mechanics

Each tile of smoke on the LoS between shooter and target now contributes to visibility error. Smokepop belts now correctly activate when wearer is shot with CE weapon.

* Implemented comparative melee formulas

- Rebalanced melee stats with new stat factors and post-process curves.
- Verb_MeleeAttackCE now calculates actual crit/dodge/parry chances by comparing opponents' melee skills against each other, with equal opponents receiving proc chances equal to a 0 skill fighter's base chance

* Added melee stat modifiers to weapons and shields

* Added StatWorker for carried weight to dodge stat

* Fixed parry not working

Also tweaked post-process curves for stats a bit. Abbreviated aiming system learning helper entry. Disabled raiders trying to equip apparel

* Critical effects

- Added new effects to critical hits: stun (blunt weapons), armor piercing (sharp weapons), knockdown (animals)
- Disabled raiders seeking apparel on their own

* Added dodge and crit stats to animals and mechs
  • Loading branch information
NoImageAvailable authored Jun 5, 2017
1 parent fe6c85d commit 3625b66
Show file tree
Hide file tree
Showing 34 changed files with 575 additions and 126 deletions.
Binary file modified Assemblies/CombatExtended.dll
Binary file not shown.
11 changes: 11 additions & 0 deletions Defs/JobDefs/Jobs_CE.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,17 @@
<alwaysShowWeapon>true</alwaysShowWeapon>
<suspendable>false</suspendable>
</JobDef>

<JobDef>
<defName>WaitKnockdown</defName>
<driverClass>CombatExtended.JobDriver_WaitKnockdown</driverClass>
<reportString>Knocked down.</reportString>
<playerInterruptible>false</playerInterruptible>
<casualInterruptible>false</casualInterruptible>
<alwaysShowWeapon>true</alwaysShowWeapon>
<suspendable>false</suspendable>
<checkOverrideOnDamage>Never</checkOverrideOnDamage>
</JobDef>

<JobDef>
<defName>ReloadTurret</defName>
Expand Down
164 changes: 69 additions & 95 deletions Defs/Stats/Stats_Pawns_Combat.xml
Original file line number Diff line number Diff line change
Expand Up @@ -97,40 +97,20 @@

<StatDef>
<defName>MeleeCritChance</defName>
<label>critical hit chance</label>
<description>Base chance to critically hit a target in melee.</description>
<label>melee critical chance</label>
<description>Base chance to critically hit a target in melee.\n\nThe final chance depends on the opponent's critical skill and equal opponents will always have a 10% chance to crit.</description>
<category>PawnCombat</category>
<displayPriorityInCategory>0</displayPriorityInCategory>
<defaultBaseValue>0.25</defaultBaseValue>
<displayPriorityInCategory>99</displayPriorityInCategory>
<defaultBaseValue>1</defaultBaseValue>
<showOnPawns>true</showOnPawns>
<minValue>0.0</minValue>
<maxValue>3.2</maxValue>
<toStringStyle>PercentZero</toStringStyle>
<skillNeedFactors>
<li Class="SkillNeed_Direct">
<li Class="SkillNeed_BaseBonus">
<skill>Melee</skill>
<factorsPerLevel>
<li>0.20</li>
<li>0.5</li>
<li>0.80</li>
<li>0.9</li>
<li>1.00</li>
<li>1.1</li>
<li>1.20</li>
<li>1.266</li>
<li>1.332</li>
<li>1.4</li>
<li>1.466</li>
<li>1.532</li>
<li>1.6</li>
<li>1.65</li>
<li>1.7</li>
<li>1.75</li>
<li>1.8</li>
<li>1.84</li>
<li>1.88</li>
<li>1.92</li>
<li>1.96</li>
</factorsPerLevel>
<baseFactor>0.1</baseFactor>
<bonusFactor>0.01</bonusFactor>
</li>
</skillNeedFactors>
<capacityFactors>
Expand All @@ -140,103 +120,82 @@
</li>
<li>
<capacity>Sight</capacity>
<weight>0.4</weight>
<weight>0.7</weight>
<max>1</max>
</li>
<li>
<capacity>Manipulation</capacity>
<weight>1</weight>
</li>
</capacityFactors>
<postProcessCurve>
<points>
<li>(0.0, 0.0)</li>
<li>(0.3, 0.3)</li>
<li>(0.6, 0.45)</li>
<li>(1.2, 0.6)</li>
<li>(2.4, 0.75)</li>
<li>(3.2, 0.8)</li>
</points>
</postProcessCurve>
</StatDef>

<!--
<StatDef>
<defName>MeleeDodgeChance</defName>
<label>dodge chance</label>
<description>Base chance to avoid incoming melee attacks.</description>
<label>melee dodge chance</label>
<description>Chance to dodge a melee attack that would've otherwise hit. Characters will not dodge while aiming or firing a ranged weapon.\n\nThe final chance depends on the opponent's dodge skill and equal opponents will always have a 10% chance to dodge.</description>
<category>PawnCombat</category>
<displayPriorityInCategory>0</displayPriorityInCategory>
<defaultBaseValue>0.25</defaultBaseValue>
<showOnPawns>true</showOnPawns>
<minValue>0.0</minValue>
<workerClass>CombatExtended.StatWorker_MoveSpeed</workerClass>
<displayPriorityInCategory>99</displayPriorityInCategory>
<defaultBaseValue>1</defaultBaseValue>
<minValue>0</minValue>
<maxValue>1.6</maxValue>
<toStringStyle>PercentZero</toStringStyle>
<skillNeedFactors>
<li Class="SkillNeed_Direct">
<li Class="SkillNeed_BaseBonus">
<skill>Melee</skill>
<factorsPerLevel>
<li>0.20</li>
<li>0.5</li>
<li>0.80</li>
<li>0.9</li>
<li>1.00</li>
<li>1.1</li>
<li>1.20</li>
<li>1.266</li>
<li>1.332</li>
<li>1.4</li>
<li>1.466</li>
<li>1.532</li>
<li>1.6</li>
<li>1.65</li>
<li>1.7</li>
<li>1.75</li>
<li>1.8</li>
<li>1.84</li>
<li>1.88</li>
<li>1.92</li>
<li>1.96</li>
</factorsPerLevel>
<baseFactor>0.1</baseFactor>
<bonusFactor>0.02</bonusFactor>
</li>
</skillNeedFactors>
<capacityFactors>
<li>
<capacity>Consciousness</capacity>
<weight>1</weight>
</li>
<li>
<capacity>Moving</capacity>
<weight>1</weight>
</li>
<li>
<capacity>Sight</capacity>
<weight>0.4</weight>
<weight>0.7</weight>
<max>1</max>
</li>
</capacityFactors>
<postProcessCurve>
<points>
<li>(0.0, 0.0)</li>
<li>(0.4, 0.4)</li>
<li>(0.8, 0.6)</li>
<li>(1.6, 0.8)</li>
</points>
</postProcessCurve>
</StatDef>
-->

<StatDef>
<defName>MeleeParryChance</defName>
<label>parry chance</label>
<description>Base chance to parry a melee attack.</description>
<label>melee parry chance</label>
<description>Base chance to parry a melee attack. When a parry is performed the equipped weapon or shield will take damage instead of the wielder. If the parrying pawn passes a critical chance check they will automatically riposte their attacker.\n\nThe final chance depends on the opponent's parry skill and equal opponents will always have a 20% chance to crit.</description>
<category>PawnCombat</category>
<displayPriorityInCategory>0</displayPriorityInCategory>
<defaultBaseValue>0.25</defaultBaseValue>
<displayPriorityInCategory>99</displayPriorityInCategory>
<defaultBaseValue>1</defaultBaseValue>
<showOnPawns>true</showOnPawns>
<minValue>0.0</minValue>
<maxValue>3.2</maxValue>
<toStringStyle>PercentZero</toStringStyle>
<noSkillFactor>0</noSkillFactor>
<skillNeedFactors>
<li Class="SkillNeed_Direct">
<li Class="SkillNeed_BaseBonus">
<skill>Melee</skill>
<factorsPerLevel>
<li>0.20</li>
<li>0.5</li>
<li>0.80</li>
<li>0.9</li>
<li>1.00</li>
<li>1.1</li>
<li>1.20</li>
<li>1.266</li>
<li>1.332</li>
<li>1.4</li>
<li>1.466</li>
<li>1.532</li>
<li>1.6</li>
<li>1.65</li>
<li>1.7</li>
<li>1.75</li>
<li>1.8</li>
<li>1.84</li>
<li>1.88</li>
<li>1.92</li>
<li>1.96</li>
</factorsPerLevel>
<baseFactor>0.2</baseFactor>
<bonusFactor>0.005</bonusFactor>
</li>
</skillNeedFactors>
<capacityFactors>
Expand All @@ -246,9 +205,24 @@
</li>
<li>
<capacity>Sight</capacity>
<weight>0.4</weight>
<weight>0.7</weight>
<max>1</max>
</li>
<li>
<capacity>Manipulation</capacity>
<weight>1</weight>
</li>
</capacityFactors>
<postProcessCurve>
<points>
<li>(0.0, 0.0)</li>
<li>(0.3, 0.3)</li>
<li>(0.6, 0.45)</li>
<li>(1.2, 0.6)</li>
<li>(2.4, 0.75)</li>
<li>(3.2, 0.8)</li>
</points>
</postProcessCurve>
</StatDef>

</Defs>
4 changes: 4 additions & 0 deletions Defs/ThingDefs_Misc/Apparel_Shield.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@
<ShootingAccuracy>-0.05</ShootingAccuracy>
<AimingAccuracy>-0.05</AimingAccuracy>
<Suppressability>-0.25</Suppressability>
<MeleeCritChance>-0.05</MeleeCritChance>
<MeleeParryChance>1.0</MeleeParryChance>
</equippedStatOffsets>
<apparel>
<tags>
Expand Down Expand Up @@ -103,6 +105,8 @@
<ShootingAccuracy>-0.2</ShootingAccuracy>
<AimingAccuracy>-0.2</AimingAccuracy>
<Suppressability>-0.5</Suppressability>
<MeleeCritChance>-0.2</MeleeCritChance>
<MeleeParryChance>1.0</MeleeParryChance>
</equippedStatOffsets>
<apparel>
<tags>
Expand Down
2 changes: 1 addition & 1 deletion Defs/Tutor/Concepts_NotedOpportunistic.xml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
<label>CE: New aiming system</label>
<priority>50</priority>
<needsOpportunity>True</needsOpportunity>
<helpText>Combat Extended replaces the vanilla percentage-based aiming system with a new physics-based system. Projectiles follow a ballistic flight path and use hitboxes for collision detection. Several factors determine how close a bullet will fly near it's target:\n\n-Visibility: Darkness and bad weather make it harder to see the target. Randomly shifts point of aim in circle around the target.\n-Movement: A shooter has to lead a moving target. Lead error means the shooter might aim too far forward or back in the direction of movement. Influenced by shooter's aiming accuracy.\n-Range: A shooter needs to correctly estimate how far away the target is. Range error means the shooter will aim as if the target was x cells closer/further than it actually is. Influenced by shooter's aiming accuracy.\n-Sway: Weapons will sway in the hands of the shooter. Heavier and one-handed weapons sway more than others. Influenced by shooter's weapon handling, weapon's sway stat. Reduced by aimed shot mode.\n-Recoil: Every shot adds to the recoil penalty, making successive burst shots less accurate. Influenced by weapon's recoil factor, shooter's weapon handling.\n-Weapon spread: Bullets randomly deviate in a cone (e.g. shotgun pellets). Influenced by weapon's shot spread, projectile's spread modifier.\n-Cover height: Cover obscures parts of the target's hitbox and reduces the hittable area. It can completely block line of sight for smaller targets (e.g. squirrels behind sandbags).\n-Body size: Larger targets have larger hitboxes.\n-Stance: Downed or hunkering pawns are harder to hit.\n\nYou can get a detailed breakdown by selecting a shooter and hovering the mouse over a target. Given measurements are the maximum deviation in cells/degrees and target/cover hitbox dimensions in cells.</helpText>
<helpText>Combat Extended uses a new physics-based projectile system. Projectiles follow a ballistic flight path and use hitboxes for collision detection. Several factors determine how close a bullet will fly near it's target:\n\n-Visibility: Darkness, bad weather and smoke make it harder to see the target.\n-Movement: shooter has to lead a moving target. Lead error means the shooter might aim too far forward or back in the direction of movement.\n-Range: shooter needs to correctly estimate how far away the target is. Range error means the shooter will aim as if target was x cells closer/further than it actually is.\n-Sway: Weapons will sway in the hands of the shooter. Reduced by aimed shot mode (reduction depends on skill and sights efficiency).\n-Recoil: Shots within a burst gradually become less accurate\n-Weapon spread: Bullets randomly deviate in a cone (e.g. shotgun pellets).\n-Cover height: Cover obscures parts of the target's hitbox. Can block line of sight for smaller targets (e.g. squirrels behind sandbags).\n-Body size\n-Stance: Downed or hunkering pawns are harder to hit.\n\nYou can get a detailed breakdown by selecting a shooter and hovering the mouse over a target. Given measurements are the maximum deviation in cells/degrees and target/cover hitbox dimensions in cells.</helpText>
</ConceptDef>

<ConceptDef>
Expand Down
71 changes: 71 additions & 0 deletions Patches/Core/ThingDefs_Misc/Weapons_Melee.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,16 @@
</value>
</Operation>

<Operation Class="PatchOperationAdd">
<xpath>*/ThingDef[defName="MeleeWeapon_Shiv"]</xpath>
<value>
<equippedStatOffsets>
<MeleeCritChance>0.1</MeleeCritChance>
<MeleeParryChance>0.1</MeleeParryChance>
</equippedStatOffsets>
</value>
</Operation>

<Operation Class="PatchOperationReplace">
<xpath>*/ThingDef[defName="MeleeWeapon_Shiv"]/verbs</xpath>
<value>
Expand Down Expand Up @@ -101,6 +111,16 @@
</value>
</Operation>

<Operation Class="PatchOperationAdd">
<xpath>*/ThingDef[defName="MeleeWeapon_Knife"]</xpath>
<value>
<equippedStatOffsets>
<MeleeCritChance>0.25</MeleeCritChance>
<MeleeParryChance>0.25</MeleeParryChance>
</equippedStatOffsets>
</value>
</Operation>

<Operation Class="PatchOperationReplace">
<xpath>*/ThingDef[defName="MeleeWeapon_Knife"]/verbs</xpath>
<value>
Expand Down Expand Up @@ -166,6 +186,16 @@
</value>
</Operation>

<Operation Class="PatchOperationAdd">
<xpath>*/ThingDef[defName="MeleeWeapon_Club"]</xpath>
<value>
<equippedStatOffsets>
<MeleeCritChance>0.5</MeleeCritChance>
<MeleeParryChance>0.25</MeleeParryChance>
</equippedStatOffsets>
</value>
</Operation>

<Operation Class="PatchOperationReplace">
<xpath>*/ThingDef[defName="MeleeWeapon_Club"]/verbs</xpath>
<value>
Expand Down Expand Up @@ -231,6 +261,16 @@
</value>
</Operation>

<Operation Class="PatchOperationAdd">
<xpath>*/ThingDef[defName="MeleeWeapon_Mace"]</xpath>
<value>
<equippedStatOffsets>
<MeleeCritChance>0.65</MeleeCritChance>
<MeleeParryChance>0.4</MeleeParryChance>
</equippedStatOffsets>
</value>
</Operation>

<Operation Class="PatchOperationReplace">
<xpath>*/ThingDef[defName="MeleeWeapon_Mace"]/verbs</xpath>
<value>
Expand Down Expand Up @@ -295,6 +335,16 @@
</value>
</Operation>

<Operation Class="PatchOperationAdd">
<xpath>*/ThingDef[defName="MeleeWeapon_Gladius"]</xpath>
<value>
<equippedStatOffsets>
<MeleeCritChance>0.5</MeleeCritChance>
<MeleeParryChance>0.65</MeleeParryChance>
</equippedStatOffsets>
</value>
</Operation>

<Operation Class="PatchOperationReplace">
<xpath>*/ThingDef[defName="MeleeWeapon_Gladius"]/verbs</xpath>
<value>
Expand Down Expand Up @@ -359,6 +409,17 @@
</value>
</Operation>

<Operation Class="PatchOperationAdd">
<xpath>*/ThingDef[defName="MeleeWeapon_Spear"]</xpath>
<value>
<equippedStatOffsets>
<MeleeCritChance>0.5</MeleeCritChance>
<MeleeParryChance>0.5</MeleeParryChance>
<MeleeDodgeChance>0.25</MeleeDodgeChance>
</equippedStatOffsets>
</value>
</Operation>

<Operation Class="PatchOperationReplace">
<xpath>*/ThingDef[defName="MeleeWeapon_Spear"]/verbs</xpath>
<value>
Expand Down Expand Up @@ -390,6 +451,16 @@
</value>
</Operation>

<Operation Class="PatchOperationAdd">
<xpath>*/ThingDef[defName="MeleeWeapon_LongSword"]</xpath>
<value>
<equippedStatOffsets>
<MeleeCritChance>1</MeleeCritChance>
<MeleeParryChance>0.75</MeleeParryChance>
</equippedStatOffsets>
</value>
</Operation>

<Operation Class="PatchOperationAdd">
<xpath>*/ThingDef[defName="MeleeWeapon_LongSword"]/statBases</xpath>
<value>
Expand Down
Loading

0 comments on commit 3625b66

Please sign in to comment.