Magic

Magic

190k Downloads

Increase magic power (API)

Blamo27 opened this issue ยท 9 comments

commented

Hello,

I would like to know how to increase the power (spell damage) of a wand with the MagicAPI
Do I have to configure the wand ? Or can I change the damage with an event ?

boolean com.elmakers.mine.bukkit.api.wand.Wand.configure (Map< String, Object > properties)

Thanks.

commented

The only way to do that with wand properties is to use configure and to set "power".

You could then modify the power-related config properties here:

https://github.com/elBukkit/MagicPlugin/blob/master/Magic/src/main/resources/defaults/config/defaults.yml#L469

To make it so Power only affects damage. By default it will also increase the radius and range of spells.

Otherwise yes another approach is to catch the damage event but there isn't a reliable way to know that the damage was from a spell. You can look for the MAGIC damage source, but it doesn't apply in a few random cases (witches, endermen) due to them being nearly immune to magic damage.

Hm- well this is a bit ugly but you could also look here:

https://github.com/elBukkit/MagicPlugin/blob/master/Magic/src/main/java/com/elmakers/mine/bukkit/utility/CompatibilityUtils.java#L82

CompatibilityUtils.isDamaging is set anytime Magic is dealing damage to something, and should be set during handling of the damage events.

If you do end up using that let me know and I'll add it to the API properly somewhere, probably on MageController.

commented

Okay so I will configure the wand

But I didn't understand this :

Map< String, Object > properties

What kind of Map should I put in argument ?

commented

Put "power", 1 in there for full power. Power is a floating point ranging from 0 to 1.

commented

Oh, thanks :) !

commented

And how to get all wands of a player ?

commented

They are just items, so you'd have to search their inventory and check every item. If they are holding one you can get that one with Mage.getActiveWand

commented

Yes but I wanted to know if there is another way (no loop)
It's not a problem

And also, how can I modify the lore on the wand describing the augmentation of spell damage so it displays a percentage instead of roman numbers ? To be clear, I want the wand to display something like "Spell Damage : +X%" instead of "Power III" or "Power VI".

commented

Unfortunately no, the only options are show the raw value or roman numeral. I think percentage is a good idea though.

commented

Okey, so thanks for your help !