Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Block damage system #1390

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open

Block damage system #1390

wants to merge 2 commits into from

Conversation

Coronia
Copy link
Contributor

@Coronia Coronia commented Sep 21, 2024

  • You can now make techno have a chance to block the incoming damage, which will make it multiply by a set percentage.
    • CanBlock, if set to false, make this TechnoType can't trigger a block, even if the block settings are from warheads, or affected by attached effects with block chance modifiers.
  • Block.Chances determines chance for a block to occur. Value from position matching the position from Block.AffectBelowPercents is used if found, or 0.0 if not found.
  • Block.DamageMultipliers determines the multiplier of received damage. Value from position matching the position from Block.AffectBelowPercents is used if found, or 1.0 if not found.
  • Block.AffectBelowPercents, if set to a single value, determines minimum percentage of their maximum Strength that targets must have left to be affected by a critical hit. If set to a list of values, it'll further determine Block.Chances and Block.DamageMultipliers when target health is below the certain percentage listed here.
  • Block.AffectsHouses can be used to customize houses that damage from this firer can be blocked. Notice that not all damage has a firer, such as damage dealt by anims.
  • Following conditions determine whether a block can be triggered.
    • Block.CanActive.NoFirer determines if the block can be triggered when the damage has no firer.
    • Block.CanActive.Powered determines if the block can be triggered when the techno is deactivated (PoweredUnit or affected by EMP) or on low power.
    • Block.CanActive.ShieldActive determines if the block can be triggered when the techno has an active shield. If you only want it to be triggered by certain type of shield, you can further set CanBlock for them.
    • Block.CanActive.ShieldInactive determines if the block can be triggered when the techno doesn't have an active shield.
    • Block.CanActive.ZeroDamage and Block.CanActive.NegativeDamage determine if the block can be triggered when the damage is equal to or below 0. determines if the block can be triggered when the damage is below 0, respectively.
    • Block.CanActive.Move and Block.CanActive.Stationarydetermines the block can be triggered when the techno is moving or not, respectively.
  • Block.Flash, if set to true, makes it so that a light flash is generated when a block is triggered. Size of the flash is determined by damage dealt (based on original damage instead of the blocked one), unless Block.Flash.FixedSize is set to a number, in which case that value is used instead (range of values that produces visible effect are increments of 4 from 81 to 252, anything higher or below does not have effect). Color can be customized via Block.Flash.Red/Green/Blue. If Block.Flash.Black is set to true, the generated flash will be black regardless of other color settings.
  • Block.Anims can be used to set animation to be displayed if a block is triggered. If more than one animation is listed, a random one is selected.
  • Block.Weapon, if set, will be fired at the techno once a block is triggered.
  • Block.ReflectDamage can be set to true to have positive damage dealt to the object to be reflected back to the attacker, if a block is triggered and there is a firer of the damage. Block.ReflectDamage.Warhead determines which Warhead is used to deal the damage, defaults to [CombatDamage]->C4Warhead. If Block.ReflectDamage.Warhead.Detonate is set to true, the Warhead is fully detonated instead of used to simply deal damage. Block.ReflectDamage.Chance determines the chance of reflection. - Block.ReflectDamage.AffectsHouses customizes which houses can trigger the reflect damage, default to Block.AffectsHouses. Block.ReflectDamage.Multiplier is a multiplier to the damage received and then reflected back (based on original damage instead of the blocked one), while Block.ReflectDamage.Override directly overrides the damage. Already reflected damage cannot be further reflected back.
    • Warheads can prevent reflect damage from occuring by setting SuppressReflectDamage to true.

==================================================================================

  • Warheads can also use the above settings to determine their own block behaviors when hitting the target.
    • Despite all block settings can be overridden, if you want to override Block.Chances or Block.DamageMultipliers, it's recommended to override Block.AffectBelowPercents in the meantime since they're lists with values in correpsonding positions.
  • Block.BasedOnWarhead, if set to true, makes the warhead block settings as a base when calculating a block. If set to false, block settings on techno is used as a base.
  • Block.AllowOverride, if set to true, allows the block settings from techno or warhead to override the other, if set. If Block.BasedOnWarhead is set to true, then it'll uses the set values from techno to override warheads', while keeping the unset values as the same. If it's set to false, then it'll do the override from warhead to techno with the same rule.
  • Block.IgnoreAttachEffect can be set on WarheadTypes to make their attack ignore modifiers of Block.Chances and Block.DamageMultipliers from the attached effects on the techno.
  • Block.ChanceMultiplier and Block.ExtraChance can be set on WarheadTypes to multiply the block chance or grant a fixed bonus to it when these warheads hit their targets, respectively.
  • Block.DamageMult.Multiplier and Block.DamageMult.Bonus can be set on WarheadTypes to multiply the block damage multiplier or grant a fixed bonus to it when these warheads hit their targets, respectively.
  • ImmuneToBlock can be set on WarheadTypes to make them can't trigger a block.

==================================================================================

  • Attached effects' Block.ChanceMultiplier and Block.ExtraChance can be used to multiply the block chance or grant a fixed bonus to it for the object the effect is attached to, respectively.
  • Attached effects' Block.DamageMult.Multiplier and Block.DamageMult.Bonus can be used to multiply the block damage multiplier or grant a fixed bonus to it for the object the effect is attached to, respectively.

In rulesmd.ini:

[SOMETECHNO]                                         ; TechnoType
CanBlock=true                                        ; boolean
Block.Chances=                                       ; list of floating-point values (percentage or absolute) (0.0-1.0)
Block.DamageMultipliers=                             ; list of floating-point values (percentage or absolute)
Block.AffectBelowPercents=                           ; list of floating-point values (percentage or absolute) (0.0-1.0)
Block.AffectsHouses=all                              ; list of Affected House Enumeration (none|owner/self|allies/ally|team|enemies/enemy|all)
Block.CanActive.NoFirer=true                         ; boolean
Block.CanActive.Powered=false                        ; boolean
Block.CanActive.ShieldActive=true                    ; boolean
Block.CanActive.ShieldInactive=true                  ; boolean
Block.CanActive.ZeroDamage=false                     ; boolean
Block.CanActive.NegativeDamage=false                 ; boolean
Block.CanActive.Move=true                            ; boolean
Block.CanActive.Stationary=true                      ; boolean
Block.Flash=false                                    ; boolean
Block.Flash.FixedSize=                               ; integer
Block.Flash.Red=true                                 ; boolean
Block.Flash.Green=true                               ; boolean
Block.Flash.Blue=true                                ; boolean
Block.Flash.Black=false                              ; boolean
Block.Anims=                                         ; list of animations
Block.Weapon=                                        ; WeaponType
Block.ReflectDamage=false                            ; boolean
Block.ReflectDamage.Chance=1.0                       ; floating point value
Block.ReflectDamage.Warhead=                         ; WarheadType
Block.ReflectDamage.Warhead.Detonate=false           ; WarheadType
Block.ReflectDamage.Multiplier=1.0                   ; floating point value, percents or absolute
Block.ReflectDamage.AffectsHouses=                   ; list of Affected House Enumeration (none|owner/self|allies/ally|team|enemies/enemy|all)
Block.ReflectDamage.Override=                        ; integer

[SOMEWARHEAD]                                        ; WarheadType
Block.Chances=                                       ; list of floating-point values (percentage or absolute) (0.0-1.0)
Block.DamageMultipliers=                             ; list of floating-point values (percentage or absolute)
Block.AffectBelowPercents=                           ; list of floating-point values (percentage or absolute) (0.0-1.0)
Block.AffectsHouses=all                              ; list of Affected House Enumeration (none|owner/self|allies/ally|team|enemies/enemy|all)
Block.CanActive.NoFirer=true                         ; boolean
Block.CanActive.Powered=false                        ; boolean
Block.CanActive.ShieldActive=true                    ; boolean
Block.CanActive.ShieldInactive=true                  ; boolean
Block.CanActive.ZeroDamage=false                     ; boolean
Block.CanActive.NegativeDamage=false                 ; boolean
Block.CanActive.Move=true                            ; boolean
Block.CanActive.Stationary=true                      ; boolean
Block.Flash=false                                    ; boolean
Block.Flash.FixedSize=                               ; integer
Block.Flash.Red=true                                 ; boolean
Block.Flash.Green=true                               ; boolean
Block.Flash.Blue=true                                ; boolean
Block.Flash.Black=false                              ; boolean
Block.Anims=                                         ; list of animations
Block.Weapon=                                        ; WeaponType
Block.ReflectDamage=false                            ; boolean
Block.ReflectDamage.Chance=1.0                       ; floating point value
Block.ReflectDamage.Warhead=                         ; WarheadType
Block.ReflectDamage.Warhead.Detonate=false           ; WarheadType
Block.ReflectDamage.Multiplier=1.0                   ; floating point value, percents or absolute
Block.ReflectDamage.AffectsHouses=                   ; list of Affected House Enumeration (none|owner/self|allies/ally|team|enemies/enemy|all)
Block.ReflectDamage.Override=                        ; integer
Block.BasedOnWarhead=false                           ; boolean
Block.AllowOverride=true                             ; boolean
Block.IgnoreAttachEffect=true                        ; boolean
Block.ChanceMultiplier=1.0                           ; floating point value
Block.ExtraChance=0.0                                ; floating point value
Block.DamageMult.Multiplier=1.0                      ; floating point value
Block.DamageMult.Bonus=0.0                           ; floating point value
ImmuneToBlock=false                                  ; boolean

[SOMEATTACHEFFECT]                             ; AttachEffectType
Block.ChanceMultiplier=1.0                     ; floating point value
Block.ExtraChance=0.0                          ; floating point value
Block.DamageMult.Multiplier=1.0                ; floating point value
Block.DamageMult.Bonus=0.0                     ; floating point value

[SOMESHIELDTYPE]                            ; ShieldType name
CanBlock=true                               ; boolean

Copy link

github-actions bot commented Sep 21, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant