Skip to content

Commit

Permalink
Pharcryption updates
Browse files Browse the repository at this point in the history
  • Loading branch information
ThePhar committed Nov 21, 2023
1 parent 6bc4365 commit b5a436f
Show file tree
Hide file tree
Showing 2 changed files with 222 additions and 180 deletions.
115 changes: 57 additions & 58 deletions worlds/pharcryption/Options.py
Original file line number Diff line number Diff line change
@@ -1,84 +1,83 @@
from typing import Dict

from Options import AssembleOptions, DefaultOnToggle, Range
from Options import Range, DefaultOnToggle, FreeText, Option


class EncryptedItems(Range):
class EnableTimeLimit(DefaultOnToggle):
"""
Number of items per player to "encrypt".
If the time limit is enabled, when time is up, any remaining items are forever encrypted, potentially making the
seed unbeatable without cheating.
"""
display_name = "Enable Time Limit"


Warning: Will cause generation failure if there are not enough progression items available to fulfil this
requirement.
class TimeLimitInMinutes(Range):
"""
display_name = "Items to Encrypt per Player"
default = 15
range_start = 10
range_end = 50
If the time limit is enabled, the number of minutes until any remaining items are forever encrypted. Has no effect
if "Enable Time Limit" is disabled.
"""
display_name = "Time Limit in Minutes"
range_start = 30
range_end = 43200 # 30 Days
default = 240 # 4 Hours


class FreeDecryptions(Range):
"""Amount of free-choice "decryptions" given to Pharcryption per player."""
display_name = "Free Decryptions per Player"
default = 1
range_start = 0
class MaximumPharcoinCost(Range):
"""Maximum number of Pharcoins that are needed to decrypt any given item."""
display_name = "Maximum Pharcoin Cost"
range_start = 2
range_end = 5
default = 3


class PaymentAmount(Range):
"""Interval number of Pharcoins to pay for items to be "decrypted"."""
display_name = "Payment Amount"
class ExtraPharcoinsPerPlayer(Range):
"""Extra Pharcoins in the item pool per player."""
display_name = "Extra Pharcoins per Player"
range_start = 0
range_end = 25
default = 5
range_start = 1
range_end = 10


class ExtraPharcoins(Range):
"""
Number of extra Pharcoins that can be found to help pay the ransom. Setting to 0, would require "mining" all
Pharcoins before time runs out.
"""
display_name = "Extra Pharcoins"
default = 0
range_start = 0
class NumberOfItemsPerBlock(Range):
"""Number of items to encrypt in each block."""
display_name = "Number of Items per Block"
range_start = 5
range_end = 100
default = 15


class EnableTimelimit(DefaultOnToggle):
"""Enables/Disables the time limit. For those who want a more... "lax" ransomware experience."""
display_name = "Enable Timelimit"
class NumberOfItemBlocks(Range):
"""
Number of blocks of items there are. Any items encrypted in a block require a certain percentage of items to be
decrypted in the previous block to be eligible for decrypting.
"""
display_name = "Number of Item Blocks"
range_start = 5
range_end = 25
default = 5


class TimelimitDays(Range):
"""Timelimit until all remaining items are encrypted forever, provided Enable Timelimit is not disabled."""
display_name = "Timelimit in Days"
default = 0
class RequiredPercentageOfItemsDecryptedForBlockUnlock(Range):
"""The percentage of items that need to be decrypted in an earlier block to decrypt items in the next block."""
display_name = "Required Percentage of Items Decrypted for Blocks to Unlock"
range_start = 0
range_end = 31
range_end = 100
default = 75


class TimelimitHours(Range):
"""Timelimit until all remaining items are encrypted forever, provided Enable Timelimit is not disabled."""
display_name = "Timelimit in Hours"
default = 4
range_start = 0
range_end = 23
class StartingPassword(FreeText):
"""A password that's required to start Pharcryption. Useful for game hosts that want to start it instead."""
display_name = "Starting Password"
default = ""


class TimelimitMinutes(Range):
"""Timelimit until all remaining items are encrypted forever, provided Enable Timelimit is not disabled."""
display_name = "Timelimit in Minutes"
default = 0
range_start = 0
range_end = 59


options: Dict[str, AssembleOptions] = {
"encrypted_items": EncryptedItems,
"free_decryptions": FreeDecryptions,
"payment_amount": PaymentAmount,
"extra_pharcoins": ExtraPharcoins,
"enable_timelimit": EnableTimelimit,
"timelimit_days": TimelimitDays,
"timelimit_hours": TimelimitHours,
"timelimit_minutes": TimelimitMinutes,
PharcryptionOptions: Dict[str, type(Option)] = {
"enable_time_limit": EnableTimeLimit,
"time_limit_in_minutes": TimeLimitInMinutes,
"maximum_pharcoin_cost": MaximumPharcoinCost,
"extra_pharcoins_per_player": ExtraPharcoinsPerPlayer,
"number_of_items_per_block": NumberOfItemsPerBlock,
"number_of_item_blocks": NumberOfItemBlocks,
"required_percentage_of_items_decrypted_for_block_unlock": RequiredPercentageOfItemsDecryptedForBlockUnlock,
"starting_password": StartingPassword,
}
Loading

0 comments on commit b5a436f

Please sign in to comment.