Project MMO

Project MMO

10M Downloads

Feature Request: Damage Mitigated Event to grant xp / trigger perks

Silvertide7 opened this issue · 7 comments

commented

Describe the solution you'd like
An event that is fired when a player takes damage, and instead of being based on the damage taken like current damage taken events are, it would look at the damage mitigated. This would allow modpack makers to grant xp for mitigating damage, or possibly trigger perks based on damage mitigation.

Why is this feature needed
This gives modpack makers a cool avenue of creating a tank class. By tying the amount of xp gained in a skill to the amount of damage mitigated, it would make it so players who wear high armor and mitigate a lot of damage would level a certain skill, say defense, based on that mitigated damage and faster than other players who don't do that. In heavily modded minecraft there are usually quite a few armor sets for doing different things, and players who choose to take lower defense but more utility based armor sets wouldn't gain as much xp as the ones who decide to go full sword and board tank.

Also, if perks make sense to you, there could be a perk with a threshold. So if you mitigate the amount of damage specified in the threshold in a single hit, which would imply either you have very high armor or you took a huge hit, it would trigger the perk. Maybe regeneration, or resistance for 10 seconds, etc.

Describe alternatives you've considered
Just give defense skill xp when you take damage or block with a shield, which is what we're currently doing. This doesn't differentiate tank style players from others as much as scaling the xp off of damage mitigated would though.

commented

Awesome sounds good, thank you! 🤞

commented

It would also be cool if we could do a section in the server like

[XP_Gains.Event_XP_Specifics.Damage.MITIGATE_DAMAGE]
         [XP_Gains.Event_XP_Specifics.Damage.MITIGATE_DAMAGE."#pmmo:magic"]
             arcana = 5

If that's too much headache no problem though

commented

🤔 hmm. you point out that mitigate damage event would mirror damage events, but that means i'll probably want to refactor the damage XP again to use a map. eg

"xp_values": {
  "DEATH":{"example":10},
  "INTERACT":{"example":10}
},
"damage_xp":{
  "DEAL_DAMAGE":{"example":10},
  "RECEIVE_DAMAGE":{"example":10},
  "MITIGATE_DAMAGE":{"example":10}
}

instead of the "dealt_damage xp" and "receive_damage_xp" that i currently have.

commented

I like the idea. Especially since with really good armor it's possible to take no damage and get no endurance for it. I'll have to see how to make this work though. There are two events for damage, one that modifies the damage and one that controls the initial act of damage. the latter happens before reduction from things like armor. The trick would be getting that original damage source to the modifying event in a clean way so that the mitigation is known by the event that would award the XP. I'll do some digging and see if I can come up with a clean way to do it.

commented

Yeah I was kind of imagining it the exact same as the damage received events, just the other side of them, the damage that is mitigated instead of the damage received. That way you have access to all of the damage in an attack and you can reward different parts of it. What you have there makes sense to me though!

The only major thing is that I can specify damage types in the events so that received or mitigated magic damage can add xp to arcana or magic defense, and regular damage can add xp to physical defense or constitution etc. Being able to specify by damage type is really nice. I'm not sure if changing that back to a map would mess with that or add dev work because it might need to be something like:

"xp_values": {
  "DEATH":{"example":10},
  "INTERACT":{"example":10}
},
"damage_xp":{
  "MITIGATE_DAMAGE": {
         "minecraft:magic": { 
                "defense_magic": 10 
          },
          "minecraft:player_attack": { 
                "defense_physical": 10 
          }
}
}
commented

oh right. yes, I would keep the damage types portion. I just didn't write that in my example.

"damage_xp": {
  "DEAL_DAMAGE": {
    "minecraft:player_attack": {"combat":100}
  },
  "RECIEVE_DAMAGE":{
    "minecraft:mob_attack": {"endurance":10}
  },
  "MITIGATE_DAMAGE": {
    "minecraft:mob_attack": {"git_gud_mobs": 1337}
  }
}
commented

okay, so this isn't possible without recreating certain vanilla logic. However, I am planning on making a PR to NF that would let me hook into the stats award code which does track mitigated damage. This means this will only happen on 1.20.5+ because I need to make the PR and have it merged.