Corp Bugfixes

Corp now correctly only destroys summons that have entered the boss room
Corp destroys summons after exactly 10 seconds (source is cited on the line of code)
Corp now repeatedly fullheals if there's no players active in the room (meaning you cannot just cannon it to death)
You no longer get a grave if you die in the corp boss room
This commit is contained in:
Ceikry 2022-09-24 16:04:08 +00:00 committed by Ryan
parent 563d7094e6
commit 506bbf35f8
4 changed files with 81 additions and 25 deletions

View file

@ -42,7 +42,7 @@ public final class CorporealBeastNPC extends AbstractNPC {
/**
* The dark energy core NPC.
*/
private NPC darkEnergyCore;
public NPC darkEnergyCore;
/**
* Constructs a new {@code CorporealBeastNPC} {@code Object}.
@ -66,28 +66,6 @@ public final class CorporealBeastNPC extends AbstractNPC {
configureBossData();
}
@Override
public void handleTickActions() {
for(Player player : getViewport().getCurrentPlane().getPlayers()){
if(player.getFamiliarManager().hasFamiliar() && RandomFunction.random(100) < 10){
int heal = player.getFamiliarManager().getFamiliar().getSkills().getLifepoints() / 4;
super.getSkills().heal(heal);
player.sendMessage("<col=990000>Your familiar was devoured by the Corporeal Beast, healing it by "+heal+" HP.");
player.getFamiliarManager().dismiss();
}
}
if (getSkills().getLifepoints() < getSkills().getMaximumLifepoints()) {
if (getViewport().getCurrentPlane().getPlayers().isEmpty()) {
super.fullRestore();
if (darkEnergyCore != null) {
darkEnergyCore.clear();
darkEnergyCore = null;
}
}
}
super.handleTickActions();
}
@Override
public CombatSwingHandler getSwingHandler(boolean swing) {
return combatHandler;

View file

@ -29,7 +29,12 @@ public enum ZoneRestriction {
/**
* No cannons allowed.
*/
CANNON, ;
CANNON,
/**
* Do not spawn a grave if a player dies here
*/
GRAVES,
;
/**
* Gets the restriction flag.

View file

@ -0,0 +1,70 @@
package rs09.game.content.zone
import api.*
import core.game.node.entity.Entity
import core.game.node.entity.npc.bosses.corp.CorporealBeastNPC
import core.game.node.entity.player.Player
import core.game.node.entity.skill.summoning.familiar.Familiar
import core.game.world.map.zone.ZoneBorders
import core.game.world.map.zone.ZoneRestriction
import rs09.tools.secondsToTicks
class CorpAreaController : MapArea, TickListener {
companion object {
var activePlayers = ArrayList<Player>()
var corpBeast: CorporealBeastNPC? = null
var borders = ZoneBorders(2974, 4369, 3007, 4400)
}
override fun defineAreaBorders(): Array<ZoneBorders> {
return arrayOf(borders)
}
override fun getRestrictions(): Array<ZoneRestriction> {
return arrayOf(ZoneRestriction.GRAVES, ZoneRestriction.RANDOM_EVENTS)
}
override fun areaEnter(entity: Entity) {
if (entity is Player) {
activePlayers.add(entity)
}
else if (entity is Familiar) {
entity.setAttribute("corp-time-remaining", secondsToTicks(10)) //Familiars last about 10 seconds, based on https://www.youtube.com/watch?v=kOd6q5Q5ZKI
}
else if (entity is CorporealBeastNPC) {
corpBeast = entity
}
}
override fun areaLeave(entity: Entity, logout: Boolean) {
if (entity is Player) {
activePlayers.remove(entity)
}
}
override fun tick() {
if (activePlayers.size == 0) {
corpBeast?.let {
it.skills.lifepoints = it.skills.maximumLifepoints
if (it.darkEnergyCore != null) {
it.darkEnergyCore.clear()
it.darkEnergyCore = null
}
}
}
if (corpBeast?.isActive == true && activePlayers.isNotEmpty()) {
for (player in activePlayers.toTypedArray()) {
val familiar = player.familiarManager.familiar ?: continue
val timeRemaining = getAttribute(familiar, "corp-time-remaining", -1)
if (timeRemaining == 0 && borders.insideBorder(familiar)) {
val healBy = familiar.skills.lifepoints / 4
player.familiarManager.dismiss()
corpBeast?.skills?.heal(healBy)
sendMessage(familiar.owner, "The Beast devoured your familiar!")
}
setAttribute(familiar, "corp-time-remaining", timeRemaining - 1)
}
}
}
}

View file

@ -12,6 +12,7 @@ import core.game.node.entity.skill.Skills
import core.game.node.item.Item
import core.game.system.task.Pulse
import core.game.world.map.Location
import core.game.world.map.zone.ZoneRestriction
import org.json.simple.JSONArray
import org.json.simple.JSONObject
import org.rs09.consts.Items
@ -222,6 +223,8 @@ class GraveController : PersistWorld, TickListener, InteractionListener, Command
return false
if (player.ironmanManager.mode == IronmanMode.HARDCORE)
return false
if (player.zoneMonitor.isRestricted(ZoneRestriction.GRAVES))
return false
return true
}