Skip to content

Ranged weapon hindrance #639

@madsboddum

Description

@madsboddum

When equipping a ranged weapon:

  1. The buff "weaponHinderance" should be applied
  2. Your movement speed should be reduced

The opposite should happen when unequipping that ranged weapon.

Ranged weapons now give a "hinderance" for wielding them. This
has no effect on fighting capabilities, but it does slow down a
person's walking speed. This is a balancing issue so melee professions
will be able to keep up with the ranged. Before, ranged professions
were able to simply kite melee professions, making melee vrs. ranged
PvP futile.

Source: https://www.neoseeker.com/starwarsgalaxies/faqs/108861-star-wars-galaxies-te.html

Pointers

This method specifies additional code to run, when equipping and unequipping weapons:
com.projectswg.holocore.resources.support.global.commands.callbacks.TransferItemCallback#changeWeapon

private static void changeWeapon(CreatureObject actor, SWGObject target, boolean equip) {
	if (equip) {
		// The equipped weapon must now be set to the target object
		actor.setEquippedWeapon((WeaponObject) target);
	} else {
		// The equipped weapon must now be set to the default weapon, which happens inside CreatureObject.setEquippedWeapon()
		actor.setEquippedWeapon(null);
	}
	actor.sendSelf(new PlayMusicMessage(0, "sound/pl_all_draw_item.snd", 1, false));
}

This can be used to add the "weaponHinderance" buff to the player:
BuffIntent.broadcast("weaponHinderance", actor, actor, false);

Similarly, this will remove the "weaponHinderance" buff from the player:
BuffIntent.broadcast("weaponHinderance", actor, actor, true);

To adjust the movement speed of the player, you must add a new entry for weapon hinderance here:
com.projectswg.holocore.resources.support.objects.swg.creature.MovementModifierIdentifier

enum class MovementModifierIdentifier(val id: String) {
	BASE("base"),
	SET_SPEED("setSpeed"),
	BURST_RUN("burstRun"),
}

Example of how to apply a movement modifier:

class BurstRunCmdCallback : ICmdCallback {
	override fun execute(player: Player, target: SWGObject?, args: String) {
		val creatureObject = player.creatureObject
		creatureObject.setMovementScale(MovementModifierIdentifier.BURST_RUN, 2f, false) // <-- here
	}
}

Example of figuring out whether a WeaponObject is a ranged weapon.

WeaponObject sourceWeapon = ...
WeaponType sourceWeaponType = sourceWeapon.getType();
if (sourceWeaponType.isRanged()) { // <-- here
	return -16;
}

Metadata

Metadata

Assignees

Labels

[Profession] Marksmangood first issueItems marked with the good first issue label are intended for first-time contributors

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions