package com.elmakers.mine.bukkit.action.builtin;

import org.bukkit.entity.Damageable;
import org.bukkit.entity.Entity;

import com.elmakers.mine.bukkit.action.BaseSpellAction;
import com.elmakers.mine.bukkit.api.action.CastContext;
import com.elmakers.mine.bukkit.api.spell.SpellResult;

public class KillAction extends BaseSpellAction
{
    @Override
    public SpellResult perform(CastContext context)
    {
        Entity entity = context.getTargetEntity();
        if (!(entity instanceof Damageable))
        {
            return SpellResult.NO_TARGET;
        }

        Damageable targetEntity = (Damageable)entity;
        if (targetEntity.isDead()) {
            return SpellResult.NO_TARGET;
        }
        // Overkill to bypass protection
        context.registerModified(targetEntity);
        targetEntity.damage(targetEntity.getMaxHealth() * 100);
        return SpellResult.CAST;
    }

    @Override
    public boolean isUndoable()
    {
        return true;
    }

    @Override
    public boolean requiresTargetEntity()
    {
        return true;
    }
}

@@ -43,16 +43,125 @@
 iltin;%0A%0A
+import java.util.Arrays;%0Aimport java.util.Collection;%0A%0Aimport org.bukkit.configuration.ConfigurationSection;%0A
 import o
@@ -335,16 +335,65 @@
 ontext;%0A
+import com.elmakers.mine.bukkit.api.spell.Spell;%0A
 import c
@@ -443,58 +443,414 @@
 lt;%0A
-%0Apublic class KillAction extends BaseSpellAction%0A%7B
+import com.elmakers.mine.bukkit.spell.BaseSpell;%0Aimport com.elmakers.mine.bukkit.utility.CompatibilityUtils;%0A%0Apublic class KillAction extends BaseSpellAction%0A%7B%0A    private boolean magicDamage;%0A%0A    @Override%0A    public void prepare(CastContext context, ConfigurationSection parameters) %7B%0A        super.prepare(context, parameters);%0A        magicDamage = parameters.getBoolean(%22magic_damage%22, false);%0A    %7D%0A
 %0A   
@@ -1013,24 +1013,16 @@
 geable))
-%0A       
  %7B%0A     
@@ -1301,16 +1301,178 @@
 ntity);%0A
+        if (magicDamage) %7B%0A            CompatibilityUtils.magicDamage(targetEntity, targetEntity.getMaxHealth() * 100, context.getEntity());%0A        %7D else %7B%0A    
         
@@ -1527,16 +1527,26 @@
 * 100);%0A
+        %7D%0A
         
@@ -1745,11 +1745,548 @@
 e;%0A    %7D
+%0A%0A    @Override%0A    public void getParameterNames(Spell spell, Collection%3CString%3E parameters) %7B%0A        super.getParameterNames(spell, parameters);%0A        parameters.add(%22magic_damage%22);%0A    %7D%0A%0A    @Override%0A    public void getParameterOptions(Spell spell, String parameterKey, Collection%3CString%3E examples) %7B%0A        if (parameterKey.equals(%22magic_damage%22)) %7B%0A            examples.addAll(Arrays.asList((BaseSpell.EXAMPLE_BOOLEANS)));%0A        %7D else %7B%0A            super.getParameterOptions(spell, parameterKey, examples);%0A        %7D%0A    %7D
 %0A%7D%0A

Add magic_damage parameter to Kill action