Skip to content

Add ammo, health, mission landtype and sequence conditions to DiscardOn - #2321

Open
DeathFishAtEase wants to merge 14 commits into
Phobos-developers:developfrom
DeathFishAtEase:DiscardOn_Ammo_HP_Land
Open

Add ammo, health, mission landtype and sequence conditions to DiscardOn#2321
DeathFishAtEase wants to merge 14 commits into
Phobos-developers:developfrom
DeathFishAtEase:DiscardOn_Ammo_HP_Land

Conversation

@DeathFishAtEase

@DeathFishAtEase DeathFishAtEase commented Aug 2, 2026

Copy link
Copy Markdown
Collaborator
  • Similar..., but ...
    • DiscardOn...
      • ammo: Discard when the ammo of the object the effect is attached to is within the interval [DiscardOn.Ammo.Min, DiscardOn.Ammo.Max].
      • health: Discard when the health ratio of the object the effect is attached to is within the interval [DiscardOn.Health.Min, DiscardOn.Health.Max].
      • mission: Discard when the current mission of the object the effect is attached to matches any one in the DiscardOn.Missions list (or DiscardOn.AIMissions for AI-controlled objects, if set).
      • landtype: Discard when the land type of the cell where the object the effect is attached to is currently located matches any land type in the DiscardOn.LandTypes list.
      • sequence: Discard when the infantry to which the effect is attached is playing a sequence that matches any one in the DiscardOn.Sequences list.
    • DiscardOn.Sequences.Immediate defines whether the sequence discard condition triggers immediately while the infantry is playing a matching sequence, or only when the infantry starts playing its next sequence after finishing that sequence.

In rulesmd.ini:

[General]
DiscardOn.Sequences.Immediate=true                 ; boolean

[SOMEATTACHEFFECT]                                 ; AttachEffectType
DiscardOn=none                                     ; List of discard condition enumeration (none|entry|move|stationary|drain|inrange|outofrange|selling|undeploying|harvesting|invokerdie|ammo|health|mission|landtype|sequence)
DiscardOn.Ammo.MinimumAmount=-1                    ; integer
DiscardOn.Ammo.MaximumAmount=-1                    ; integer
DiscardOn.Health.BelowPercent=-1                   ; floating point value
DiscardOn.Health.AbovePercent=-1                   ; floating point value
DiscardOn.Missions=                                ; List of MissionTypes
DiscardOn.AIMissions=                              ; List of MissionTypes, default to [AttachEffectType] -> DiscardOn.Missions
DiscardOn.LandTypes=                               ; List of LandTypes (none | clear | road | water | rock | wall | tiberium | beach | rough | ice | railroad | tunnel | weeds)
DiscardOn.Sequences=                               ; List of Sequences (ready | guard | prone | walk | fireup | fireprone | secondaryfire | secondaryprone | down | crawl | up | idle1 | idle2 | die1 | die2 | die3 | die4 | die5 | deploy | deployed | deployedfire | deployedidle | undeploy | paradrop | cheer | panic | shovel | carry | fly | hover | firefly | tumble | airdeathstart | airdeathfalling | airdeathfinish | tread | swim | wetattack | wetidle1 | wetidle2 | wetdie1 | wetdie2)
DiscardOn.Sequences.Immediate=                     ; boolean, default to [General] -> DiscardOn.Sequences.Immediate

@DeathFishAtEase DeathFishAtEase self-assigned this Aug 2, 2026
@DeathFishAtEase DeathFishAtEase added the ⚙️T1 T1 maintainer review is sufficient label Aug 2, 2026
@phoboscn-bot

Copy link
Copy Markdown

To Chinese users:
This pull request has been mentioned on Phobos CN. There might be relevant details there:

致中文用户:
此拉取请求已在 Phobos CN 上被提及。那里可能有相关详细信息:

https://www.phoboscn.top/t/topic/690/1

@Coronia

Coronia commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

I'm not sure if using mission for discard condition is a good idea since it's very uncontrollable especially for AI, which might easily result in unwanted discarding

@DeathFishAtEase

Copy link
Copy Markdown
Collaborator Author

I'm not sure if using mission for discard condition is a good idea since it's very uncontrollable especially for AI, which might easily result in unwanted discarding

Is using two different lists for humans and AI sufficient to solve it?

@github-actions

github-actions Bot commented Aug 2, 2026

Copy link
Copy Markdown

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.

@TaranDahl

Copy link
Copy Markdown
Contributor

I'm not sure if using mission for discard condition is a good idea since it's very uncontrollable especially for AI, which might easily result in unwanted discarding

I think this is an issue with Mission or the AI system, not something on this end.

@Coronia

Coronia commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

maybe use AbovePercent and BelowPercent for health conditions like all the other places did.

@DeathFishAtEase

Copy link
Copy Markdown
Collaborator Author

maybe use AbovePercent and BelowPercent for health conditions like all the other places did.

They are currently used in the context of xxx.Affects- to constrain the affected range, but here they are handled differently, and I currently plan to use closed intervals in the discardon calculation, so there will also be differences in the algorithm as well.

@DeathFishAtEase DeathFishAtEase changed the title Add ammo, health, mission and landtype conditions to DiscardOn Add ammo, health, mission landtype and sequence conditions to DiscardOn Aug 2, 2026
@Coronia

Coronia commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

and I currently plan to use closed intervals in the discardon calculation

I think it would be better to make these health conditions follow the same standard. Besides, using close intervals can result in some issues (which I couldn't remember it clearly) that we had to change them all into open intervals for upper limit before

@DeathFishAtEase

Copy link
Copy Markdown
Collaborator Author

I will make adjustments later.

@DeathFishAtEase

Copy link
Copy Markdown
Collaborator Author

Tested by: https://www.phoboscn.top/t/topic/690/8?u=noble_fish

image

[AE1]
Duration=-1
DiscardOn=Ammo
DiscardOn.Ammo.MinimumAmount=1
DiscardOn.Ammo.MaximumAmount=1
Animation=MININUKE
ExpireWeapon=AEWeapon1
ExpireWeapon.TriggerOn=discard
ExpireWeapon.UseInvokerAsOwner=yes

[AEWeapon1]
Projectile=Invisible
Warhead=AE1WH

[AE1WH]
Verses=1%,1%,1%,0%,0%,0%,0%,0%,0%,0%,0%
Convert.From=E1
Convert.To=E2
Convert.AffectsHouse=all
AllowDamageOnSelf=yes
AffectsInvokerOnly=yes

[E1]
AttachEffect.AttachTypes=AE1
Ammo=3
Reload=99999

image

[AE1]
Duration=-1
DiscardOn=Health
DiscardOn.Health.BelowPercent=.5
DiscardOn.Health.AbovePercent=0
Animation=MININUKE
ExpireWeapon=AEWeapon1
ExpireWeapon.TriggerOn=discard
ExpireWeapon.UseInvokerAsOwner=yes

[AEWeapon1]
Projectile=Invisible
Warhead=AE1WH

[AE1WH]
Verses=1%,1%,1%,0%,0%,0%,0%,0%,0%,0%,0%
Convert.From=E1
Convert.To=E2
Convert.AffectsHouse=all
AllowDamageOnSelf=yes
AffectsInvokerOnly=yes

[E1]
AttachEffect.AttachTypes=AE1

image

[AE1]
Duration=-1
DiscardOn=Mission
DiscardOn.Missions=Enter
DiscardOn.AIMissions=Hunt
Animation=MININUKE
ExpireWeapon=AEWeapon1
ExpireWeapon.TriggerOn=discard
ExpireWeapon.UseInvokerAsOwner=yes

[AEWeapon1]
Projectile=Invisible
Warhead=AE1WH

[AE1WH]
Verses=0%,0%,0%,1%,1%,1%,0%,0%,0%,0%,0%
Convert.From=HTNK
Convert.To=APOC
Convert.AffectsHouse=all
AllowDamageOnSelf=yes
AffectsInvokerOnly=yes

[HTNK]
AttachEffect.AttachTypes=AE1

image

[AE1]
Duration=-1
DiscardOn=Landtype
DiscardOn.LandTypes=beach,water
Animation=MININUKE
ExpireWeapon=AEWeapon1
ExpireWeapon.TriggerOn=discard
ExpireWeapon.UseInvokerAsOwner=yes

[AEWeapon1]
Projectile=Invisible
Warhead=AE1WH

[AE1WH]
Verses=1%,1%,1%,0%,0%,0%,0%,0%,0%,0%,0%
Convert.From=GHOST
Convert.To=TANY
Convert.AffectsHouse=all
AllowDamageOnSelf=yes
AffectsInvokerOnly=yes

[GHOST]
AttachEffect.AttachTypes=AE1

image

[AE1]
Duration=-1
DiscardOn=Sequence
DiscardOn.Sequences=cheer
Animation=MININUKE
ExpireWeapon=AEWeapon1
ExpireWeapon.TriggerOn=discard
ExpireWeapon.UseInvokerAsOwner=yes

[AEWeapon1]
Projectile=Invisible
Warhead=AE1WH

[AE1WH]
Verses=1%,1%,1%,0%,0%,0%,0%,0%,0%,0%,0%
Convert.From=E1
Convert.To=E2
Convert.AffectsHouse=all
AllowDamageOnSelf=yes
AffectsInvokerOnly=yes

[E1]
AttachEffect.AttachTypes=AE1

image

[AE1]
Duration=-1
DiscardOn=Sequence
DiscardOn.Sequences=cheer
DiscardOn.Sequences.Immediate=no
Animation=MININUKE
ExpireWeapon=AEWeapon1
ExpireWeapon.TriggerOn=discard
ExpireWeapon.UseInvokerAsOwner=yes

[AEWeapon1]
Projectile=Invisible
Warhead=AE1WH

[AE1WH]
Verses=1%,1%,1%,0%,0%,0%,0%,0%,0%,0%,0%
Convert.From=E1
Convert.To=E2
Convert.AffectsHouse=all
AllowDamageOnSelf=yes
AffectsInvokerOnly=yes

[E1]
AttachEffect.AttachTypes=AE1

@DeathFishAtEase DeathFishAtEase added Tested Will be merged in 24h This PR will be merged in 24 hours if no one has further instructions. labels Aug 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

⚙️T1 T1 maintainer review is sufficient Tested Will be merged in 24h This PR will be merged in 24 hours if no one has further instructions.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants