Skip to content

Commit

Permalink
Adjusted armor normal DT/DR.
Browse files Browse the repository at this point in the history
  • Loading branch information
tnevolin committed Nov 28, 2021
1 parent a850f0d commit f83af00
Show file tree
Hide file tree
Showing 3 changed files with 120 additions and 25 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,3 +89,7 @@ See [README](https://github.com/tnevolin/FO2FairPlay) for detailed modification
* All improved grenades in fo2tweaks.ini/[improved_grenades]/weapons are given weapon accurate perk.
* QoL: Lockpick skill is adjusted automatically with lockpicks in the inventory.

# 0.12

* Adjusted armor normal DT/DR for smoother progression and more distributed weapon type selection.

24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,30 @@ multiplier = (1 + <DR mod> / 100)
| JHP, shotgun regular | +35 | 1.35 | leather to metal |
| shotgun buckshot | +70 | 1.70 | unarmored to leather |

## Armor normal DT/DR adjustment

This is to make above ammor DR mod adjustment work smoother.

* Lower armors are given more DT to have at least some stopping power against high DR mod ammo.
* DT and DT values are distributed smoothly to make each next armor type distinctly better.

| armor | DT | DR | most effective ammo type against |
|----|----:|----:|----|
| Leather jacket | 2 | 12 | shotgun buckshot |
| Leather armor | 3 | 16 | shotgun buckshot - JHP, shotgun regular |
| Combat leather jacket | 4 | 20 | JHP, shotgun regular |
| Leather armor Mk II | 5 | 24 | JHP, shotgun regular - normal, shotgun slug |
| Metal armor | 6 | 28 | normal, shotgun slug |
| Metal armor Mk II | 7 | 32 | normal, shotgun slug |
| Tesla armor | 8 | 36 | normal, shotgun slug - FMJ, ball |
| Combat armor | 9 | 40 | normal, shotgun slug - FMJ, ball |
| Combat armor Mk II | 10 | 44 | FMJ, ball |
| Brotherhood armor | 11 | 48 | FMJ, ball |
| Power armor | 12 | 52 | FMJ, ball - AP |
| Hardened power armor | 13 | 56 | FMJ, ball - AP |
| Advanced power armor | 14 | 60 | AP |
| Advanced power armor Mk II | 15 | 64 | AP |

# Quality of life

## Lockpicks
Expand Down
117 changes: 92 additions & 25 deletions source/gl_fairplay.ssl
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,16 @@ Requires sfall 4.3.0.2 +
#define NAME "gl_fairplay"
#define ndebug(message) debug_msg(NAME + ": " + message)

// constants

// lockpick skill level boost by each lockpicks level
#define LOCKPICKS_SKILL_LEVEL_BOOST (20)
// extra base skill rate on top of vanilla 5
#define SKILL_RATE_BASE_CHANGE (10)
// weapon Min ST multiplier for sqrt(damage)
#define WEAPON_MINST_DAMAGE_SQRT_MULTIPLIER (1.20)
// grenade Min ST multiplier for sqrt(damage)
#define WEAPON_MINST_DAMAGE_SQRT_MULTIPLIER_GRENADE (0.40)
#define WEAPON_MINST_BURST_DIVIDER (5)
// weapon Min ST increase for burst size
#define WEAPON_MINST_BURST_DIVIDER (6)

variable lockpickSkillLevel;
variable fractionalAP = 0.0;
Expand Down Expand Up @@ -52,12 +55,15 @@ procedure modifyShotguns;
procedure modifyShotgunAmmunition;
procedure modifyBurstWeaponAccurate;
procedure modifyImprovedGrenadesAccurate;
procedure modifyArmor;

procedure item_w_subtype(variable weapon, variable attackMode);
procedure getBestLockpicksLevel(variable critter, variable lockpicksType);

procedure start begin
display_msg("start");
if game_loaded then begin
display_msg("game_loaded");

// standard procedure hooks

Expand All @@ -79,9 +85,9 @@ procedure start begin

mod_skill_points_per_level(SKILL_RATE_BASE_CHANGE - get_pc_base_stat(STAT_iq));

// trigger map enter
// modify proto data

call map_enter_p_proc;
call modifyProtoData;

end
end
Expand Down Expand Up @@ -120,6 +126,10 @@ procedure modifyProtoData begin

call modifyImprovedGrenadesAccurate;

// armor

call modifyArmor;

end

// ====================
Expand Down Expand Up @@ -739,11 +749,12 @@ procedure modifyAmmoACMod begin

ndebug("Ammo: set AC mod = 0");

// cycle through pids for ammo

variable pid;
for (pid = 1; pid < 2000; pid++) begin

if (proto_data(pid, it_pid) == 0) then
continue;

// ammo

if (not (proto_data(pid, it_type) == item_type_ammo)) then
Expand All @@ -769,6 +780,9 @@ procedure modifyWeaponMinST begin
for (pid = 1; pid < 2000; pid++)
begin

if (proto_data(pid, it_pid) == 0) then
continue;

// weapon

if (not (proto_data(pid, it_type) == item_type_weapon)) then
Expand All @@ -786,27 +800,12 @@ procedure modifyWeaponMinST begin
variable minSTOld = get_proto_data(pid, PROTO_WP_MIN_ST);
variable averageDamage = (get_proto_data(pid, PROTO_WP_DMG_MIN) + get_proto_data(pid, PROTO_WP_DMG_MAX)) / 2;
variable burst = get_proto_data(pid, PROTO_WP_BURST);
variable minST = max(minSTOld, 1 + floor(sqrt(averageDamage) * weaponMinSTDamageSqrtMultiplier + burst / WEAPON_MINST_BURST_DIVIDER));
variable minSTNew = (1 + floor(sqrt(averageDamage) * weaponMinSTDamageSqrtMultiplier + burst / WEAPON_MINST_BURST_DIVIDER));
variable minST = max(minSTOld, minSTNew);

set_proto_data(pid, PROTO_WP_MIN_ST, minST);

variable message = name + ":";
variable i;
for (i = strlen(message); i < 26; i++)
begin
message += " ";
end
if (averageDamage < 10) then
message += " ";
else if (averageDamage < 100) then
message += " ";
message += " " + averageDamage;
if (burst < 10) then
message += " ";
message += " " + burst;
if (minST < 10) then
message += " ";
message += " " + minST;
variable message = sprintf("%-26s", name) + sprintf(" %3d", averageDamage) + sprintf("(%2d)", burst) + sprintf(" => %2d", minSTNew);
debug_msg(message);

end
Expand All @@ -823,6 +822,9 @@ procedure modifyShotguns begin
for (pid = 1; pid < 2000; pid++)
begin

if (proto_data(pid, it_pid) == 0) then
continue;

// weapon

if (not (proto_data(pid, it_type) == item_type_weapon)) then
Expand Down Expand Up @@ -866,6 +868,9 @@ procedure modifyShotgunAmmunition begin
for (pid = 1; pid < 2000; pid++)
begin

if (proto_data(pid, it_pid) == 0) then
continue;

// ammunition

if (not (proto_data(pid, it_type) == item_type_ammo)) then
Expand Down Expand Up @@ -903,6 +908,9 @@ procedure modifyBurstWeaponAccurate begin
for (pid = 1; pid < 2000; pid++)
begin

if (proto_data(pid, it_pid) == 0) then
continue;

// weapon

if (not (proto_data(pid, it_type) == item_type_weapon)) then
Expand Down Expand Up @@ -966,6 +974,65 @@ procedure modifyImprovedGrenadesAccurate begin

end

procedure modifyArmor begin

ndebug("modifyArmor");
debug_msg("(name/old/new");

variable armorData = {};
armorData[PID_LEATHER_JACKET] = [2, 12];
armorData[PID_LEATHER_ARMOR] = [3, 16];
armorData[PID_CURED_LEATHER_ARMOR] = [4, 20];
armorData[PID_LEATHER_ARMOR_MK_II] = [5, 24];
armorData[PID_METAL_ARMOR] = [6, 28];
armorData[PID_METAL_ARMOR_MK_II] = [7, 32];
armorData[PID_TESLA_ARMOR] = [8, 36];
armorData[PID_COMBAT_ARMOR] = [9, 40];
armorData[PID_COMBAT_ARMOR_MK_II] = [10, 44];
armorData[PID_BROTHERHOOD_COMBAT_ARMOR] = [11, 48];
armorData[PID_POWERED_ARMOR] = [12, 52];
armorData[PID_HARDENED_POWER_ARMOR] = [13, 56];
armorData[PID_ADVANCED_POWER_ARMOR] = [14, 60];
armorData[PID_ADVANCED_POWER_ARMOR_MK2] = [15, 64];

variable pid, data;
foreach (pid : data in armorData) begin

debug_msg(sprintf("%-25s", proto_data(pid, it_name)));

debug_msg
(
"\t"
+ " N:" + sprintf("%2d", get_proto_data(pid, PROTO_AR_DT_NORMAL)) + "/" + sprintf("%2d", get_proto_data(pid, PROTO_AR_DR_NORMAL))
+ " F:" + sprintf("%2d", get_proto_data(pid, PROTO_AR_DT_FIRE)) + "/" + sprintf("%2d", get_proto_data(pid, PROTO_AR_DR_FIRE))
+ " L:" + sprintf("%2d", get_proto_data(pid, PROTO_AR_DT_LASER)) + "/" + sprintf("%2d", get_proto_data(pid, PROTO_AR_DR_LASER))
+ " P:" + sprintf("%2d", get_proto_data(pid, PROTO_AR_DT_PLASMA)) + "/" + sprintf("%2d", get_proto_data(pid, PROTO_AR_DR_PLASMA))
+ " E:" + sprintf("%2d", get_proto_data(pid, PROTO_AR_DT_ELECTRICAL)) + "/" + sprintf("%2d", get_proto_data(pid, PROTO_AR_DR_ELECTRICAL))
+ " X:" + sprintf("%2d", get_proto_data(pid, PROTO_AR_DT_EXPLOSION)) + "/" + sprintf("%2d", get_proto_data(pid, PROTO_AR_DR_EXPLOSION))
)
;

set_proto_data(pid, PROTO_AR_DT_NORMAL, data[0]);
set_proto_data(pid, PROTO_AR_DR_NORMAL, data[1]);

debug_msg
(
"\t"
+ " N:" + sprintf("%2d", get_proto_data(pid, PROTO_AR_DT_NORMAL)) + "/" + sprintf("%2d", get_proto_data(pid, PROTO_AR_DR_NORMAL))
+ " F:" + sprintf("%2d", get_proto_data(pid, PROTO_AR_DT_FIRE)) + "/" + sprintf("%2d", get_proto_data(pid, PROTO_AR_DR_FIRE))
+ " L:" + sprintf("%2d", get_proto_data(pid, PROTO_AR_DT_LASER)) + "/" + sprintf("%2d", get_proto_data(pid, PROTO_AR_DR_LASER))
+ " P:" + sprintf("%2d", get_proto_data(pid, PROTO_AR_DT_PLASMA)) + "/" + sprintf("%2d", get_proto_data(pid, PROTO_AR_DR_PLASMA))
+ " E:" + sprintf("%2d", get_proto_data(pid, PROTO_AR_DT_ELECTRICAL)) + "/" + sprintf("%2d", get_proto_data(pid, PROTO_AR_DR_ELECTRICAL))
+ " X:" + sprintf("%2d", get_proto_data(pid, PROTO_AR_DT_EXPLOSION)) + "/" + sprintf("%2d", get_proto_data(pid, PROTO_AR_DR_EXPLOSION))
)
;

end

debug_msg("");

end

// ====================
// utility methods
// ====================
Expand Down

0 comments on commit f83af00

Please sign in to comment.