Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

5.24 Damage Over Time Kills Don't Give XP #164

Open
aszecsei opened this issue Jun 6, 2021 · 0 comments
Open

5.24 Damage Over Time Kills Don't Give XP #164

aszecsei opened this issue Jun 6, 2021 · 0 comments

Comments

@aszecsei
Copy link

aszecsei commented Jun 6, 2021

Because damage effects created by a DOT status condition don't include a creator, if the player uses the effect to kill a monster they don't gain any XP from the kill.

I was able to fix it with a little bit of difficulty (all thanks to a bug in specs):

In components.rs:

#[derive(Component, Debug, ConvertSaveload, Clone)]
pub struct DamageOverTime {
    pub damage: i32,
    pub creator: EntityOption<Entity>,
}

This requires the entity-container workaround at amethyst/specs#681 (comment) to store an optional entity.

In rawmaster.rs:

"damage_over_time" => $eb = $eb.with(DamageOverTime {
    damage: effect.1.parse::<i32>().unwrap(),
    creator: None.into(),
}),

Then, in effects/damage.rs, pass along the effect creator (converting to an EntityOption):

.with(DamageOverTime { damage: *damage, creator: effect.creator.into() })

And finally, in ai/initiative_system.rs, pass the status effect creator back into the effect system:

add_effect(
    dot.creator.into(),
    EffectType::Damage { amount: dot.damage },
    Targets::Single {
        target: status.target,
    },
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant