Skip to content

Customize DoT tick schedules #1539

@DaloLorn

Description

@DaloLorn

Problem Overview

Generally, the persistent effects for DoTs such as bleeding, burning, or poison are built with a _WatchRule of eGameRule_PlayerTurnBegin, causing them to tick at the start of the unit owner's turn. This is usually okay; the only exception I've heard of so far has been Requiem Corrosion, which would be pretty painful if it ticked before you had a chance to heal it.

However, with the use of Highlander features such as #89 and #629, and mods such as TeslaRage's Ablative Vests, or Iridar's Vest & Plating and/or Armor Overhaul, these effects have the potential to guarantee an inordinate amount of medbay time for anyone affected.

Proposed Solution

Add new configs, similar to those in the above-linked features, to override the default tick schedule. As I assume eGameRule_PlayerTurnEnd is the only other legitimate option for a DoT's _WatchRule, Boolean flags seem sufficient:

[XComGame.X2Effect_Burning]
BURNED_TICKS_AFTER_TURN=true ; Make burn and acid DOTs tick on turn end

[XComGame.X2StatusEffects]
POISONED_TICKS_AFTER_TURN=true ; Make poison DOT tick on turn end
BLEEDING_TICKS_AFTER_TURN=true ; Make bleeding DOT tick on turn end

That said, this solution lacks granularity: X2Effect_Burning is used for almost every custom DoT in the community, and it may make sense for different damage types to have different behaviors. Simply recycling #89's design seems... inadequate, and more refinement is warranted. If one is going to the trouble of making such sweeping changes to the game's rules, OPTCing against half the modding community will be an inelegant and needlessly laborious process when a few extra lines of code could solve it at the source.

To resolve this, a list of damage types could be provided to cause the inverse behavior, e.g. radiation burns ticking on turn start when everything else ticks on turn end (or vice versa, as is more convenient to a given modder):

[XComGame.X2Effect_Burning]
BURNED_TICKS_AFTER_TURN=true             ; Make most burn and acid DOTs tick on turn end
+BURNED_TICKS_REVERSE_SCHEDULE=Radiation ; But make radiation DOT tick on turn start!

; Or if the default is to tick on turn start...

[XComGame.X2Effect_Burning]
BURNED_TICKS_AFTER_TURN=false            ; Make most burn and acid DOTs tick on turn start
+BURNED_TICKS_REVERSE_SCHEDULE=Radiation ; But make radiation DOT tick on turn end!

Alternatively, a single config could cover everything burn-related, simply enumerating all damage types that break from the vanilla default:

[XComGame.X2Effect_Burning]
+BURN_TYPES_TICKING_AFTER_TURN=Radiation ; Make radiation DOT tick on turn end!

This is a functionality I'd also like to backport to #89, for the same reasons, but I'm not sure about the protocol here. Would that be considered an update to the original feature, or would it require a separate issue?

Either way, backwards compatibility seems to demand keeping the original config and adding an exclusion/inversion list, lest we break existing mods relying on that flag.

Can Self-Serve?

Yep. I'll open a PR soon, after I'm done setting up my dev environment and running the appropriate tests.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions