Scythe
Hit enemies to steal their defense and heal
← Back to main
Code Block:
api.giveItem(myId, "Gold Hoe", 1, {customDisplayName: "Scythe",customDescription: "Hit enemies to heal and steal their defense!", customAttributes: {weaponId: 1, "enchantmentTier":"Tier 5"}})
function check_item(item, item_name, custom_name, customId){
return (
item &&
item.name === item_name &&
item.attributes.customDisplayName === custom_name &&
item.attributes.customAttributes.weaponId === customId
);
}
function onPlayerDamagingOtherPlayerScythe(aId, eId, damage, item){
held = api.getHeldItem(aId)
if (check_item(held, "Gold Hoe", "Scythe",1) && !api.getEffects(aId).includes("Scythe Cooldown")) {
api.applyEffect(aId, "Health Regen", 8000, {inbuiltLevel: 2});
api.applyEffect(aId, "Damage Reduction", 8000, {inbuiltLevel: 2});
api.applyEffect(eId, "Weakness", 8000, {inbuiltLevel: 1});
api.applyEffect(aId, "Scythe Cooldown", 38000, {icon: "Red Wool"})
} else{
return
}
};
World Code:
// Handle attack logic
onPlayerDamagingOtherPlayer = (attackingPlayer, damagedPlayer, damageDealt, withItem, bodyPartHit, damagerDbId)=> {
onPlayerDamagingOtherPlayerScythe(attackingPlayer, damagedPlayer, damageDealt, withItem)
}