Damage Types not working
mythguy1226 opened this issue ยท 17 comments
Hello, so on my server we have different forms of resistance against certain Damage Types such as fire, explosions, etc. However, when I try to change the Damage Type on my spells it gives them the full damage rather than negating some. We have tested the resistance and it works via other methods such as TNT or catching fire. But it keeps doing magic damage only for my spells no matter what damage type I set it to. Could this be an issue with my version of the plugin? Or is this a bug with the plugin overall?
Thanks, I'll give it a try and get back to you!
The truth is that not all damage types are spoofable and I'm not even sure offhand which are and which are not. Could be something else wrong, but it may work for some types and not others.
Alrighty, if it turns out that explosion damage just doesn't work then I can perhaps just try different types. Because the spell damage types I see not working are both fire and explosion which I use for fire and energy resistance.
solarblast:
icon: magma_cream
icon_disabled: firework_star
icon_url: http://textures.minecraft.net/texture/1adaf6e6e387bc18567671bb82e948488bbacff97763ee5985442814989f5d
category: dark
worth: 80
earns_sp: 6
upgrade_required_path: apprentice
upgrade_required_casts: 50
actions:
cast:
- class: CustomProjectile
actions:
- class: Damage
magic_damage: false
damage_type: explosion
damage: 45
- class: Ignite
effects:
cast:
- class: EffectSingle
sound: block.conduit.activate
sound_pitch: 2
sound_volume: 100
effectlib:
class: ConeEffect
iterations: 15
particle: redstone
color: ff8800
lengthGrow: 0.1
radiusGrow: 0.003
updateLocations: false
updateDirections: false
tick:
- particle: redstone
color: BA4E4E
location: target
- particle: redstone
color: ffff00
particle_count: 10
particle_offset_x: 0.2
particle_offset_y: 0.2
particle_offset_z: 0.2
location: target
hit:
- class: EffectSingle
location: target
color: ff4400
firework: star
- class: EffectSingle
location: target
requires_entity_target: true
effectlib:
class: SphereEffect
iterations: 2
particles: 3
particle: end_rod
hit_entity:
- location: target
source_location: body
effectlib:
class: Modified
duration: $duration
parameters:
radius: 1.5 * sin(t) + 0.5
effect:
class: SphereEffect
particle: block_crack
iterations: 2
material: ice
particles: 20
disappear_with_origin_entity: true
- location: target
source_location: body
effectlib:
class: SphereEffect
iterations: 4
particle: redstone
color: 00ff00
radius: 0.8
particles: 2
particle_count: 10
particle_offset_x: 0.2
particle_offset_y: 0.2
particle_offset_z: 0.2
disappear_with_origin_entity: true
costs:
mana: 50
parameters:
fov: 0.2
track_target: true
track_speed: 1
use_target_location: true
speed: 10
range: 35
target: other
cooldown: 6000
hitbox: true
So I tested this out, and I think this is due to the vanilla damage types not being defined by default in the damage_types
map. This has been fixed already in the latest dev build, but you can also fix it yourself by using
/mconfig editor config damage_types
and pasting in something like this:
Right now the default max reduction is 20% but I think I will change that to 100%. You can tweak it as you like.
I tested this by giving a mob your solarblast spell and (though it still one-shotted me) I did see the 20% reduction work via /mage debug 100
.
Let me know if you still have trouble!
Alrighty, so the command doesn't work for me however, I added the damage_types file to my config folder and then set the max reduction to 1.0. People who have 100% resistance to explosion types are still taking damage from the spell. Perhaps I need to update the plugin? The server is still on 1.14.4 as well. It may help to know the way I am using res is via my own code. When a person takes damage it looks at their permissions and based on their permissions I reduce the damage done by that certain type. I used an event listener for entity damage, I check the damage types and permissions and then calculate the final damage done to them.
Oh- haha ok yeah that's important, that's not gonna work ๐
Sorry, I thought you were using the builtin protection stuff.
If you can hook into Magic's API you can use Mage.getLastDamageType()
to get it, but if you're just looking at the DamageCause I don't think you'll ever see explosion as it's not spoofable.
Alrighty lmao, I'll use the API and make it check for that as well. Should it work if I use the API?
Hmm having some trouble getting the Mage aka the player doing the damage. Should I make a new issue for this? Or is it fine to be in this thread?
Nah that's fine, you could also join our Discord server if you want https://discord.gg/QHH2RSq but it's fine to continue here.
So first you get the MageController via MagicAPI.getController()
(The Magic plugin class implements MagicAPI)
Then if you have the player that got damaged, you can do controller.getMage(player);
to get the Mage.
From there you can use Mage.getLastDamageType()
to get the type of damage (should match whatever you specified in the Damage action). You can do Mage.getLastDamager()
to get the Entity that last damaged the player, but if you're in a damage event at the time it should match whatever the event says.
If you need the Mage for the damager as well, you can do controller.getMage(entity)
, but if you only want players make sure to check first. That method creates on demand, which could be a little wasteful if you call it for every entity that does damage to a player.
Hope that helps, let me know if not!
Yes, here it is: https://pastebin.com/5e9EBM5b
Here is the code snippet that gave me that error
After trying to debug this myself I've pinned it to both the getLastDamageType() and the getLastDamager() methods. I'm not sure if I'm using these wrong or if there's an issue with the API itself. Could it have something to do with my version of the plugin?