factions icon indicating copy to clipboard operation
factions copied to clipboard

Per player power patch

Open CamperSamu opened this issue 3 years ago • 22 comments

Before working more on this I'd like to discuss various implementations of this.

For now I just added a way to modify via LuckPerms how much power can each user have via factions.power.modifier.<number>, but we can go further by moving the power attribute from the Faction to the User and add methods to calculate and manipulate power in a faction (it would be similar to this branch' Faction#calculateMaxPower).

I'd like to hear your point of view on this change.

~~(also this branch is based on CamperSamu:placeholders-patch since some work is needed on the placeholders too)~~ (now based on master)

CamperSamu avatar Jul 03 '22 20:07 CamperSamu

What is the use case for this? I don't really see a need for something like this

BlueZeeKing avatar Jul 03 '22 22:07 BlueZeeKing

Servers might want to add extra power with roles (like VIPs or gamemode ranks), so adding a way to increase a player's power would be nice.

Instead, moving power to be per-player should prevent a faction's power to be completely drained by a single player committing suicide over and over.

CamperSamu avatar Jul 03 '22 23:07 CamperSamu

Instead, moving power to be per-player should prevent a faction's power to be completely drained by a single player committing suicide over and over.

This is something I think should be fixed, so per-player power could be a nice feature.

BlueZeeKing avatar Jul 05 '22 03:07 BlueZeeKing

Great! I'll start working on it again in the following days since during this week I won't be often at home.

CamperSamu avatar Jul 05 '22 16:07 CamperSamu

This version of the patch is already testable. CI Builds are available on my branch under github actions.

https://github.com/CamperSamu/factions/actions/runs/2624887857

CamperSamu avatar Jul 06 '22 18:07 CamperSamu

I am removing base power since with the per-player power it's not possible to really implemet, but if you want we can add the base power to the faction's owner or make it common power.

Also I (obviously) had to change the f admin command to make it edit players and not factions.

CamperSamu avatar Jul 10 '22 16:07 CamperSamu

In the meantime I'm doing a bit of code cleanup (also doing it on the code-cleanup branch, not frequently updated) and refactoring of minor stuff

CamperSamu avatar Jul 10 '22 16:07 CamperSamu

Starting to work on commands and placeholders, then I'll playtest everything a bit; if you want to try it out and point out issues and missing features you're welcome!

CamperSamu avatar Jul 10 '22 16:07 CamperSamu

Last commit fixes broken factions by using f create on console and via /execute

CamperSamu avatar Jul 10 '22 17:07 CamperSamu

now f info gives the player's power when used while not in a faction image

CamperSamu avatar Jul 10 '22 17:07 CamperSamu

(obviously the normal command stays unaffected) image

CamperSamu avatar Jul 10 '22 17:07 CamperSamu

Forgot to note, this includes the info command changes and the extra placeholders

CamperSamu avatar Jul 10 '22 18:07 CamperSamu

The new placeholders are:

  • player_power_formatted
    • Shows the player power with a color that transitions between green and red
  • power_stats
    • Shows the current power stats
      • If the player is not in a faction it will show player power/player max power
      • If the player is in a faction, it will show faction power/faction required power/faction max power
  • power_stats_formatted
    • The same as power_stats, but with formatting like player power and the other pre-formatted placeholders

(Not in a Faction) Not in a Faction

(In a Faction) In a Faction

CamperSamu avatar Jul 10 '22 18:07 CamperSamu

Rebalanced the default power values:

  • Each player has 20 power
  • Death penalty is now 5
  • Claim weight lowered to 2
  • Survival reward raised to 3

This should make everything work better after the power changes.

CamperSamu avatar Jul 10 '22 18:07 CamperSamu

I'd say that this is now ready for PR!

Play around with it and tell me if anything else needs to be changed. (Builds available in GH Actions)

CamperSamu avatar Jul 10 '22 18:07 CamperSamu

Forgot to mention, I've enabled maintainer commits to the branch, so if there's a small adjustment that you are willing to do yourself you can just checkout to my branch (or do it inside the web editor) and make the adjustment before merging the branch.

CamperSamu avatar Jul 12 '22 14:07 CamperSamu

Will work on it in the following days! Also I've noticed weird behavior when the survival power bonus is applied on my server while testing, will double check that code ASAP before merging

CamperSamu avatar Jul 30 '22 20:07 CamperSamu

What problem was there with base power that caused you to remove it?

BlueZeeKing avatar Aug 02 '22 17:08 BlueZeeKing

I am removing base power since with the per-player power it's not really possible to implemet elegantly, but if you want we can add the base power to the faction's owner or make it common power.

Base power doens't make sense in a system where the power belongs to single players; the only sensible place to put it would be in a common/faction power pool (that is against what this PR is trying to accomplish). Handling a common pool of power is not as straight forward as removing power from a single user; a possible solution would be to give extra power to the faction owner, another one might be to deplete that pool when a user with 0 power dies or to remove a portion of common power for each death.

In my opinion this is confusing and it's better to remove base power.

CamperSamu avatar Aug 03 '22 17:08 CamperSamu

(also sorry if I'm not quick at responding/working lately but I am currently in vacation with my family, both internet and time are kind of unreliable)

CamperSamu avatar Aug 03 '22 17:08 CamperSamu

Fixed the issue I had with power, I forgot to port the power cap checks to the penalty/reward

CamperSamu avatar Aug 03 '22 19:08 CamperSamu

Currently very, very busy, idk when I'll be able to bring everything up to speed, but it will be done eventually.

CamperSamu avatar Dec 15 '22 00:12 CamperSamu