miwarnec / uMMORPG

4 stars 0 forks source link

Monster Ranged Attacks broken #19

Closed wovencode closed 4 years ago

wovencode commented 5 years ago

Unmodified 1173

The code part below, will always return false when a monster tries to activate a projectile skill. This means, monsters wont be able to use ranged attacks.

This error got introduced with the Ammo system a good while ago - it worked before.

It is the final "return false;" that causes the issue. should be true - if you dont have a weapon, we don't have to check for weapon based ammo requirements at all.,

bool HasRequiredWeaponAndAmmo(UnitBase caster) { int weaponIndex = GetEquipmentWeaponIndex(caster); if (weaponIndex != -1) { // no ammo required, or has that ammo equipped? WeaponItem itemData = (WeaponItem)caster.equipment.Get(weaponIndex).template; return itemData.requiredAmmo == null || caster.GetEquipmentIndexByName(itemData.requiredAmmo.name) != -1; } return false; }

miwarnec commented 4 years ago

CE V2.12 has an example ranged attack for bandit boss. closing.