CleverRaven / Cataclysm-DDA

Cataclysm - Dark Days Ahead. A turn-based survival game set in a post-apocalyptic world.
http://cataclysmdda.org
Other
10.59k stars 4.17k forks source link

Create a new Monster attack pattern "Bad Tempered" #49236

Open Maleclypse opened 3 years ago

Maleclypse commented 3 years ago

Is your feature request related to a problem? Please describe.

I'd like for some animals to have a Bad Tempered pattern like when a domestic bull has gotten loose and is walking down the road. When your car tries to pass him going the same direction he'll try to shoulder check and gore your car most times as you get close to passing but if you drop speed he'll go back to ignoring you.

Describe the solution you'd like

I'd like to mimic this by having a pattern where some domesticated animals make it a little harder to successfully tame them. My idea is that they'd like have flags that raise aggression for things like "PC nearby" and then when aggression is high they charge the PC and strike, then move back like they do on Hit and Run but during the run section their anger level significantly drops. So if you've hurt the monster significantly it would be hit and run tactics til it or you die, but if it's got most of it's health it calms down.

Describe alternatives you've considered

A clear and concise description of any alternative solutions or features you've considered.

Additional context

Sections I believe I need to work in for this. Monster.cpp 2624

    //Monster will regen morale and aggression if it is on max HP
    //It regens more morale and aggression if is currently fleeing.
    if( type->regen_morale && hp >= type->hp ) {
        if( is_fleeing( player_character ) ) {
            morale = type->morale;
            anger = type->agro;
        }
        if( morale <= type->morale ) {
            morale += 1;
        }
        if( anger <= type->agro ) {
            anger += 1;
        }
        if( morale < 0 ) {
            morale += 5;
        }
        if( anger < 0 ) {
            anger += 5;
        }
    }

monster.cpp 1531 I'd probably want to mirror this flag then insert the mirrored flag in the above "if" chain to set the anger cooldown effect

    if( has_flag( MF_HIT_AND_RUN ) ) {
        add_effect( effect_run, 4_turns );
    }
Maleclypse commented 3 years ago

Here's what I think this might look like

          if( has_flag( MF_BAD_TEMPERED || MF_HIT_AND_RUN ) ) {
        add_effect( effect_run, 4_turns );
    }

And then it might look like the following

    //Monster will regen morale and aggression if it is on max HP
    //It regens more morale and aggression if is currently fleeing.
    if( type->regen_morale && hp >= type->hp ) {
        if( is_fleeing( player_character ) && has_flag MF_HIT_AND_RUN ) ) {
            morale = type->morale;
            anger = type->agro;
        }
        if( morale <= type->morale ) {
            morale += 1;
        }
        if( anger <= type->agro ) {
            anger += 1;
        }
        if( morale < 0 ) {
            morale += 5;
        }
        if( anger > 0 ) {
            anger -= 3;
        }
    }

I know the bottom is wrong but I'm trying to put together my notes.

actual-nh commented 3 years ago

One advantage of such a thing would be making the hit-and-run fleeing make more sense in terms of potential aggression during it - as in, instead of enforcing fleeing, enforce a drop in morale sufficient to cause flight.

More generally, a reverse version of STALK - decrease anger if over starting. (I've had thoughts regarding changing triggers from a list of flags into a list of flag, float pairs - the float being multiplied times the effect of the trait. In this case, "STALK", -1.) EDIT: BTW, @Venera3 - any thoughts?

Venera3 commented 3 years ago

How I could see it being hooked up easily is building a trigger into the melee attack function, like ATTACK - if the mob gets annoyed by a clamped trigger (like, say, HOSTILE_SEEN) even a relatively weak placate trigger would turn it Tracking again, but it wouldn't make a difference for a mob turned hostile by other triggers (HURT, to pick the least cheesable one). I think either all triggers should be clamped pretty aggressively, or the morale/aggression decay rate should be reduced because as it stands things just never chill.

E: adding more customization options would be amazing, as well.

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. Please do not \'bump\' or comment on this issue unless you are actively working on it. Stale issues, and stale issues that are closed are still considered.