Implemented HP carryover after NPC transform
Fixed goblin cave miners not taking damage on the first hit
This commit is contained in:
@@ -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",
|
||||
|
||||
+1
-1
@@ -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
|
||||
|
||||
@@ -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 -> {
|
||||
|
||||
@@ -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
|
||||
*/
|
||||
|
||||
@@ -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.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user