Phobos icon indicating copy to clipboard operation
Phobos copied to clipboard

AttachEffect / Custom tints / Revenge weapons / Warhead effect Verses requirement change

Open Starkku opened this issue 2 years ago • 24 comments

Phobos-introduced Warhead effects like shield modifiers, critical hits, disguise & mind control removal now require Warhead Verses to affect target to apply unless EffectsRequireVerses is set to false. Shield armor type is used if target has an active shield that cannot be penetrated by the Warhead.


Attached effects

  • Similar (but not identical) to Ares' AttachEffect, but with some differences and new features. The largest difference is that here attached effects are explicitly defined types.

    • Duration determines how long the effect lasts for. It can be overriden by DurationOverrides on TechnoTypes and Warheads.
    • Cumulative, if set to true, allows the same type of effect to be applied on same object multiple times, up to Cumulative.MaxCount number or with no limit if Cumulative.MaxCount is a negative number.
    • Powered controls whether or not the effect is rendered inactive if the object it is attached to is deactivated (PoweredUnit or affected by EMP) or on low power. What happens to animation is controlled by Animation.OfflineAction.
    • DiscardOn accepts a list of values corresponding to conditions where the attached effect should be discarded. Defaults to none, meaning it is never discarded.
      • entry: Discard on exiting the map when entering transports or buildings etc.
      • move: Discard when the object the effect is attached on moves. Ignored if the object is a building.
      • stationary: Discard when the object the effect is attached on stops moving. Ignored if the object is a building.
    • If PenetratesIronCurtain is not set to true, the effect is not applied on currently invulnerable objects (Iron Curtain / Force Shield).
    • Animation defines animation to play in an indefinite loop for as long as the effect is active on the object it is attached to.
      • If Animation.ResetOnReapply is set to true, the animation playback is reset every time the effect is applied if Cumulative=false.
      • Animation.OfflineAction determines what happens to the animation when the attached object is deactivated or not powered. Only applies if Powered=true.
      • Animation.TemporalAction determines what happens to the animation when the attached object is under effect of Temporal=true Warhead.
      • Animation.UseInvokerAsOwner can be used to set the house and TechnoType that created the effect (e.g firer of the weapon that applied it) as the animation's owner & invoker instead of the object the effect is attached to.
    • Tint.Color & Tint.Intensity can be used to set a color tint effect and additive lighting increase/decrease on the object the effect is attached to, respectively.
      • Tint.VisibleToHouses can be used to control which houses can see the tint effect.
    • FirepowerMultiplier, ArmorMultiplier, SpeedMultiplier and ROFMultiplier can be used to modify the object's firepower, armor strength, movement speed and weapon reload rate, respectively.
      • If ROFMultiplier.ApplyOnCurrentTimer is set to true, ROFMultiplier is applied on currently running reload timer (if any) when the effect is first applied.
    • If Cloakable is set to true, the object the effect is attached to is granted ability to cloak itself for duration of the effect.
    • ForceDecloak, if set to true, will uncloak and make the object the effect is attached to unable to cloak itself for duration of the effect.
    • WeaponRange.Multiplier and WeaponRange.ExtraRange can be used to multiply the weapon firing range of the object the effect is attached to, or give it an increase / decrease (measured in cells), respectively. ExtraRange is cumulatively applied from all attached effects after all Multiplier values have been applied.
      • WeaponRange.AllowWeapons can be used to list only weapons that can benefit from this range bonus and WeaponRange.DisallowWeapons weapons that are not allowed to, respectively.
      • On TechnoTypes with OpenTopped=true, OpenTopped.UseTransportRangeModifiers can be set to true to make passengers firing out use the transport's active range bonuses instead.
    • Crit.Multiplier and Crit.ExtraChance can be used to multiply the critical hit chance or grant a fixed bonus to it for the object the effect is attached to, respectively.
      • Crit.AllowWarheads can be used to list only Warheads that can benefit from this critical hit chance multiplier and Crit.DisallowWarheads weapons that are not allowed to, respectively.
    • RevengeWeapon can be used to temporarily grant the specified weapon as a revenge weapon for the attached object.
      • RevengeWeapon.AffectsHouses customizes which houses can trigger the revenge weapon.
  • AttachEffectTypes can be attached to TechnoTypes using AttachEffect.AttachTypes.

    • AttachEffect.DurationOverrides can be used to override the default durations. Duration matching the position in AttachTypes is used for that type, or the last listed duration if not available.
    • AttachEffect.Delays can be used to set the delays for recreating the effects on the TechnoType after they expire. Defaults to 0 (immediately), negative values mean the effects are not recreated. Delay matching the position in AttachTypes is used for that type, or the last listed delay if not available.
    • AttachEffect.InitialDelays can be used to set the delays before first creating the effects on TechnoType. Defaults to 0 (immediately). Delay matching the position in AttachTypes is used for that type, or the last listed delay if not available.
    • AttachEffect.RecreationDelays is used to determine if the effect can be recreated if it is removed completely (e.g AttachEffect.RemoveTypes), and if yes, how long this takes. Defaults to -1, meaning no recreation. Delay matching the position in AttachTypes is used for that type, or the last listed delay if not available.
  • AttachEffectTypes can be attached to objects via Warheads using AttachEffect.AttachTypes.

    • AttachEffect.DurationOverrides can be used to override the default durations. Duration matching the position in AttachTypes is used for that type, or the last listed duration if not available.
    • Attached effects can be removed from objects by Warheads using AttachEffect.RemoveTypes.
  • Weapons can require attached effects on target to fire, or be prevented by firing if specific attached effects are applied.

    • AttachEffect.RequiredTypes can be used to list attached effects required to be on target to fire, all listed effect types must be present to allow firing.
    • AttachEffect.DisallowedTypes can be used to list attached effects that when present prevent the weapon from firing, any of the listed effect types will prevent firing if present.
    • AttachEffect.IgnoreFromSameSource can be set to true to ignore effects that have been attached by the firer of the weapon and its Warhead.

In rulesmd.ini:

[AttachEffectTypes]
0=SOMEATTACHEFFECT

[SOMEATTACHEFFECT]                           ; AttachEffectType
Duration=0                                   ; integer - game frames or negative value for indefinite duration
Cumulative=false                             ; boolean
Cumulative.MaxCount=-1                       ; integer
Powered=false                                ; boolean
DiscardOn=none                               ; list of discard condition enumeration (none|entry|move|stationary)
PenetratesIronCurtain=false                  ; boolean
Animation=                                   ; Animation
Animation.ResetOnReapply=false               ; boolean
Animation.OfflineAction=Hides                ; AttachedAnimFlag (None, Hides, Temporal, Paused or PausedTemporal)
Animation.TemporalAction=None                ; AttachedAnimFlag (None, Hides, Temporal, Paused or PausedTemporal)
Animation.UseInvokerAsOwner=false            ; boolean
Tint.Color=                                  ; integer - R,G,B
Tint.Intensity=                              ; floating point value
Tint.VisibleToHouses=all                     ; list of Affected House Enumeration (none|owner/self|allies/ally|team|enemies/enemy|all)
FirepowerMultiplier=1.0                      ; floating point value
ArmorMultiplier=1.0                          ; floating point value
SpeedMultiplier=1.0                          ; floating point value
ROFMultiplier=1.0                            ; floating point value
ROFMultiplier.ApplyOnCurrentTimer=true       ; boolean
Cloakable=false                              ; boolean
ForceDecloak=false                           ; boolean
WeaponRange.Multiplier=1.0                   ; floating point value
WeaponRange.ExtraRange=0.0                   ; floating point value
WeaponRange.AllowWeapons=                    ; list of WeaponTypes
WeaponRange.DisallowWeapons=                 ; list of WeaponTypes
Crit.Multiplier=1.0                          ; floating point value
Crit.ExtraChance=0.0                         ; floating point value
Crit.AllowWarheads=                          ; list of WarheadTypes
Crit.DisallowWarheads=                       ; list of WarheadTypes
RevengeWeapon=                               ; WeaponType
RevengeWeapon.AffectsHouses=all              ; list of Affected House Enumeration (none|owner/self|allies/ally|team|enemies/enemy|all)

[SOMETECHNO]                                 ; TechnoType
AttachEffect.AttachTypes=                    ; List of AttachEffectTypes
AttachEffect.DurationOverrides=              ; integer - duration overrides (comma-separated) for AttachTypes in order from first to last.
AttachEffect.Delays=                         ; integer - delays (comma-separated) for AttachTypes in order from first to last.
AttachEffect.InitialDelays=                  ; integer - initial delays (comma-separated) for AttachTypes in order from first to last.
AttachEffect.RecreationDelays=               ; integer - recreation delays (comma-separated) for AttachTypes in order from first to last.
OpenTopped.UseTransportRangeModifiers=false  ; boolean

[SOMEWEAPON]                                 ; WeaponType
AttachEffect.RequiredTypes=                  ; List of AttachEffectTypes
AttachEffect.DisallowedTypes=                ; List of AttachEffectTypes
AttachEffect.IgnoreFromSameSource=false      ; boolean

[SOMEWARHEAD]
AttachEffect.AttachTypes=                    ; List of AttachEffectTypes
AttachEffect.RemoveTypes=                    ; List of AttachEffectTypes
AttachEffect.DurationOverrides=              ; integer - duration overrides (comma-separated) for AttachTypes in order from first to last.

Theres also a couple of tinting-related bugfixes:

  • Tint effects are now correctly applied to SHP vehicles and all types of aircraft as well as building animations regardless of their position.
  • Iron Curtained / Force Shielded objects now always use the correct tint color.

Revenge weapon

  • Similar to DeathWeapon in that it is fired after a TechnoType is killed, but with the difference that it will be fired on whoever dealt the damage that killed the TechnoType. If TechnoType died of sources other than direct damage dealt by another TechnoType, RevengeWeapon will not be fired.
    • RevengeWeapon.AffectsHouses can be used to filter which houses the damage that killed the TechnoType is allowed to come from to fire the weapon.

In rulesmd.ini:

[SOMETECHNO]                    ; TechnoType
RevengeWeapon=                  ; WeaponType
RevengeWeapon.AffectsHouses=all ; list of Affected House Enumeration (none|owner/self|allies/ally|team|enemies/enemy|all)

Summary by CodeRabbit

  • New Features

    • Custom tint effects for a more immersive visual experience.
    • Revenge weapons and new combat mechanics introduced.
    • Enhanced singleplayer map loading features.
    • Additional customization options for EVA voice and unit selling sounds.
    • New attached effects for entities, offering expanded gameplay interactions.
    • Shields now include custom radiation types and visual tints.
    • Warhead effects now consider armor types and shield penetration.
  • Bug Fixes

    • Fixed issues with jumpjets and ambient damage mechanics.
    • Corrected tint color usage for Iron Curtained/Force Shielded objects.
    • Refined weapon range calculations for consistency.
  • Documentation

    • Updated Fixed-or-Improved Logics documentation.
    • Expanded New-or-Enhanced Logics documentation with recent additions.
    • Listed new features and fixes in the What's New document.
  • Refactor

    • Improved handling of building animations and their associations.
    • Refined logic for weapon range modifiers and attached effects.
    • Streamlined code related to TechnoType properties and shield class behavior.
  • Style

    • Enhanced visual representation of shields and tinting effects on game entities.
  • Chores

    • General codebase maintenance and cleanup for better performance and stability.
  • Revert

    • Removed previously implemented hooks for certain classes to improve game mechanics.

Starkku avatar Jan 22 '23 23:01 Starkku

Massively reworked the PR by basically reimplementing AttachEffect as explicit types.

  • This system should be able to coexist with Ares' AttachEffect without a hitch, there might be some edge cases I have not caught though.
  • ROFMultiplier is by default also applied on currently running reload timer here unlike with Ares' version. This can be customized via ROFMultplier.ApplyOnCurrentTimer.
  • Note that ForceDecloak works differently here (it keeps the objects uncloaked for duration of the effect instead of uncloaking once when applied), Ares' implementation is not particularly useful.
  • WeaponRangeBonus and weapons requiring or being blocked by target's AttachEffects are new logic I decided to throw in, should allow for some interesting things.

Due to the large amount of TechnoExt::ExtMap.Find calls necessiated by the custom tint logic, weapon range bonus as well AttachEffect as whole, this PR will likely run at less than optimal performance until that system is reworked.

Starkku avatar Feb 04 '23 17:02 Starkku

Rebased on develop, as well as a couple of other changes.

  • The weapon range modifier keys have been renamed to accomodate addition of a multiplier alongside the 'fixed' extra range bonus.
  • Added critical hit chance multiplier.

Starkku avatar Mar 09 '23 21:03 Starkku

Rebased on develop again, as well as introduced fixed critical hit chance bonus effect. Note that rest of the critical hit modifier keys have been renamed as well.

Starkku avatar Mar 15 '23 11:03 Starkku

Before I forget, a thought for the future (not necessarily this PR). To unify the attachability of different things what I think maybe the best approach would be splitting the concept of an AttachEffect into two entities:

  • the component that can be attached (in this case the effect, the shield as well, maybe stuff like LaserTrails, interceptors etc.), without the lifetime/attachment/detachment conditions etc., just the component itself which won't have any self-management logic
  • the attacher itself, which could manage multiple components at once using timers, conditions for attachment/detachment/activation/deactivation/etc., which can also be a component.

Up to further discussion.

Metadorius avatar Mar 15 '23 12:03 Metadorius

Some extra suggestions:

  • Sight modifier (use cases for this increases if correct Fog of War gets implemented)
  • Ammo reload modifier
  • Experience modifier
  • Bounty modifier
  • Retailation weapon (fires on damage inflictor)
  • Ares' suppress EVA, DeathWeapon on death

Envoidener avatar Mar 20 '23 16:03 Envoidener

There is a bug, when using these AEs on mobile buildings which is packing into vehicles, the game freezes.

reedom114514 avatar May 28 '23 07:05 reedom114514

There is a bug, when using these AEs on mobile buildings which is packing into vehicles, the game freezes.

Good catch, should be fixed now.

Starkku avatar May 28 '23 09:05 Starkku

There is a bug, when using these AEs on mobile buildings which is packing into vehicles, the game freezes.

Good catch, should be fixed now.

After bug fix, there is another one about it: when building affected by new AE turns (in my test it is a SODAR) to vehicle, and adjust game speed in this step, after 1-2 sec the game freezes, EIP:5B767260

reedom114514 avatar May 29 '23 15:05 reedom114514

There is a bug, when using these AEs on mobile buildings which is packing into vehicles, the game freezes.

Good catch, should be fixed now.

After bug fix, there is another one about it: when building affected by new AE turns (in my test it is a SODAR) to vehicle, and adjust game speed in this step, after 1-2 sec the game freezes, EIP:5B767260

Is this on the most up to date build? For some reason the github-actions bot isn't updating the links correctly right now.

Here's the link https://github.com/Phobos-developers/Phobos/suites/13202812824/artifacts/718933906

Starkku avatar May 29 '23 15:05 Starkku

There is a bug, when using these AEs on mobile buildings which is packing into vehicles, the game freezes.

Good catch, should be fixed now.

After bug fix, there is another one about it: when building affected by new AE turns (in my test it is a SODAR) to vehicle, and adjust game speed in this step, after 1-2 sec the game freezes, EIP:5B767260

Is this on the most up to date build? For some reason the github-actions bot isn't updating the links correctly right now.

Here's the link https://github.com/Phobos-developers/Phobos/suites/13202812824/artifacts/718933906

Oh, not the newest one, the one I downloaded is about 9 hours earlier Ok, I shall try

reedom114514 avatar May 29 '23 17:05 reedom114514

There is a bug, when using these AEs on mobile buildings which is packing into vehicles, the game freezes.

Good catch, should be fixed now.

After bug fix, there is another one about it: when building affected by new AE turns (in my test it is a SODAR) to vehicle, and adjust game speed in this step, after 1-2 sec the game freezes, EIP:5B767260

Is this on the most up to date build? For some reason the github-actions bot isn't updating the links correctly right now.

Here's the link https://github.com/Phobos-developers/Phobos/suites/13202812824/artifacts/718933906

With the newest one there is still a FE, EIP:5B33B669, randomly during packing/unpacking the SODAR, Firepower/Armor/Speed/Range

reedom114514 avatar May 30 '23 05:05 reedom114514

With the newest one there is still a FE, EIP:5B33B669, randomly during packing/unpacking the SODAR, Firepower/Armor/Speed/Range

Could you provide the exact AttachEffect code used in this case? I've been able to reproduce this crash, but it isn't reliable and it occurs really rarely for me so I might need further info to help narrow it down.

Starkku avatar May 30 '23 10:05 Starkku

With the newest one there is still a FE, EIP:5B33B669, randomly during packing/unpacking the SODAR, Firepower/Armor/Speed/Range

Could you provide the exact AttachEffect code used in this case? I've been able to reproduce this crash, but it isn't reliable and it occurs really rarely for me so I might need further info to help narrow it down.

Okay, here it is [BCNTRBuffAE] Duration=110 Animation=MADNESS ArmorMultiplier=1.75 SpeedMultiplier=1.2 FirepowerMultiplier=1.3 WeaponRange.ExtraRange=2

reedom114514 avatar May 30 '23 16:05 reedom114514

https://github.com/Phobos-developers/Phobos/suites/13280697552/artifacts/724636536

Refactored attaching/detaching code and changed how transfering works, I was unable to reproduce the crash afterwards.

Starkku avatar Jun 01 '23 08:06 Starkku

https://github.com/Phobos-developers/Phobos/suites/13280697552/artifacts/724636536

Refactored attaching/detaching code and changed how transfering works, I was unable to reproduce the crash afterwards.

After testing I cannot reproduce this too, but in multi-player the RE happens (using this PR branch), shall I post that on the other feedback?

reedom114514 avatar Jun 01 '23 13:06 reedom114514

Nightly build for this pull request:

This comment is automatic and is meant to allow guests to get latest nightly builds for this pull request without registering. It is updated on every successful build.

github-actions[bot] avatar Jul 15 '23 11:07 github-actions[bot]

DiscardOnEntry has been deprecated. Use the new key DiscardOn (f.ex DiscardOn=entry) instead which accepts a list of conditions including two new ones for discarding when object moves or becomes stationary, respectively (move and stationary).

Additionally fixed an issue with discarded attacheffects not being recreated even if they should after exiting from limbo.

Starkku avatar Sep 23 '23 13:09 Starkku

Means they are exclusive now? Maybe different tags or enum flags would work better for combination of different conditions?

Metadorius avatar Sep 23 '23 13:09 Metadorius

Means they are exclusive now? Maybe different tags or enum flags would work better for combination of different conditions?

I worded it badly, it takes a list of values. It is bit more clear in the doc. I amended my above post to make that more clear.

Starkku avatar Sep 23 '23 13:09 Starkku

Walkthrough

The project has undergone a significant update, introducing features like custom tint effects, revenge weapons, and AttachEffect to enhance gameplay dynamics and visual customization. Various components have been refined to improve game logics, such as tint application for shielded objects and weapon range adjustments, reflecting a comprehensive integration of these new elements into the game engine.

Changes

Files Change Summary
CREDITS.md, Phobos.vcxproj Expanded project functionality with custom tints, revenge weapons, and AttachEffect. Added new source files for entity attachments and updated hooks for shield behavior and weapon range modifications.
docs/Fixed-or-Improved-Logics.md, docs/New-or-Enhanced-Logics.md, docs/Whats-New.md Documented fixes and new features like attached effects, custom radiation types, and enhanced customization options.
src/Ext/Anim/Body.cpp, Body.h, Building/Hooks.cpp Added handling for building animations and parent building updates in the animation extension.
src/Ext/Rules/Body.cpp, Script/Mission.Attack.cpp Included new classes and logic for loading attach effect data and evaluating weapon ranges with modifiers.
src/Ext/Techno/*, TechnoType/* Comprehensive updates across Techno extension files for attach effects, tint application, and gameplay enhancements.
src/Ext/WarheadType/*, WeaponType/* Updates introducing methods for warhead effects, attach effects handling, and weapon range calculations.
src/New/Entity/*, Type/* Introduction of classes for managing attachment effects and their types, including loading data from INI files.
src/Utilities/* Updates including new enum classes, color handling methods, and template specialization for parsing from INI files.

🐇✨ In the warren of code, we dig and we delve, Crafting new hues, shields, and might to preserve. With each line we spin, a new tale we tell, In the land of Phobos, where our creations swell. 🌟 🐇💻


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

Note: Auto-reply has been disabled for this repository by the repository owner. The CodeRabbit bot will not respond to your replies unless it is explicitly tagged.

  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

coderabbitai[bot] avatar Jan 21 '24 10:01 coderabbitai[bot]

Considering it's a replacement for Ares' AttachEffect - it may be good to add a note stating what changes are required to migrate to Phobos one.

It doesn't stop any of the Ares' AttachEffect features from working though. It simply offers new system alongside the old one.

Starkku avatar Feb 26 '24 10:02 Starkku

It doesn't stop any of the Ares' AttachEffect features from working though. It simply offers new system alongside the old one.

Correct, I didn't mean this in fact. I mean it as just an upgrade scenario, if the user would want to migrate from Ares to Phobos AE and/or back, and we could point them to the note.

Metadorius avatar Feb 26 '24 10:02 Metadorius

Added some additional features to AttachEffect, mostly things that have been requested from me (grouping & group filters, Cumulative stack filters/animations, expire weapon). I will not expand the current functionality any further in this PR and consider this PR finished, save for potential bugfixes.

Starkku avatar Apr 23 '24 13:04 Starkku

AttachEffect.RequiredTypes=; on weapons make the unit not able to attack the target until the AE is on it (as intended), but the weapon can still be fired on the ground, so in a way it's still able to damage said target if it moves to the ground cell being attacked. This can be "fixed" with CanTarget= but doesn't feel like it interacts well.

Having an AttachEffectType with an ExpireWeapon= that triggers another AttachEffectType crashes the game. See except.txt: except.txt The second and third time around the game just closed without throwing an IE: syringe.log

ExpireWeapon= does not damage the owner/invoker, but does damage friendly units, would be good to control this. Effects such as (Ares AE) do get applied to the owner/invoker though.

Powered=true does not work on low power as described, but it does work when the unit is disabled e.g. EMP

Crit.ExtraChance does not work if the Warhead has 0.0 crit to begin with, which it should, e.g.

Crit test results: If your warhead has a 0.01 chance to crit and you add 0.5, you now have 0.51 and can confirm it works; But if your warhead has 0.0 chance and you add 0.5, you still have 0.0 and your weapon will not crit.

Expected results: 0.0 crit + 0.50 should give you 0.50, not 0.0 as it is not a multiplier.

ayylmaoRotE avatar Apr 26 '24 12:04 ayylmaoRotE

AttachEffect.RequiredTypes=; on weapons make the unit not able to attack the target until the AE is on it (as intended), but the weapon can still be fired on the ground, so in a way it's still able to damage said target if it moves to the ground cell being attacked. This can be "fixed" with CanTarget= but doesn't feel like it interacts well.

Noted but not the easiest 'problem' to solve, CanTarget itself also technically can have same issue depending on values.

Having an AttachEffectType with an ExpireWeapon= that triggers another AttachEffectType crashes the game.

This needs a crash dump.

ExpireWeapon= does not damage the owner/invoker, but does damage friendly units, would be good to control this. Effects such as (Ares AE) do get applied to the owner/invoker though.

Use AllowDamageOnSelf on Warhead, technos don't take damage from weapons/warheads that are considered to be fired by themselves normally and this applies literally everywhere.

Powered=true does not work on low power as described, but it does work when the unit is disabled e.g. EMP

Cannot reproduce. This is technically not a 'low base power' check and it is not advertised as such in the documentation either, but rather simply if the techno it is attached to is 'offline' or not. For buildings that require power it does work as intended.

Crit.ExtraChance does not work if the Warhead has 0.0 crit to begin with, which it should,

Will change this although there might be a performance impact from it, however noticeable or unnoticeable.

Starkku avatar Apr 26 '24 16:04 Starkku

This needs a crash dump.

Attached. https://1drv.ms/u/s!Ah86cVoN9dYikZJA5vSbP6yWYCRwJA?e=1uQJh9

Cannot reproduce. This is technically not a 'low base power' check and it is not advertised as such in the documentation either, but rather simply if the techno it is attached to is 'offline' or not. For buildings that require power it does work as intended.

Oh yep that makes sense, didn't look into buildings

Will do MP testing later too

ayylmaoRotE avatar Apr 27 '24 00:04 ayylmaoRotE

Just want to point out since it using vector of unique_ptr make sure to check if the unique_ptr is not empty when looping thru the vector(s), accessing that empty unique_ptr then doing operator-> can cause unexpected crashes ( like ares case with vector of SWStateMachine unique ptr ).

Otamaa avatar May 04 '24 13:05 Otamaa

I could change it to use vector of instances like @chaserli suggested earlier, but besides having to go through the effort to refactor a bunch of code are there any other actual concerns I should take into account if I do that? Is it even a feasible approach for something like this, I know shields use unique_ptr so that is why I picked it in the first place. If I nuke the vector (e.g techno dies) will it automagically delete/deallocate the objects contained as well even if I don't use unique_ptr?

Starkku avatar May 04 '24 17:05 Starkku

I personally think that for consistency sake it's better to use pointer vector for now, after all everything uses that. If there are benefits for instance vectors - the refactoring should be separate.

Metadorius avatar May 05 '24 12:05 Metadorius