{
    "type": "origins:multiple",

    "dodge_charges": {
        "type": "origins:resource",
        "start_value": 0,
        "min": 0,
        "max": 7,
        "hud_render": {
            "sprite_location": "origins:textures/gui/community/spiderkolo/resource_bar_points_01.png",
            "bar_index": 14,
            "condition": {
                "type": "origins:resource",
                "resource": "*:*_dodge_charges",
                "comparison": ">=",
                "compare_to": 1
            }
        }
    },

    "dodge_activate": {
        "type": "origins:active_self",
        "entity_action": {
            "type": "origins:and",
            "actions": [
                {
                    "type": "origins:change_resource",
                    "resource": "*:*_dodge_charges",
                    "operation": "set",
                    "change": 3
                },
                {
                    "type": "apoli:change_resource",
                    "resource": "*:*_charge_cooldown",
                    "operation": "set",
                    "change": 30
                }
            ]
        },
        "key": "key.origins.primary_active",
        "cooldown": 1800,
        "hud_render": {
            "sprite_location": "origins:textures/gui/community/spiderkolo/resource_bar_02.png",
            "bar_index": 0
        }
    },

    "charge_cooldown": {
        "type": "apoli:resource",
        "min": 0,
        "max": 30,
        "min_action": {
            "type": "apoli:change_resource",
            "resource": "*:*_dodge_charges",
            "operation": "set",
            "change": 0
        }
    },

    "cooldown_lose": {
        "type": "apoli:action_over_time",
        "entity_action": {
            "type": "apoli:change_resource",
            "resource": "*:*_charge_cooldown",
            "operation": "add",
            "change": -1
        },
        "condition": {
            "type": "apoli:resource",
            "resource": "*:*_charge_cooldown",
            "comparison": ">",
            "compare_to": 0
        },
        "interval": 20
    },

    "lose_stacks": {
        "type": "apoli:action_on_callback",
        "entity_action_respawned": {
            "type": "apoli:and",
            "actions": [
                {
                    "type": "apoli:change_resource",
                    "resource": "*:*_dodge_charges",
                    "operation": "set",
                    "change": 0
                },
                {
                    "type": "apoli:change_resource",
                    "resource": "*:*_charge_cooldown",
                    "operation": "set",
                    "change": 0
                }
            ]
        }
    },

    "dodge_effect": {
        "type": "origins:modify_damage_taken",
		"damage_condition": {
			"type": "origins:projectile"
		},
		"modifier": {
			"operation": "multiply_total",
			"value": -0.99
		},
    
        "condition": {
            "type": "origins:resource",
            "resource": "*:*_dodge_charges",
            "comparison": ">=",
            "compare_to": 1
        }
    },

    "dodge_remove": {
        "type": "origins:self_action_when_hit",
        "entity_action": {
            "type": "origins:and",
            "actions": [
                {
                    "type": "origins:change_resource",
                    "resource": "*:*_dodge_charges",
                    "change": -1,
                    "operation": "add"
                },
                {
                    "type": "origins:play_sound",
                    "sound": "entity.arrow.hit_player",
                    "pitch": 0.5
                }
            ]
        },
        "damage_condition": {
            "type": "origins:projectile"
        },
        "condition": {
            "type": "origins:resource",
            "resource": "*:*_dodge_charges",
            "comparison": ">=",
            "compare_to": 1
        }
    },

    "arrow_dmg": {
        "type": "origins:modify_projectile_damage",
        "damage_condition": {
            "type": "apoli:projectile",
            "projectile_condition": {
                "type": "origins:or",
                "conditions": [
                    {
                        "type": "origins:entity_type",
                        "entity_type": "minecraft:arrow"
                    },
                    {
                        "type": "origins:entity_type",
                        "entity_type": "minecraft:spectral_arrow"
                    }
                ]
            }

        },
        "modifier": {
            "operation": "addition",
            "value": 3
        }
    },

    "dmg_taken": {
        "type": "origins:modify_damage_taken",
        "modifier": {
            "operation": "addition",
            "value": 1
        },
        "damage_condition": {
            "type": "origins:or",
            "conditions": [
                {
                    "type": "origins:attacker",
                    "entity_condition": {
                        "value": false,
                        "type": "origins:constant",
                        "inverted": false
                    }
                },
                {
                    "type": "origins:projectile",
                    "projectile_condition": {
                        "type": "origins:or",
                        "conditions": [
                            {
                                "type": "origins:entity_type",
                                "entity_type": "minecraft:arrow"
                            },
                            {
                                "type": "origins:entity_type",
                                "entity_type": "minecraft:spectral_arrow"
                            } 
                        ]
                    }
                }
            ]
        }
    },

    "badges": [
		{
			"type": "origins:tooltip",
			"sprite": "origins:textures/gui/badge/star.png",
			"text": "§2[+] Deal additional 3dmg with arrow projectiles\n[+] Dodge Ability\n§c[-] Take additional 1dmg while hit by an arrow or continuous melee hits"
		},
        {
            "type": "origins:keybind",
            "sprite": "origins:textures/gui/badge/active.png",
            "text": "Activate Dodge ability with [§2Primary§f]\n\n§6> Dodge Ability has 3 charges, that will last 30sec\n> You'll lose the charge if you get hit by an arrow projectile\n> Dodged arrows that reach you won't hurt you"
        }
	],

    "name": "§f[§e+/-§f] §eUno Reverse",
    "description": "Do you remember all these times when people were trying to hunt your kind? It's time to pay them back! You managed to master their own weapon, so now not only you can shoot arrows, but they are also more deadly! You also learned how to dodge their shots, at least to some extent. But any shot that will reach you will hurt you more than a standard person, and the same applies to constant attacks close-up."
}