Jump to content

Thoughts / Opinions On Attack Flag Chagne


Guest SWGuard

Recommended Posts

Greetings,

I noticed today that the flag UNIT_STAT_ATTACKING has been changed to UNIT_STAT_MELEE_ATTACKING

and the function Unit::Attack() has been changed from:

Unit::Attack(*victim, bool playerMeleeAttack)

to

Unit::Attack(Unit *victim, bool meleeAttack)

The problem with this is pets that are caster pets should not get a UNIT_STAT_MELEE_ATTACKING flag

but the Attack() function no longer sets UNIT_STAT_ATTACKING for casters which the old one did.

The new PetAI calls Attack() with a "true" value for bool meleeAttack but again, this is incorrect for

caster pets (I'll be changing this with the PetAI updates).

I think Unit::Attack() would be better handled by using an enum for the function parameter to indicate melee attacks

or ranged attacks and then set either a melee attack flag or ranged attack flag...

Something like this:

enum AttackTypes
{
   ATT_MELEE = 0,
   ATT_RANGED = 1
};

Unit::Attack( Unit* victim, AttackTypes attackType)
{
    // normal code here

    if (attackType == ATT_MELEE )
        addUnitState(UNIT_STAT_MELEE_ATTACKING);

    if( attackType == ATT_RANGED )
        addUnitState(UNIT_STAT_RANGED_ATTACKING);

    // normal code here
}

The fix for pets reaching far targets may not work without this since caster pets shouldn't have a MELEE_ATTACKING

flag. I haven't tested it yet, just brainstorming.

Thoughts?

Link to comment
Share on other sites

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use