ON INIT {
 SET_TWO_HANDED
 SETNAME [description_axeiron_2handed]
 SET_MATERIAL WEAPON
 SET_WEAPON_MATERIAL SWORD
 SET_STRIKE_SPEECH [player_strike_strong]
 SET_PRICE 1000
 SET_STEAL 90
//SET_THROW_DAMAGE 2
 SETOBJECTTYPE WEAPON
 SET_GROUP "BLADE"
 SET_GROUP "BLUNT"
 SET_GROUP ARMORY
 SETOBJECTTYPE 2H
 SETEQUIP DAMAGES 10
 SETEQUIP aim_time 3000
 SETEQUIP STEALTH -10
 SETEQUIP CASTING -10
 SETEQUIP armor_class 4%
 SET_DURABILITY 20
 SET §poisonable 1
 SET £reagent "none"
  TWEAK SKIN "[WEAPON]2HANDEDAXE" "[WEAPON]2HANDEDAXE_IRON"
 ACCEPT
}

ON EQUIPIN {
 PLAY "equip_nosword"
 ACCEPT
}

ON INVENTORYUSE {
 IF (^FIGHTING == 1) ACCEPT
 IF (^PLAYER_ATTRIBUTE_STRENGTH < 16) {
  SPEAK -p [player_not_skilled_enough] NOP
  HEROSAY [required_st_16]
  //COLORISE SELF 1 0 0
  ACCEPT
 }
 IF (^PLAYER_SKILL_CLOSE_COMBAT < 60) {
  SPEAK -p [player_not_skilled_enough] NOP
  HEROSAY [required_cc_60]
  //COLORISE SELF 1 0 0
  ACCEPT
 }
 //COLORISE SELF 0 0 0
 EQUIP PLAYER
 ACCEPT
}


//#WEAPONS
ON COMBINE {
 IF (^$PARAM1 ISCLASS "POTION_GREEN") {
  IF (§poisonable == 0) {
   SPEAK -p [player_weapon_not_poisonable] NOP
   ACCEPT
  }
  IF (^PLAYER_SKILL_OBJECT_KNOWLEDGE < 30) {
   SPEAK -p [player_not_skilled_enough] NOP
   HEROSAY [required_obj_30]
   ACCEPT
  }
  SENDEVENT CUSTOM ^$PARAM1 "EMPTY"
  SET #TMP ~^PLAYER_SKILL_OBJECT_KNOWLEDGE~
  DEC #TMP 27 // donc tmp est entre 3 et 73
  DIV #TMP 3 // donc tmp est entre 1 et 24
  SET_POISONOUS ~#TMP~ ~#TMP~
  SPEAK -p [player_weapon_poisoned] NOP
  ACCEPT
 }
 IF (£reagent == "egg") { 
  SPEAK -p [player_no] NOP
  ACCEPT
 }
 IF (§enchanted == 1) { 
  SPEAK -p [player_no] NOP
  ACCEPT
 }
 IF (^$PARAM1 ISCLASS "DRAGON_EGG" ) {
  IF (^ME ISCLASS "SABRE_METEOR") {
   SET £reagent "egg"
   HALO -ocs 1 1 0 30
   GOTO REGENTMIXED
  }
  IF (^ME ISCLASS "Sword_2handed_METEOR") {
   SET £reagent "egg"
   HALO -ocs 1 1 0 30
   GOTO REGENTMIXED
  }
  SPEAK -p [player_no] NOP
  ACCEPT
 }
 IF (^ME ISCLASS "SABRE_METEOR") {
  SPEAK -p [player_no] NOP
  ACCEPT
 }
 IF (^ME ISCLASS "Sword_2handed_METEOR") {
  SPEAK -p [player_no] NOP
  ACCEPT
 }
 IF (^$PARAM1 ISCLASS "GARLIC" ) {
  SET £reagent "garlic"
  HALO -ocs 0 1 0 30
  GOTO REGENTMIXED
  ACCEPT
 }
 IF (^$PARAM1 ISCLASS "powder_bone" ) {
  SET £reagent "powder_bone"
  HALO -ocs 1 0.5 0 30
  GOTO REGENTMIXED
  ACCEPT
 }
 IF (^$PARAM1 ISCLASS "dragon_bone_powder" ) {
  SET £reagent "powder_dragon_bone"
  HALO -ocs 1 0 0 30
  GOTO REGENTMIXED
  ACCEPT
 }
 IF (^$PARAM1 ISCLASS "golem_heart" ) {
  SET £reagent "golem_heart"
  HALO -ocs 0.5 0.5 0.5 30
  GOTO REGENTMIXED
  ACCEPT
 }
 IF (^$PARAM1 ISCLASS "rock_amikar" ) {
  SET £reagent "rock_amikar"
  HALO -ocs 1 1 1 30
  GOTO REGENTMIXED
  ACCEPT
 }
 ACCEPT
}

>>REGENTMIXED
 DESTROY ^$PARAM1
 TIMERoff 1 1 HALO -f
 SETNAME [description_axeiron_2handed_ready]
 SPEAK -p [Player_off_interesting] NOP
 ACCEPT

>>ENCHANTED
  SET_PRICE §tmp
  UNSET §tmp
  UNSET £reagent
 // HALO -ocs 0 1 0 30
  ACCEPT

ON REPAIRED {
 IF (^$PARAM1 == "checkdur") {
  IF (^DURABILITY == ^MAXDURABILITY) {
   SPEAK -p [player_weapon_already_repaired] NOP
   ACCEPT
  }
  SENDEVENT REPAIR ^SENDER ""
  ACCEPT
 }
 SET §tmp ~^MAXDURABILITY~
 REPAIR SELF ~^PLAYER_SKILL_OBJECT_KNOWLEDGE~
 if (^DURABILITY < §tmp) {
  SPEAK -p [player_weapon_repaired_partially] NOP
  ACCEPT
 }
 SPEAK -p [player_weapon_repaired_in_full] NOP
 UNSET §tmp
 ACCEPT
}

ON BREAK {
PLAY "broken_weapon"
>>BREAKING
 INVENTORY PLAYERADD "\\special\\piece_wood\\piece_wood"
 INVENTORY PLAYERADD "\\Provisions\\scrap_metal_med\\scrap_metal_med"
DESTROY SELF
ACCEPT
}

//#
ON DURABILITY {
 SET_DURABILITY -c ~^$PARAM1~
 ACCEPT
}

ON SPELLCAST {
 IF (^$PARAM1 != ENCHANT_WEAPON) ACCEPT
 IF (§enchanted == 1) { 
  SPEAK -p [player_no] NOP
  ACCEPT
 }
 IF (£reagent == "none") { 
  SPEAK -p [player_wrong] NOP
  ACCEPT
 }
 PLAY -o "Magic_Spell_Enchant_Weapon"
 IF (£reagent == "egg") {
  IF (^#PARAM2 < 8) {
   SPEAK -p [player_not_skilled_enough] NOP
   ACCEPT
  }
  SET §enchanted 1
  IF (#need_superweapon == 1) {
   QUEST [system_Quest_log_final_meeting]
   HEROSAY [system_questbook_updated]
   PLAY SYSTEM
  }
  IF (#superweapon < 2) {
   SET #weapon_enchanted 2
   SET #need_superweapon 2
   SET #superweapon 2
  }
  UNSET £reagent
  IF (^ME ISCLASS "SABRE_METEOR") REPLACEME "\\WEAPONS\\SABRE_METEOR_ENCHANT\\SABRE_METEOR_ENCHANT" ACCEPT
  IF (^ME ISCLASS "Sword_2handed_METEOR") REPLACEME "\\WEAPONS\\SWORD_2HANDED_METEOR_ENCHANT\\SWORD_2HANDED_METEOR_ENCHANT"
  ACCEPT
 }
 SET §enchanted 1
 SETNAME [description_dagger]
 IF (£reagent == "garlic") {
  HALO -ocs 0 1 0 30
  IF (^PLAYER_SKILL_CASTING < 50) {
   SETEQUIP DEXTERITY 1
  }
  IF (^PLAYER_SKILL_CASTING > 50) {
   SETEQUIP DEXTERITY 2
  }
  SET §tmp ~^PRICE~
  MUL §tmp 1.5
  GOTO ENCHANTED
 }
 IF (£reagent == "powder_bone") {
  HALO -ocs 1 0.5 0 30
  SETEQUIP STRENGTH 1
  SET §tmp ~^PRICE~
  MUL §tmp 1.5
  GOTO ENCHANTED
 }
 IF (£reagent == "powder_dragon_bone") {
  HALO -ocs 1 0 0 30
  IF (^PLAYER_SKILL_CASTING < 50) {
   SETEQUIP STRENGTH 2
  } 
  IF (^PLAYER_SKILL_CASTING > 50) {
   SETEQUIP STRENGTH 3
  } 
  SET §tmp ~^PRICE~
  MUL §tmp 3
  GOTO ENCHANTED
 }
 IF (£reagent == "golem_heart") {
  HALO -ocs 0.5 0.5 0.5 30
  IF (^PLAYER_SKILL_CASTING < 50) {
   SETEQUIP -s PARALYSE 500
  }
  IF (^PLAYER_SKILL_CASTING > 80) {
   SETEQUIP -s PARALYSE 3000
   SET §tmp ~^PRICE~
   MUL §tmp 3
   GOTO ENCHANTED
   ACCEPT
  }
  IF (^PLAYER_SKILL_CASTING > 50) {
   SETEQUIP -s PARALYSE 1000
  }
  SET §tmp ~^PRICE~
  MUL §tmp 3
  GOTO ENCHANTED
 }
  IF (£reagent == "rock_amikar") {
  HALO -ocs 1 1 1 30
  SET_DURABILITY 100
  SET_DURABILITY -c 100
  SET §tmp ~^PRICE~
  MUL §tmp 2
  GOTO ENCHANTED
 }
 ACCEPT
} 