filler

Golem Axe

Every hit has a chance to mark enemies, marked enemies will take massive amounts of true damage on the next attack

← Back to main

Code Block:


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
  );
}
api.giveItem(myId, "Moonstone Axe", 1, {customDisplayName: "Golem Axe",customDescription: "Mark enemies and smite them", customAttributes: {weaponId: 1, "enchantmentTier":"Tier 5", enchantments: {"Damage":2}}})

function onPlayerDamagingOtherPlayerAxe(aId, eId, damage, item){
  held = api.getHeldItem(aId)
  if(check_item(held,"Moonstone Axe","Golem Axe",1)){
    k = Math.random()
    if(api.getEffects(eId).includes("Moonstruck")){
      api.removeEffect(eId, "Moonstruck")
      api.attemptApplyDamage({
        eId: aId, 
        hitEId: eId, 
        attemptedDmgAmt: 15,
        withItem: "Moonstone",
        isTrueDamage: true
      })
      api.updateEntityNodeMeshAttachment(eId, "HeadMesh", "BloxdBlock", {blockName: "Air",size: 0.7,meshOffset: [0, 0, 0]}, [0, 1, 0], [0, 0, 0]);
    }
    if(k<=0.15){
      api.applyEffect(eId, "Moonstruck", null, {icon: "Moonstone"})
      api.updateEntityNodeMeshAttachment(eId, "HeadMesh", "BloxdBlock", {blockName: "Golem Eye",size: 0.4,meshOffset: [0, 0, 0]}, [0, 1, 0], [0, 0, 0]);
      api.broadcastMessage(`${api.getEntityName(eId)} has been marked`)
    }
  }else{
    return
  }
}
      

World Code:




// Handle attack logic
onPlayerDamagingOtherPlayer = (attackingPlayer, damagedPlayer, damageDealt, withItem, bodyPartHit, damagerDbId)=> {
  onPlayerDamagingOtherPlayerAxe(attackingPlayer, damagedPlayer, damageDealt, withItem)
};