diff options
author | Fedja Beader <fedja@protonmail.ch> | 2023-06-27 01:20:18 +0200 |
---|---|---|
committer | Fedja Beader <fedja@protonmail.ch> | 2023-06-27 01:20:18 +0200 |
commit | 49b2986313bc650e07af349c91396cf1231f7522 (patch) | |
tree | 2d1011b9482b7ac1ef01f01bf1a8bebeae10a0e3 /npc/functions | |
parent | cd835b5951e0f59ba3743bbd747a71ee2d207c53 (diff) | |
download | serverdata-49b2986313bc650e07af349c91396cf1231f7522.tar.gz serverdata-49b2986313bc650e07af349c91396cf1231f7522.tar.bz2 serverdata-49b2986313bc650e07af349c91396cf1231f7522.tar.xz serverdata-49b2986313bc650e07af349c91396cf1231f7522.zip |
Add multi-invest options to town management menu, to ease mayorship
Diffstat (limited to 'npc/functions')
-rw-r--r-- | npc/functions/politics.txt | 41 |
1 files changed, 30 insertions, 11 deletions
diff --git a/npc/functions/politics.txt b/npc/functions/politics.txt index 1a13cb83d..21d719ce6 100644 --- a/npc/functions/politics.txt +++ b/npc/functions/politics.txt @@ -402,6 +402,7 @@ function script POL_Manage { .@DQ=getd("$"+getarg(0)+"_DAILYQUEST"); .@SE=getd("$"+getarg(0)+"_SIEGEXP"); .@left=(gettimeparam(GETTIME_HOUR)/4)-TOWN_ACTIONS[.@TP]; + .@repeat = .@left; mesc l("Town Money: @@", .@GP), 2; mesc l("Town Reputation: %d | %d.%02d %% Tax", .@RP, .@TX/100, .@TX%100), 2; @@ -413,8 +414,10 @@ function script POL_Manage { menuint l("Nothing"), 0, rif(.@DQ != gettimeparam(GETTIME_DAYOFMONTH), l("Do some paperwork")), 1, - rif(.@left, l("Invest in Exportations")), 10, - rif(.@left, l("Invest in Reputation")), 20, + rif(.@left, l("Invest into boosting town exports")), 10, + rif(.@left > 1, l("Invest all into boosting town exports")), 11, + rif(.@left, l("Invest into boosting town reputation")), 20, + rif(.@left > 1, l("Invest all into boosting town reputation")), 21, rif(.@left, l("Raise city taxes")), 30, rif(.@left, l("Lower city taxes")), 35, rif(.@CR && .@RP, l("Tax crafters")), 40, @@ -438,26 +441,42 @@ function script POL_Manage { break; // Mark 10: Exports case 10: - .@cost=.@EX/10; + .@repeat = 1; + // fall-through + case 11: + // direct formula exists, but is difficult to implement with integer math: + // k = (10 + rand(1/52, 1/24))/10; newEX = k^.@repeat*.@EX + (1-k^.@repeat)/(1-k) + .@newEX = .@EX; + for(.@i = 0; .@i < .@repeat; .@i += 1) { + .@cost = .@newEX/10; + .@newEX += rand2(.@cost/52, .@cost/24) + 1; + } + + // to prevent GP cost fluctuating in the menu (excuse for bulk discount): + .@cost = .@repeat * .@EX/10; + mesc l("Investing in Exportations"), 3; mesc l("You need @@ GP to make this investment.", .@cost); if (.@GP < .@cost) break; mesc l("Are you sure?"); if (askyesno() == ASK_YES) { - .@BN=rand2(.@cost/52, .@cost/24) + 1; .@GP=getd("$"+getarg(0)+"_MONEY"); setd(.@town$+"_MONEY", .@GP-.@cost); - setd(.@town$+"_EXPORT", .@EX+.@BN); - TOWN_ACTIONS[.@TP]+=1; + setd(.@town$+"_EXPORT", .@newEX); + TOWN_ACTIONS[.@TP] += .@repeat; mesc l("Investment executed"), 2; next; } break; // Mark 20: Reputation case 20: - .@cost=.@RP*3; - mesc l("Investing in Reputation"), 3; + .@repeat = 1; + // fall-through + case 21: + .@repeat = max(1, min(.@repeat, 100 - .@RP)); + .@cost = .@repeat * .@RP * 3; + mesc l("Investing into Reputation"), 3; if (.@RP >= 100) { mesc l("Reputation cannot go above 100!"), 1; next; @@ -469,9 +488,9 @@ function script POL_Manage { mesc l("Are you sure?"); if (askyesno() == ASK_YES) { .@GP=getd("$"+getarg(0)+"_MONEY"); - setd(.@town$+"_MONEY", .@GP-.@cost); - setd(.@town$+"_REPUTATION", .@RP+1); - TOWN_ACTIONS[.@TP]+=1; + setd(.@town$+"_MONEY", .@GP - .@cost); + setd(.@town$+"_REPUTATION", .@RP + .@repeat); + TOWN_ACTIONS[.@TP] += .@repeat; mesc l("Investment executed"), 2; next; } |