function init(hero) {
    hero.setName("Star");
    hero.setTier(8);
    
	
    hero.setChestplate("item.superhero_armor.piece.chestpiece");
    hero.setLeggings("item.superhero_armor.piece.pants");
    hero.setBoots("item.superhero_armor.piece.boots");
    
    hero.addPowers("pack:star_power");
	
	hero.addAttribute("BASE_SPEED_LEVELS", 2.0, 0);
	hero.addAttribute("KNOCKBACK", 2.0, 0);
    hero.addAttribute("PUNCH_DAMAGE", 9.0, 0);
	hero.addAttribute("JUMP_HEIGHT", 1.5, 0);
	hero.addAttribute("SPRINT_SPEED", 0.70, 1);
	hero.addAttribute("FALL_RESISTANCE", 140.0, 0);
	
    
    
    hero.addKeyBind("ENERGY_PROJECTION", "Energy Blast", 1);
    hero.addKeyBind("AIM", "Energy Blast", 1);
	hero.addKeyBind("GROUND_SMASH", "key.groundSmash", 1);
	
	hero.addKeyBind("SHIELD", "Protect", 2);
	hero.addKeyBind("CHARGED_PUNCH", "Power Punch", 2);
	hero.addKeyBind("POWER", "Star Power", 3);

	hero.addKeyBind("SLOW_MOTION", "Slow-Motion", 4);

    hero.setHasProperty(hasProperty);
	
	hero.setAttributeProfile(getProfile);
		hero.addAttributeProfile("POWER", powerProfile);
		hero.addAttributeProfile("PUNCH_1", punch1Profile);
		hero.addAttributeProfile("PUNCH_2", punch2Profile);
		
	hero.setDamageProfile(getProfile);
		hero.addDamageProfile("POWER", {
			"types": {
				"BLUNT": 1.0,
				"ENERGY": 1.0
			},
			"properties": {
				"HEAT_TRANSFER": 2
			}
		});
		hero.addDamageProfile("PUNCH_1", {
			"types": {
				"BLUNT": 1.0,
				"ENERGY": 1.0
			},
			"properties": {
				"HEAT_TRANSFER": 2
			}
		});
		hero.addDamageProfile("PUNCH_2", {
			"types": {
				"BLUNT": 1.0,
				"ENERGY": 1.5
			},
			"properties": {
				"HEAT_TRANSFER": 10
			}
		});
	
    hero.setModifierEnabled(isModifierEnabled);
    hero.setTierOverride(getTierOverride);
	hero.setKeyBindEnabled(isKeyBindEnabled);
    hero.supplyFunction("canAim", canAim);
}



function getTierOverride(entity) {
    return !entity.getData("pack:dyn/powered") ? 6 : 8;
}

function powerProfile(profile) {
	profile.inheritDefaults();
	profile.addAttribute("KNOCKBACK", 3.0, 0);
    profile.addAttribute("JUMP_HEIGHT", 2.5, 0);
    profile.addAttribute("PUNCH_DAMAGE", 12.5, 0);
    profile.addAttribute("SPRINT_SPEED", 0.75, 1);

}

function punch1Profile(profile) {
    profile.inheritDefaults();
    profile.addAttribute("PUNCH_DAMAGE", 12.5, 0);
    profile.addAttribute("KNOCKBACK", 5.0, 0);
}

function punch2Profile(profile) {
    profile.inheritDefaults();
    profile.addAttribute("PUNCH_DAMAGE", 15.5, 0);
    profile.addAttribute("KNOCKBACK", 7.5, 0);
}

function getProfile(entity) {
    if (entity.getData("pack:dyn/powered") && !entity.getData("fiskheroes:punch_charged")) {
        return "POWER"; 
    }
	if (entity.getData("fiskheroes:punch_charged") && !entity.getData("pack:dyn/powered")) {
        return "PUNCH_1"; 
    }
    if (entity.getData("fiskheroes:punch_charged") && entity.getData("pack:dyn/powered")) {
        return "PUNCH_2"; 
    }
    return null;
	}


function isKeyBindEnabled(entity, keyBind) {
    switch (keyBind) {
	case "ENERGY_PROJECTION":
        return entity.getData("fiskheroes:aimed_timer") == 1 && !entity.getData("fiskheroes:punch_charged") && entity.getData("pack:dyn/powered");
	case "AIM":
        return !entity.getData("fiskheroes:punch_charged") ;
	case "GROUND_SMASH":
        return entity.getData("fiskheroes:punch_charged") ;
	case "SLOW_MOTION":
        return entity.getData("pack:dyn/powered") ;
	case "SHIELD":
        return (entity.getData("fiskheroes:punchmode_timer") == 0 && entity.getData("pack:dyn/powered"));
    case "CHARGED_PUNCH":
        return (entity.getData("fiskheroes:shield_timer") > 0 || entity.getData("fiskheroes:punchmode_timer") > 0 && entity.getData("pack:dyn/powered")) || (!entity.getData("pack:dyn/powered"));
    default:
        return true
    }
}

function isModifierEnabled(entity, modifier) {
	if (modifier.name() == "fiskheroes:cooldown" && (modifier.id() !="shooting_cooldown") ) {
        var day = entity.world().isDaytime();
		var night = !entity.world().isDaytime();
		var moon = entity.world().getDimension() == 4;
        return (modifier.id() == "day" ? day : !day) && (modifier.id() == "moon" ? moon : !moon);
    }

	switch (modifier.name()) {
	case "fiskheroes:charged_punch":
        return !entity.getData("fiskheroes:aiming") && !(entity.getData("fiskheroes:shield") && entity.getData("fiskheroes:punchmode")) && !entity.getData("fiskheroes:gliding");
    case "fiskheroes:shield":
        return !entity.getData("fiskheroes:aiming") && !(entity.getData("fiskheroes:shield") && entity.getData("fiskheroes:punchmode")) && entity.getData("pack:dyn/powered") && !entity.getData("fiskheroes:gliding");

	case "fiskheroes:gliding":
        return entity.getData("pack:dyn/powered");
    case "fiskheroes:energy_blast":
        return !entity.getData("pack:dyn/powered") && entity.getData("fiskheroes:aimed_timer") >= 1;
	case "fiskheroes:slow_motion":
        return entity.getData("pack:dyn/powered");
	case "fiskheroes:healing_factor":
        return entity.getData("pack:dyn/powered");
	case "fiskheroes:leaping":
        return modifier.id() == "springboard" == (entity.getData("fiskheroes:ticks_since_gliding") < 7);
	case "fiskheroes:ground_smash":
        return modifier.id() == "punch_power" == (entity.getData("pack:dyn/powered"));
    default:
        return true;
    }
	
}

function canAim(entity) {
    return entity.getHeldItem().isEmpty() && !entity.getData("fiskheroes:glide_flying") && entity.getData("pack:dyn/cooldown_1") !=1;
}

function hasProperty(entity, property) {
    return property == "BREATHE_SPACE";
}