Skip to content

Status Effect refactoring for cleaner code #3261

Open
@SombraRO

Description

I was looking at some forum suggestions today and found something interesting

Hercules effects use SC_ to apply the effect and SI_ to apply the icon, but this is unnecessary

If SC_ follows the game client id, the icon is applied, and we could remove SI_

After reading the post a lot and doing some tests, you really don't need to use SI_

You can get the effect ID from https://github.com/llchrisll/ROenglishRE/blob/master/Additions/data/luafiles514/lua%20files/stateicon/efstids.lub

Effects like SC_STONE to SC_DEEP_SLEEP must be created in a separate enumeration, they are another type of effects, different from the status effect

In Aegis he uses

typedef enum <unnamed-tag> {  
      BODY_STONECURSE =  0x1,
      BODY_FREEZING =  0x2,
      BODY_STUN =  0x3,
      BODY_SLEEP =  0x4,
      BODY_UNDEAD =  0x5,
      HEALTH_POISON =  0x6,
      HEALTH_CURSE =  0x7,
      HEALTH_SILENCE =  0x8,
      HEALTH_CONFUSION =  0x9,
      HEALTH_BLIND =  0xa,
      HEALTH_HEAVYPOISON =  0xb,
      HEALTH_BLOODING =  0xc,
      EFFECT_ENDURE =  0xd,
      EFFECT_HASTE =  0xe,
      EFFECT_HASTEATTACK =  0xf,
      EFFECT_SLOW_POTION =  0x10,
      EFFECT_HASTE_POTION =  0x11,
      EFFECT_SANTA =  0x12,
      EFFECT_ANGELUS =  0x13,
      EFFECT_PUSHCART =  0x14,
      EFFECT_CONCENTRATE =  0x15,
      EFFECT_HIDE =  0x16,
      EFFECT_WEDDING =  0x17,
      EFFECT_PLUSATTACKPOWER =  0x18,
      EFFECT_PLUSMAGICPOWER =  0x19,
      EFFECT_CLAIRVOYANCE =  0x1a,
      EFFECT_HASTE_HORSE =  0x1b,
      EFFECT_SUMMER =  0x1c,
      HEALTH_FEAR =  0x1d,
      BODY_BURNNING =  0x1e,
      BODY_IMPRISON =  0x1f,
      HANDICAPSTATE_DEEPSLEEP =  0x20,
      HANDICAPSTATE_FROSTMISTY =  0x21,
      HANDICAPSTATE_COLD =  0x22,
      HANDICAPSTATE_NORECOVER =  0x23,
      EFFECT_HASTEATTACK_CASH =  0x24,
      HANDICAPSTATE_ICEEXPLO =  0x25,
      HANDICAPSTATE_ILLUSION =  0x26,
      EFFECT_HANBOK =  0x27,
      STATE_ENUM_END_MARK =  0x28,
} <unnamed-tag>;

With this change, adding custom effects will be easier, the SC_COMMON_MAX loop will not be impacted since the same effects are in a completely separate enum

This change will make the emulator cleaner and better to understand.

Original post link: https://board.herc.ws/topic/15848-effect-state-refactoring/

@dastgirp @Asheraf @4144 @skyleo

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