BowSpell - TheComputerGeek2/MagicSpells GitHub Wiki

Source Code

This spell extends its options from Spell.

spell-class: ".BowSpell"

Spell Effect Positions:

  • projectile - Plays the effect at the projectile's location.
  • casterprojectile - Plays the effect from the caster towards the projectile's location.

Description:

A spell that fires when a player shoots a bow or crossbow. Options exist for casting a spell on shooting, hitting an entity or hitting a block.

Configuration:

Since 4.0 Beta 13 some of these options support dynamic values through numeric or string expressions.

Option Description Type Default Supports expressions
bow-names When defined, only bows with names contained in this list can trigger the bow spell. String List of Formatted Text false
bow-name When defined, only bows with names that match this value exactly can trigger the bow spell. Formatted Text false
disallowed-bow-names When defined, any bows with names contained in this list cannot trigger the bow spell. String List of Formatted Text false
can-trigger Target list "players" false
bow-items When defined, only bows that match one of the listed items (using the Magic Item String format) can trigger the spell. String List false
ammo-items When defined, only ammo (items used to fire a projectile) that match one of the listed magic items can trigger the spell. String List false
disallowed-bow-items When defined, only bows that do not match one of the list items (using the Magic Item String format) can trigger the spell. This option takes precedence over the option bow-items. String List false
disallowed-ammo-items When defined, only ammo (items used to fire a projectile) that do not match one of the list magic items can trigger the spell. This option takes precedence over the option ammo-items. String List false
spell Sub-spell casted when the bow is initially shot. String false
spell-on-hit-entity Sub-spell cast when the arrow associated with the bow spell hits an entity. String false
spell-on-hit-ground Sub-spell cast when the arrow associated with the bow spell hits a block. String false
spell-on-hit-entity-location Sub-spell cast when the arrow associated with the bow spell hits an entity, firing at the location the arrow hits the entity. For example, if the arrow hits the head of a zombie, the spell provided will be cast at the zombie's head. Must be a targeted spell that can hit the ground. String false
bindable Whether the bow spell can be bound to an item. Boolean false false
require-bind Requires bow spell to be bound to be cast. Boolean false false
cancel-shot Cancels the bow's arrow shot if the bow spell successfully casts. Boolean true true
deny-offhand If true, the bow spell will not be cast if the arrow is being shot from a bow in the offhand. Boolean false true
remove-arrow Removes the arrow associated with a bow spell after casting spells from hitting the ground or an entity. Boolean false true
use-bow-force Uses the bow's force when shot as the power for the spells being cast. 0 force translates to 0 power; 1 force translates to 1 power. Spells by default have 1 power. Boolean true true
cancel-shot-on-fail When true, if the bow spell fails to cast, the bow's arrow shot is cancelled. Boolean true true
minimum-force Minimum force (how far the bow is pulled back) for the bow spell to trigger. Ranges from 0 to 1 Boolean 0 true
maximum-force Maximum force (how far the bow is pulled back) for the bow spell to trigger. Ranges from 0 to 1 Boolean 1 true

Examples:

frost-shot:
    spell-class: ".BowSpell"
    bindable: true
    cancel-shot: false
    require-bind: true
    remove-arrow: true
    cancel-shot-on-fail: false
    spell-on-hit-entity: frost-shot-slow(mode=full)
    effects:
        trail:
            position: projectile
            effect: effectlibentity
            effectlib:
                class: ParticleEffect
                particle: snowball
                particle_count: 2
                iterations: 50
                period: 2

frost-shot-slow:
    spell-class: ".targeted.PotionEffectSpell"
    helper-spell: true
    type: slowness
    strength: 5
    duration: 100
    targeted: true
    str-cast-self: "Your shot has frozen your enemy!"
bow:
    spell-class: ".BowSpell"
    bow-names:
        - "Bow Of Volley"
        - "Bow Of Volley2"
    cooldown: 1
    cancel-shot: false
    use-bow-force: true
    cancel-shot-on-fail: false
    str-modifier-failed: "Modifiers failed!"
    minimum-force: 0.5
    spell: EFF_ARROW
    spell-on-hit-ground: ARROW_GROUND
    spell-on-hit-entity: ARROW_ENTITY
    modifiers:
        - sneaking required
    target-modifiers:
        - entitytype pig required
    location-modifiers:
        - inblock grass_block required

EFF_ARROW:
    spell-class: ".instant.DummySpell"
    effects:
        eff1:
            position: caster
            effect: effectlib
            effectlib:
                class: SphereEffect
                particle: REDSTONE
                particleSize: 0.8
                color: ffff00
                iterations: 20
                period: 3
                radius: 1.25
                particles: 40
                visibleRange: 60

ARROW_ENTITY:
    spell-class: ".targeted.DummySpell"
    effects:
        eff1:
            position: target
            effect: effectlibentity
            effectlib:
                class: SphereEffect
                particle: REDSTONE
                particleSize: 0.8
                color: 00ff00
                iterations: 20
                period: 3
                radius: 1.25
                particles: 40
                visibleRange: 60

ARROW_GROUND:
    spell-class: ".targeted.DummySpell"
    effects:
        eff1:
            position: target
            effect: effectlib
            effectlib:
                class: SphereEffect
                particle: REDSTONE
                particleSize: 0.8
                color: 00ffff
                iterations: 20
                period: 3
                radius: 1.25
                particles: 40
                visibleRange: 60