function init(hero) {
    hero.setName("Scarlet Witch/Wanda Maximoff");
    hero.setTier(8);
    
    hero.setHelmet("Crown");
    hero.setChestplate("item.superhero_armor.piece.chestpiece");
    hero.setLeggings("item.superhero_armor.piece.pants");
    hero.setBoots("item.superhero_armor.piece.boots");

    hero.addPowers("jmctheroes:chaos_magic");
    hero.addAttribute("FALL_RESISTANCE", 1.0, 1);
    hero.addAttribute("JUMP_HEIGHT", 0.75, 0);
    hero.addAttribute("PUNCH_DAMAGE", 3.8, 0);
    hero.addAttribute("SPRINT_SPEED", 0.15, 1);

    hero.addKeyBind("AIM", "Chaos Energy Blast", 1);
    hero.addKeyBind("SHADOWDOME", "Create Hex", 2);
    hero.addKeyBind("TELEKINESIS", "Telekinesis", 3);
    hero.addKeyBind("CHARGE_ENERGY", "Chaos Energy Charge", 4);

    hero.addKeyBind("SPELL_MENU", "Darkhold Spells", 1);
    hero.addKeyBind("TELEPORT", "Teleport", 2);
    hero.addKeyBind("SHIELD", "Forcefield", 3);
    hero.addKeyBind("CHARGED_BEAM", "Chaos Magic Beam", 4);

    hero.addKeyBind("HOVER", "key.hover", 4);
    hero.addKeyBind("CHAOS", "The Darkhold", 5);

    hero.setModifierEnabled(isModifierEnabled);
    hero.setKeyBindEnabled(isKeyBindEnabled);
    hero.supplyFunction("canAim", canAim);
}

function isModifierEnabled(entity, modifier) {
    if (modifier.name() == "jmctheroes:dyn/chaos") {
        return !entity.isOnGround();
    }
    else if (modifier.name() == "fiskheroes:telekinesis") {
        return !entity.getData("jmctheroes:dyn/chaos");
    }
    else if (modifier.name() == "fiskheroes:teleportation") {
        return entity.getData("jmctheroes:dyn/chaos");
    }
    else if (modifier.name() == "fiskheroes:shield") {
        return entity.getData("jmctheroes:dyn/chaos");
    }
    return true;
}

function isKeyBindEnabled(entity, keyBind) {
    var height = entity.posY();
    switch (keyBind) {
    case "AIM":
        return !entity.getData("jmctheroes:dyn/chaos");
    case "SHADOWDOME":
        return !entity.getData("jmctheroes:dyn/chaos");
    case "TELEKINESIS":
        return !entity.getData("jmctheroes:dyn/chaos");
    case "CHARGE_ENERGY":
        return !entity.getData("jmctheroes:dyn/chaos") && !entity.isSneaking();
    case "SPELL_MENU":
        return entity.getData("jmctheroes:dyn/chaos") && !entity.isOnGround();
    case "TELEPORT":
        return entity.getData("jmctheroes:dyn/chaos") && !entity.isOnGround();
    case "SHIELD":
        return entity.getData("jmctheroes:dyn/chaos") && !entity.isOnGround();
    case "CHARGED_BEAM":
        return entity.getData("jmctheroes:dyn/chaos") && !entity.isOnGround() && !entity.isSneaking();
    case "CHAOS":
        return !entity.isOnGround();
    case "HOVER":
        return entity.isSneaking();
    default:
        return true;
    }
}

function canAim(entity) {
    return entity.getHeldItem().isEmpty() && !entity.getData("jmctheroes:dyn/chaos");
}