{
 "format_version": "1.16.100",
 "minecraft:item": {
	"description": {
		"identifier": "pixel:iron_glaive",
        "category":"Equipment"
	},
	"components": {
      "minecraft:creative_category": {
        "parent": "itemGroup.name.sword"
      },
	  "minecraft:icon": {
		"texture": "iron_glaive"
	  },
	  "tag:damage:iron":{},
	  "tag:minecraft:longrange":{},
      "tag:minecraft:is_glaive":{},
      "minecraft:durability": {
        "max_durability": 251,
        "damage_chance": {
          "min": 60,
          "max": 100
        }
      },
      "minecraft:repairable": {
        "repair_items": [
          {
            "items": [ "minecraft:iron_ingot" ],
            "repair_amount": 280
          },
          {
            "items": [ "pixel:repair_item" ],
            "repair_amount": 250
          },
          {
            "items": [ "pixel:iron_glaive" ],
            "repair_amount": "query.max_durability"
          }
        ]
      },
      "minecraft:use_duration": 1000,
	  "minecraft:display_name": {
		"value": "item.pixel:iron_glaive.name"
	  },
	  "minecraft:max_stack_size": 1,
	  "minecraft:hand_equipped": true,
      "minecraft:mining_speed": 1.5,
      "minecraft:damage": 7,
      "minecraft:enchantable": {
        "value": 12,
        "slot": "sword"
      },
      "minecraft:can_destroy_in_creative": false,
      "minecraft:digger": {
        "use_efficiency": true,
        "destroy_speeds": [
          {
            "block": "minecraft:web",
            "speed": 15,
			"on_dig": {
			  "event": "minecraft:break"
			}
          },
          {
            "block": "minecraft:bamboo",
            "speed": 10,
			"on_dig": {
			  "event": "minecraft:break"
			}
          }
        ],
		"on_dig": {
		  "event": "minecraft:break",
		  "target": "self"
		}
      },
      "minecraft:chargeable": {
		"on_complete": {
		  "event": "filter_the_shoot",
		  "target": "self"
		}
	  },
	  "minecraft:weapon": {
		"on_hurt_entity": {
		  "event": "minecraft:break"
		}
	  }
    },
	"events": {
	  "minecraft:break": {
	    "sequence":[
	      {
		    "condition": "query.scoreboard('mdmmstr') >= 0 && query.scoreboard('mdmmstr') < 100",
		    "sequence": [
	          {
		        "condition": "query.scoreboard('glvabl') <= 0",
	            "run_command":{
	              "command":[
	                "scoreboard objectives add glaive_cd dummy",
	                "scoreboard players set @s glaive_cd 35",
	                "scoreboard players remove @s exhaust 3",
	                "effect @s weakness 2 20"
	              ]
	            }
	          },
	          {
		        "condition": "query.scoreboard('glvabl') > 0",
	            "run_command":{
	              "command":[
	                "scoreboard objectives add glaive_cd dummy",
	                "scoreboard players set @s glaive_cd 20",
	                "scoreboard players remove @s exhaust 3",
	                "effect @s weakness 1 20"
	              ]
	            }
	          },
	          {
		        "condition": "query.is_sprinting && query.scoreboard('glaive_cd') < 2",
	            "sequence":[
	              {
		            "damage": {
		              "type": "magic",
		              "amount": 3,
		              "target": "other"
		            }
	              }
	            ]
	          },
	          {
		        "condition": "!query.is_on_ground && query.scoreboard('glaive_cd') < 2",
	            "sequence":[
	              {
		            "damage": {
		              "type": "magic",
		              "amount": 5,
		              "target": "other"
		            }
	              }
	            ]
	          }
		    ]
	      },
	      {
		    "condition": "query.scoreboard('mdmmstr') >= 100 && query.scoreboard('mdmmstr') < 500",
		    "sequence": [
	          {
		        "condition": "query.scoreboard('glvabl') <= 0",
	            "run_command":{
	              "command":[
	                "scoreboard objectives add glaive_cd dummy",
	                "scoreboard players set @s glaive_cd 25",
	                "scoreboard players remove @s exhaust 2",
	                "effect @s weakness 1 20"
	              ]
	            }
	          },
	          {
		        "condition": "query.scoreboard('glvabl') > 0",
	            "run_command":{
	              "command":[
	                "scoreboard objectives add glaive_cd dummy",
	                "scoreboard players set @s glaive_cd 10",
	                "scoreboard players remove @s exhaust 3"
	              ]
	            }
	          },
	          {
		        "condition": "query.is_sprinting && query.scoreboard('glaive_cd') < 2",
	            "sequence":[
	              {
		            "damage": {
		              "type": "magic",
		              "amount": 6,
		              "target": "other"
		            }
	              }
	            ]
	          },
	          {
		        "condition": "!query.is_on_ground && query.scoreboard('glaive_cd') < 2",
	            "sequence":[
	              {
		            "damage": {
		              "type": "magic",
		              "amount": 7,
		              "target": "other"
		            }
	              }
	            ]
	          }
		    ]
	      },
	      {
		    "condition": "query.scoreboard('mdmmstr') >= 500 && query.scoreboard('mdmmstr') < 1000",
		    "sequence": [
	          {
		        "condition": "query.scoreboard('glvabl') <= 0",
	            "run_command":{
	              "command":[
	                "scoreboard objectives add glaive_cd dummy",
	                "scoreboard players set @s glaive_cd 25",
	                "scoreboard players remove @s exhaust 2",
	                "effect @s weakness 1 20"
	              ]
	            }
	          },
	          {
		        "condition": "query.scoreboard('glvabl') > 0",
	            "run_command":{
	              "command":[
	                "scoreboard objectives add glaive_cd dummy",
	                "scoreboard players set @s glaive_cd 5",
	                "scoreboard players remove @s exhaust 3"
	              ]
	            }
	          },
	          {
		        "condition": "query.is_sprinting && query.scoreboard('glaive_cd') < 2",
	            "sequence":[
	              {
		            "damage": {
		              "type": "magic",
		              "amount": 8,
		              "target": "other"
		            }
	              }
	            ]
	          },
	          {
		        "condition": "!query.is_on_ground && query.scoreboard('glaive_cd') < 2",
	            "sequence":[
	              {
		            "damage": {
		              "type": "magic",
		              "amount": 9,
		              "target": "other"
		            }
	              }
	            ]
	          }
		    ]
	      },
	      {
		    "condition": "query.scoreboard('mdmmstr') >= 1000",
		    "sequence": [
	          {
	            "run_command":{
	              "command":[
	                "scoreboard objectives add glaive_cd dummy",
	                "scoreboard players set @s glaive_cd 10",
	                "scoreboard players remove @s exhaust 1"
	              ]
	            }
	          },
	          {
		        "condition": "query.is_sprinting && query.scoreboard('glaive_cd') < 2",
	            "sequence":[
	              {
		            "damage": {
		              "type": "magic",
		              "amount": 9,
		              "target": "other"
		            }
	              }
	            ]
	          },
	          {
		        "condition": "!query.is_on_ground && query.scoreboard('glaive_cd') < 2",
	            "sequence":[
	              {
		            "damage": {
		              "type": "magic",
		              "amount": 11,
		              "target": "other"
		            }
	              }
	            ]
	          }
		    ]
	      },
	      {
		    "condition": "query.scoreboard('frctnstrk') > 0",
		    "sequence":[
	          {
		        "damage": {
		          "type": "fire_tick",
		          "amount": 3,
		          "target": "other"
	            }
	          }
		    ]
	      },
	      {
		    "condition": "query.scoreboard('irnlng') != 1 && query.scoreboard('dmndlng') != 1",
	        "randomize":[
	          {
	            "weight": 10,
		        "run_command": {
		          "command":[
	                "scoreboard players remove @s exhaust 2"
		          ]
		        }
	          },
	          {
	            "weight": 20,
		        "run_command": {
		          "command":[
	                "scoreboard players remove @s exhaust 3"
		          ]
		        }
	          },
	          {
	            "weight": 5,
		        "run_command": {
		          "command":[
	                "scoreboard players remove @s exhaust 1"
		          ]
		        }
	          }
	        ]
	      },
	      {
		    "condition": "query.scoreboard('irnlng') == 1",
	        "randomize":[
	          {
	            "weight": 10,
		        "run_command": {
		          "command":[
	                "scoreboard players remove @s exhaust 1"
		          ]
		        }
	          },
	          {
	            "weight": 20,
		        "run_command": {
		          "command":[
	                "scoreboard players remove @s exhaust 2"
		          ]
		        }
	          },
	          {
	            "weight": 5,
		        "run_command": {
		          "command":[
	                "scoreboard players remove @s exhaust 0"
		          ]
		        }
	          }
	        ]
	      },
	      {
		    "condition": "query.scoreboard('dmndlng') == 1",
	        "randomize":[
	          {
	            "weight": 10,
		        "run_command": {
		          "command":[
	                "scoreboard players remove @s exhaust 0"
		          ]
		        }
	          },
	          {
	            "weight": 20,
		        "run_command": {
		          "command":[
	                "scoreboard players remove @s exhaust 1"
		          ]
		        }
	          }
	        ]
	      },
	      {
	        "randomize":[
	          {
	            "weight": 10,
		        "damage": {
		          "type": "durability",
		          "amount": 1
	            }
	          },
	          {
	            "weight": 20,
		        "damage": {
		          "type": "durability",
		          "amount": 0
	            }
	          },
	          {
	            "weight": 5,
		        "damage": {
		          "type": "durability",
		          "amount": 2
	            }
	          }
	        ]
	      },
	      {
	        "randomize":[
	          {
	            "weight": 15,
	            "run_command":{
	              "command":[
	                "scoreboard objectives add mdmmstr dummy"
	              ]
	            }
	          },
	          {
	            "weight": 20,
	            "run_command":{
	              "command":[
	                "scoreboard objectives add mdmmstr dummy",
	                "scoreboard players add @s mdmmstr 1"
	              ]
	            }
	          },
	          {
	            "weight": 10,
	            "run_command":{
	              "command":[
	                "scoreboard objectives add mdmmstr dummy",
	                "scoreboard players add @s mdmmstr 2"
	              ]
	            }
	          },
	          {
	            "weight": 2,
	            "run_command":{
	              "command":[
	                "scoreboard objectives add mdmmstr dummy",
	                "scoreboard players add @s mdmmstr 5"
	              ]
	            }
	          }
	        ]
	      },
	      {
		    "condition": "query.scoreboard('irnlng') != 1 && query.scoreboard('dmndlng') != 1",
		    "run_command": {
		      "command":[
	            "scoreboard players set @s exhregen 100"
		      ]
		    }
	      },
	      {
		    "condition": "query.scoreboard('irnlng') == 1",
		    "run_command": {
		      "command":[
	            "scoreboard players set @s exhregen 100"
		      ]
		    }
	      },
	      {
		    "condition": "query.scoreboard('dmndlng') == 1",
		    "run_command": {
		      "command":[
	            "scoreboard players set @s exhregen 100"
		      ]
		    }
	      }
	    ]
	  }
	}
  }
}