From db528d12114824d12e2dbf96262dbb63ce4e6ad3 Mon Sep 17 00:00:00 2001 From: vk Date: Sat, 20 Nov 2021 20:44:53 +0000 Subject: [PATCH] Move the +6 boost of the attack cape perk before all modifiers/bonuses are applied --- CHANGELOG | 1 + .../combat/handlers/MeleeSwingHandler.kt | 7 +++---- .../system/command/sets/MiscCommandSet.kt | 19 +++++++++++++++++-- Server/worldprops/default.json | 1 + 4 files changed, 22 insertions(+), 6 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 79a6e68c9..12df6628e 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -54,4 +54,5 @@ - Void set effects now work more uniformly. - Summoning familiars now grant combat xp when attacking - Canoe travel interface now animates correctly +- Fix how the attack skill cape perk is calculated. It should now have a much more noticeable effect - Properly track leaf-bladed sword drops in ::stats command diff --git a/Server/src/main/kotlin/rs09/game/node/entity/combat/handlers/MeleeSwingHandler.kt b/Server/src/main/kotlin/rs09/game/node/entity/combat/handlers/MeleeSwingHandler.kt index 9706c93b6..1284bb11f 100644 --- a/Server/src/main/kotlin/rs09/game/node/entity/combat/handlers/MeleeSwingHandler.kt +++ b/Server/src/main/kotlin/rs09/game/node/entity/combat/handlers/MeleeSwingHandler.kt @@ -146,6 +146,9 @@ open class MeleeSwingHandler if(entity.properties.attackStyle.style == WeaponInterface.STYLE_ACCURATE) effectiveAttackLevel += 3 else if(entity.properties.attackStyle.style == WeaponInterface.STYLE_CONTROLLED) effectiveAttackLevel += 1 effectiveAttackLevel += 8 + if(entity is Player && SkillcapePerks.isActive(SkillcapePerks.PRECISION_STRIKES, entity)){ //Attack skillcape perk + effectiveAttackLevel += 6 + } effectiveAttackLevel *= getSetMultiplier(entity, Skills.ATTACK); effectiveAttackLevel = floor(effectiveAttackLevel) effectiveAttackLevel *= (entity.properties.bonuses[entity.properties.attackStyle.bonusType] + 64) @@ -153,10 +156,6 @@ open class MeleeSwingHandler val amuletName = (if(entity is Player) ContentAPI.getItemFromEquipment(entity, EquipmentSlot.AMULET)?.name ?: "null" else "null").toLowerCase() val victimName = entity.properties.combatPulse.getVictim()?.name ?: "none" - if(entity is Player && SkillcapePerks.isActive(SkillcapePerks.PRECISION_STRIKES, entity)){ //Attack skillcape perk - effectiveAttackLevel += 6 - } - if(entity is Player && entity.slayer.task?.ids?.contains((entity.properties.combatPulse?.getVictim()?.id ?: 0)) == true) effectiveAttackLevel *= SlayerEquipmentFlags.getDamAccBonus(entity) //Slayer Helm/ Black Mask/ Slayer cape diff --git a/Server/src/main/kotlin/rs09/game/system/command/sets/MiscCommandSet.kt b/Server/src/main/kotlin/rs09/game/system/command/sets/MiscCommandSet.kt index be7ff6000..be203daf3 100644 --- a/Server/src/main/kotlin/rs09/game/system/command/sets/MiscCommandSet.kt +++ b/Server/src/main/kotlin/rs09/game/system/command/sets/MiscCommandSet.kt @@ -8,11 +8,12 @@ import core.cache.def.impl.SceneryDefinition import core.cache.def.impl.VarbitDefinition import core.game.component.Component import core.game.ge.OfferState -import core.game.node.scenery.Scenery +import core.game.node.entity.npc.NPC import core.game.node.entity.player.Player import core.game.node.entity.player.info.Rights import core.game.node.entity.skill.Skills import core.game.node.item.Item +import core.game.node.scenery.Scenery import core.game.system.communication.CommunicationInfo import core.game.world.map.RegionManager import core.game.world.map.build.DynamicRegion @@ -34,7 +35,6 @@ import rs09.tools.stringtools.colorize import java.awt.Toolkit import java.awt.datatransfer.StringSelection import java.util.* -import kotlin.collections.ArrayList @Initializable class MiscCommandSet : CommandSet(Command.Privilege.ADMIN){ @@ -47,6 +47,21 @@ class MiscCommandSet : CommandSet(Command.Privilege.ADMIN){ player.toggleDebug() } + define("calc_accuracy", Command.Privilege.STANDARD){ player, args -> + val handler = player.getSwingHandler(false) + player.sendMessage("handler type: ${handler.type}") + player.sendMessage("calculateAccuracy: ${handler.calculateAccuracy(player)}") + + if (args.size > 1) + { + val npcId: Int = args[1].toInt() + val npc = NPC(npcId) + npc.initConfig() + player.sendMessage("npc: ${npc.name}. npc defence: ${npc.skills.getLevel(Skills.DEFENCE)}") + player.sendMessage("calculateDefence: ${handler.calculateDefence(npc, player)}") + } + } + /** * Prints player's current location */ diff --git a/Server/worldprops/default.json b/Server/worldprops/default.json index 2855b1a3e..9b14d3260 100644 --- a/Server/worldprops/default.json +++ b/Server/worldprops/default.json @@ -18,6 +18,7 @@ "allow_token_purchase": true, "max_adv_bots": "0", "message_of_the_week_identifier": "0", + "skillcape_perks": false, "message_of_the_week_text": "Welcome to 2009Scape!
Nowin Technicolor!" },