Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/moderocky/witchcraft-api


https://github.com/moderocky/witchcraft-api

Last synced: 27 days ago
JSON representation

Awesome Lists containing this project

README

        

# Witchcraft

This is the public-facing API for Witchcraft.

It interfaces with the online data sheet [here](https://docs.google.com/spreadsheets/d/13giaJ7dw3rpyvdsM_AFrPaSTcWtxmtU5XL4zBnH0p9U/edit?usp=sharing).

You cannot build this into a plugin or use it as a standalone resource - it is designed to be implemented by an internal server layer.

## Contributing
You are welcome to contribute to this via pull-request.

## Adding a Spell

Select a spell from the [Spells tab](https://docs.google.com/spreadsheets/d/13giaJ7dw3rpyvdsM_AFrPaSTcWtxmtU5XL4zBnH0p9U/edit?usp=sharing#gid=0).
One that is not ticked 'done'.

Create a new class for the spell in `mx.kenzie.witchcraft.spell.single` extending `StandardSpell` \
or an existing spell, if your spell is an extension of another (e.g. `Teleportation Circle` -> `Teleport`)

Inside this class you have:
### canCast `boolean canCast(LivingEntity caster)`
This method verifies whether the caster is actually able to do the spell.

This method should check:
- If the spell is physically possible (e.g. for a teleport, can the caster actually teleport)
- If the spell is applicable for the caster (e.g. we don't open a GUI for a zombie caster)

This method should not check:
- If the caster has spell ingredients; this is done already
- If the caster has energy

If this method returns true the spell is **guaranteed** to be cast directly after.

### run `void run(LivingEntity caster, int range, float scale, double amplitude)`
This method runs the actual spell effects (after cast is verified.)

The `range` is the maximum range of the caster from their magic item.

The `scale` is how large they drew the pattern. This can be used to magnify the size of the spell's result where applicable.

The `amplitude` is the caster's magical power. This is typically used for increasing spell damage.

Note: the caster may not be a player. The caster may not be a Bukkit entity.

Please use the `Client` interface for visual effects. (These are all thread-safe!)
Please use the `Minecraft` interface for damaging/world effects. (These are possibly thread-safe!)