Merge branch 'fix-void' into 'master'

Void set effects now work more uniformly.

See merge request 2009scape/2009scape!334
This commit is contained in:
Ceikry 2021-11-16 22:49:54 +00:00
commit 783bcbd4f3
6 changed files with 27 additions and 24 deletions

View file

@ -51,4 +51,5 @@
- Fixed Typo in Professor Oddenstein's dialogue
- Random Events can no longer spawn in the wilderness.
- Fairy rings emit a sound when teleporting.
- Void set effects now work more uniformly.
- Summoning familiars now grant combat xp when attacking

View file

@ -772,9 +772,22 @@ public class Player extends Entity {
/**
* Checks if the player is wearing void.
*/
public boolean isWearingVoid(boolean melee){
int helm = melee ? Items.VOID_MELEE_HELM_11665 : Items.VOID_RANGER_HELM_11664;
return ContentAPI.inEquipment(this, helm, 1) && ContentAPI.inEquipment(this, Items.VOID_KNIGHT_ROBE_8840, 1) && ContentAPI.inEquipment(this, Items.VOID_KNIGHT_TOP_8839, 1);
public boolean isWearingVoid(CombatStyle style) {
int helm;
if(style == CombatStyle.MELEE) {
helm = Items.VOID_MELEE_HELM_11665;
} else if(style == CombatStyle.RANGE) {
helm = Items.VOID_RANGER_HELM_11664;
} else if(style == CombatStyle.MAGIC) {
helm = Items.VOID_MAGE_HELM_11663;
} else {
return false;
}
boolean legs = ContentAPI.inEquipment(this, Items.VOID_KNIGHT_ROBE_8840, 1);
boolean top = ContentAPI.inEquipment(this, Items.VOID_KNIGHT_TOP_8839, 1)
|| ContentAPI.inEquipment(this, Items.VOID_KNIGHT_TOP_10611, 1);
boolean gloves = ContentAPI.inEquipment(this, Items.VOID_KNIGHT_GLOVES_8842, 1);
return ContentAPI.inEquipment(this, helm, 1) && legs && top && gloves;
}
/**

View file

@ -137,18 +137,6 @@ abstract class CombatSwingHandler(var type: CombatStyle?) {
return null
}
/**
* Checks if the container contains a void knight set.
* @param c The container to check.
* @return `True` if so.
*/
fun containsVoidSet(c: Container): Boolean {
val top = c.getNew(EquipmentContainer.SLOT_CHEST)
return if (top.id != 8839 && top.id != 10611) {
false
} else c.getNew(EquipmentContainer.SLOT_LEGS).id == 8840 && c.getNew(EquipmentContainer.SLOT_HANDS).id == 8842
}
/**
* Checks if the hit will be accurate.
* @param entity The entity.

View file

@ -173,7 +173,7 @@ open class MagicSwingHandler
if (entity is Player) {
prayer += entity.prayer.getSkillBonus(Skills.MAGIC)
}
val additional = 1.0 // Slayer helmet/salve/...
val additional = getSetMultiplier(entity, Skills.MAGIC);
val effective = floor(level * prayer * additional + spellBonus)
val bonus = entity.properties.bonuses[WeaponInterface.BONUS_MAGIC]
return floor((effective + 8) * (bonus + 64) / 10).toInt()
@ -210,9 +210,8 @@ open class MagicSwingHandler
}
override fun getSetMultiplier(e: Entity?, skillId: Int): Double {
if (e is Player) {
val c: Container = e.equipment
if (containsVoidSet(c) && c.getNew(EquipmentContainer.SLOT_HAT).id == 11663) {
if(skillId == Skills.MAGIC) {
if(e is Player && e.isWearingVoid(CombatStyle.MAGIC)) {
return 1.3
}
}

View file

@ -146,7 +146,7 @@ open class MeleeSwingHandler
if(entity.properties.attackStyle.style == WeaponInterface.STYLE_ACCURATE) effectiveAttackLevel += 3
else if(entity.properties.attackStyle.style == WeaponInterface.STYLE_CONTROLLED) effectiveAttackLevel += 1
effectiveAttackLevel += 8
if(entity is Player && entity.isWearingVoid(true)) effectiveAttackLevel *= 1.1
effectiveAttackLevel *= getSetMultiplier(entity, Skills.ATTACK);
effectiveAttackLevel = floor(effectiveAttackLevel)
effectiveAttackLevel *= (entity.properties.bonuses[entity.properties.attackStyle.bonusType] + 64)
@ -228,6 +228,9 @@ open class MeleeSwingHandler
// System.out.println("Fiist number -> " + 1.0 + ((e.getSkills().getMaximumLifepoints() - e.getSkills().getLifepoints()) * 0.01));
return 1.0 + (e!!.skills.maximumLifepoints - e.skills.lifepoints) * 0.01
}
if(e is Player && e.isWearingVoid(CombatStyle.MELEE) && (skillId == Skills.ATTACK || skillId == Skills.STRENGTH)) {
return 1.1
}
return 1.0
}

View file

@ -201,7 +201,7 @@ open class RangeSwingHandler
if(entity is Player) effectiveRangedLevel = floor(effectiveRangedLevel + (entity.prayer.getSkillBonus(Skills.RANGE) * effectiveRangedLevel))
if(entity.properties.attackStyle.style == WeaponInterface.STYLE_RANGE_ACCURATE) effectiveRangedLevel += 3
effectiveRangedLevel += 8
if(entity is Player && entity.isWearingVoid(false)) effectiveRangedLevel *= 1.1
effectiveRangedLevel *= getSetMultiplier(entity, Skills.RANGE)
if(entity is Player && SkillcapePerks.isActive(SkillcapePerks.ACCURATE_MARKSMAN,entity)) effectiveRangedLevel *= 1.1
effectiveRangedLevel = floor(effectiveRangedLevel)
@ -237,9 +237,8 @@ open class RangeSwingHandler
}
override fun getSetMultiplier(e: Entity?, skillId: Int): Double {
if (e is Player) {
val c: Container = e.equipment
if (containsVoidSet(c) && c.getNew(EquipmentContainer.SLOT_HAT).id == 11664) {
if(skillId == Skills.RANGE) {
if(e is Player && e.isWearingVoid(CombatStyle.RANGE)) {
return 1.1
}
}