Skip to content

Commit

Permalink
Merge pull request Meridian59#355 from treymd/broadcast_mana
Browse files Browse the repository at this point in the history
Made broadcast mana penalty a setting that can be changed at runtime
  • Loading branch information
akirmse authored Sep 21, 2018
2 parents 89781e4 + 96142ca commit c7bd9c5
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
12 changes: 10 additions & 2 deletions kod/object/active/holder/nomoveon/battler/player.kod
Original file line number Diff line number Diff line change
Expand Up @@ -3216,7 +3216,7 @@ messages:
"Called when the user wants to broadcast a string. Return True/False, "
"and use some mana too."
{
local iCost;
local iCost, iBroadcastPenaltyPercent;

if piFlags & PFLAG_SQUELCHED
{
Expand All @@ -3227,7 +3227,15 @@ messages:

if NOT Send(Send(SYS,@GetParliament),@BetaPotionsEnabled)
{
iCost = Bound(piMax_mana/2+1,11,$);
iBroadcastPenaltyPercent = Send(Send(SYS,@GetSettings),@GetBroadcastManaCostPercent);

if iBroadcastPenaltyPercent = 0
{
return TRUE;
}

iCost = Bound((piMax_Mana * iBroadcastPenaltyPercent / 100 + 1),1,$);

if piMana < iCost
{
Send(self,@MsgSendUser,#message_rsc=player_cant_broadcast);
Expand Down
10 changes: 10 additions & 0 deletions kod/util/settings.kod
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,12 @@ properties:
% a player in hatred calculations. This is off by default, enabling it
% will allow players to attack monsters without them fighting back.
pbAlwaysCheckMonsterChasers = FALSE

% Broadcast mana penalty in percent. While the cost to broadcast can be
% useful to prevent flame wars and spamming, it also reduces player's
% ability to ask questions and socialize. (Puts a damper on trivia
% contests too!) This value can be changed to tweak the penalty in realtime
piBroadcastManaCostPercent = 50

messages:

Expand Down Expand Up @@ -343,5 +349,9 @@ messages:
return pbAlwaysCheckMonsterChasers;
}

GetBroadcastManaCostPercent()
{
return piBroadcastManaCostPercent;
}
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

0 comments on commit c7bd9c5

Please sign in to comment.