elBukkit / MagicPlugin

A Bukkit plugin for spells, wands and other magic
http://mine.elmakers.com
MIT License
239 stars 148 forks source link

Critical Strike on Damage Action? #821

Closed afoxxvi closed 3 years ago

afoxxvi commented 3 years ago

Here is a feature request. I believe adding a critical chance and the damage multiplier when a critical strike is done will make DamageAction more useful. For example damage: 40 critical_chance: 20 critical_damage: 50 A DamageAction will cause 50% more damage with 20% probability.

NathanWolf commented 3 years ago

You can add this yourself with a Probability action and an additional Damage action. It is also what the “critical” passive does.

afoxxvi commented 3 years ago

You can add this yourself with a Probability action and an additional Damage action. It is also what the “critical” passive does.

Thank you very much, but it seems that a mob isn't damagable if it was damaged in 10 ticks. So may I use ChangeParameters action? However I don't know and the reference guide website doesn't tell me how to use it.

damage: 2*$damage Will this line work? or in other ways?

NathanWolf commented 3 years ago

Thank you very much, but it seems that a mob isn't damagable if it was damaged in 10 ticks.

I'm not sure what this means - are you trying to make your own spell with a critical chance? If so can you share your spell config?

afoxxvi commented 3 years ago

I'm not making any new spells, in Minecraft, if a mob is damaged, it can't be damaged in the following 10 ticks. So if I add an additional Damage action, the second damage may not work, and my test proved this. I solved this problem with the following config, but it looks too complex because as this spell upgraded to level 2, the whole config should be copied instead of simply changing some parameters, and I used "stop_on_success", this may make some new troubles in other more complex spells.

test3:
actions:

cast:  
- class: Probability
  actions:
  - class: Damage
    damage: 4
  stop_on_success: true
- class: Damage

parameters:

probability: 0.5
damage: 2
range: 10
target: other

I want to change "damage: 4" to "damage: 2 * $damage" to do doubled damage, but failed. I noticed there was an action named ChangeParameters, but I still can't find how to use it, and this action's class is likely deprecated. Would you like to add a new action to replace it or simply remove it?

test2: actions:

cast:
- class: Probability
  actions:
  - class: ChangeParameters
    damage: 4
- class: Damage

parameters:

probability: 0.5
damage: 2
range: 10
target: other

The config above is invalid.

NathanWolf commented 3 years ago

in Minecraft, if a mob is damaged, it can't be damaged in the following 10 ticks.

I was not aware of that... if true that means the Critical passive is completely useless. Is there a Spigot/Paper setting to disable that feature?

At any rate, if a critical probability on Damage would help you I can add that.

You could do what you're trying to do with variables, but it'd still be more complex than is probably worthwhile.

afoxxvi commented 3 years ago

About your question: https://minecraft.gamepedia.com/Damage#Immunity Maybe my description has something incorrect, sorry for this. So my request is two new parameters on Damage action: critical probability and critical strike damage, I would appreciate it if you could help to do this.

Finally, no matter if you will add this, thanks a lot for your reply, have a good day :)

NathanWolf commented 3 years ago

Thanks for the link!

The next dev build will have two new parameters for the Damage action, critical_probability and critical_damage_multiplier

NathanWolf commented 3 years ago

If an entity is in the immunity period and then receives higher damage (before accounting for armor, enchantments, or status effects), the difference between the original and new damage amounts is dealt. For example, if a mob is attacked with a weapon dealing 7♥♥♥♥ damage and then attacked with another weapon dealing 12♥ × 6 damage during the immunity period, the second hit deals 5♥♥♥ damage (resulting in 12♥ × 6 total). This does not reset the immunity period.

Interesting- I guess I could tweak the Critical passive to make it work.. it currently does this

1 + damage_dealt * 0.5

But I think if I did

damage_dealt * 1.5 It would work as a +50% damage buff

afoxxvi commented 3 years ago

Yeah, an interesting feature, ready to discover more amazing things in this plugin!

afoxxvi commented 3 years ago

Glad to see this feature finished, Thank you:) And with my test, parameter damage_type may have something wrong but it doesn't matter. I have made a plugin to detect damage event and here is my result (Server version: Paper 1.12.2): https://pastebin.com/Yejc2mA3 I would like to help if you want some messages to be translated into Chinese, and I wonder if you can leave me a way to contact you such as e-mail or so-on. (Not Discord please, it's blocked in China.)