diff --git a/Server/data/configs/npc_configs.json b/Server/data/configs/npc_configs.json index 2f3dd9984..44c10bdcb 100644 --- a/Server/data/configs/npc_configs.json +++ b/Server/data/configs/npc_configs.json @@ -25592,7 +25592,7 @@ "death_animation": "6003", "defence_animation": "6008", "defence_level": "5", - "lifepoints": "7", + "lifepoints": "10", "magic_animation": "0", "melee_animation": "6007", "range_animation": "0", @@ -25610,7 +25610,7 @@ "death_animation": "6003", "defence_animation": "6008", "defence_level": "5", - "lifepoints": "7", + "lifepoints": "10", "magic_animation": "0", "melee_animation": "6007", "range_animation": "0", @@ -25628,7 +25628,7 @@ "death_animation": "6003", "defence_animation": "6008", "defence_level": "5", - "lifepoints": "7", + "lifepoints": "10", "magic_animation": "0", "melee_animation": "6007", "range_animation": "0", @@ -25646,7 +25646,7 @@ "death_animation": "6003", "defence_animation": "6008", "defence_level": "5", - "lifepoints": "7", + "lifepoints": "10", "magic_animation": "0", "melee_animation": "6007", "range_animation": "0", @@ -25697,61 +25697,61 @@ "id": "2075", "name": "Cave goblin miner", "examine": "He's working hard!", - "attack_level": "1", + "attack_level": "5", "combat_audio": "469,472,471", "death_animation": "6003", "defence_animation": "6008", - "defence_level": "1", + "defence_level": "5", "lifepoints": "10", "melee_animation": "6007", "range_level": "1", "safespot": null, - "strength_level": "1" + "strength_level": "5" }, { "id": "2076", "name": "Cave goblin miner", "examine": "He's working hard!", - "attack_level": "1", + "attack_level": "5", "combat_audio": "469,472,471", "death_animation": "6003", "defence_animation": "6008", - "defence_level": "1", + "defence_level": "5", "lifepoints": "10", "melee_animation": "6007", "range_level": "1", "safespot": null, - "strength_level": "1" + "strength_level": "5" }, { "id": "2077", "name": "Cave goblin miner", "examine": "He's working hard!", - "attack_level": "1", + "attack_level": "5", "combat_audio": "469,472,471", "death_animation": "6003", "defence_animation": "6008", - "defence_level": "1", + "defence_level": "5", "lifepoints": "10", "melee_animation": "6007", "range_level": "1", "safespot": null, - "strength_level": "1" + "strength_level": "5" }, { "id": "2078", "name": "Cave goblin miner", "examine": "He's working hard!", - "attack_level": "1", + "attack_level": "5", "combat_audio": "469,472,471", "death_animation": "6003", "defence_animation": "6008", - "defence_level": "1", + "defence_level": "5", "lifepoints": "10", "melee_animation": "6007", "range_level": "1", "safespot": null, - "strength_level": "1" + "strength_level": "5" }, { "id": "2079", diff --git a/Server/src/main/content/region/misthalin/dorgeshuun/quest/thelosttribe/CaveGoblinMinerNPC.kt b/Server/src/main/content/region/misthalin/dorgeshuun/quest/thelosttribe/CaveGoblinMinerNPC.kt index 6813ad0b9..4d6feec03 100644 --- a/Server/src/main/content/region/misthalin/dorgeshuun/quest/thelosttribe/CaveGoblinMinerNPC.kt +++ b/Server/src/main/content/region/misthalin/dorgeshuun/quest/thelosttribe/CaveGoblinMinerNPC.kt @@ -29,7 +29,7 @@ class CaveGoblinMinerNPC(id: Int = 0, location: Location? = null) : AbstractNPC( mining = (id > 2074) if(properties.combatPulse.isAttacking && mining){ - transform(id - 6) + transformWithHpCarryover(id - 6) this.isWalks = true this.walkRadius = 4 this.isNeverWalks = false diff --git a/Server/src/main/content/region/morytania/canifis/handlers/CanafisWerewolfNPC.kt b/Server/src/main/content/region/morytania/canifis/handlers/CanafisWerewolfNPC.kt index 51a82b834..369aa550f 100644 --- a/Server/src/main/content/region/morytania/canifis/handlers/CanafisWerewolfNPC.kt +++ b/Server/src/main/content/region/morytania/canifis/handlers/CanafisWerewolfNPC.kt @@ -3,6 +3,7 @@ package content.region.morytania.canifis.handlers import core.api.* import core.game.interaction.QueueStrength import core.game.node.entity.Entity +import core.game.node.entity.skill.Skills import core.game.node.entity.combat.BattleState import core.game.node.entity.combat.DeathTask import core.game.node.entity.npc.NPC @@ -38,7 +39,9 @@ class WerewolfBehavior : NPCBehavior(*HUMAN_NPCS) { return@queueScript delayScript(self, WEREWOLF_IN_ANIMATION.duration) } 1 -> { - transformNpc(self, WEREWOLF_NPCS[self.id - 6026], 200) + val humanMaxLp = self.getSkills().getMaximumLifepoints() + transformNpcWithHpCarryover(self, WEREWOLF_NPCS[self.id - 6026], 200) + self.getSkills().heal(self.getSkills().getMaximumLifepoints() - humanMaxLp) return@queueScript delayScript(self, 1) } 2 -> { diff --git a/Server/src/main/core/api/ContentAPI.kt b/Server/src/main/core/api/ContentAPI.kt index 2acac9bea..7423518a7 100644 --- a/Server/src/main/core/api/ContentAPI.kt +++ b/Server/src/main/core/api/ContentAPI.kt @@ -1342,6 +1342,25 @@ fun transformNpc(npc: NPC, transformTo: Int, restoreTicks: Int) { }) } +/** + * Transforms an NPC for the given number of ticks with hp carryover + * @param npc the NPC object to transform + * @param transformTo the ID of the NPC to turn into + * @param restoreTicks the number of ticks until the NPC returns to normal + */ +fun transformNpcWithHpCarryover(npc: NPC, transformTo: Int, restoreTicks: Int) { + npc.transformWithHpCarryover(transformTo) + queueScript(npc, 0, QueueStrength.SOFT) { stage: Int -> + when (stage) { + 0 -> return@queueScript delayScript(npc, restoreTicks) + else -> { + npc.reTransform() + return@queueScript stopExecuting(npc) + } + } + } +} + /** * Produces a Location object using the given x,y,z values */ diff --git a/Server/src/main/core/game/node/entity/npc/NPC.java b/Server/src/main/core/game/node/entity/npc/NPC.java index d0e349d7c..18334251e 100644 --- a/Server/src/main/core/game/node/entity/npc/NPC.java +++ b/Server/src/main/core/game/node/entity/npc/NPC.java @@ -751,6 +751,18 @@ public class NPC extends Entity { return this; } + /** + * Transforms this NPC with HP carried over from pre-transformed entity. + * HP adjustments (ie healing/scaling HP to new maximum) should be done manually per-NPC + * @param id The new NPC id. + */ + public NPC transformWithHpCarryover(int id) { + int lp = getSkills().getLifepoints(); + this.transform(id); + getSkills().setLifepoints(lp); + return this; + } + /** * Transforms this NPC back to original. */