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:
@@ -21,6 +21,7 @@ import core.game.node.scenery.Scenery
|
||||
import core.game.system.command.Privilege
|
||||
import core.game.system.config.NPCConfigParser
|
||||
import core.game.system.task.Pulse
|
||||
import core.game.system.timer.impl.PoisonImmunity
|
||||
import core.game.world.map.Location
|
||||
import core.game.world.map.RegionManager
|
||||
import core.game.world.repository.Repository
|
||||
@@ -379,7 +380,7 @@ class LunarListeners : SpellListener("lunar"), Commands {
|
||||
setInterfaceText(player, "Hitpoints : ${npc.definition.handlers[NPCConfigParser.LIFEPOINTS] ?: 0}", Components.DREAM_MONSTER_STAT_522, 2)
|
||||
setInterfaceText(player, "Max hit : ${npc.getSwingHandler(false).calculateHit(npc, player, 1.0)}", Components.DREAM_MONSTER_STAT_522, 3)
|
||||
|
||||
val poisonStatus = if(npc.definition.handlers.getOrDefault(NPCConfigParser.POISON_IMMUNE,false) == true){
|
||||
val poisonStatus = if(npc.isPoisonImmune){
|
||||
"This creature is immune to poison."
|
||||
} else "This creature is not immune to poison."
|
||||
|
||||
@@ -818,7 +819,10 @@ class LunarListeners : SpellListener("lunar"), Commands {
|
||||
return@define
|
||||
}
|
||||
if(dmg != null) {
|
||||
p.let { applyPoison(it, it, dmg) }
|
||||
p.let {
|
||||
removeTimer<PoisonImmunity>(it)
|
||||
applyPoison(it, it, dmg)
|
||||
}
|
||||
} else {
|
||||
sendMessage(player, "Damage must be an integer. Format:")
|
||||
sendMessage(player, "::poison username damage")
|
||||
|
||||
+1
-1
@@ -73,7 +73,7 @@ public final class GWDTsutsarothSwingHandler extends CombatSwingHandler {
|
||||
hit = RandomFunction.random(max);
|
||||
state.setMaximumHit(max);
|
||||
if (style == CombatStyle.MELEE) {
|
||||
applyPoison(victim, entity, 16);
|
||||
applyPoison(victim, entity, 80);
|
||||
}
|
||||
if (special) {
|
||||
((Player) victim).getSkills().decrementPrayerPoints((double) hit / 2);
|
||||
|
||||
@@ -1,48 +0,0 @@
|
||||
package content.region.karamja.handlers;
|
||||
|
||||
import core.game.node.entity.npc.AbstractNPC;
|
||||
import core.game.world.map.Location;
|
||||
import core.plugin.Initializable;
|
||||
import core.game.system.config.NPCConfigParser;
|
||||
|
||||
/**
|
||||
* Represents the tribesamn npc.
|
||||
* @author 'Vexia
|
||||
* @version 1.0
|
||||
*/
|
||||
@Initializable
|
||||
public final class TribesmanNPC extends AbstractNPC {
|
||||
|
||||
/**
|
||||
* Represents the npc ids.
|
||||
*/
|
||||
private static final int[] IDS = new int[] { 191, 2496, 2497 };
|
||||
|
||||
/**
|
||||
* Constructs a new {@code TribesmanNPC} {@code Object}.
|
||||
* @param id the id.
|
||||
* @param location the location.
|
||||
*/
|
||||
public TribesmanNPC(int id, Location location) {
|
||||
super(id, location, true);
|
||||
getDefinition().getHandlers().put(NPCConfigParser.POISONOUS, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new {@code TribesmanNPC} {@code Object}.
|
||||
*/
|
||||
public TribesmanNPC() {
|
||||
super(0, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractNPC construct(int id, Location location, Object... objects) {
|
||||
return new TribesmanNPC(id, location);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getIds() {
|
||||
return IDS;
|
||||
}
|
||||
|
||||
}
|
||||
+4
-2
@@ -74,8 +74,10 @@ public class RevenantCombatHandler extends MultiSwingHandler {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!isPoisoned(victim) && (WildernessZone.getWilderness(entity) >= 50 || entity.getId() == 6998)) {
|
||||
applyPoison(victim, entity, 6);
|
||||
if (entity.getId() == 6998) {
|
||||
applyPoison(victim, entity, 40);
|
||||
} else if (WildernessZone.getWilderness(entity) >= 50) {
|
||||
applyPoison(victim, entity, 30);
|
||||
}
|
||||
super.impact(entity, victim, state);
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user