var int hero_1h_max_bonus;
const int MASTER_1H_BONUS = 20;
instance ITRI_MASTER(C_Item)
{
name = "Кольцо мастера";
mainflag = ITEM_KAT_MAGIC;
flags = ITEM_RING;
value = 4000;
visual = "ItRi_Prot_Mage_02.3ds";
visual_skin = 0;
material = MAT_METAL;
on_equip = equip_MASTER;
on_unequip = unequip_MASTER;
wear = WEAR_EFFECT;
effect = "SPELLFX_ITEMGLIMMER";
description = "Кольцо мастера";
text[2] = NAME_ADDON_BONUS_1H;
count[2] = MASTER_1H_BONUS;
text[5] = NAME_Value;
count[5] = value;
};
func void equip_MASTER()
{
if(Npc_IsPlayer(self) && (self.HitChance[NPC_TALENT_1H] < 100))
{
if((self.HitChance[NPC_TALENT_1H] + MASTER_1H_BONUS) > 100)
{
hero_1h_max_bonus = 100 - self.HitChance[NPC_TALENT_1H];
B_AddFightSkill(self,NPC_TALENT_1H,hero_1h_max_bonus);
b_meleeweaponchange(hero_1h_max_bonus,0,0);
}
else
{
hero_1h_max_bonus = -1;
B_AddFightSkill(self,NPC_TALENT_1H,MASTER_1H_BONUS);
b_meleeweaponchange(MASTER_1H_BONUS,0,0);
};
};
};
func void unequip_MASTER()
{
if(Npc_IsPlayer(self) && (MELEEWEAPONCHANGEDHERO || (SCRIPTPATCHWEAPONCHANGE == FALSE)))
{
if(hero_1h_max_bonus < 0)
{
B_AddFightSkill(self,NPC_TALENT_1H,-MASTER_1H_BONUS);
b_meleeweaponundochange();
}
else
{
B_AddFightSkill(self,NPC_TALENT_1H,-hero_1h_max_bonus);
b_meleeweaponundochange();
};
};
};