tdauth / wowr

Warcraft III: Reforged funmap World of Warcraft Reforged.
https://wowreforged.org
8 stars 0 forks source link

Enchanting does not add any bonuses to some registered items #1168

Open tdauth opened 1 year ago

tdauth commented 1 year ago

Make sure we modify the item ability:

native BlzGetItemAbilityByIndex                    takes item whichItem, integer index returns ability
native BlzGetItemAbility                           takes item whichItem, integer abilCode returns ability
native BlzItemAddAbility                           takes item whichItem, integer abilCode returns boolean
native BlzGetItemBooleanField                      takes item whichItem, itembooleanfield whichField returns boolean
native BlzGetItemIntegerField                      takes item whichItem, itemintegerfield whichField returns integer
native BlzGetItemRealField                         takes item whichItem, itemrealfield whichField returns real
native BlzGetItemStringField                       takes item whichItem, itemstringfield whichField returns string
native BlzSetItemBooleanField                      takes item whichItem, itembooleanfield whichField, boolean value returns boolean
native BlzSetItemIntegerField                      takes item whichItem, itemintegerfield whichField, integer value returns boolean
native BlzSetItemRealField                         takes item whichItem, itemrealfield whichField, real value returns boolean
native BlzSetItemStringField                       takes item whichItem, itemstringfield whichField, string value returns boolean
native BlzItemRemoveAbility                        takes item whichItem, integer abilCode returns boolean
tdauth commented 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.

tdauth commented 1 year ago

EnchanterGetHeroStatsAndDefenseBonus and EnchanterGetDamageBonus count only items of type 'I07F'. Use constants and check all enchanting item types.

tdauth commented 1 year ago

After revising the system's code there is 0 previous damage for the ability level field but should be 10 for Bow of Fire!

tdauth commented 1 year ago

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.

tdauth commented 1 year ago

Works with level 0 but the ability is not applied again.

tdauth commented 1 year ago

Some fields cannot be changed: https://www.hiveworkshop.com/pastebin/b2769ab71109c3634b3115937deaa34a.24187

tdauth commented 1 year ago

Works for summoned units but not for defense and not for damage.

tdauth commented 1 year ago

https://www.hiveworkshop.com/members/tasyen.194042/#profile-post-comment-115162

Try disabling and enabling the ability.

tdauth commented 1 year ago

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
tdauth commented 1 year ago

Tasyen IncUnitAbilityLevel/DecUnitAbilityLevel also works for abilities without any object Editor setup for Lvl 2. SetUnitAbilityLevel needs Lvl 2 to work.