Open tdauth opened 1 year ago
Rename EquipmentBagGetAbilityCount into GetItemTypeAbilityCount and make a separate system for registering abilities for item types and unit types/hero types. The system could be some kind of missing field system. Register dependencies etc.
EnchanterGetHeroStatsAndDefenseBonus and EnchanterGetDamageBonus count only items of type 'I07F'. Use constants and check all enchanting item types.
After revising the system's code there is 0 previous damage for the ability level field but should be 10 for Bow of Fire!
Maybe test level 0 instead of 1 for abilities with only one level? If it works we could use 'alev' to check the levels. The enchanting system should add bonuses to ALL level values anyway.
Works with level 0 but the ability is not applied again.
Some fields cannot be changed: https://www.hiveworkshop.com/pastebin/b2769ab71109c3634b3115937deaa34a.24187
Works for summoned units but not for defense and not for damage.
https://www.hiveworkshop.com/members/tasyen.194042/#profile-post-comment-115162
Try disabling and enabling the ability.
We can also split/refactor the systems a bit:
// Adds function to retrieve object type information which cannot be retrieved by Blizzard's natives.
library ObjectTypeFieldsSystem
function RegisterHeroTypeAbility takes integer unitTypeId, integer abilityId, integer maxLevel returns integer
function GetHeroTypeAbilityCount takes integer itemTypeId returns integer
function GetHeroTypeAbilityId takes integer itemTypeId, integer index returns integer
function GetHeroTypeAbilityMaxLevel takes integer itemTypeId, integer index returns integer
function RegisterItemTypeAbility takes integer itemTypeId, integer abilityId, integer maxLevel returns integer
function GetItemTypeAbilityCount takes integer itemTypeId returns integer
function GetItemTypeAbilityId takes integer itemTypeId, integer index returns integer
function GetItemTypeAbilityMaxLevel takes integer itemTypeId, integer index returns integer
endlibrary
// Allows changing numeric values of ability fields to improve or worsen abilities.
library AbilityFieldBonusSystem requires ObjectTypeFieldsSystem
function RegisterAbilityFieldBonusType takes integer varType returns integer
function AddAbilityFieldToBonusType takes integer bonusType, integer fieldId returns integer
function AddAbilityFieldBonus takes integer abilityId, ability whichAbility, integer bonusType, integer bonus returns integer
endlibrary
// Allows automatic auto skilling of hero abilities.
library HeroAutoSkillSystem requires ObjectTypeFieldsSystem
function AutoSkill takes unit hero returns integer
endlibrary
Make sure we modify the item ability: