Repository navigation
fix balance issues associated with dinky shockwaves - #7833
Draft
Goober5000 wants to merge 6 commits into
Draft
Goober5000 wants to merge 6 commits into
Goober5000 wants to merge 6 commits into
Conversation
…y index The_mission.ai_profile becomes ai_profile_index, with a const ai_profile() accessor. This removes MAX_AI_PROFILES, Num_ai_profiles, and AI_PROFILES_INDEX. Also, parse_mission_info now stores the profile in the mission being parsed rather than always in The_mission. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
set-friendly-damage-caps modified the shared table profile, so its changes persisted into every later mission until the game was restarted. It now modifies a per-mission copy, created on demand by mission_get_transient_ai_profile() and tracked by the runtime-only Has_transient_ai_profile flag. mission::Reset() removes the copy. Inactive mission flags (Unused_1-5 and the new flag) are now cleared when a mission is loaded and omitted when it is saved. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The radius curve was always read from the weapon's regular shockwave, so a curve specified under $Dinky shockwave: had no effect. Store the curve on the shockwave itself. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Retail quartered the shockwave of a bomb shot down by another weapon and restored full damage against huge ships. The dinky shockwave system absorbed that rule, but later changes drifted from it: the default multiplier became 1.0 (PR 2201), area-effect weapons without a shockwave were reduced too, and beam kills began to count as shot down. * Route the dinky multiplier through a new ai_profiles field, dinky_shockwave_multiplier, initialized from the game_settings value. The default dinky damage is now computed at detonation rather than baked into the weapon at parse time. * Add the "$consistent dinky shockwaves:" ai_profiles flag, enabled for mods targeting 27.0. With it, any shot-down weapon uses its dinky shockwave, including area-effect weapons, beam kills, and weapons with $Arm parameters. Huge ships take the regular shockwave damage only when the dinky damage was not explicitly specified. Area effects use the dinky damage type. * Without the flag, behavior is retail: area-effect weapons and beam kills are not reduced, and the x4 against huge ships is kept. * Dinky shockwave fields that a table does not specify are inherited from the regular shockwave after all tables are parsed, so later TBM changes carry through. * The disarmed impact sound falls back to the regular impact sound unless one is specified. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The game_settings default for the dinky shockwave multiplier is now 0.25, the retail value. Missions last modified while the earlier rules were in effect get those rules back through the transient AI profile: * 2005-11-08 onward: shot-down weapons without a shockwave have their area damage reduced too (Era_reduce_shot_down_area_effects) * 2016-11-28 onward: weapons destroyed by beams use the dinky shockwave (Era_beam_kills_count_as_shot_down) * 2019-12-17 onward: the multiplier is 1.0, unless game_settings specifies one A profile that specifies "$consistent dinky shockwaves:" opts out of all of them. The two era flags are internal and never parsed. The window ends at a placeholder date that must be set to the merge date. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Depends on #7830, #7831, and #7835; in draft until those are merged.
Background
Retail quartered the shockwave damage of a bomb that was shot down by another weapon, and multiplied it back by 4 against huge ships (
maybe_shockwave_damage_adjust). Both halves date from the same Volition check-in, so small craft near an intercepted bomb took a quarter of the damage while capital ships took all of it.The 2005 dinky shockwave system absorbed that rule, and three later changes moved it away from retail:
weapon_hit()is never called with a weapon as the other object. That is true, but the retail condition also testsWF_DESTROYED_BY_WEAPON, whichcollide_weapon_weaponsets before the bomb detonates throughweapon_detonate(). Since 19.0.0, shot-down bombs have done full damage to small craft and, because the x4 is still there, four times the damage to huge ships.The multiplier was also baked into each weapon when the table was parsed, so it could not vary per mission, and the dinky copy went stale if a later TBM changed the weapon.
Design goals
What this PR does
Retail default.
$Dinky Shockwave Default Multiplier:in game_settings now defaults to 0.25.Per-mission multiplier.
ai_profile_tgainsdinky_shockwave_multiplier, initialized from the game_settings value. The default dinky damage is computed at detonation as the regular shockwave damage times the profile's multiplier.New ai_profiles flag,
$consistent dinky shockwaves:, enabled by default for mods targeting 27.0.With the flag on:
$Arm time/distance/radius.With the flag off, behavior is retail: area-effect weapons and beam kills are not reduced, and the x4 against huge ships is kept.
Multiples of regular damage, small craft / huge ships, for a weapon shot down after arming with default dinky damage and multiplier M:
Era window. When a mission is loaded in-game,
mission_apply_era_adjustments()looks at its$Modified:date. A mission last saved while a buggy rule was in effect gets that rule back on its transient profile:All three windows end at
ERA_DINKY_END, which must be set to this PR's merge date.$Modified:was chosen over$Created:because the last save is the most likely balance pass. The two era rules are internal profile flags that are never parsed.Opt-outs: a profile that writes
$consistent dinky shockwaves:(either value) gets no era adjustment. A game_settings table that writes$Dinky Shockwave Default Multiplier:keeps its value; the other two rules still apply to in-window missions, since those mods balanced under them.Fixes that apply regardless of the flag:
$Damageor the shockwave fields now carries through.$Disarmed ImpactSnd:falls back to the regular impact sound when not specified. A shot-down bomb has been silent by default since 2005. An explicit-1still means no sound.Behavior changes for existing mods
$Armparameters become dinky; the x4 against huge ships becomes a restore to regular damage; explicit dinky damage loses its x4.Implementation notes
weapon_armed()is built from two helpers, one for "shot down" and one for "failed to arm"; its callers and the LuaisArmed()are unchanged.Destroyed_by_beamweapon flag alongsideDestroyed_by_weapon, so the retail path can tell the two apart while "don't spawn if shot" and scoring keep working.SW_WEAPON_KILLmeans "huge ships take the regular shockwave damage" and is only set when that applies.do_subobj_hit_stuff()is unaffected.parse_shockwave_info()records which fields it parsed (SCI_*bits), andshockwave_create_info_inherit()fills in the rest inweapon_do_post_parse().ai_profile_t::explicit_flagsrecords which flags a table wrote, so the era code can tell "set to NO" from "not mentioned".mission_parse_date()reads the C-localeMM/DD/YYdate that both editors write.Testing
WeaponsParseTest.dinky_inheritance(a+nocreateentry changes a weapon's damage, outer radius and shockwave speed, and the dinky shockwave picks them up while keeping the one field it specified) andMissionParseTest.parse_date.$Arm timedetonated before arming, shot down before arming, and shot down after; and a bomb with explicit dinky damage shot down. Run with the flag off and on at multipliers 1.0 and 0.25, then with a mission dated 1999 (retail arithmetic), a mission dated 2027 with nothing explicit (all three era rules), the same mission with an explicit 0.25 multiplier (multiplier kept, other two rules applied), and a regression pass on the flag-on mission. All 160 results matched the tables above.🤖 Generated with Claude Code