Poison corrections

::poison command (admin) will now automatically remove poison immunity timers for faster testing
Poison will no longer give an inauthentic warning when it is about to expire
Newly applied poison timers will only overwrite old poison timers if they are greater in severity
Fixed up some logic for monster examine checking poison immunity
Fixed numerous poison stats
This commit is contained in:
Syndromeramo
2025-09-23 13:35:52 +00:00
committed by Ryan
parent 676397f3fd
commit 6d8ef4247c
12 changed files with 219 additions and 233 deletions
+6 -2
View File
@@ -3044,8 +3044,12 @@ fun applyPoison (entity: Entity, source: Entity, severity: Int) {
val existingTimer = getTimer<Poison>(entity)
if (existingTimer != null) {
existingTimer.severity = severity
existingTimer.damageSource = source
if (existingTimer.severity > severity) {
return
} else {
existingTimer.severity = severity
existingTimer.damageSource = source
}
} else {
registerTimer(entity, spawnTimer<Poison>(source, severity))
}
@@ -115,16 +115,23 @@ open class MeleeSwingHandler (vararg flags: SwingHandlerFlag)
val name = entity.equipment.getNew(3).name
var damage = -1
if (name.contains("(p++") || name.contains("(s)") || name.contains("(kp)")) {
damage = 68
damage = 30
} else if (name.contains("(p+)")) {
damage = 58
damage = 25
} else if (name.contains("(p)")) {
damage = 48
damage = 20
}
if (damage > -1 && RandomFunction.random(10) < 4) {
applyPoison (victim, entity, damage)
}
}
} else if (entity is NPC) {
val poisonous = entity.isPoisonous
val damage = entity.poisonSeverity()
if (poisonous && damage > -1 && RandomFunction.random(10) < 4) {
applyPoison (victim, entity, damage)
}
}
super.adjustBattleState(entity, victim, state)
}
@@ -134,6 +134,13 @@ open class RangeSwingHandler (vararg flags: SwingHandlerFlag) : CombatSwingHandl
if (state.estimatedHit > 0 && damage > 8 && RandomFunction.random(10) < 4) {
applyPoison(victim, entity, damage)
}
} else if (entity is NPC) {
val poisonous = entity.isPoisonous
val damage = entity.poisonSeverity()
if (poisonous && damage > -1 && RandomFunction.random(10) < 4) {
applyPoison (victim, entity, damage)
}
}
super.adjustBattleState(entity, victim, state)
}
@@ -563,6 +563,14 @@ public class NPC extends Entity {
return definition.getConfiguration(NPCConfigParser.POISON_IMMUNE, false);
}
public boolean isPoisonous() {
return definition.getConfiguration(NPCConfigParser.POISONOUS, false);
}
public int poisonSeverity() {
return definition.getConfiguration(NPCConfigParser.POISON_AMOUNT, 0);
}
@Override
public void finalizeDeath(Entity killer) {
super.finalizeDeath(killer);
@@ -20,14 +20,6 @@ class Poison : PersistTimer (30, "poison", flags = arrayOf(TimerFlag.ClearOnDeat
lateinit var damageSource: Entity
var severity = 0
set (value) {
if (value != field - 1 && value % 10 == 8) {//This was Arios's incorrect attempt at replicating severity, convert it to correct values.
(damageSource as? Player)?.debug ("[PoisonTimer] Warning: Converting suspect Arios severity into true severity. If numbers look wrong, this could be why.")
field = (value / 10) * 5
(damageSource as? Player)?.debug ("[PoisonTimer] Warning: New Severity: $field.")
} else field = value
}
override fun save (root: JSONObject, entity: Entity) {
root["source-uid"] = (damageSource as? Player)?.details?.uid ?: -1
root["severity"] = severity.toString()
@@ -31,11 +31,7 @@ class PoisonImmunity : PersistTimer (1, "poison:immunity", isSoft = true, flags
override fun run (entity: Entity) : Boolean {
ticksRemaining--
if (entity is Player && ticksRemaining == secondsToTicks(30)) {
sendMessage(entity, colorize("%RYou have 30 seconds remaining on your poison immunity."))
playAudio(entity, Sounds.CLOCK_TICK_1_3120, 0, 3)
}
else if (entity is Player && ticksRemaining == 0) {
if (entity is Player && ticksRemaining == 0) {
sendMessage(entity, colorize("%RYour poison immunity has expired."))
playAudio(entity, Sounds.DRAGON_POTION_FINISHED_2607)
}